ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1062307 - in /incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui: UIExtensionFactory.java vaadin/VaadinClient.java
Date Sun, 23 Jan 2011 01:34:18 GMT
Author: marrs
Date: Sun Jan 23 01:34:18 2011
New Revision: 1062307

URL: http://svn.apache.org/viewvc?rev=1062307&view=rev
Log:
Added extension points for items in each of the four columns, so you can add your own components
that work on these items.

Modified:
    incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/UIExtensionFactory.java
    incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java

Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/UIExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/UIExtensionFactory.java?rev=1062307&r1=1062306&r2=1062307&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/UIExtensionFactory.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/UIExtensionFactory.java
Sun Jan 23 01:34:18 2011
@@ -23,10 +23,15 @@ import java.util.Map;
 import com.vaadin.ui.Component;
 
 /**
- * Creates components for named extension points in the Vaadin UI.
+ * Creates components for named extension points in the Vaadin UI. Extension factories
+ * are used throughout the UI to allow other bundles to contribute features.
  */
 public interface UIExtensionFactory {
-    public static final String EXTENSION_POINT = "extension_point";
+    public static final String EXTENSION_POINT_KEY = "extension_point";
+    public static final Object EXTENSION_POINT_VALUE_ARTIFACT = "artifact";
+    public static final Object EXTENSION_POINT_VALUE_FEATURE = "feature";
+    public static final Object EXTENSION_POINT_VALUE_DISTRIBUTION = "distribution";
+    public static final Object EXTENSION_POINT_VALUE_TARGET = "target";
     
     /**
      * Creates a UI component for use in the extension point. The contents of the

Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java?rev=1062307&r1=1062306&r2=1062307&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/VaadinClient.java
Sun Jan 23 01:34:18 2011
@@ -517,7 +517,22 @@ public class VaadinClient extends com.va
             protected RepositoryObject getFromId(String id) {
                 return getArtifact(id);
             }
-            private void init() {
+            private void init(Component component) {
+                populate();
+                DependencyManager dm = component.getDependencyManager();
+                component.add(dm.createServiceDependency()
+                    .setInstanceBound(true)
+                    .setService(UIExtensionFactory.class, "(" + UIExtensionFactory.EXTENSION_POINT_KEY
+ "=" + UIExtensionFactory.EXTENSION_POINT_VALUE_ARTIFACT + ")")
+                    .setCallbacks("addExtension", "removeExtension")
+                );
+            }
+            private List<UIExtensionFactory> m_factories = new ArrayList<UIExtensionFactory>();
+            public void addExtension(UIExtensionFactory factory) {
+                m_factories.add(factory);
+                populate();
+            }
+            public void removeExtension(UIExtensionFactory factory) {
+                m_factories.remove(factory);
                 populate();
             }
             public void populate() {
@@ -572,6 +587,12 @@ public class VaadinClient extends com.va
                     buttons.addComponent(removeLinkButton);
                 }
                 buttons.addComponent(new RemoveItemButton<ArtifactObject, ArtifactRepository>(artifact,
m_artifactRepository));
+                Map<String, Object> context = new HashMap<String, Object>();
+                context.put("object", artifact);
+                for (UIExtensionFactory factory : m_factories) {
+                    com.vaadin.ui.Component component = factory.create(context);
+                    buttons.addComponent(component);
+                }
                 item.getItemProperty(ACTIONS).setValue(buttons);
 
             }
@@ -591,7 +612,22 @@ public class VaadinClient extends com.va
             protected RepositoryObject getFromId(String id) {
                 return getFeature(id);
             }
-            private void init() {
+            private void init(Component component) {
+                populate();
+                DependencyManager dm = component.getDependencyManager();
+                component.add(dm.createServiceDependency()
+                    .setInstanceBound(true)
+                    .setService(UIExtensionFactory.class, "(" + UIExtensionFactory.EXTENSION_POINT_KEY
+ "=" + UIExtensionFactory.EXTENSION_POINT_VALUE_FEATURE + ")")
+                    .setCallbacks("addExtension", "removeExtension")
+                );
+            }
+            private List<UIExtensionFactory> m_factories = new ArrayList<UIExtensionFactory>();
+            public void addExtension(UIExtensionFactory factory) {
+                m_factories.add(factory);
+                populate();
+            }
+            public void removeExtension(UIExtensionFactory factory) {
+                m_factories.remove(factory);
                 populate();
             }
             public void populate() {
@@ -644,6 +680,12 @@ public class VaadinClient extends com.va
                 HorizontalLayout buttons = new HorizontalLayout();
                 buttons.addComponent(removeLinkButton);
                 buttons.addComponent(new RemoveItemButton<GroupObject, GroupRepository>(feature,
m_featureRepository));
+                Map<String, Object> context = new HashMap<String, Object>();
+                context.put("object", feature);
+                for (UIExtensionFactory factory : m_factories) {
+                    com.vaadin.ui.Component component = factory.create(context);
+                    buttons.addComponent(component);
+                }
                 item.getItemProperty(ACTIONS).setValue(buttons);
             }
             private void change(GroupObject go) {
@@ -707,7 +749,22 @@ public class VaadinClient extends com.va
             protected RepositoryObject getFromId(String id) {
                 return getDistribution(id);
             }
-            private void init() {
+            private void init(Component component) {
+                populate();
+                DependencyManager dm = component.getDependencyManager();
+                component.add(dm.createServiceDependency()
+                    .setInstanceBound(true)
+                    .setService(UIExtensionFactory.class, "(" + UIExtensionFactory.EXTENSION_POINT_KEY
+ "=" + UIExtensionFactory.EXTENSION_POINT_VALUE_DISTRIBUTION + ")")
+                    .setCallbacks("addExtension", "removeExtension")
+                );
+            }
+            private List<UIExtensionFactory> m_factories = new ArrayList<UIExtensionFactory>();
+            public void addExtension(UIExtensionFactory factory) {
+                m_factories.add(factory);
+                populate();
+            }
+            public void removeExtension(UIExtensionFactory factory) {
+                m_factories.remove(factory);
                 populate();
             }
             public void populate() {
@@ -759,6 +816,12 @@ public class VaadinClient extends com.va
                 HorizontalLayout buttons = new HorizontalLayout();
                 buttons.addComponent(removeLinkButton);
                 buttons.addComponent(new RemoveItemButton<LicenseObject, LicenseRepository>(distribution,
m_distributionRepository));
+                Map<String, Object> context = new HashMap<String, Object>();
+                context.put("object", distribution);
+                for (UIExtensionFactory factory : m_factories) {
+                    com.vaadin.ui.Component component = factory.create(context);
+                    buttons.addComponent(component);
+                }
                 item.getItemProperty(ACTIONS).setValue(buttons);
             }
             private void change(LicenseObject distribution) {
@@ -782,7 +845,7 @@ public class VaadinClient extends com.va
                 DependencyManager dm = component.getDependencyManager();
                 component.add(dm.createServiceDependency()
                     .setInstanceBound(true)
-                    .setService(UIExtensionFactory.class)
+                    .setService(UIExtensionFactory.class, "(" + UIExtensionFactory.EXTENSION_POINT_KEY
+ "=" + UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET + ")")
                     .setCallbacks("addExtension", "removeExtension")
                 );
             }
@@ -817,7 +880,7 @@ public class VaadinClient extends com.va
             private void add(StatefulGatewayObject statefulTarget) {
                 Item item = addItem(statefulTarget.getID());
                 item.getItemProperty(OBJECT_NAME).setValue(statefulTarget.getID());
-                item.getItemProperty(OBJECT_DESCRIPTION).setValue("TODO");
+                item.getItemProperty(OBJECT_DESCRIPTION).setValue("");
                 Button removeLinkButton = new RemoveLinkButton<StatefulGatewayObject>(statefulTarget,
m_distributionsPanel, null) {
                     @Override
                     protected void removeLinkFromLeft(StatefulGatewayObject object, RepositoryObject
other) {
@@ -848,7 +911,7 @@ public class VaadinClient extends com.va
             }
             private void change(StatefulGatewayObject statefulTarget) {
                 Item item = getItem(statefulTarget.getID());
-                item.getItemProperty(OBJECT_DESCRIPTION).setValue("TODO");
+                item.getItemProperty(OBJECT_DESCRIPTION).setValue("");
             }
             private void remove(StatefulGatewayObject statefulTarget) {
                 removeItem(statefulTarget.getID());



Mime
View raw message