Mercurial > hg > thermostat
changeset 2517:0be4e0290bca
Platform as Plugin (addendum)
review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-November/021547.html
reviewed-bu: aazores
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Wed, 09 Nov 2016 18:50:13 +0100 |
parents | 5507e0168b50 |
children | b3aaa70143e2 |
files | platform/swing/compat/pom.xml platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/HostPlugin1.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/HostPluginInterface1.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/HostProvider1.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMPlugin1.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMPlugin2.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMPluginInterface1.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMProvider1.java platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMProvider2.java |
diffstat | 9 files changed, 0 insertions(+), 724 deletions(-) [+] |
line wrap: on
line diff
--- a/platform/swing/compat/pom.xml Wed Nov 09 11:56:27 2016 +0100 +++ b/platform/swing/compat/pom.xml Wed Nov 09 18:50:13 2016 +0100 @@ -151,7 +151,6 @@ </Export-Package> <Private-Package> com.redhat.thermostat.compat.platform.internal, - com.redhat.thermostat.compat.platform.internal.test, </Private-Package> <!--Do not autogenerate uses clauses in Manifests --> <_nouses>true</_nouses>
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/HostPlugin1.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.EmbeddedPlatformPlugin; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; -import com.redhat.thermostat.platform.annotations.Extension; -import com.redhat.thermostat.platform.mvc.MVCProvider; -import com.redhat.thermostat.platform.swing.components.ContentPane; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Service; - -import javax.swing.JLabel; - -/** - */ -@Component -@Service(MVCProvider.class) -public class HostPlugin1 extends EmbeddedPlatformPlugin { - @Override - protected EmbeddedPlatformSwingView createView() { - return new TheSwingView(); - } - - @Extension(HostPluginInterface1.class) - private class TheSwingView extends EmbeddedPlatformSwingView implements HostPluginInterface1 { - - @Override - protected void postCreate(ContentPane contentPane) { - super.postCreate(contentPane); - contentPane.add(new JLabel("HostPlugin1")); - } - - @Override - public EmbeddedPlatformSwingView getContent() { - return this; - } - - @Override - public void start() { - System.err.println("------------------ HostPlugin1 Started -------------"); - } - - @Override - public void stop() { - System.err.println("------------------ HostPlugin1 Stopped -------------"); - } - } -}
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/HostPluginInterface1.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; - -/** - */ -public interface HostPluginInterface1 { - EmbeddedPlatformSwingView getContent(); -}
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/HostProvider1.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.DynamicHostPlugin; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformController; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; -import com.redhat.thermostat.platform.annotations.ExtensionPoint; -import com.redhat.thermostat.platform.annotations.PlatformService; -import com.redhat.thermostat.platform.mvc.MVCProvider; - -import com.redhat.thermostat.shared.locale.LocalizedString; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Service; - -/** - * - */ -@Component -@Service(MVCProvider.class) -@PlatformService(service = DynamicHostPlugin.class) -public class HostProvider1 extends DynamicHostPlugin { - - @Override - protected EmbeddedPlatformController createController() { - return new EmbeddedPlatformController() { - @Override - public LocalizedString getName() { - return new LocalizedString("Test Plugin"); - } - }; - } - - @Override - protected EmbeddedPlatformSwingView createView() { - return new EmbeddedPlatformSwingView() { - @ExtensionPoint(HostPluginInterface1.class) - public void hook(HostPluginInterface1 extension) { - add(extension.getContent()); - } - }; - } -}
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMPlugin1.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.EmbeddedPlatformController; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformPlugin; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; -import com.redhat.thermostat.platform.annotations.Extension; -import com.redhat.thermostat.platform.mvc.MVCProvider; -import com.redhat.thermostat.platform.swing.components.ContentPane; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Service; - -import javax.swing.JLabel; - -/** - */ -@Component -@Service(MVCProvider.class) -public class VMPlugin1 extends EmbeddedPlatformPlugin { - @Override - protected EmbeddedPlatformSwingView createView() { - return new TheSwingView(); - } - - @Override - protected EmbeddedPlatformController createController() { - return new EmbeddedPlatformController() { - @Override - public void stop() { - System.err.println("/////////////////// VMPlugin1.Controller stop"); - } - - @Override - public void start() { - System.err.println("/////////////////// VMPlugin1.Controller start"); - } - }; - } - - @Extension(VMPluginInterface1.class) - private class TheSwingView extends EmbeddedPlatformSwingView implements VMPluginInterface1 { - - @Override - protected void postCreate(ContentPane contentPane) { - super.postCreate(contentPane); - contentPane.setName("VMPlugin1"); - contentPane.add(new JLabel("VMPlugin1")); - } - - @Override - public EmbeddedPlatformSwingView getContent() { - return this; - } - - @Override - protected void init() { - super.init(); - - System.err.println("------------------ VMPlugin1 init -------------"); - } - - @Override - public void start() { - System.err.println("------------------ VMPlugin1 start -------------"); - } - - @Override - public void stop() { - System.err.println("------------------ VMPlugin1 stop -------------"); - } - } -} -
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMPlugin2.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.EmbeddedPlatformController; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformPlugin; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; -import com.redhat.thermostat.platform.Platform; -import com.redhat.thermostat.platform.annotations.Extension; -import com.redhat.thermostat.platform.mvc.MVCProvider; -import com.redhat.thermostat.platform.swing.components.ContentPane; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Service; - -import javax.swing.JLabel; - -@Component -@Service(MVCProvider.class) -public class VMPlugin2 extends EmbeddedPlatformPlugin { - @Override - protected EmbeddedPlatformSwingView createView() { - return new TheSwingView(); - } - - @Override - protected EmbeddedPlatformController createController() { - return new EmbeddedPlatformController() { - @Override - public void stop() { - System.err.println("/////////////////// VMPlugin2.Controller stop"); - } - - @Override - public void start() { - System.err.println("/////////////////// VMPlugin2.Controller start"); - } - }; - } - - @Extension(VMPluginInterface1.class) - private class TheSwingView extends EmbeddedPlatformSwingView implements VMPluginInterface1 { - - @Override - protected void postCreate(ContentPane contentPane) { - super.postCreate(contentPane); - contentPane.setName("VMPlugin2"); - contentPane.add(new JLabel("VMPlugin2")); - } - - @Override - public EmbeddedPlatformSwingView getContent() { - return this; - } - - @Override - protected void init() { - super.init(); - - System.err.println("------------------ VMPlugin2 init -------------"); - } - - @Override - public void start() { - System.err.println("------------------ VMPlugin2 start -------------"); - } - - @Override - public void stop() { - System.err.println("------------------ VMPlugin2 stop -------------"); - } - } -}
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMPluginInterface1.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; - -/** - */ -public interface VMPluginInterface1 { - EmbeddedPlatformSwingView getContent(); -}
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMProvider1.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.DynamicHostPlugin; -import com.redhat.thermostat.compat.platform.DynamicVMPlugin; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformController; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; -import com.redhat.thermostat.platform.annotations.ExtensionPoint; -import com.redhat.thermostat.platform.annotations.PlatformService; -import com.redhat.thermostat.platform.mvc.MVCProvider; -import com.redhat.thermostat.platform.swing.components.ContentPane; -import com.redhat.thermostat.shared.locale.LocalizedString; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Service; - -import javax.swing.JTabbedPane; -import java.util.ArrayList; -import java.util.List; - -/** - */ -@Component -@Service(MVCProvider.class) -@PlatformService(service = DynamicVMPlugin.class) -public class VMProvider1 extends DynamicVMPlugin { - @Override - protected EmbeddedPlatformController createController() { - return new EmbeddedPlatformController() { - @Override - public LocalizedString getName() { - return new LocalizedString("VMProvider1"); - } - - @Override - public void stop() { - System.err.println("/////////////////// VMProvider1.Controller stop"); - } - - @Override - public void start() { - System.err.println("/////////////////// VMProvider1.Controller start"); - } - }; - } - - @Override - protected EmbeddedPlatformSwingView createView() { - return new EmbeddedPlatformSwingView() { - private List<VMPluginInterface1> extensions; - - JTabbedPane pane; - - @Override - protected void init() { - extensions = new ArrayList<>(); - pane = new JTabbedPane(); - contentPane.add(pane); - contentPane.setName("VMProvider1"); - } - - @ExtensionPoint(VMPluginInterface1.class) - public void hook(VMPluginInterface1 extension) { - System.err.println("/////////////////// VMProvider1 adding: " + extension.getClass()); - extensions.add(extension); - } - - @Override - protected void addImpl(ContentPane contentPane, Object constraints, int index) { - pane.addTab(contentPane.getName(), contentPane); - } - - @Override - public void start() { - super.start(); - - System.err.println("/////////////////// VMProvider1 start"); - - for (VMPluginInterface1 extension : extensions) { - add(extension.getContent()); - } - } - - @Override - public void stop() { - super.stop(); - - System.err.println("/////////////////// VMProvider1 stop"); - - for (VMPluginInterface1 extension : extensions) { - remove(extension.getContent()); - } - } - }; - } -}
--- a/platform/swing/compat/src/main/java/com/redhat/thermostat/compat/platform/internal/test/VMProvider2.java Wed Nov 09 11:56:27 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* - * Copyright 2012-2016 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.compat.platform.internal.test; - -import com.redhat.thermostat.compat.platform.DynamicVMPlugin; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformController; -import com.redhat.thermostat.compat.platform.EmbeddedPlatformSwingView; -import com.redhat.thermostat.platform.annotations.ExtensionPoint; -import com.redhat.thermostat.platform.annotations.PlatformService; -import com.redhat.thermostat.platform.mvc.MVCProvider; -import com.redhat.thermostat.platform.swing.components.ContentPane; -import com.redhat.thermostat.shared.locale.LocalizedString; -import org.apache.felix.scr.annotations.Component; -import org.apache.felix.scr.annotations.Service; - -import javax.swing.JLabel; -import javax.swing.JTabbedPane; -import java.util.ArrayList; -import java.util.List; - -/** - */ -@Component -@Service(MVCProvider.class) -@PlatformService(service = DynamicVMPlugin.class) -public class VMProvider2 extends DynamicVMPlugin { - @Override - protected EmbeddedPlatformController createController() { - return new EmbeddedPlatformController() { - @Override - public LocalizedString getName() { - return new LocalizedString("VMProvider2"); - } - - @Override - public void stop() { - System.err.println(">>>>>>>>>>>>>>>>>>>>> VMProvider2.Controller stop"); - } - - @Override - public void start() { - System.err.println(">>>>>>>>>>>>>>>>>>>>> VMProvider2.Controller start"); - } - }; - } - - @Override - protected EmbeddedPlatformSwingView createView() { - return new EmbeddedPlatformSwingView() { - - private List<VMPluginInterface1> extensions; - - JTabbedPane pane; - - @Override - protected void init() { - extensions = new ArrayList<>(); - pane = new JTabbedPane(); - contentPane.add(pane); - } - - @ExtensionPoint(VMPluginInterface1.class) - public void hook(VMPluginInterface1 extension) { - System.err.println(">>>>>>>>>>>>>>>>>>>>> VMProvider2 adding: " + extension.getClass()); - extensions.add(extension); - } - - @Override - protected void addImpl(ContentPane contentPane, Object constraints, int index) { - pane.addTab(contentPane.getName(), contentPane); - } - - @Override - public void start() { - super.start(); - System.err.println(">>>>>>>>>>>>>>>>>>>>> VMProvider2 start"); - - for (VMPluginInterface1 extension : extensions) { - add(extension.getContent()); - } - } - - @Override - public void stop() { - super.stop(); - System.err.println(">>>>>>>>>>>>>>>>>>>>> VMProvider2 stop"); - - for (VMPluginInterface1 extension : extensions) { - remove(extension.getContent()); - } - } - }; - - } -}