ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1310301 - in /ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin: VaadinClient.java component/BaseObjectPanel.java component/TargetsPanel.java
Date Fri, 06 Apr 2012 12:34:14 GMT
Author: jawi
Date: Fri Apr  6 12:34:13 2012
New Revision: 1310301

URL: http://svn.apache.org/viewvc?rev=1310301&view=rev
Log:
ACE-248: also listen for all target object events; as they contain valuable information as
well.

Modified:
    ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
    ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java
    ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/TargetsPanel.java

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1310301&r1=1310300&r2=1310301&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
(original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
Fri Apr  6 12:34:13 2012
@@ -423,7 +423,7 @@ public class VaadinClient extends com.va
         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);
-        addListener(m_targetsPanel, StatefulTargetObject.TOPIC_ALL, RepositoryAdmin.TOPIC_STATUSCHANGED);
+        addListener(m_targetsPanel, StatefulTargetObject.TOPIC_ALL, TargetObject.TOPIC_ALL,
RepositoryAdmin.TOPIC_STATUSCHANGED);
 
         m_mainWindow.addComponent(m_grid);
     }

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java?rev=1310301&r1=1310300&r2=1310301&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java
(original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java
Fri Apr  6 12:34:13 2012
@@ -248,7 +248,7 @@ abstract class BaseObjectPanel<REPO_OBJ 
         synchronized (getApplication()) {
             if (isSupportedEntity(entity)) {
                 try {
-                    handleEvent(topic, (REPO_OBJ) entity, event);
+                    handleEvent(topic, entity, event);
                 }
                 finally {
                     refreshRenderedCells();
@@ -431,17 +431,6 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     /**
-     * @param topic the topic of the event;
-     * @param entity the entity of the event;
-     * @param event the original event.
-     * 
-     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
-     */
-    protected void handleEvent(String topic, REPO_OBJ entity, org.osgi.service.event.Event
event) {
-        // Nop...
-    }
-
-    /**
      * Does the actual removal of the left-hand side associations for a given repository
object.
      * 
      * @param object the repository object to remove the left-hand side associations;
@@ -464,6 +453,16 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     /**
+     * Converts a table-id back to a concrete {@link RepositoryObject}.
+     * 
+     * @param id the identifier of the {@link RepositoryObject}, cannot be <code>null</code>.
+     * @return a {@link RepositoryObject} instance for the given ID, can be <code>null</code>
in case no such object is found.
+     */
+    protected final REPO_OBJ getFromId(String id) {
+        return getRepository().get(id);
+    }
+
+    /**
      * Returns the actual repository for objects.
      * 
      * @return the actual repository for obtaining the repository objects, cannot be <code>null</code>.
@@ -500,6 +499,17 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     /**
+     * @param topic the topic of the event;
+     * @param entity the entity of the event;
+     * @param event the original event.
+     * 
+     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
+     */
+    protected void handleEvent(String topic, RepositoryObject entity, org.osgi.service.event.Event
event) {
+        // Nop...
+    }
+
+    /**
      * Returns whether the given {@link RepositoryObject} can be handled by this panel.
      * 
      * @param entity the entity to test, cannot be <code>null</code>.
@@ -568,16 +578,6 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     /**
-     * Converts a table-id back to a concrete {@link RepositoryObject}.
-     * 
-     * @param id the identifier of the {@link RepositoryObject}, cannot be <code>null</code>.
-     * @return a {@link RepositoryObject} instance for the given ID, can be <code>null</code>
in case no such object is found.
-     */
-    private REPO_OBJ getFromId(String id) {
-        return getRepository().get(id);
-    }
-
-    /**
      * Shows an edit window for the given named object.
      * 
      * @param object the named object to edit;

Modified: ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/TargetsPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/TargetsPanel.java?rev=1310301&r1=1310300&r2=1310301&view=diff
==============================================================================
--- ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/TargetsPanel.java
(original)
+++ ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/component/TargetsPanel.java
Fri Apr  6 12:34:13 2012
@@ -20,11 +20,11 @@ package org.apache.ace.webui.vaadin.comp
 
 import java.util.List;
 
-import org.apache.ace.client.repository.RepositoryAdmin;
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.RepositoryObject.WorkingState;
 import org.apache.ace.client.repository.object.Distribution2TargetAssociation;
 import org.apache.ace.client.repository.object.DistributionObject;
+import org.apache.ace.client.repository.object.TargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetRepository;
 import org.apache.ace.webui.UIExtensionFactory;
@@ -113,16 +113,15 @@ public abstract class TargetsPanel exten
     /**
      * {@inheritDoc}
      */
-    protected void handleEvent(String topic, StatefulTargetObject statefulTarget, org.osgi.service.event.Event
event) {
+    protected void handleEvent(String topic, RepositoryObject entity, org.osgi.service.event.Event
event) {
+        StatefulTargetObject statefulTarget = asStatefulTargetObject(entity);
         if (StatefulTargetObject.TOPIC_ADDED.equals(topic)) {
             add(statefulTarget);
         }
         if (StatefulTargetObject.TOPIC_REMOVED.equals(topic)) {
             remove(statefulTarget);
         }
-        if (StatefulTargetObject.TOPIC_CHANGED.equals(topic) || StatefulTargetObject.TOPIC_STATUS_CHANGED.equals(topic)
-            || StatefulTargetObject.TOPIC_AUDITEVENTS_CHANGED.equals(topic)
-            || RepositoryAdmin.TOPIC_STATUSCHANGED.equals(topic)) {
+        if (topic.endsWith("CHANGED")) {
             update(statefulTarget);
         }
     }
@@ -132,7 +131,7 @@ public abstract class TargetsPanel exten
      */
     @Override
     protected boolean isSupportedEntity(RepositoryObject entity) {
-        return entity instanceof StatefulTargetObject;
+        return (entity instanceof StatefulTargetObject) || (entity instanceof TargetObject);
     }
 
     /**
@@ -179,4 +178,16 @@ public abstract class TargetsPanel exten
         Resource res = createIconResource("target_store_" + name);
         return createIcon(name, res);
     }
+
+    /**
+     * 
+     * @param entity
+     * @return
+     */
+    private StatefulTargetObject asStatefulTargetObject(RepositoryObject entity) {
+        if (entity instanceof StatefulTargetObject) {
+            return (StatefulTargetObject) entity;
+        }
+        return getFromId(((TargetObject) entity).getDefinition());
+    }
 }



Mime
View raw message