ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1537896 [2/2] - in /ace/trunk: org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/ org.apache.ace.nodelauncher/src/org/apache/ace/nodelauncher/ui/ org.apache.ace.tageditor/src/org/apache/ace/tageditor/ org.apache.ace.target.mgmt...
Date Fri, 01 Nov 2013 10:59:29 GMT
Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java Fri Nov  1 10:59:28 2013
@@ -20,10 +20,13 @@ package org.apache.ace.webui.vaadin.comp
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.ace.client.repository.Association;
 import org.apache.ace.client.repository.ObjectRepository;
 import org.apache.ace.client.repository.RepositoryAdmin;
 import org.apache.ace.client.repository.RepositoryObject;
@@ -39,6 +42,8 @@ import org.osgi.framework.ServiceReferen
 import org.osgi.service.event.EventHandler;
 
 import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeListener;
 import com.vaadin.event.ItemClickEvent;
 import com.vaadin.event.ItemClickEvent.ItemClickListener;
 import com.vaadin.event.Transferable;
@@ -52,74 +57,22 @@ import com.vaadin.terminal.ThemeResource
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Embedded;
 import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.CellStyleGenerator;
 import com.vaadin.ui.TreeTable;
 import com.vaadin.ui.Window.Notification;
-import com.vaadin.ui.themes.Reindeer;
 
 /**
  * Provides a custom table for displaying artifacts, features and so on.
  */
