ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1481283 - in /ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin: VaadinClient.java component/MainActionToolbar.java
Date Sat, 11 May 2013 10:15:49 GMT
Author: marrs
Date: Sat May 11 10:15:49 2013
New Revision: 1481283

URL: http://svn.apache.org/r1481283
Log:
ACE-349 Fixed life cycle issue with extra main toolbar components.

Modified:
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1481283&r1=1481282&r2=1481283&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
(original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinClient.java
Sat May 11 10:15:49 2013
@@ -161,6 +161,8 @@ public class VaadinClient extends com.va
 	private Component m_component;
 	private final List<Component> m_eventHandlers = new ArrayList<Component>();
 
+	private GridLayout m_mainToolbar;
+
     // basic session ID generator
     private static long generateSessionID() {
         return SESSION_ID++;
@@ -333,7 +335,8 @@ public class VaadinClient extends com.va
         m_grid.setSpacing(true);
         m_grid.setSizeFull();
 
-        m_grid.addComponent(createToolbar(user), 0, 0, count - 1, 0);
+        m_mainToolbar = createToolbar(user);
+		m_grid.addComponent(m_mainToolbar, 0, 0, count - 1, 0);
 
         m_artifactsPanel = createArtifactsPanel(user);
 
@@ -497,6 +500,7 @@ public class VaadinClient extends com.va
             }
         });
 
+        addListener(m_mainToolbar, RepositoryObject.PUBLIC_TOPIC_ROOT.concat(RepositoryObject.TOPIC_ALL_SUFFIX));
         addListener(m_artifactsPanel, ArtifactObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
         addListener(m_featuresPanel, FeatureObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
         addListener(m_distributionsPanel, DistributionObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
@@ -633,7 +637,6 @@ public class VaadinClient extends com.va
                 m_targetsPanel.populate();
             }
         };
-        addListener(mainActionToolbar, RepositoryObject.PUBLIC_TOPIC_ROOT.concat(RepositoryObject.TOPIC_ALL_SUFFIX));
         return mainActionToolbar;
     }
 

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java?rev=1481283&r1=1481282&r2=1481283&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java
(original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java
Sat May 11 10:15:49 2013
@@ -283,6 +283,8 @@ public abstract class MainActionToolbar 
 
     private final User m_user;
 
+	private HorizontalLayout m_extraComponentBar;
+
     /**
      * Creates a new {@link MainActionToolbar} instance.
      * @param user 
@@ -302,7 +304,7 @@ public abstract class MainActionToolbar 
         
         initComponent();
     }
-    
+
     public void init(org.apache.felix.dm.Component component) {
     	DependencyManager dm = component.getDependencyManager();
     	component.add(dm.createServiceDependency()
@@ -315,10 +317,19 @@ public abstract class MainActionToolbar 
     
     public void add(ServiceReference ref, UIExtensionFactory factory) {
         m_extensions.put(ref, factory);
+        setExtraComponents();
     }
+
+	private void setExtraComponents() {
+		m_extraComponentBar.removeAllComponents();
+		for (Component c : getExtraComponents()) {
+			m_extraComponentBar.addComponent(c);
+		}
+	}
     
     public void remove(ServiceReference ref,  UIExtensionFactory factory) {
         m_extensions.remove(ref);
+        setExtraComponents();
     }
 
     /**
@@ -393,14 +404,11 @@ public abstract class MainActionToolbar 
         m_revertButton.addListener(new RevertButtonListener());
         addComponent(m_revertButton, 2, 0);
 
-        HorizontalLayout bar = new HorizontalLayout();
+        m_extraComponentBar = new HorizontalLayout();
         Label spacer = new Label("");
         spacer.setWidth("2em");
-        bar.addComponent(spacer);
-        for (Component c : getExtraComponents()) {
-            bar.addComponent(c);
-        }
-        addComponent(bar, 3, 0);
+        m_extraComponentBar.addComponent(spacer);
+        addComponent(m_extraComponentBar, 3, 0);
 
         m_logoutButton = new Button("Logout");
         m_logoutButton.addListener(new LogoutButtonListener());



Mime
View raw message