ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1537896 [1/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
Author: jawi
Date: Fri Nov  1 10:59:28 2013
New Revision: 1537896

URL: http://svn.apache.org/r1537896
Log:
Several improvements in the Web UI:

- added proper icons for unlinking and removing items (thanks to Marrs for creating them);
- removed the "dynamic links" checkbox and instead allow bundles by the BSN to be dropped
  on features to create dynamic links;
- cleanup and simplification of lots of UI code possible due to earlier refactorings.


Added:
    ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/trash.png   (with props)
    ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/unlink.png   (with props)
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedStatefulTargetObject.java
      - copied, changed from r1536612, ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java
Modified:
    ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java
    ace/trunk/org.apache.ace.nodelauncher/src/org/apache/ace/nodelauncher/ui/NodeLauncherPanelFactory.java
    ace/trunk/org.apache.ace.tageditor/src/org/apache/ace/tageditor/ACETagEditorExtension.java
    ace/trunk/org.apache.ace.target.mgmt.ui/src/org/apache/ace/target/management/ui/TargetManagementExtension.java
    ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/ui/ACEVerifierExtension.java
    ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/styles.css
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedObjectFactory.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AssociationManager.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/EditWindow.java
    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/ArtifactsPanel.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/AssociationHelper.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/BaseObjectPanel.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/DistributionsPanel.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/FeaturesPanel.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/MainActionToolbar.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/TargetsPanel.java

Modified: ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java (original)
+++ ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java Fri Nov  1 10:59:28 2013
@@ -35,7 +35,6 @@ import org.apache.ace.feedback.AuditEven
 import org.apache.ace.feedback.Descriptor;
 import org.apache.ace.feedback.Event;
 import org.apache.ace.log.server.store.LogStore;
-import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
 import org.osgi.service.log.LogService;
 
@@ -80,13 +79,11 @@ public class LogViewerExtension implemen
      * {@inheritDoc}
      */
     public Component create(Map<String, Object> context) {
-        RepositoryObject object = getRepositoryObjectFromContext(context);
-        if (object instanceof StatefulTargetObject
-            && !((StatefulTargetObject) object).isRegistered()) {
+        StatefulTargetObject target = getRepositoryObjectFromContext(context);
+        if (!target.isRegistered()) {
             VerticalLayout result = new VerticalLayout();
             result.setCaption(CAPTION);
-            result.addComponent(new Label(
-                "This target is not yet registered, so it has no log."));
+            result.addComponent(new Label("This target is not yet registered, so it has no log."));
             return result;
         }
 
@@ -112,7 +109,7 @@ public class LogViewerExtension implemen
         m_table.setColumnCollapsingAllowed(true);
 
         try {
-            fillTable(object, m_table);
+            fillTable(target, m_table);
             // Sort on time in descending order...
             m_table.setSortAscending(false);
             m_table.setSortContainerPropertyId(COL_TIME);
@@ -239,18 +236,12 @@ public class LogViewerExtension implemen
         }
     }
 
-    private RepositoryObject getRepositoryObjectFromContext(
-        Map<String, Object> context) {
-        Object contextObject = context.get("object");
+    private StatefulTargetObject getRepositoryObjectFromContext(Map<String, Object> context) {
+        Object contextObject = context.get("statefulTarget");
         if (contextObject == null) {
             throw new IllegalStateException("No context object found");
         }
-        // It looks like there is some bug (or some other reason that escapes
-        // me) why ace is using either the object directly or wraps it in a
-        // NamedObject first.
-        // Its unclear when it does which so for now we cater for both.
-        return (contextObject instanceof NamedObject ? ((NamedObject) contextObject)
-            .getObject() : (RepositoryObject) contextObject);
+        return (StatefulTargetObject) contextObject;
     }
 
     private TextField makeTextField(final String colType) {
@@ -275,7 +266,7 @@ public class LogViewerExtension implemen
 
         return t;
     }
-    
+
     private String normalize(String input) {
         return input.toLowerCase().replaceAll("_", " ");
     }

Modified: ace/trunk/org.apache.ace.nodelauncher/src/org/apache/ace/nodelauncher/ui/NodeLauncherPanelFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.nodelauncher/src/org/apache/ace/nodelauncher/ui/NodeLauncherPanelFactory.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.nodelauncher/src/org/apache/ace/nodelauncher/ui/NodeLauncherPanelFactory.java (original)
+++ ace/trunk/org.apache.ace.nodelauncher/src/org/apache/ace/nodelauncher/ui/NodeLauncherPanelFactory.java Fri Nov  1 10:59:28 2013
@@ -25,7 +25,6 @@ import java.util.concurrent.Future;
 
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.nodelauncher.NodeLauncher;
-import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
 import org.osgi.service.log.LogService;
 
@@ -38,8 +37,7 @@ public class NodeLauncherPanelFactory im
     private final ExecutorService m_executor = Executors.newCachedThreadPool();
     
     public Panel create(Map<String, Object> context) {
-        NamedObject namedObject = (NamedObject) context.get("object");
-        StatefulTargetObject target = (StatefulTargetObject) namedObject.getObject();
+        StatefulTargetObject target = (StatefulTargetObject) context.get("statefulTarget");
         return new NodePanel(this, target.getID());
     }
     

Modified: ace/trunk/org.apache.ace.tageditor/src/org/apache/ace/tageditor/ACETagEditorExtension.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.tageditor/src/org/apache/ace/tageditor/ACETagEditorExtension.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.tageditor/src/org/apache/ace/tageditor/ACETagEditorExtension.java (original)
+++ ace/trunk/org.apache.ace.tageditor/src/org/apache/ace/tageditor/ACETagEditorExtension.java Fri Nov  1 10:59:28 2013
@@ -74,7 +74,8 @@ public class ACETagEditorExtension imple
     /**
      * Creates a tag editor component for the given repository object.
      * 
-     * @param object the repository object to create the tag editor for, cannot be <code>null</code>.
+     * @param object
+     *            the repository object to create the tag editor for, cannot be <code>null</code>.
      * @return a tag editor component, never <code>null</code>.
      */
     private Component createTagEditor(final RepositoryObject object) {
@@ -85,11 +86,11 @@ public class ACETagEditorExtension imple
         table.addContainerProperty("Value", TextField.class, null);
         table.addContainerProperty("Remove", Button.class, null, "", null, Table.ALIGN_CENTER);
         table.setEditable(false);
-        
+
         table.setColumnExpandRatio("Tag", 1.0f);
         table.setColumnExpandRatio("Value", 1.0f);
         table.setColumnExpandRatio("Remove", 0.2f);
-        
+
         final Map<Object, TagTableEntry> idToKey = new HashMap<Object, TagTableEntry>();
         Enumeration<String> keys = object.getTagKeys();
         while (keys.hasMoreElements()) {
@@ -100,10 +101,10 @@ public class ACETagEditorExtension imple
                 idToKey.put(tte.addTo(table), tte);
             }
         }
-        
+
         final TagTableEntry tte = new TagTableEntry(object);
         idToKey.put(tte.addTo(table), tte);
-        
+
         tte.setListener(new TagTableEntry.ChangeListener() {
             private volatile TagTableEntry m_lastEntry = tte;
 
@@ -115,7 +116,7 @@ public class ACETagEditorExtension imple
                 ntte.setListener(this);
             }
         });
-        
+
         table.addActionHandler(new Action.Handler() {
             final Action[] delete = new Action[] { new Action("delete") };
 
@@ -132,12 +133,14 @@ public class ACETagEditorExtension imple
     }
 
     private RepositoryObject getRepositoryObjectFromContext(Map<String, Object> context) {
-        Object contextObject = context.get("object");
+        Object contextObject = context.get("statefulTarget");
         if (contextObject == null) {
-            throw new IllegalStateException("No context object found");
+            contextObject = context.get("object");
+            if (contextObject == null) {
+                throw new IllegalStateException("No context object found");
+            }
         }
 
-        return (contextObject instanceof NamedObject ? ((NamedObject) contextObject).getObject()
-            : (RepositoryObject) contextObject);
+        return (contextObject instanceof NamedObject ? ((NamedObject) contextObject).getObject() : (RepositoryObject) contextObject);
     }
 }

Modified: ace/trunk/org.apache.ace.target.mgmt.ui/src/org/apache/ace/target/management/ui/TargetManagementExtension.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.target.mgmt.ui/src/org/apache/ace/target/management/ui/TargetManagementExtension.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.target.mgmt.ui/src/org/apache/ace/target/management/ui/TargetManagementExtension.java (original)
+++ ace/trunk/org.apache.ace.target.mgmt.ui/src/org/apache/ace/target/management/ui/TargetManagementExtension.java Fri Nov  1 10:59:28 2013
@@ -20,10 +20,8 @@ package org.apache.ace.target.management
 
 import java.util.Map;
 
-import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject.ApprovalState;
-import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
 
 import com.vaadin.ui.Button;
@@ -48,13 +46,7 @@ public class TargetManagementExtension i
         result.setSpacing(true);
         result.setSizeFull();
 
-        RepositoryObject object = getRepositoryObjectFromContext(context);
-        if (!(object instanceof StatefulTargetObject)) {
-            result.addComponent(new Label("This target is not a stateful target object."));
-            return result;
-        }
-
-        final StatefulTargetObject target = (StatefulTargetObject) object;
+        final StatefulTargetObject target = getRepositoryObjectFromContext(context);
 
         final CheckBox registerCB = new CheckBox("Registered?");
         registerCB.setImmediate(true);
@@ -110,12 +102,12 @@ public class TargetManagementExtension i
         return ApprovalState.Unapproved.equals(target.getApprovalState()) && target.needsApprove();
     }
 
-    private RepositoryObject getRepositoryObjectFromContext(Map<String, Object> context) {
-        Object contextObject = context.get("object");
+    private StatefulTargetObject getRepositoryObjectFromContext(Map<String, Object> context) {
+        Object contextObject = context.get("statefulTarget");
         if (contextObject == null) {
             throw new IllegalStateException("No context object found");
         }
 
-        return (contextObject instanceof NamedObject ? ((NamedObject) contextObject).getObject() : (RepositoryObject) contextObject);
+        return (StatefulTargetObject) contextObject;
     }
 }

Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/ui/ACEVerifierExtension.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/ui/ACEVerifierExtension.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/ui/ACEVerifierExtension.java (original)
+++ ace/trunk/org.apache.ace.verifier/src/org/apache/ace/deployment/verifier/ui/ACEVerifierExtension.java Fri Nov  1 10:59:28 2013
@@ -38,11 +38,10 @@ import org.apache.ace.client.repository.
 import org.apache.ace.client.repository.object.DeploymentVersionObject;
 import org.apache.ace.client.repository.repository.DeploymentVersionRepository;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
+import org.apache.ace.connectionfactory.ConnectionFactory;
 import org.apache.ace.deployment.verifier.VerifierService;
 import org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment;
 import org.apache.ace.deployment.verifier.VerifierService.VerifyReporter;
-import org.apache.ace.connectionfactory.ConnectionFactory;
-import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
 import org.osgi.framework.Constants;
 import org.osgi.framework.wiring.BundleCapability;
@@ -149,14 +148,11 @@ public class ACEVerifierExtension implem
      * {@inheritDoc}
      */
     public Component create(Map<String, Object> context) {
-        RepositoryObject object = getRepositoryObjectFromContext(context);
+        StatefulTargetObject target = getRepositoryObjectFromContext(context);
 
         Component content = new Label("This target is not yet registered, so it can not verify anything.");
-        if (object instanceof StatefulTargetObject) {
-            StatefulTargetObject statefulTarget = (StatefulTargetObject) object;
-            if (statefulTarget.isRegistered()) {
-                content = new ManifestArea(statefulTarget.getID(), getManifest(statefulTarget), statefulTarget);
-            }
+        if (target.isRegistered()) {
+            content = new ManifestArea(target.getID(), getManifest(target), target);
         }
 
         VerticalLayout result = new VerticalLayout();
@@ -215,7 +211,8 @@ public class ACEVerifierExtension implem
     /**
      * Quietly closes a given {@link Closeable}.
      * 
-     * @param closeable the closeable to close, can be <code>null</code>.
+     * @param closeable
+     *            the closeable to close, can be <code>null</code>.
      */
     private void closeQuietly(Closeable closeable) {
         if (closeable != null) {
@@ -231,8 +228,10 @@ public class ACEVerifierExtension implem
     /**
      * Factory method to create a suitable {@link VerifyEnvironment} instance.
      * 
-     * @param manifest the manifest to use;
-     * @param verifyResult the verification result to use.
+     * @param manifest
+     *            the manifest to use;
+     * @param verifyResult
+     *            the verification result to use.
      * @return a new {@link VerifyEnvironment} instance, never <code>null</code>.
      */
     @SuppressWarnings("deprecation")
@@ -286,9 +285,12 @@ public class ACEVerifierExtension implem
 
     /**
      * Returns the manifest for a given repository object.
-     * <p>In case the given repository object does not provide a manifest, this method will return a hard-coded manifest.</p>
+     * <p>
+     * In case the given repository object does not provide a manifest, this method will return a hard-coded manifest.
+     * </p>
      * 
-     * @param object the repository object to get the manifest for, cannot be <code>null</code>.
+     * @param object
+     *            the repository object to get the manifest for, cannot be <code>null</code>.
      * @return a manifest, never <code>null</code>.
      */
     private String getManifest(RepositoryObject object) {
@@ -302,7 +304,8 @@ public class ACEVerifierExtension implem
     /**
      * Converts a given {@link Attributes} into a map.
      * 
-     * @param attributes the attributes to convert, cannot be <code>null</code>.
+     * @param attributes
+     *            the attributes to convert, cannot be <code>null</code>.
      * @return a manifest map, never <code>null</code>.
      */
     private Map<String, String> getManifestEntries(final Manifest manifest) {
@@ -333,22 +336,24 @@ public class ACEVerifierExtension implem
      * @param context
      * @return
      */
-    private RepositoryObject getRepositoryObjectFromContext(Map<String, Object> context) {
-        Object contextObject = context.get("object");
+    private StatefulTargetObject getRepositoryObjectFromContext(Map<String, Object> context) {
+        Object contextObject = context.get("statefulTarget");
         if (contextObject == null) {
             throw new IllegalStateException("No context object found");
         }
 
-        return ((RepositoryObject) (contextObject instanceof NamedObject ? ((NamedObject) contextObject).getObject()
-            : contextObject));
+        return (StatefulTargetObject) contextObject;
     }
 
     /**
      * Processes all artifacts.
      * 
-     * @param artifacts the artifacts to process.
-     * @param env the environment to use;
-     * @param verifyResult the verification result, cannot be <code>null</code>.
+     * @param artifacts
+     *            the artifacts to process.
+     * @param env
+     *            the environment to use;
+     * @param verifyResult
+     *            the verification result, cannot be <code>null</code>.
      */
     private void processArtifacts(DeploymentArtifact[] artifacts, VerifyEnvironment env, VerificationResult verifyResult) {
         String dir;
@@ -365,9 +370,12 @@ public class ACEVerifierExtension implem
     /**
      * Processes a single bundle.
      * 
-     * @param bundle the bundle to process;
-     * @param env the environment to use;
-     * @param verifyResult the verification result, cannot be <code>null</code>.
+     * @param bundle
+     *            the bundle to process;
+     * @param env
+     *            the environment to use;
+     * @param verifyResult
+     *            the verification result, cannot be <code>null</code>.
      */
     private void processBundle(DeploymentArtifact bundle, VerifyEnvironment env, VerificationResult verifyResult) {
         InputStream is = null;
@@ -401,9 +409,11 @@ public class ACEVerifierExtension implem
     }
 
     /**
-     * @param url the remote URL to connect to, cannot be <code>null</code>.
+     * @param url
+     *            the remote URL to connect to, cannot be <code>null</code>.
      * @return an {@link InputStream} to the remote URL, never <code>null</code>.
-     * @throws IOException in case of I/O problems opening the remote connection.
+     * @throws IOException
+     *             in case of I/O problems opening the remote connection.
      */
     private InputStream getBundleContents(String url) throws IOException {
         URLConnection conn = m_connectionFactory.createConnection(new URL(url));

Added: ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/trash.png
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/trash.png?rev=1537896&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/trash.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/unlink.png
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/unlink.png?rev=1537896&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/icons/unlink.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Modified: ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/styles.css
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/styles.css?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/styles.css (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/resources/VAADIN/themes/reindeer/styles.css Fri Nov  1 10:59:28 2013
@@ -6000,6 +6000,12 @@ textarea.v-textarea-readonly,
 .v-table-row-odd.v-table-row-associated {
     background: #79b;
 }
+.v-table-row-broken-association {
+    background: #bac;
+}
+.v-table-row-odd.v-table-row-broken-association {
+    background: #a9b;
+}
 .v-table-row-related {
     background: #9ab;
 }
@@ -6023,3 +6029,12 @@ textarea.v-textarea-readonly,
 	font-weight: bold;
 	color: red;
 }
+.v-button-tiny .v-button-caption {
+	text-decoration: none;
+}
+.v-button-tiny .v-button-wrap,
+.v-disabled.v-button-tiny .v-button-wrap {
+  background-position: right -412px;
+	height: 20px;
+	padding: 1px 4px 0px 0px;
+}

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedObjectFactory.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedObjectFactory.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedObjectFactory.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedObjectFactory.java Fri Nov  1 10:59:28 2013
@@ -42,12 +42,12 @@ public final class NamedObjectFactory {
         else if (object instanceof DistributionObject) {
             return new NamedDistributionObject((DistributionObject) object);
         }
-        else if (object instanceof StatefulTargetObject) {
-            return new NamedTargetObject((StatefulTargetObject) object);
-        }
         else if (object instanceof TargetObject) {
             return new NamedTargetObject((TargetObject) object);
         }
+        else if (object instanceof StatefulTargetObject) {
+            return new NamedStatefulTargetObject((StatefulTargetObject) object);
+        }
         else if (object instanceof Association) {
             return new NamedAssociationObject((Association<?, ?>) object);
         }

Copied: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedStatefulTargetObject.java (from r1536612, ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java)
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedStatefulTargetObject.java?p2=ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedStatefulTargetObject.java&p1=ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java&r1=1536612&r2=1537896&rev=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedStatefulTargetObject.java Fri Nov  1 10:59:28 2013
@@ -19,29 +19,18 @@
 package org.apache.ace.webui.domain;
 
 import org.apache.ace.client.repository.RepositoryObject;
-import org.apache.ace.client.repository.object.TargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.webui.NamedObject;
 
-public class NamedTargetObject implements NamedObject {
-    private final RepositoryObject m_target;
+public class NamedStatefulTargetObject implements NamedObject {
+    private final StatefulTargetObject m_target;
 
-    public NamedTargetObject(StatefulTargetObject target) {
-        m_target = target;
-    }
-
-    public NamedTargetObject(TargetObject target) {
+    public NamedStatefulTargetObject(StatefulTargetObject target) {
         m_target = target;
     }
 
     public String getName() {
-        if (m_target instanceof StatefulTargetObject) {
-            return ((StatefulTargetObject) m_target).getID();
-        }
-        else if (m_target instanceof TargetObject) {
-            return ((TargetObject) m_target).getID();
-        }
-        return null;
+        return m_target.getID();
     }
 
     public String getDescription() {
@@ -59,4 +48,4 @@ public class NamedTargetObject implement
     public String getDefinition() {
         return m_target.getDefinition();
     }
-}
\ No newline at end of file
+}

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/domain/NamedTargetObject.java Fri Nov  1 10:59:28 2013
@@ -20,28 +20,17 @@ package org.apache.ace.webui.domain;
 
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.object.TargetObject;
-import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.webui.NamedObject;
 
 public class NamedTargetObject implements NamedObject {
-    private final RepositoryObject m_target;
-
-    public NamedTargetObject(StatefulTargetObject target) {
-        m_target = target;
-    }
+    private final TargetObject m_target;
 
     public NamedTargetObject(TargetObject target) {
         m_target = target;
     }
 
     public String getName() {
-        if (m_target instanceof StatefulTargetObject) {
-            return ((StatefulTargetObject) m_target).getID();
-        }
-        else if (m_target instanceof TargetObject) {
-            return ((TargetObject) m_target).getID();
-        }
-        return null;
+        return m_target.getID();
     }
 
     public String getDescription() {
@@ -59,4 +48,4 @@ public class NamedTargetObject implement
     public String getDefinition() {
         return m_target.getDefinition();
     }
-}
\ No newline at end of file
+}

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java Fri Nov  1 10:59:28 2013
@@ -24,7 +24,6 @@ import java.util.Properties;
 import javax.servlet.Servlet;
 
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
-import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
 import org.apache.felix.dm.DependencyActivatorBase;
 import org.apache.felix.dm.DependencyManager;
@@ -71,9 +70,8 @@ public class Activator extends Dependenc
                 public Component create(Map<String, Object> context) {
                     VerticalLayout vl = new VerticalLayout();
                     vl.setCaption("Info");
-                    final NamedObject namedObject = (NamedObject) context.get("object");
-                    final StatefulTargetObject target = (StatefulTargetObject) namedObject.getObject();
-                    Label info = new Label("Target ID          : " + namedObject.getName() + "\n" +
+                    final StatefulTargetObject target = (StatefulTargetObject) context.get("statefulTarget");
+                    Label info = new Label("Target ID          : " + target.getID() + "\n" +
                         "Installed version  : " + (target.getLastInstallVersion() == null ? "(none)" : target.getLastInstallVersion()) + "\n" +
                         "Available version  : " + target.getCurrentVersion() + "\n" +
                         "Approval state     : " + target.getApprovalState() + "\n" +

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AddArtifactWindow.java Fri Nov  1 10:59:28 2013
@@ -93,8 +93,8 @@ abstract class AddArtifactWindow extends
         m_artifactsTable.addContainerProperty(PROPERTY_VERSION, String.class, null);
         m_artifactsTable.addContainerProperty(PROPERTY_PURGE, Button.class, null);
         m_artifactsTable.setSizeFull();
-        m_artifactsTable.setSelectable(false);
-        m_artifactsTable.setMultiSelect(false);
+        m_artifactsTable.setSelectable(true);
+        m_artifactsTable.setMultiSelect(true);
         m_artifactsTable.setImmediate(true);
         m_artifactsTable.setHeight("15em");
 

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AssociationManager.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AssociationManager.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AssociationManager.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AssociationManager.java Fri Nov  1 10:59:28 2013
@@ -20,23 +20,31 @@
 package org.apache.ace.webui.vaadin;
 
 import org.apache.ace.client.repository.object.Artifact2FeatureAssociation;
-import org.apache.ace.client.repository.object.ArtifactObject;
 import org.apache.ace.client.repository.object.Distribution2TargetAssociation;
-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.stateful.StatefulTargetObject;
 
 /**
  * Defines methods for removing associations.
  */
 public interface AssociationManager {
 
-    void createArtifact2FeatureAssociation(ArtifactObject artifact, FeatureObject feature);
+    /**
+     * @param artifactId
+     * @param featureId
+     */
+    Artifact2FeatureAssociation createArtifact2FeatureAssociation(String artifactId, String featureId);
 
-    void createDistribution2TargetAssociation(DistributionObject distribution, StatefulTargetObject target);
+    /**
+     * @param distributionId
+     * @param targetId
+     */
+    Distribution2TargetAssociation createDistribution2TargetAssociation(String distributionId, String targetId);
 
-    void createFeature2DistributionAssociation(FeatureObject feature, DistributionObject distribution);
+    /**
+     * @param featureId
+     * @param distributionId
+     */
+    Feature2DistributionAssociation createFeature2DistributionAssociation(String featureId, String distributionId);
 
     /**
      * @param association

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/EditWindow.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/EditWindow.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/EditWindow.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/EditWindow.java Fri Nov  1 10:59:28 2013
@@ -110,6 +110,7 @@ public abstract class EditWindow extends
 
         Map<String, Object> context = new HashMap<String, Object>();
         context.put("object", object);
+        populateContext(context);
 
         for (UIExtensionFactory factory : factories) {
             try {
@@ -159,6 +160,10 @@ public abstract class EditWindow extends
         // layout; you can use either. Alignments are set using the layout
         layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);
     }
+    
+    protected Map<String, Object> populateContext(Map<String, Object> context) {
+        return context;
+    }
 
     /**
      * Called when the user acknowledges this window by pressing Ok.

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=1537896&r1=1537895&r2=1537896&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 Fri Nov  1 10:59:28 2013
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -52,11 +53,14 @@ import org.apache.ace.client.repository.
 import org.apache.ace.client.repository.repository.DistributionRepository;
 import org.apache.ace.client.repository.repository.Feature2DistributionAssociationRepository;
 import org.apache.ace.client.repository.repository.FeatureRepository;
+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.connectionfactory.ConnectionFactory;
 import org.apache.ace.webui.NamedObject;
 import org.apache.ace.webui.UIExtensionFactory;
+import org.apache.ace.webui.domain.NamedStatefulTargetObject;
+import org.apache.ace.webui.domain.NamedTargetObject;
 import org.apache.ace.webui.vaadin.LoginWindow.LoginFunction;
 import org.apache.ace.webui.vaadin.UploadHelper.ArtifactDropHandler;
 import org.apache.ace.webui.vaadin.UploadHelper.GenericUploadHandler;
@@ -71,6 +75,9 @@ import org.apache.ace.webui.vaadin.compo
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.event.EventConstants;
 import org.osgi.service.event.EventHandler;
 import org.osgi.service.log.LogService;
@@ -81,13 +88,10 @@ import org.osgi.service.useradmin.UserAd
 import com.vaadin.service.ApplicationContext;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.DragAndDropWrapper;
 import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.ProgressIndicator;
-import com.vaadin.ui.Table;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Window.Notification;
 
@@ -143,6 +147,7 @@ public class VaadinClient extends com.va
     private volatile FeatureRepository m_featureRepository;
     private volatile DistributionRepository m_distributionRepository;
     private volatile StatefulTargetRepository m_statefulTargetRepository;
+    private volatile TargetRepository m_targetRepository;
     private volatile Artifact2FeatureAssociationRepository m_artifact2featureAssociationRepository;
     private volatile Feature2DistributionAssociationRepository m_feature2distributionAssociationRepository;
     private volatile Distribution2TargetAssociationRepository m_distribution2targetAssociationRepository;
@@ -159,9 +164,8 @@ public class VaadinClient extends com.va
     private TargetsPanel m_targetsPanel;
     private GridLayout m_grid;
     private StatusLine m_statusLine;
-    private boolean m_dynamicRelations = true;
     private File m_sessionDir; // private folder for session info
-    private HorizontalLayout m_artifactToolbar;
+    private Button m_artifactToolbar;
     private Button m_featureToolbar;
     private Button m_distributionToolbar;
     private Button m_targetToolbar;
@@ -228,34 +232,64 @@ public class VaadinClient extends com.va
     }
 
     @Override
-    public void createArtifact2FeatureAssociation(ArtifactObject artifact, FeatureObject feature) {
-        // if you drop on a resource processor, and try to get it, you
-        // will get null because you cannot associate anything with a
-        // resource processor so we check for null here
+    public Artifact2FeatureAssociation createArtifact2FeatureAssociation(String artifactId, String featureId) {
+        boolean dynamicRelation = false;
+
+        FeatureObject feature = m_featureRepository.get(featureId);
+        ArtifactObject artifact = m_artifactRepository.get(artifactId);
+        if (artifact == null) {
+            // Maybe a BSN?
+            try {
+                List<ArtifactObject> artifacts = m_artifactRepository.get(FrameworkUtil.createFilter(String.format("(%s=%s)", Constants.BUNDLE_SYMBOLICNAME, artifactId)));
+                if (artifacts != null && artifacts.size() > 0) {
+                    dynamicRelation = true;
+                    // we only need this artifact for creating the association, so it does not matter which one we
+                    // take...
+                    artifact = artifacts.get(0);
+                }
+            }
+            catch (InvalidSyntaxException exception) {
+                m_log.log(LogService.LOG_ERROR, "Invalid filter syntax?!", exception);
+            }
+        }
+
+        // Make sure we didn't drop on a resource processor bundle...
+        if (artifact != null && artifact.getAttribute(BundleHelper.KEY_RESOURCE_PROCESSOR_PID) != null) {
+            // if you drop on a resource processor, and try to get it, you
+            // will get null because you cannot associate anything with a
+            // resource processor so we check for null here
+            return null;
+        }
+
+        Artifact2FeatureAssociation result = null;
         if (artifact != null) {
-            if (m_dynamicRelations) {
-                Map<String, String> properties = new HashMap<String, String>();
-                properties.put(BundleHelper.KEY_ASSOCIATION_VERSIONSTATEMENT, "0.0.0");
-                m_artifact2featureAssociationRepository.create(artifact, properties, feature, null);
+            if (dynamicRelation) {
+                Map<String, String> properties = Collections.singletonMap(BundleHelper.KEY_ASSOCIATION_VERSIONSTATEMENT, "0.0.0");
+                result = m_artifact2featureAssociationRepository.create(artifact, properties, feature, null);
             }
             else {
-                m_artifact2featureAssociationRepository.create(artifact, feature);
+                result = m_artifact2featureAssociationRepository.create(artifact, feature);
             }
         }
+        return result;
     }
 
     @Override
-    public void createDistribution2TargetAssociation(DistributionObject distribution, StatefulTargetObject target) {
+    public Distribution2TargetAssociation createDistribution2TargetAssociation(String distributionId, String targetId) {
+        DistributionObject distribution = m_distributionRepository.get(distributionId);
+        StatefulTargetObject target = m_statefulTargetRepository.get(targetId);
         if (!target.isRegistered()) {
             target.register();
             target.setAutoApprove(true);
         }
-        m_distribution2targetAssociationRepository.create(distribution, target.getTargetObject());
+        return m_distribution2targetAssociationRepository.create(distribution, target.getTargetObject());
     }
 
     @Override
-    public void createFeature2DistributionAssociation(FeatureObject feature, DistributionObject distribution) {
-        m_feature2distributionAssociationRepository.create(feature, distribution);
+    public Feature2DistributionAssociation createFeature2DistributionAssociation(String featureId, String distributionId) {
+        FeatureObject feature = m_featureRepository.get(featureId);
+        DistributionObject distribution = m_distributionRepository.get(distributionId);
+        return m_feature2distributionAssociationRepository.create(feature, distribution);
     }
 
     public void destroyDependencies() {
@@ -296,9 +330,8 @@ public class VaadinClient extends com.va
      * {@inheritDoc}
      */
     public boolean login(String username, String password) {
-        User user = m_authenticationService.authenticate(username, password);
-        setUser(user);
-        return login(user);
+        setUser(m_authenticationService.authenticate(username, password));
+        return doLogin();
     }
 
     /**
@@ -335,6 +368,7 @@ public class VaadinClient extends com.va
         addSessionDependency(component, Artifact2FeatureAssociationRepository.class);
         addSessionDependency(component, Feature2DistributionAssociationRepository.class);
         addSessionDependency(component, Distribution2TargetAssociationRepository.class);
+        addSessionDependency(component, TargetRepository.class);
         addSessionDependency(component, StatefulTargetRepository.class);
         addDependency(component, ConnectionFactory.class);
     }
@@ -493,7 +527,7 @@ public class VaadinClient extends com.va
      *            Main Window
      * @return Button
      */
-    private Button createAddArtifactButton(User user) {
+    private Button createAddArtifactButton() {
         Button button = new Button("Add artifact...");
         button.addListener(new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
@@ -511,7 +545,7 @@ public class VaadinClient extends com.va
      * 
      * @return the add-distribution button instance.
      */
-    private Button createAddDistributionButton(User user) {
+    private Button createAddDistributionButton() {
         Button button = new Button("Add Distribution...");
         button.addListener(new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
@@ -540,7 +574,7 @@ public class VaadinClient extends com.va
      * 
      * @return the add-feature button instance.
      */
-    private Button createAddFeatureButton(User user) {
+    private Button createAddFeatureButton() {
         Button button = new Button("Add Feature...");
         button.addListener(new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
@@ -568,7 +602,7 @@ public class VaadinClient extends com.va
      * 
      * @return the add-target button instance.
      */
-    private Button createAddTargetButton(User user) {
+    private Button createAddTargetButton() {
         Button button = new Button("Add target...");
         button.addListener(new Button.ClickListener() {
             public void buttonClick(ClickEvent event) {
@@ -597,7 +631,7 @@ public class VaadinClient extends com.va
         return button;
     }
 
-    private ArtifactsPanel createArtifactsPanel(User user) {
+    private ArtifactsPanel createArtifactsPanel() {
         return new ArtifactsPanel(m_associations, this) {
             @Override
             protected EditWindow createEditor(final NamedObject object, final List<UIExtensionFactory> extensions) {
@@ -627,7 +661,7 @@ public class VaadinClient extends com.va
         };
     }
 
-    private DistributionsPanel createDistributionsPanel(User user) {
+    private DistributionsPanel createDistributionsPanel() {
         return new DistributionsPanel(m_associations, this) {
             @Override
             protected EditWindow createEditor(final NamedObject object, final List<UIExtensionFactory> extensions) {
@@ -657,7 +691,7 @@ public class VaadinClient extends com.va
         };
     }
 
-    private FeaturesPanel createFeaturesPanel(User user) {
+    private FeaturesPanel createFeaturesPanel() {
         return new FeaturesPanel(m_associations, this) {
             @Override
             protected EditWindow createEditor(final NamedObject object, final List<UIExtensionFactory> extensions) {
@@ -687,7 +721,7 @@ public class VaadinClient extends com.va
         };
     }
 
-    private TargetsPanel createTargetsPanel(User user) {
+    private TargetsPanel createTargetsPanel() {
         return new TargetsPanel(m_associations, this) {
             @Override
             protected EditWindow createEditor(final NamedObject object, final List<UIExtensionFactory> extensions) {
@@ -711,25 +745,39 @@ public class VaadinClient extends com.va
                     protected void onOk(String name, String description) throws Exception {
                         // Nothing to edit!
                     }
+
+                    @Override
+                    protected Map<String, Object> populateContext(Map<String, Object> context) {
+                        if (object instanceof NamedTargetObject) {
+                            context.put("statefulTarget", m_statefulTargetRepository.get(object.getDefinition()));
+                        }
+                        else if (object instanceof NamedStatefulTargetObject) {
+                            context.put("statefulTarget", object.getObject());
+                        }
+                        return context;
+                    }
                 };
             }
 
             @Override
-            protected StatefulTargetRepository getRepository() {
-                return m_statefulTargetRepository;
+            protected TargetRepository getRepository() {
+                return m_targetRepository;
             }
 
             @Override
             protected RepositoryAdmin getRepositoryAdmin() {
                 return m_admin;
             }
+
+            @Override
+            protected StatefulTargetRepository getStatefulTargetRepository() {
+                return m_statefulTargetRepository;
+            }
         };
     }
 
-    private GridLayout createToolbar(User user) {
-        final boolean showLogoutButton = m_useAuth;
-        final DependencyManager manager = m_manager;
-        MainActionToolbar mainActionToolbar = new MainActionToolbar(user, manager, showLogoutButton) {
+    private GridLayout createToolbar() {
+        return new MainActionToolbar(m_useAuth) {
             @Override
             protected void doAfterCommit() throws IOException {
                 updateTableData();
@@ -769,10 +817,55 @@ public class VaadinClient extends com.va
                 m_targetsPanel.populate();
             }
         };
-        return mainActionToolbar;
     }
 
-    private void initGrid(User user) {
+    /**
+     * Authenticates the given user by creating all dependent services.
+     * 
+     * @param user
+     * @throws IOException
+     *             in case of I/O problems.
+     */
+    private boolean doLogin() {
+        try {
+            RepositoryAdminLoginContext context = m_admin.createLoginContext((User) getUser());
+
+            // @formatter:off
+            context
+                .add(context.createShopRepositoryContext()
+                    .setLocation(m_repository).setCustomer(customerName).setName(shopRepo).setWriteable())
+                .add(context.createTargetRepositoryContext()
+                    .setLocation(m_repository).setCustomer(customerName).setName(targetRepo).setWriteable())
+                .add(context.createDeploymentRepositoryContext()
+                    .setLocation(m_repository).setCustomer(customerName).setName(deployRepo).setWriteable());
+            // @formatter:on
+
+            m_admin.login(context);
+            initGrid();
+            m_admin.checkout();
+
+            return true;
+        }
+        catch (Exception e) {
+            m_log.log(LogService.LOG_WARNING, "Login failed! Destroying session...", e);
+
+            try {
+                // Avoid errors when the user tries to login again (due to the stale session)...
+                m_admin.logout(true /* force */);
+            }
+            catch (IllegalStateException inner) {
+                // Ignore; probably we're not logged...
+            }
+            catch (IOException inner) {
+                m_log.log(LogService.LOG_WARNING, "Logout failed! Session possibly not destroyed...", inner);
+            }
+
+            return false;
+        }
+    }
+
+    private void initGrid() {
+        User user = (User) getUser();
         Authorization auth = m_userAdmin.getAuthorization(user);
         int count = 0;
         for (String role : new String[] { "viewArtifact", "viewFeature", "viewDistribution", "viewTarget" }) {
@@ -780,14 +873,6 @@ public class VaadinClient extends com.va
                 count++;
             }
         }
-        m_grid = new GridLayout(count, 4);
-        m_grid.setSpacing(true);
-        m_grid.setSizeFull();
-
-        m_mainToolbar = createToolbar(user);
-        m_grid.addComponent(m_mainToolbar, 0, 0, count - 1, 0);
-
-        m_artifactsPanel = createArtifactsPanel(user);
 
         final GenericUploadHandler uploadHandler = new GenericUploadHandler(m_sessionDir) {
             @Override
@@ -899,33 +984,30 @@ public class VaadinClient extends com.va
             }
         };
 
-        final DragAndDropWrapper finalUploadedArtifacts = new DragAndDropWrapper(m_artifactsPanel);
-        finalUploadedArtifacts.setCaption(m_artifactsPanel.getCaption());
-        finalUploadedArtifacts.setSizeFull();
-        finalUploadedArtifacts.setDropHandler(new ArtifactDropHandler(uploadHandler));
-
-        m_artifactToolbar = new HorizontalLayout();
-        m_artifactToolbar.addComponent(createAddArtifactButton(user));
-
-        CheckBox dynamicCheckBox = new CheckBox("Dynamic Links");
-        dynamicCheckBox.setImmediate(true);
-        dynamicCheckBox.setValue(Boolean.TRUE);
-        dynamicCheckBox.addListener(new Button.ClickListener() {
-            public void buttonClick(ClickEvent event) {
-                m_dynamicRelations = event.getButton().booleanValue();
-            }
-        });
-        m_artifactToolbar.addComponent(dynamicCheckBox);
+        m_grid = new GridLayout(count, 4);
+        m_grid.setSpacing(true);
+        m_grid.setSizeFull();
+
+        m_mainToolbar = createToolbar();
+        m_grid.addComponent(m_mainToolbar, 0, 0, count - 1, 0);
+
+        m_artifactsPanel = createArtifactsPanel();
+        m_artifactToolbar = createAddArtifactButton();
+
+        final DragAndDropWrapper artifactsPanelWrapper = new DragAndDropWrapper(m_artifactsPanel);
+        artifactsPanelWrapper.setDropHandler(new ArtifactDropHandler(uploadHandler));
+        artifactsPanelWrapper.setCaption(m_artifactsPanel.getCaption());
+        artifactsPanelWrapper.setSizeFull();
 
         count = 0;
         if (auth.hasRole("viewArtifact")) {
-            m_grid.addComponent(finalUploadedArtifacts, count, 2);
+            m_grid.addComponent(artifactsPanelWrapper, count, 2);
             m_grid.addComponent(m_artifactToolbar, count, 1);
             count++;
         }
 
-        m_featuresPanel = createFeaturesPanel(user);
-        m_featureToolbar = createAddFeatureButton(user);
+        m_featuresPanel = createFeaturesPanel();
+        m_featureToolbar = createAddFeatureButton();
 
         if (auth.hasRole("viewFeature")) {
             m_grid.addComponent(m_featuresPanel, count, 2);
@@ -933,8 +1015,8 @@ public class VaadinClient extends com.va
             count++;
         }
 
-        m_distributionsPanel = createDistributionsPanel(user);
-        m_distributionToolbar = createAddDistributionButton(user);
+        m_distributionsPanel = createDistributionsPanel();
+        m_distributionToolbar = createAddDistributionButton();
 
         if (auth.hasRole("viewDistribution")) {
             m_grid.addComponent(m_distributionsPanel, count, 2);
@@ -942,22 +1024,14 @@ public class VaadinClient extends com.va
             count++;
         }
 
-        m_targetsPanel = createTargetsPanel(user);
-        m_targetToolbar = createAddTargetButton(user);
+        m_targetsPanel = createTargetsPanel();
+        m_targetToolbar = createAddTargetButton();
 
         if (auth.hasRole("viewTarget")) {
             m_grid.addComponent(m_targetsPanel, count, 2);
             m_grid.addComponent(m_targetToolbar, count, 1);
         }
 
-        // Wire up all panels so they have the correct associations...
-        m_artifactsPanel.setAssociatedTables(null, m_featuresPanel);
-        m_featuresPanel.setAssociatedTables(m_artifactsPanel, m_distributionsPanel);
-        m_distributionsPanel.setAssociatedTables(m_featuresPanel, m_targetsPanel);
-        m_targetsPanel.setAssociatedTables(m_distributionsPanel, null);
-
-        m_grid.setRowExpandRatio(2, 1.0f);
-
         m_statusLine = new StatusLine();
 
         m_grid.addComponent(m_statusLine, 0, 3, 2, 3);
@@ -969,19 +1043,18 @@ public class VaadinClient extends com.va
 
         m_grid.addComponent(m_progress, 3, 3);
 
-        m_artifactsPanel.addListener(m_associations.createSelectionListener(m_artifactsPanel, m_artifactRepository,
-            new Class[] {}, new Class[] { FeatureObject.class, DistributionObject.class, TargetObject.class },
-            new Table[] { m_featuresPanel, m_distributionsPanel, m_targetsPanel }));
-        m_featuresPanel.addListener(m_associations.createSelectionListener(m_featuresPanel, m_featureRepository,
-            new Class[] { ArtifactObject.class }, new Class[] { DistributionObject.class, TargetObject.class },
-            new Table[] { m_artifactsPanel, m_distributionsPanel, m_targetsPanel }));
-        m_distributionsPanel.addListener(m_associations.createSelectionListener(m_distributionsPanel,
-            m_distributionRepository,
-            new Class[] { FeatureObject.class, ArtifactObject.class }, new Class[] { TargetObject.class },
-            new Table[] { m_artifactsPanel, m_featuresPanel, m_targetsPanel }));
-        m_targetsPanel.addListener(m_associations.createSelectionListener(m_targetsPanel, m_statefulTargetRepository,
-            new Class[] { DistributionObject.class, FeatureObject.class, ArtifactObject.class }, new Class[] {},
-            new Table[] { m_artifactsPanel, m_featuresPanel, m_distributionsPanel }));
+        m_grid.setRowExpandRatio(2, 1.0f);
+
+        m_grid.setColumnExpandRatio(0, 0.31f);
+        m_grid.setColumnExpandRatio(1, 0.23f);
+        m_grid.setColumnExpandRatio(2, 0.23f);
+        m_grid.setColumnExpandRatio(3, 0.23f);
+
+        // Wire up all panels so they have the correct associations...
+        m_artifactsPanel.setAssociatedTables(null, m_featuresPanel);
+        m_featuresPanel.setAssociatedTables(m_artifactsPanel, m_distributionsPanel);
+        m_distributionsPanel.setAssociatedTables(m_featuresPanel, m_targetsPanel);
+        m_targetsPanel.setAssociatedTables(m_distributionsPanel, null);
 
         addListener(m_statusLine, RepositoryObject.PUBLIC_TOPIC_ROOT.concat(RepositoryObject.TOPIC_ALL_SUFFIX));
         addListener(m_mainToolbar, RepositoryAdmin.TOPIC_STATUSCHANGED, RepositoryAdmin.TOPIC_LOGIN, RepositoryAdmin.TOPIC_REFRESH);
@@ -994,57 +1067,11 @@ public class VaadinClient extends com.va
     }
 
     /**
-     * Authenticates the given user by creating all dependent services.
-     * 
-     * @param user
-     * @throws IOException
-     *             in case of I/O problems.
-     */
-    private boolean login(final User user) {
-        try {
-            RepositoryAdminLoginContext context = m_admin.createLoginContext(user);
-
-            // @formatter:off
-            context
-                .add(context.createShopRepositoryContext()
-                    .setLocation(m_repository).setCustomer(customerName).setName(shopRepo).setWriteable())
-                .add(context.createTargetRepositoryContext()
-                    .setLocation(m_repository).setCustomer(customerName).setName(targetRepo).setWriteable())
-                .add(context.createDeploymentRepositoryContext()
-                    .setLocation(m_repository).setCustomer(customerName).setName(deployRepo).setWriteable());
-            // @formatter:on
-
-            m_admin.login(context);
-            initGrid(user);
-            m_admin.checkout();
-
-            return true;
-        }
-        catch (Exception e) {
-            m_log.log(LogService.LOG_WARNING, "Login failed! Destroying session...", e);
-
-            try {
-                // Avoid errors when the user tries to login again (due to the stale session)...
-                m_admin.logout(true /* force */);
-            }
-            catch (IllegalStateException inner) {
-                // Ignore; probably we're not logged...
-            }
-            catch (IOException inner) {
-                m_log.log(LogService.LOG_WARNING, "Logout failed! Session possibly not destroyed...", inner);
-            }
-
-            return false;
-        }
-    }
-
-    /**
      * @return <code>true</code> if the login succeeded, <code>false</code> otherwise.
      */
     private boolean loginAutomatically() {
-        User user = m_userAdmin.getUser("username", m_userName);
-        setUser(user);
-        return login(user);
+        setUser(m_userAdmin.getUser("username", m_userName));
+        return doLogin();
     }
 
     private void showAddArtifactDialog() {

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/ArtifactsPanel.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/ArtifactsPanel.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/ArtifactsPanel.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/ArtifactsPanel.java Fri Nov  1 10:59:28 2013
@@ -37,7 +37,6 @@ import com.vaadin.data.Item;
  * Provides an object panel for displaying artifacts.
  */
 public abstract class ArtifactsPanel extends BaseObjectPanel<ArtifactObject, ArtifactRepository, RepositoryObject, FeatureObject> {
-
     /**
      * Creates a new {@link ArtifactsPanel} instance.
      * 
@@ -47,13 +46,19 @@ public abstract class ArtifactsPanel ext
      *            the helper for creating/removing associations.
      */
     public ArtifactsPanel(AssociationHelper associations, AssociationManager associationMgr) {
-        super(associations, associationMgr, "Artifact", UIExtensionFactory.EXTENSION_POINT_VALUE_ARTIFACT, true);
+        super(associations, associationMgr, "Artifact", UIExtensionFactory.EXTENSION_POINT_VALUE_ARTIFACT, true, ArtifactObject.class);
     }
 
     @Override
-    protected boolean doCreateRightSideAssociation(ArtifactObject artifact, FeatureObject feature) {
-        m_associationManager.createArtifact2FeatureAssociation(artifact, feature);
-        return true;
+    protected void defineTableColumns() {
+        super.defineTableColumns();
+        
+        setColumnCollapsed(OBJECT_DESCRIPTION, true);
+    }
+
+    @Override
+    protected Artifact2FeatureAssociation doCreateRightSideAssociation(String artifactId, String featureId) {
+        return m_associationManager.createArtifact2FeatureAssociation(artifactId, featureId);
     }
 
     @Override
@@ -67,31 +72,20 @@ public abstract class ArtifactsPanel ext
 
     @Override
     protected String getDisplayName(ArtifactObject artifact) {
-        String bv = artifact.getAttribute(Constants.BUNDLE_VERSION);
-        if (bv != null) {
-            return bv;
+        String bsn = artifact.getAttribute(Constants.BUNDLE_SYMBOLICNAME);
+        if (bsn != null) {
+            return getVersion(artifact);
         }
         return artifact.getName();
     }
 
     @Override
     protected String getParentDisplayName(ArtifactObject artifact) {
-        String bn = artifact.getAttribute(Constants.BUNDLE_NAME);
-        if (bn != null) {
-            return bn;
-        }
-        String name = artifact.getName();
-        int idx = name.lastIndexOf('-');
-        if (idx > 0) {
-            name = name.substring(0, idx);
-        }
-        else {
-            idx = name.lastIndexOf('.');
-            if (idx > 0) {
-                name = name.substring(0, idx);
-            }
+        String bsn = artifact.getAttribute(Constants.BUNDLE_SYMBOLICNAME);
+        if (bsn != null) {
+            return bsn;
         }
-        return name;
+        return artifact.getName();
     }
 
     @Override
@@ -100,7 +94,6 @@ public abstract class ArtifactsPanel ext
         if (bsn != null) {
             return bsn;
         }
-        // return getParentDisplayName(artifact);
         return null;
     }
 
@@ -130,6 +123,14 @@ public abstract class ArtifactsPanel ext
         item.getItemProperty(ACTION_DELETE).setValue(new RemoveItemButton(artifact));
     }
 
+    private String getVersion(ArtifactObject artifact) {
+        String bv = artifact.getAttribute(Constants.BUNDLE_VERSION);
+        if (bv != null) {
+            return bv;
+        }
+        return "";
+    }
+
     /**
      * Returns whether or not the given artifact is actually a resource processor.
      * 

Modified: ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/AssociationHelper.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/AssociationHelper.java?rev=1537896&r1=1537895&r2=1537896&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/AssociationHelper.java (original)
+++ ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/component/AssociationHelper.java Fri Nov  1 10:59:28 2013
@@ -18,33 +18,24 @@
  */
 package org.apache.ace.webui.vaadin.component;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.ace.client.repository.ObjectRepository;
-import org.apache.ace.client.repository.RepositoryObject;
-import org.apache.ace.client.repository.stateful.StatefulTargetObject;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.ui.Button;
 import com.vaadin.ui.Table;
-import com.vaadin.ui.Table.CellStyleGenerator;
 
 public class AssociationHelper {
-    private List<RepositoryObject> m_associatedItems = new ArrayList<RepositoryObject>();
-    private List<RepositoryObject> m_relatedItems = new ArrayList<RepositoryObject>();
+    private Set<String> m_associatedItems = new HashSet<String>();
+    private Set<String> m_relatedItems = new HashSet<String>();
     private Table m_activeTable;
-    private Set<?> m_activeSelection;
-    private SelectionListener m_activeSelectionListener;
 
-    public void addAssociatedItem(RepositoryObject item) {
-        m_associatedItems.add(item);
+    public void addAssociated(Collection<String> associated) {
+        m_associatedItems.addAll(associated);
     }
-    
-    public void removeAssociatedItem(RepositoryObject item) {
-        m_associatedItems.remove(item);
+
+    public void addRelated(Collection<String> related) {
+        m_relatedItems.addAll(related);
     }
 
     public void clear() {
@@ -52,191 +43,38 @@ public class AssociationHelper {
         m_relatedItems.clear();
     }
 
-    public boolean isActiveTable(Table table) {
-        return (m_activeTable != null) ? m_activeTable.equals(table) : false;
-    }
-
     public Set<?> getActiveSelection() {
-        return m_activeSelection;
+        return (m_activeTable != null) ? (Set<?>) m_activeTable.getValue() : Collections.emptySet();
     }
 
-    public RepositoryObject lookupInActiveSelection(Object item) {
-        if (m_activeSelectionListener == null) {
-            return null;
-        }
-        return m_activeSelectionListener.lookup(item);
+    public boolean isActiveTable(Table table) {
+        return (m_activeTable != null) ? m_activeTable.equals(table) : false;
     }
 
-    public CellStyleGenerator createCellStyleGenerator(final BaseObjectPanel parent) {
-        return new CellStyleGenerator() {
-            public String getStyle(Object itemId, Object propertyId) {
-                Item item = parent.getItem(itemId);
-
-                if (propertyId == null) {
-                    // no propertyId, styling row
-                    for (RepositoryObject o : m_associatedItems) {
-                        if (equals(itemId, o)) {
-                            return "associated";
-                        }
-                    }
-                    for (RepositoryObject o : m_relatedItems) {
-                        if (equals(itemId, o)) {
-                            return "related";
-                        }
-                    }
-
-                    parent.updateItemIcon(itemId);
-                }
-                else if (BaseObjectPanel.OBJECT_DESCRIPTION.equals(propertyId)) {
-                    return "description";
-                }
-                else if (BaseObjectPanel.ACTION_UNLINK.equals(propertyId)) {
-                    Button unlinkButton = (Button) item.getItemProperty(propertyId).getValue();
-
-                    boolean enabled = false;
-                    for (RepositoryObject o : m_associatedItems) {
-                        if (equals(itemId, o)) {
-                            enabled = true;
-                        }
-                    }
-
-                    if (unlinkButton != null) {
-                        unlinkButton.setEnabled(enabled);
-                    }
-                }
-                return null;
-            }
-
-            private boolean equals(Object itemId, RepositoryObject object) {
-                if (object == null) {
-                    return false;
-                }
-                else {
-                    String definition = object.getDefinition();
-                    return definition == null ? false : definition.equals(itemId);
-                }
-            }
-        };
+    public boolean isAssociated(Object definition) {
+        return m_associatedItems.contains(definition);
     }
 
-    public SelectionListener createSelectionListener(Table table, ObjectRepository<? extends RepositoryObject> repository, Class[] left, Class[] right, Table[] tablesToRefresh) {
-        return new SelectionListener(table, repository, left, right, tablesToRefresh);
+    public boolean isRelated(Object definition) {
+        return m_relatedItems.contains(definition);
     }
 
-    /**
-     * Helper method to find all related {@link RepositoryObject}s in a given 'direction'
-     */
-    private <FROM extends RepositoryObject, TO extends RepositoryObject> List<TO> getRelated(FROM from,
-        Class<TO> toClass) {
-        // if the SGO is not backed by a GO yet, this will cause an exception
-        return from.getAssociations(toClass);
-    }
-
-    /**
-     * Helper method to find all related {@link RepositoryObject}s in a given 'direction', starting with a list of
-     * objects
-     */
-    private <FROM extends RepositoryObject, TO extends RepositoryObject> List<TO> getRelated(List<FROM> from,
-        Class<TO> toClass) {
-        List<TO> result = new ArrayList<TO>();
-        for (RepositoryObject o : from) {
-            result.addAll(getRelated(o, toClass));
-        }
-        return result;
+    public void removeAssociatedItem(String definition) {
+        m_associatedItems.remove(definition);
     }
 
-    private class SelectionListener implements Table.ValueChangeListener {
-        private final Table m_table;
-        private final Table[] m_tablesToRefresh;
-        private final ObjectRepository<? extends RepositoryObject> m_repository;
-        private final Class[] m_left;
-        private final Class[] m_right;
-
-        public SelectionListener(final Table table, final ObjectRepository<? extends RepositoryObject> repository,
-            final Class[] left, final Class[] right, final Table[] tablesToRefresh) {
-            m_table = table;
-            m_repository = repository;
-            m_left = left;
-            m_right = right;
-            m_tablesToRefresh = tablesToRefresh;
-        }
-
-        @SuppressWarnings("unchecked")
-        public void valueChange(ValueChangeEvent event) {
-            if (m_activeSelection != null && m_activeTable != null) {
-                if (!m_activeTable.equals(m_table)) {
-                    for (Object val : m_activeSelection) {
-                        m_activeTable.unselect(val);
-                    }
-                    m_table.requestRepaint();
-                }
-            }
-
-            m_activeSelectionListener = SelectionListener.this;
-
-            // set the active table
-            m_activeTable = m_table;
-
-            // in multiselect mode, a Set of itemIds is returned,
-            // in singleselect mode the itemId is returned directly
-            Set<?> value = (Set<?>) event.getProperty().getValue();
-
-            // remember the active selection too
-            m_activeSelection = value;
-
-            if (value != null) {
-                clear();
-
-                for (Object val : value) {
-                    RepositoryObject lo = lookup(val);
-                    if (lo != null) {
-                        List related = null;
-                        for (int i = 0; i < m_left.length; i++) {
-                            if (i == 0) {
-                                related = getRelated(lo, m_left[i]);
-                                m_associatedItems.addAll(related);
-                            }
-                            else {
-                                related = getRelated(related, m_left[i]);
-                                m_relatedItems.addAll(related);
-                            }
-                        }
-                        for (int i = 0; i < m_right.length; i++) {
-                            if (i == 0) {
-                                related = getRelated(lo, m_right[i]);
-                                m_associatedItems.addAll(related);
-                            }
-                            else {
-                                related = getRelated(related, m_right[i]);
-                                m_relatedItems.addAll(related);
-                            }
-                        }
-                    }
-
-                    m_table.refreshRowCache();
-                    for (Table t : m_tablesToRefresh) {
-                        t.refreshRowCache();
-                    }
-                }
-            }
-        }
+    public void updateRelations(Set<String> associated, Set<String> related) {
+        m_associatedItems.addAll(associated);
+        m_relatedItems.addAll(related);
+    }
 
-        public RepositoryObject lookup(Object value) {
-            RepositoryObject object = null;
-            if (value instanceof String) {
-                object = m_repository.get((String) value);
-                if (object instanceof StatefulTargetObject) {
-                    StatefulTargetObject sgo = (StatefulTargetObject) object;
-                    if (sgo.isRegistered()) {
-                        object = sgo.getTargetObject();
-                    }
-                    else {
-                        object = null;
-                    }
-                }
+    public void updateActiveTable(Table source) {
+        if (m_activeTable != null) {
+            if (!m_activeTable.equals(source)) {
+                m_activeTable.setValue(Collections.emptySet());
             }
-            return object;
         }
-
+        m_activeTable = source;
+        m_activeTable.requestRepaint();
     }
 }



Mime
View raw message