-abstract class BaseObjectPanel<REPO_OBJ extends RepositoryObject, REPO extends ObjectRepository<REPO_OBJ>, LEFT_ASSOC_REPO_OBJ extends RepositoryObject, RIGHT_ASSOC_REPO_OBJ extends RepositoryObject> extends TreeTable implements EventHandler {
-    /**
-     * Drop handler for associations.
-     */
-    private class AssociationDropHandler implements DropHandler {
-
-        public void drop(DragAndDropEvent event) {
-            Transferable transferable = event.getTransferable();
-
-            TargetDetails targetDetails = event.getTargetDetails();
-            if (!(transferable instanceof Table.TableTransferable) || !(targetDetails instanceof Table.AbstractSelectTargetDetails)) {
-                return;
-            }
-
-            Table.TableTransferable tt = (Table.TableTransferable) transferable;
-            Table.AbstractSelectTargetDetails ttd = (Table.AbstractSelectTargetDetails) targetDetails;
-
-            // get the active selection, but only if we drag from the same table
-            Set<?> selection = m_associations.isActiveTable(tt.getSourceComponent()) ? m_associations.getActiveSelection() : null;
-
-            Object fromItemId = tt.getItemId();
-            Object toItemId = ttd.getItemIdOver();
-
-            if (tt.getSourceComponent().equals(m_leftTable)) {
-                REPO_OBJ rightObject = getFromId((String) toItemId);
-
-                if (selection != null) {
-                    for (Object item : selection) {
-                        createLeftSideAssociation(m_leftTable.getFromId((String) item), rightObject);
-                    }
-                }
-                else {
-                    createLeftSideAssociation(m_leftTable.getFromId((String) fromItemId), rightObject);
-                }
-            }
-            else if (tt.getSourceComponent().equals(m_rightTable)) {
-                REPO_OBJ leftObject = getFromId((String) toItemId);
-
-                if (selection != null) {
-                    for (Object item : selection) {
-                        createRightSideAssociation(leftObject, m_rightTable.getFromId((String) item));
-                    }
-                }
-                else {
-                    createRightSideAssociation(leftObject, m_rightTable.getFromId((String) fromItemId));
-                }
-            }
-        }
-
-        public AcceptCriterion getAcceptCriterion() {
-            return new Or(VerticalLocationIs.MIDDLE);
-        }
-    }
-
+abstract class BaseObjectPanel<REPO_OBJ extends RepositoryObject, REPO extends ObjectRepository<REPO_OBJ>, LEFT_ASSOC_REPO_OBJ extends RepositoryObject, RIGHT_ASSOC_REPO_OBJ extends RepositoryObject> extends TreeTable implements EventHandler,
+    CellStyleGenerator, ValueChangeListener {
     /**
      * Provides a generic remove item button.
      */
     protected class RemoveItemButton extends Button {
         public RemoveItemButton(final REPO_OBJ object) {
-            super("x");
-            setStyleName(Reindeer.BUTTON_SMALL);
+            setIcon(createIconResource("trash"));
+            setStyleName("small tiny");
             setDescription("Delete " + getDisplayName(object));
 
             addListener(new Button.ClickListener() {
@@ -145,8 +98,12 @@ abstract class BaseObjectPanel<REPO_OBJ 
      */
     protected class RemoveLinkButton extends Button {
         public RemoveLinkButton(final REPO_OBJ object) {
-            super("-");
-            setStyleName(Reindeer.BUTTON_SMALL);
+            this(object, null);
+        }
+
+        public RemoveLinkButton(final REPO_OBJ object, String parentId) {
+            setIcon(createIconResource("unlink"));
+            setStyleName("small tiny");
             setData(object.getDefinition());
             setDescription("Unlink " + getDisplayName(object));
             // Only enable this button when actually selected...
@@ -161,12 +118,12 @@ abstract class BaseObjectPanel<REPO_OBJ 
                     if (selection != null) {
                         if (m_associations.isActiveTable(m_leftTable)) {
                             for (Object itemId : selection) {
-                                removeLeftSideAssociation(m_leftTable.getFromId((String) itemId), object);
+                                removeLeftSideAssociation(m_leftTable.getFromId(itemId), object);
                             }
                         }
                         else if (m_associations.isActiveTable(m_rightTable)) {
                             for (Object itemId : selection) {
-                                removeRightSideAssocation(object, m_rightTable.getFromId((String) itemId));
+                                removeRightSideAssocation(object, m_rightTable.getFromId(itemId));
                             }
                         }
                     }
@@ -176,6 +133,64 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     /**
+     * Drop handler for associations.
+     */
+    private class AssociationDropHandler implements DropHandler {
+
+        public void drop(DragAndDropEvent event) {
+            Transferable transferable = event.getTransferable();
+
+            TargetDetails targetDetails = event.getTargetDetails();
+            if (!(transferable instanceof Table.TableTransferable) || !(targetDetails instanceof Table.AbstractSelectTargetDetails)) {
+                return;
+            }
+
+            Table.TableTransferable tt = (Table.TableTransferable) transferable;
+            Table.AbstractSelectTargetDetails ttd = (Table.AbstractSelectTargetDetails) targetDetails;
+
+            // get the active selection, but only if we drag from the same table
+            Set<?> selection = m_associations.isActiveTable(tt.getSourceComponent()) ? m_associations.getActiveSelection() : null;
+
+            if (tt.getSourceComponent().equals(m_leftTable)) {
+                if (selection != null) {
+                    for (Object item : selection) {
+                        createLeftSideAssociation(item, ttd.getItemIdOver());
+                    }
+                }
+                else {
+                    createLeftSideAssociation(tt.getItemId(), ttd.getItemIdOver());
+                }
+            }
+            else if (tt.getSourceComponent().equals(m_rightTable)) {
+                if (selection != null) {
+                    for (Object item : selection) {
+                        createRightSideAssociation(ttd.getItemIdOver(), item);
+                    }
+                }
+                else {
+                    createRightSideAssociation(ttd.getItemIdOver(), tt.getItemId());
+                }
+            }
+        }
+
+        public AcceptCriterion getAcceptCriterion() {
+            return new Or(VerticalLocationIs.MIDDLE);
+        }
+    }
+
+    private static enum Direction {
+        BOTH, LEFT, RIGHT;
+
+        boolean isGoLeft() {
+            return this == BOTH || this == LEFT;
+        }
+
+        boolean isGoRight() {
+            return this == BOTH || this == RIGHT;
+        }
+    }
+
+    /**
      * Provides a small container for {@link UIExtensionFactory} instances.
      */
     private static class UIExtensionFactoryHolder implements Comparable<UIExtensionFactoryHolder> {
@@ -239,11 +254,12 @@ abstract class BaseObjectPanel<REPO_OBJ 
 
     protected static final int ICON_HEIGHT = 16;
     protected static final int ICON_WIDTH = 16;
-    /** Empirically determined (most common width appears to be 36px). */
-    protected static final int FIXED_COLUMN_WIDTH = 36;
+    /** Empirically determined (most common width appears to be 30px). */
+    protected static final int FIXED_COLUMN_WIDTH = 30;
 
     protected final AssociationHelper m_associations;
     protected final AssociationManager m_associationManager;
+    protected final Class<REPO_OBJ> m_entityType;
 
     private final List<UIExtensionFactoryHolder> m_extensionFactories;
     private final String m_extensionPoint;
@@ -266,25 +282,25 @@ abstract class BaseObjectPanel<REPO_OBJ 
      *            <code>true</code> if double clicking an row in this table should show an editor, <code>false</code> to
      *            disallow editing.
      */
-    public BaseObjectPanel(final AssociationHelper associations, final AssociationManager associationRemover,
-        final String name, final String extensionPoint, final boolean hasEdit) {
+    public BaseObjectPanel(AssociationHelper associations, AssociationManager associationRemover, String name, String extensionPoint, boolean hasEdit, Class<REPO_OBJ> entityType) {
         super(name + "s");
 
         m_associations = associations;
         m_associationManager = associationRemover;
         m_extensionFactories = new ArrayList<UIExtensionFactoryHolder>();
         m_extensionPoint = extensionPoint;
-
-        defineTableColumns();
+        m_entityType = entityType;
 
         setSizeFull();
-        setCellStyleGenerator(m_associations.createCellStyleGenerator(this));
+        setCellStyleGenerator(this);
         setSelectable(true);
         setMultiSelect(true);
         setImmediate(true);
         setDragMode(TableDragMode.MULTIROW);
         setColumnCollapsingAllowed(true);
 
+        defineTableColumns();
+
         setItemIconPropertyId(ICON);
         setHierarchyColumn(ICON);
 
@@ -292,7 +308,7 @@ abstract class BaseObjectPanel<REPO_OBJ 
             addListener(new ItemClickListener() {
                 public void itemClick(ItemClickEvent event) {
                     if (event.isDoubleClick()) {
-                        RepositoryObject object = getFromId((String) event.getItemId());
+                        RepositoryObject object = getFromId(event.getItemId());
 
                         NamedObject namedObject = NamedObjectFactory.getNamedObject(object);
                         if (namedObject != null) {
@@ -302,6 +318,16 @@ abstract class BaseObjectPanel<REPO_OBJ 
                 }
             });
         }
+
+        addListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(Property.ValueChangeEvent event) {
+                Property property = event.getProperty();
+                if (BaseObjectPanel.this == property) {
+                    updateActiveTable();
+                }
+            }
+        });
     }
 
     /**
@@ -319,6 +345,40 @@ abstract class BaseObjectPanel<REPO_OBJ 
         populate();
     }
 
+    @Override
+    public String getStyle(Object itemId, Object propertyId) {
+        Item item = getItem(itemId);
+
+        if (propertyId == null) {
+            // no propertyId, styling row
+            if (m_associations.isAssociated(itemId)) {
+                return "associated";
+            }
+            if (m_associations.isRelated(itemId)) {
+                return "related";
+            }
+
+            updateItemIcon(itemId);
+        }
+        else if (OBJECT_NAME.equals(propertyId)) {
+            if (getParent(itemId) != null) {
+                return "name-pad-left";
+            }
+        }
+        else if (OBJECT_DESCRIPTION.equals(propertyId)) {
+            return "description";
+        }
+        else if (ACTION_UNLINK.equals(propertyId)) {
+            Button unlinkButton = (Button) item.getItemProperty(propertyId).getValue();
+            if (unlinkButton != null) {
+                boolean enabled = m_associations.isAssociated(itemId);
+
+                unlinkButton.setEnabled(enabled);
+            }
+        }
+        return null;
+    }
+
     /**
      * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
      */
@@ -396,40 +456,56 @@ abstract class BaseObjectPanel<REPO_OBJ 
     /**
      * Creates the left-hand side associations for a given repository object.
      * 
-     * @param leftObject
+     * @param leftObjectId
      *            the (left-hand side) repository object to create the associations for.
-     * @param rightObject
+     * @param rightObjectId
      *            the repository object to create the left-hand side associations;
      */
-    final void createLeftSideAssociation(LEFT_ASSOC_REPO_OBJ leftObject, REPO_OBJ rightObject) {
-        if (doCreateLeftSideAssociation(leftObject, rightObject)) {
-            m_associations.addAssociatedItem(rightObject);
-            refreshRowCache();
-            if (m_leftTable != null) {
-                m_leftTable.refreshRowCache();
-            }
+    final void createLeftSideAssociation(Object leftObjectId, Object rightObjectId) {
+        Association<LEFT_ASSOC_REPO_OBJ, REPO_OBJ> association = doCreateLeftSideAssociation(String.valueOf(leftObjectId), String.valueOf(rightObjectId));
+        if (association != null) {
+            m_leftTable.recalculateRelations(Direction.RIGHT);
         }
     }
 
     /**
      * Creates the right-hand side associations for a given repository object.
      * 
-     * @param leftObject
+     * @param leftObjectId
      *            the repository object to create the right-hand side associations;
-     * @param rightObject
+     * @param rightObjectId
      *            the (right-hand side) repository object to create the associations for.
      */
-    final void createRightSideAssociation(REPO_OBJ leftObject, RIGHT_ASSOC_REPO_OBJ rightObject) {
-        if (doCreateRightSideAssociation(leftObject, rightObject)) {
-            m_associations.addAssociatedItem(leftObject);
-            refreshRowCache();
-            if (m_rightTable != null) {
-                m_rightTable.refreshRowCache();
-            }
+    final void createRightSideAssociation(Object leftObjectId, Object rightObjectId) {
+        Association<REPO_OBJ, RIGHT_ASSOC_REPO_OBJ> association = doCreateRightSideAssociation(String.valueOf(leftObjectId), String.valueOf(rightObjectId));
+        if (association != null) {
+            m_rightTable.recalculateRelations(Direction.LEFT);
         }
     }
 
     /**
+     * Updates the active table and recalculates all relations.
+     */
+    final void updateActiveTable() {
+        m_associations.clear();
+        m_associations.updateActiveTable(this);
+        recalculateRelations(Direction.BOTH);
+    }
+
+    /**
+     * Recalculates all relations.
+     */
+    final void recalculateRelations(Direction direction) {
+        Set<String> associated = new HashSet<String>();
+        Set<String> related = new HashSet<String>();
+        collectRelations(direction, associated, related);
+
+        m_associations.updateRelations(associated, related);
+
+        refreshAllRowCaches(direction);
+    }
+
+    /**
      * Removes the left-hand side associations for a given repository object.
      * 
      * @param leftObject
@@ -439,11 +515,9 @@ abstract class BaseObjectPanel<REPO_OBJ 
      */
     final void removeLeftSideAssociation(LEFT_ASSOC_REPO_OBJ leftObject, REPO_OBJ rightObject) {
         if (doRemoveLeftSideAssociation(leftObject, rightObject)) {
-            m_associations.removeAssociatedItem(rightObject);
-            refreshRowCache();
-            if (m_leftTable != null) {
-                m_leftTable.refreshRowCache();
-            }
+            m_associations.clear();
+
+            m_leftTable.recalculateRelations(Direction.RIGHT);
         }
     }
 
@@ -457,11 +531,9 @@ abstract class BaseObjectPanel<REPO_OBJ 
      */
     final void removeRightSideAssocation(REPO_OBJ leftObject, RIGHT_ASSOC_REPO_OBJ rightObject) {
         if (doRemoveRightSideAssociation(leftObject, rightObject)) {
-            m_associations.removeAssociatedItem(leftObject);
-            refreshRowCache();
-            if (m_rightTable != null) {
-                m_rightTable.refreshRowCache();
-            }
+            m_associations.clear();
+
+            m_rightTable.recalculateRelations(Direction.LEFT);
         }
     }
 
@@ -496,6 +568,28 @@ abstract class BaseObjectPanel<REPO_OBJ 
         setChildrenAllowed(itemId, false);
     }
 
+    /**
+     * Collects the item-IDs of the directly associated entities and the related entities based on the current
+     * selection.
+     * 
+     * @param associated
+     *            the collection with associated item-IDs, will be filled by this method;
+     * @param related
+     *            the collection with related item-IDs, will be filled by this method.
+     */
+    protected final void collectRelations(Direction direction, Collection<String> associated, Collection<String> related) {
+        Set<?> value = (Set<?>) getValue();
+        List<REPO_OBJ> selection = new ArrayList<REPO_OBJ>();
+        for (Object itemID : value) {
+            REPO_OBJ obj = getFromId(itemID);
+            if (obj != null) {
+                selection.add(obj);
+            }
+        }
+
+        collectRelations(direction, selection, new HashSet<Class<?>>(), associated, related);
+    }
+
     protected abstract EditWindow createEditor(NamedObject object, List<UIExtensionFactory> extensions);
 
     /**
@@ -537,9 +631,9 @@ abstract class BaseObjectPanel<REPO_OBJ 
         addContainerProperty(ACTION_UNLINK, Button.class, null, "", null, ALIGN_CENTER);
         addContainerProperty(ACTION_DELETE, Button.class, null, "", null, ALIGN_CENTER);
 
+        setColumnWidth(ICON, ICON_WIDTH);
         setColumnWidth(ACTION_UNLINK, FIXED_COLUMN_WIDTH);
         setColumnWidth(ACTION_DELETE, FIXED_COLUMN_WIDTH);
-        setColumnWidth(ICON, FIXED_COLUMN_WIDTH);
 
         setColumnCollapsible(ICON, false);
         setColumnCollapsible(ACTION_UNLINK, false);
@@ -547,21 +641,29 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     /**
-     * @param leftObject
-     * @param rightObject
-     * @return
+     * Does the actual creation of the left-hand side associations for a given repository object.
+     * 
+     * @param leftObjectId
+     *            the (left-hand side) object ID to create the associations for.
+     * @param rightObjectId
+     *            the object ID to craete the left-hand side associations;
+     * @return the created {@link Association}, or <code>null</code> if the association could not be created.
      */
-    protected boolean doCreateLeftSideAssociation(LEFT_ASSOC_REPO_OBJ leftObject, REPO_OBJ rightObject) {
-        return m_leftTable != null;
+    protected Association<LEFT_ASSOC_REPO_OBJ, REPO_OBJ> doCreateLeftSideAssociation(String leftObjectId, String rightObjectId) {
+        return null;
     }
 
     /**
-     * @param leftObject
-     * @param rightObject
-     * @return
+     * Does the actual creation of the right-hand side associations for a given repository object.
+     * 
+     * @param leftObjectId
+     *            the object ID to create the right-hand side associations;
+     * @param rightObjectId
+     *            the (right-hand side) object ID to create the associations for.
+     * @return the created {@link Association}, or <code>null</code> if the association could not be created.
      */
-    protected boolean doCreateRightSideAssociation(REPO_OBJ leftObject, RIGHT_ASSOC_REPO_OBJ rightObject) {
-        return m_rightTable != null;
+    protected Association<REPO_OBJ, RIGHT_ASSOC_REPO_OBJ> doCreateRightSideAssociation(String leftObjectId, String rightObjectId) {
+        return null;
     }
 
     /**
@@ -607,8 +709,8 @@ abstract class BaseObjectPanel<REPO_OBJ 
      * @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);
+    protected final REPO_OBJ getFromId(Object id) {
+        return getRepository().get((String) id);
     }
 
     /**
@@ -712,11 +814,30 @@ abstract class BaseObjectPanel<REPO_OBJ 
     protected void populateParentItem(REPO_OBJ object, String parentId, Item item) {
         item.getItemProperty(OBJECT_NAME).setValue(getParentDisplayName(object));
         item.getItemProperty(OBJECT_DESCRIPTION).setValue("");
+        // XXX add unlink button when we can correctly determine dynamic links...
+//        item.getItemProperty(ACTION_UNLINK).setValue(new RemoveLinkButton(object));
         // we *must* set a non-null icon for the parent as well to ensure that the tree-table open/collapse icon is
         // rendered properly...
         setItemIcon(parentId, createIconResource("resource_workingstate_unchanged"));
     }
 
+    protected final void refreshAllRowCaches(Direction direction) {
+        if (direction.isGoLeft()) {
+            BaseObjectPanel ptr = this;
+            while (ptr != null) {
+                ptr.refreshRowCache();
+                ptr = ptr.m_leftTable;
+            }
+        }
+        if (direction.isGoRight()) {
+            BaseObjectPanel ptr = this;
+            while (ptr != null) {
+                ptr.refreshRowCache();
+                ptr = ptr.m_rightTable;
+            }
+        }
+    }
+
     /**
      * Removes a given repository object from this table.
      * 
@@ -728,7 +849,7 @@ abstract class BaseObjectPanel<REPO_OBJ 
         Object parentID = getParent(itemID);
 
         if (removeItem(itemID)) {
-            if (!hasChildren(parentID)) {
+            if ((parentID != null) && !hasChildren(parentID)) {
                 removeItem(parentID);
             }
         }
@@ -760,8 +881,40 @@ abstract class BaseObjectPanel<REPO_OBJ 
     }
 
     protected final void updateItemIcon(Object itemId) {
-        REPO_OBJ obj = getFromId((String) itemId);
-        setItemIcon(obj);
+        setItemIcon(getFromId(itemId));
+    }
+
+    private void collectRelations(Direction direction, List<REPO_OBJ> selection, Set<Class<?>> seenTypes, Collection<String> associated, Collection<String> related) {
+        // We've already visited this entity...
+        seenTypes.add(m_entityType);
+
+        for (REPO_OBJ obj : selection) {
+            if (direction.isGoLeft() && m_leftTable != null && !seenTypes.contains(m_leftTable.m_entityType)) {
+                seenTypes.add(m_leftTable.m_entityType);
+
+                List<LEFT_ASSOC_REPO_OBJ> left = obj.getAssociations(m_leftTable.m_entityType);
+                extractDefinitions(associated, left);
+                // the associated items of our left-side table are the ones related to us...
+                m_leftTable.collectRelations(direction, left, seenTypes, related, related);
+            }
+            if (direction.isGoRight() && m_rightTable != null && !seenTypes.contains(m_rightTable.m_entityType)) {
+                seenTypes.add(m_rightTable.m_entityType);
+
+                List<RIGHT_ASSOC_REPO_OBJ> right = obj.getAssociations(m_rightTable.m_entityType);
+                extractDefinitions(associated, right);
+                // the associated items of our right-side table are the ones related to us...
+                m_rightTable.collectRelations(direction, right, seenTypes, related, related);
+            }
+        }
+    }
+
+    private void extractDefinitions(Collection<String> defs, List<? extends RepositoryObject> objects) {
+        if (defs == null) {
+            return;
+        }
+        for (RepositoryObject obj : objects) {
+            defs.add(obj.getDefinition());
+        }
     }
 
     /**

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/DistributionsPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/DistributionsPanel.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/DistributionsPanel.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/DistributionsPanel.java Fri Nov  1 10:59:28 2013
@@ -26,8 +26,8 @@ import org.apache.ace.client.repository.
 import org.apache.ace.client.repository.object.DistributionObject;
 import org.apache.ace.client.repository.object.Feature2DistributionAssociation;
 import org.apache.ace.client.repository.object.FeatureObject;
+import org.apache.ace.client.repository.object.TargetObject;
 import org.apache.ace.client.repository.repository.DistributionRepository;
-import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.webui.UIExtensionFactory;
 import org.apache.ace.webui.vaadin.AssociationManager;
 
@@ -36,7 +36,7 @@ import com.vaadin.data.Item;
 /**
  * Provides an object panel for displaying distributions.
  */
-public abstract class DistributionsPanel extends BaseObjectPanel<DistributionObject, DistributionRepository, FeatureObject, StatefulTargetObject> {
+public abstract class DistributionsPanel extends BaseObjectPanel<DistributionObject, DistributionRepository, FeatureObject, TargetObject> {
 
     /**
      * Creates a new {@link DistributionsPanel} instance.
@@ -47,20 +47,17 @@ public abstract class DistributionsPanel
      *            the helper for removing associations.
      */
     public DistributionsPanel(AssociationHelper associations, AssociationManager associationRemover) {
-        super(associations, associationRemover, "Distribution", UIExtensionFactory.EXTENSION_POINT_VALUE_DISTRIBUTION,
-            true /* hasEdit */);
+        super(associations, associationRemover, "Distribution", UIExtensionFactory.EXTENSION_POINT_VALUE_DISTRIBUTION, true, DistributionObject.class);
     }
 
     @Override
-    protected boolean doCreateLeftSideAssociation(FeatureObject feature, DistributionObject distribution) {
-        m_associationManager.createFeature2DistributionAssociation(feature, distribution);
-        return true;
+    protected Feature2DistributionAssociation doCreateLeftSideAssociation(String featureId, String distributionId) {
+        return m_associationManager.createFeature2DistributionAssociation(featureId, distributionId);
     }
 
     @Override
-    protected boolean doCreateRightSideAssociation(DistributionObject distribution, StatefulTargetObject target) {
-        m_associationManager.createDistribution2TargetAssociation(distribution, target);
-        return true;
+    protected Distribution2TargetAssociation doCreateRightSideAssociation(String distribution, String target) {
+        return m_associationManager.createDistribution2TargetAssociation(distribution, target);
     }
 
     @Override
@@ -73,8 +70,8 @@ public abstract class DistributionsPanel
     }
 
     @Override
-    protected boolean doRemoveRightSideAssociation(DistributionObject object, StatefulTargetObject target) {
-        List<Distribution2TargetAssociation> associations = object.getAssociationsWith(target.getTargetObject());
+    protected boolean doRemoveRightSideAssociation(DistributionObject object, TargetObject target) {
+        List<Distribution2TargetAssociation> associations = object.getAssociationsWith(target);
         for (Distribution2TargetAssociation association : associations) {
             m_associationManager.removeAssociation(association);
         }

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/FeaturesPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/FeaturesPanel.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/FeaturesPanel.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/FeaturesPanel.java Fri Nov  1 10:59:28 2013
@@ -47,19 +47,17 @@ public abstract class FeaturesPanel exte
      *            the helper for removing associations.
      */
     public FeaturesPanel(AssociationHelper associations, AssociationManager associationRemover) {
-        super(associations, associationRemover, "Feature", UIExtensionFactory.EXTENSION_POINT_VALUE_FEATURE, true);
+        super(associations, associationRemover, "Feature", UIExtensionFactory.EXTENSION_POINT_VALUE_FEATURE, true, FeatureObject.class);
     }
 
     @Override
-    protected boolean doCreateLeftSideAssociation(ArtifactObject artifact, FeatureObject feature) {
-        m_associationManager.createArtifact2FeatureAssociation(artifact, feature);
-        return true;
+    protected Artifact2FeatureAssociation doCreateLeftSideAssociation(String artifactId, String featureId) {
+        return m_associationManager.createArtifact2FeatureAssociation(artifactId, featureId);
     }
 
     @Override
-    protected boolean doCreateRightSideAssociation(FeatureObject feature, DistributionObject distribution) {
-        m_associationManager.createFeature2DistributionAssociation(feature, distribution);
-        return true;
+    protected Feature2DistributionAssociation doCreateRightSideAssociation(String featureId, String distributionId) {
+        return m_associationManager.createFeature2DistributionAssociation(featureId, distributionId);
     }
 
     @Override

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=1537896&r1=1537895&r2=1537896&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 Fri Nov  1 10:59:28 2013
@@ -20,6 +20,7 @@ package org.apache.ace.webui.vaadin.comp
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,7 +31,6 @@ import org.apache.ace.webui.UIExtensionF
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.event.EventHandler;
-import org.osgi.service.useradmin.User;
 
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
@@ -50,9 +50,6 @@ public abstract class MainActionToolbar 
      */
     private class LogoutButtonListener implements Button.ClickListener, ConfirmationDialog.Callback {
 
-        /**
-         * {@inheritDoc}
-         */
         public void buttonClick(ClickEvent event) {
             final RepositoryAdmin repoAdmin = getRepositoryAdmin();
             try {
@@ -66,37 +63,22 @@ public abstract class MainActionToolbar 
                 }
             }
             catch (IOException e) {
-                getWindow().showNotification("Changes not stored",
-                    "Failed to store the changes to the server.<br />Reason: " + e.getMessage(),
-                    Notification.TYPE_ERROR_MESSAGE);
+                showError("Changes not stored", "Failed to store the changes to the server.", e);
             }
         }
 
-        /**
-         * {@inheritDoc}
-         */
         public void onDialogResult(String buttonName) {
             if (ConfirmationDialog.YES.equals(buttonName)) {
                 try {
                     logout();
                 }
                 catch (IOException e) {
-                    handleIOException(e);
+                    showError("Warning", "There were errors during the logout procedure.", e);
                 }
             }
         }
 
         /**
-         * @param e
-         *            the exception to handle.
-         */
-        private void handleIOException(IOException e) {
-            getWindow().showNotification("Warning",
-                "There were errors during the logout procedure.<br />Reason: " + e.getMessage(),
-                Notification.TYPE_ERROR_MESSAGE);
-        }
-
-        /**
          * Does the actual logout of the user.
          * 
          * @throws IOException
@@ -113,9 +95,6 @@ public abstract class MainActionToolbar 
      */
     private final class RetrieveButtonListener implements Button.ClickListener, ConfirmationDialog.Callback {
 
-        /**
-         * {@inheritDoc}
-         */
         public void buttonClick(ClickEvent event) {
             final RepositoryAdmin repoAdmin = getRepositoryAdmin();
             try {
@@ -134,9 +113,6 @@ public abstract class MainActionToolbar 
             }
         }
 
-        /**
-         * {@inheritDoc}
-         */
         public void onDialogResult(String buttonName) {
             if (ConfirmationDialog.YES.equals(buttonName)) {
                 try {
@@ -148,14 +124,8 @@ public abstract class MainActionToolbar 
             }
         }
 
-        /**
-         * @param e
-         *            the exception to handle.
-         */
         private void handleIOException(IOException e) {
-            getWindow().showNotification("Retrieve failed",
-                "Failed to retrieve the data from the server.<br />Reason: " + e.getMessage(),
-                Notification.TYPE_ERROR_MESSAGE);
+            showError("Retrieve failed", "Failed to retrieve the data from the server.", e);
         }
 
         /**
@@ -175,9 +145,6 @@ public abstract class MainActionToolbar 
      */
     private final class RevertButtonListener implements Button.ClickListener, ConfirmationDialog.Callback {
 
-        /**
-         * {@inheritDoc}
-         */
         public void buttonClick(ClickEvent event) {
             try {
                 if (getRepositoryAdmin().isModified()) {
@@ -188,8 +155,7 @@ public abstract class MainActionToolbar 
                 }
                 else {
                     // Nothing to revert...
-                    getWindow().showNotification("Nothing to revert",
-                        "There are no local changes that need to be reverted.", Notification.TYPE_WARNING_MESSAGE);
+                    showWarning("Nothing to revert", "There are no local changes that need to be reverted.");
                 }
             }
             catch (IOException e) {
@@ -197,9 +163,6 @@ public abstract class MainActionToolbar 
             }
         }
 
-        /**
-         * {@inheritDoc}
-         */
         public void onDialogResult(String buttonName) {
             if (ConfirmationDialog.YES.equals(buttonName)) {
                 try {
@@ -211,13 +174,8 @@ public abstract class MainActionToolbar 
             }
         }
 
-        /**
-         * @param e
-         *            the exception to handle.
-         */
         private void handleIOException(IOException e) {
-            getWindow().showNotification("Revert failed",
-                "Failed to revert your changes.<br />Reason: " + e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
+            showError("Revert failed", "Failed to revert your changes.", e);
         }
 
         /**
@@ -253,16 +211,11 @@ public abstract class MainActionToolbar 
                     }
                 }
                 else {
-                    getWindow()
-                        .showNotification("Nothing to store",
-                            "There are no changes that can be stored to the repository.",
-                            Notification.TYPE_WARNING_MESSAGE);
+                    showWarning("Nothing to store", "There are no changes that can be stored to the repository.");
                 }
             }
             catch (IOException e) {
-                getWindow().showNotification("Changes not stored",
-                    "Failed to store the changes to the server.<br />Reason: " + e.getMessage(),
-                    Notification.TYPE_ERROR_MESSAGE);
+                showError("Changes not stored", "Failed to store the changes to the server.", e);
             }
         }
 
@@ -278,6 +231,7 @@ public abstract class MainActionToolbar 
         }
     }
 
+    private final ConcurrentHashMap<ServiceReference, UIExtensionFactory> m_extensions;
     private final boolean m_showLogoutButton;
 
     private Button m_retrieveButton;
@@ -285,10 +239,6 @@ public abstract class MainActionToolbar 
     private Button m_revertButton;
     private Button m_logoutButton;
 
-    private final ConcurrentHashMap<ServiceReference, UIExtensionFactory> m_extensions = new ConcurrentHashMap<ServiceReference, UIExtensionFactory>();
-
-    private final User m_user;
-
     private HorizontalLayout m_extraComponentBar;
 
     /**
@@ -300,10 +250,10 @@ public abstract class MainActionToolbar 
      * @param showLogoutButton
      *            <code>true</code> if a logout button should be shown, <code>false</code> if it should not.
      */
-    public MainActionToolbar(User user, DependencyManager manager, boolean showLogoutButton) {
-        super(5, 1);
+    public MainActionToolbar(boolean showLogoutButton) {
+        super(6, 1);
 
-        m_user = user;
+        m_extensions = new ConcurrentHashMap<ServiceReference, UIExtensionFactory>();
         m_showLogoutButton = showLogoutButton;
 
         setWidth("100%");
@@ -333,16 +283,6 @@ public abstract class MainActionToolbar 
         m_revertButton.setEnabled(modified);
     }
 
-    public void init(org.apache.felix.dm.Component component) {
-        DependencyManager dm = component.getDependencyManager();
-        component.add(dm.createServiceDependency()
-            .setService(UIExtensionFactory.class, "(" + UIExtensionFactory.EXTENSION_POINT_KEY + "=" + UIExtensionFactory.EXTENSION_POINT_VALUE_MENU + ")")
-            .setCallbacks("add", "remove")
-            .setRequired(false)
-            .setInstanceBound(true)
-            );
-    }
-
     protected final void add(ServiceReference ref, UIExtensionFactory factory) {
         m_extensions.put(ref, factory);
         setExtraComponents();
@@ -376,12 +316,22 @@ public abstract class MainActionToolbar 
      */
     protected abstract void doAfterRevert() throws IOException;
 
+    @SuppressWarnings("unchecked")
     protected final List<Component> getExtraComponents() {
+        // create a shapshot of the current extensions...
+        Map<ServiceReference, UIExtensionFactory> extensions = new HashMap<ServiceReference, UIExtensionFactory>(m_extensions);
+
+        // Make sure we've got a predictable order of the components...
+        List<ServiceReference> refs = new ArrayList<ServiceReference>(extensions.keySet());
+        Collections.sort(refs);
+
+        Map<String, Object> context = new HashMap<String, Object>();
+
         List<Component> result = new ArrayList<Component>();
-        for (UIExtensionFactory f : m_extensions.values()) {
-            Map<String, Object> context = new HashMap<String, Object>();
-            context.put("user", m_user);
-            result.add(f.create(context));
+        for (ServiceReference ref : refs) {
+            UIExtensionFactory factory = extensions.get(ref);
+
+            result.add(factory.create(context));
         }
         return result;
     }
@@ -391,11 +341,40 @@ public abstract class MainActionToolbar 
      */
     protected abstract RepositoryAdmin getRepositoryAdmin();
 
+    /**
+     * Called by Felix DM when initializing this component.
+     */
+    protected void init(org.apache.felix.dm.Component component) {
+        DependencyManager dm = component.getDependencyManager();
+        component.add(dm.createServiceDependency()
+            .setService(UIExtensionFactory.class, "(" + UIExtensionFactory.EXTENSION_POINT_KEY + "=" + UIExtensionFactory.EXTENSION_POINT_VALUE_MENU + ")")
+            .setCallbacks("add", "remove")
+            .setRequired(false)
+            .setInstanceBound(true)
+            );
+    }
+
     protected final void remove(ServiceReference ref, UIExtensionFactory factory) {
         m_extensions.remove(ref);
         setExtraComponents();
     }
 
+    protected void showError(String title, String message, Exception e) {
+        StringBuilder sb = new StringBuilder("<br/>");
+        sb.append(message);
+        if (e.getMessage() != null) {
+            sb.append("<br/>").append(e.getMessage());
+        }
+        else {
+            sb.append("<br/>unknown error!");
+        }
+        getWindow().showNotification(title, sb.toString(), Notification.TYPE_ERROR_MESSAGE);
+    }
+
+    protected void showWarning(String title, String message) {
+        getWindow().showNotification(title, String.format("<br/>%s", message), Notification.TYPE_WARNING_MESSAGE);
+    }
+
     /**
      * Initializes this component.
      */
@@ -415,16 +394,19 @@ public abstract class MainActionToolbar 
         m_revertButton.addListener(new RevertButtonListener());
         addComponent(m_revertButton, 2, 0);
 
-        m_extraComponentBar = new HorizontalLayout();
         Label spacer = new Label("");
         spacer.setWidth("2em");
-        m_extraComponentBar.addComponent(spacer);
-        addComponent(m_extraComponentBar, 3, 0);
+        addComponent(spacer, 3, 0);
+
+        m_extraComponentBar = new HorizontalLayout();
+        m_extraComponentBar.setSpacing(true);
+
+        addComponent(m_extraComponentBar, 4, 0);
 
         m_logoutButton = new Button("Logout");
         m_logoutButton.addListener(new LogoutButtonListener());
         if (m_showLogoutButton) {
-            addComponent(m_logoutButton, 4, 0);
+            addComponent(m_logoutButton, 5, 0);
         }
 
         // Ensure the spacer gets all the excessive room, causing the logout

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/TargetsPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/TargetsPanel.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/TargetsPanel.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/TargetsPanel.java Fri Nov  1 10:59:28 2013
@@ -25,6 +25,7 @@ import org.apache.ace.client.repository.
 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.repository.TargetRepository;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetRepository;
 import org.apache.ace.webui.UIExtensionFactory;
@@ -38,7 +39,7 @@ import com.vaadin.ui.Embedded;
 /**
  * Provides an object panel for displaying (stateful) targets.
  */
-public abstract class TargetsPanel extends BaseObjectPanel<StatefulTargetObject, StatefulTargetRepository, DistributionObject, RepositoryObject> {
+public abstract class TargetsPanel extends BaseObjectPanel<TargetObject, TargetRepository, DistributionObject, RepositoryObject> {
 
     private static final String REGISTRATION_STATE_ICON = "regStateIcon";
     private static final String PROVISIONING_STATE_ICON = "provStateIcon";
@@ -53,7 +54,7 @@ public abstract class TargetsPanel exten
      *            the helper for removing associations.
      */
     public TargetsPanel(AssociationHelper associations, AssociationManager associationRemover) {
-        super(associations, associationRemover, "Target", UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET, true /* hasEdit */);
+        super(associations, associationRemover, "Target", UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET, true, TargetObject.class);
     }
 
     protected void defineTableColumns() {
@@ -65,7 +66,7 @@ public abstract class TargetsPanel exten
         addContainerProperty(ACTION_UNLINK, Button.class, null, "", null, ALIGN_CENTER);
         addContainerProperty(ACTION_DELETE, Button.class, null, "", null, ALIGN_CENTER);
 
-        setColumnWidth(ICON, FIXED_COLUMN_WIDTH);
+        setColumnWidth(ICON, ICON_WIDTH);
         setColumnWidth(ACTION_UNLINK, FIXED_COLUMN_WIDTH);
         setColumnWidth(ACTION_DELETE, FIXED_COLUMN_WIDTH);
         setColumnWidth(REGISTRATION_STATE_ICON, ICON_WIDTH);
@@ -78,13 +79,12 @@ public abstract class TargetsPanel exten
     }
 
     @Override
-    protected boolean doCreateLeftSideAssociation(DistributionObject distribution, StatefulTargetObject target) {
-        m_associationManager.createDistribution2TargetAssociation(distribution, target);
-        return true;
+    protected Distribution2TargetAssociation doCreateLeftSideAssociation(String distributionId, String targetId) {
+        return m_associationManager.createDistribution2TargetAssociation(distributionId, targetId);
     }
 
     @Override
-    protected boolean doRemoveLeftSideAssociation(DistributionObject distribution, StatefulTargetObject target) {
+    protected boolean doRemoveLeftSideAssociation(DistributionObject distribution, TargetObject target) {
         List<Distribution2TargetAssociation> associations = target.getAssociationsWith(distribution);
         for (Distribution2TargetAssociation association : associations) {
             m_associationManager.removeAssociation(association);
@@ -93,13 +93,15 @@ public abstract class TargetsPanel exten
     }
 
     @Override
-    protected String getDisplayName(StatefulTargetObject object) {
+    protected String getDisplayName(TargetObject object) {
         return object.getID();
     }
 
+    protected abstract StatefulTargetRepository getStatefulTargetRepository();
+
     @Override
     protected WorkingState getWorkingState(RepositoryObject object) {
-        final StatefulTargetObject statefulTarget = (StatefulTargetObject) object;
+        final StatefulTargetObject statefulTarget = asStatefulTargetObject(object);
         if (statefulTarget.isRegistered()) {
             return super.getWorkingState(statefulTarget.getTargetObject());
         }
@@ -108,15 +110,15 @@ public abstract class TargetsPanel exten
 
     @Override
     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);
+        TargetObject target = asTargetObject(entity);
+        if (TargetObject.TOPIC_ADDED.equals(topic)) {
+            add(target);
         }
-        if (StatefulTargetObject.TOPIC_REMOVED.equals(topic)) {
-            remove(statefulTarget);
+        if (TargetObject.TOPIC_REMOVED.equals(topic)) {
+            remove(target);
         }
         if (topic.endsWith("CHANGED")) {
-            update(statefulTarget);
+            update(target);
         }
     }
 
@@ -125,29 +127,33 @@ public abstract class TargetsPanel exten
         return (entity instanceof StatefulTargetObject) || (entity instanceof TargetObject);
     }
 
-    protected void populateItem(StatefulTargetObject target, Item item) {
+    protected void populateItem(TargetObject target, Item item) {
+        StatefulTargetObject statefulTarget = asStatefulTargetObject(target);
+
         item.getItemProperty(OBJECT_NAME).setValue(target.getID());
-        item.getItemProperty(REGISTRATION_STATE_ICON).setValue(getRegistrationStateIcon(target));
-        item.getItemProperty(STORE_STATE_ICON).setValue(getStoreStateIcon(target));
-        item.getItemProperty(PROVISIONING_STATE_ICON).setValue(getProvisioningStateIcon(target));
+        item.getItemProperty(REGISTRATION_STATE_ICON).setValue(getRegistrationStateIcon(statefulTarget));
+        item.getItemProperty(STORE_STATE_ICON).setValue(getStoreStateIcon(statefulTarget));
+        item.getItemProperty(PROVISIONING_STATE_ICON).setValue(getProvisioningStateIcon(statefulTarget));
         item.getItemProperty(ACTION_UNLINK).setValue(new RemoveLinkButton(target));
-        item.getItemProperty(ACTION_DELETE).setValue(createRemoveItemButton(target));
+        item.getItemProperty(ACTION_DELETE).setValue(createRemoveItemButton(statefulTarget));
     }
 
-    /**
-     * 
-     * @param entity
-     * @return
-     */
     private StatefulTargetObject asStatefulTargetObject(RepositoryObject entity) {
         if (entity instanceof StatefulTargetObject) {
             return (StatefulTargetObject) entity;
         }
-        return getFromId(((TargetObject) entity).getDefinition());
+        return getStatefulTargetRepository().get(((TargetObject) entity).getDefinition());
+    }
+
+    private TargetObject asTargetObject(RepositoryObject entity) {
+        if (entity instanceof TargetObject) {
+            return (TargetObject) entity;
+        }
+        return ((StatefulTargetObject) entity).getTargetObject();
     }
 
     private RemoveItemButton createRemoveItemButton(StatefulTargetObject object) {
-        RemoveItemButton b = new RemoveItemButton(object);
+        RemoveItemButton b = new RemoveItemButton(object.getTargetObject());
         b.setEnabled(object.isRegistered());
         return b;
     }
@@ -158,20 +164,12 @@ public abstract class TargetsPanel exten
         return createIcon(name, res);
     }
 
-    /**
-     * @param object
-     * @return
-     */
     private Embedded getRegistrationStateIcon(StatefulTargetObject object) {
         String name = object.getRegistrationState().name();
         Resource res = createIconResource("target_" + name);
         return createIcon(name, res);
     }
 
-    /**
-     * @param object
-     * @return
-     */
     private Embedded getStoreStateIcon(StatefulTargetObject object) {
         String name = object.getStoreState().name();
         Resource res = createIconResource("target_store_" + name);



Mime
View raw message