incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1068677 - in /incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin: Activator.java Associations.java NamedTargetObject.java VaadinClient.java
Date Tue, 08 Feb 2011 23:17:48 GMT
Author: marrs
Date: Tue Feb  8 23:17:47 2011
New Revision: 1068677

URL: http://svn.apache.org/viewvc?rev=1068677&view=rev
Log:
Refactoring the dialogs that appear when double clicking on an item in a table. Target now
has an extension mechanism for those dialogs. Needs more work.

Modified:
    incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Activator.java
    incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
    incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/NamedTargetObject.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/vaadin/Activator.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Activator.java?rev=1068677&r1=1068676&r2=1068677&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Activator.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Activator.java
Tue Feb  8 23:17:47 2011
@@ -34,6 +34,8 @@ import org.osgi.service.http.HttpService
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
 
 public class Activator extends DependencyActivatorBase {
     @Override
@@ -69,18 +71,20 @@ public class Activator extends Dependenc
         
         // shows off components that are contributed by extensions
         manager.add(createComponent()
-            .setInterface(UIExtensionFactory.class.getName(), null)
+            .setInterface(UIExtensionFactory.class.getName(), new Properties() {{ put(UIExtensionFactory.EXTENSION_POINT_KEY,
UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET); }})
             .setImplementation(new UIExtensionFactory() {
                 public Component create(Map<String, Object> context) {
-                    final StatefulGatewayObject target = (StatefulGatewayObject) context.get("object");
-                    Button button = new Button("i", new Button.ClickListener() {
+                    final NamedObject object = (NamedObject) context.get("object");
+                    VerticalLayout vl = new VerticalLayout();
+                    vl.setCaption("Info");
+                    Button button = new Button("info", new Button.ClickListener() {
                         public void buttonClick(ClickEvent event) {
-                            event.getButton().getWindow().showNotification(
-                                target.getID(), "Available version: " + target.getCurrentVersion()
+ ", installed version: " + target.getLastInstallVersion());
+                            event.getButton().getWindow().showNotification(object.getName(),
"Description: " + object.getName());
                         }
                     });
-                    button.setStyleName("small");
-                    return button;
+                    vl.addComponent(new Label("Hit the button to see a message pop up!"));
+                    vl.addComponent(button);
+                    return vl;
                 }
             })
         );

Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java?rev=1068677&r1=1068676&r2=1068677&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/Associations.java
Tue Feb  8 23:17:47 2011
@@ -90,8 +90,8 @@ public class Associations {
     	else if (object instanceof LicenseObject) {
     		return new NamedDistributionObject((LicenseObject) object);
     	}
-    	else if (object instanceof GatewayObject) {
-    		return new NamedTargetObject((GatewayObject) object);
+    	else if (object instanceof StatefulGatewayObject) {
+    		return new NamedTargetObject((StatefulGatewayObject) object);
     	}
     	return null;
     }

Modified: incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/NamedTargetObject.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/NamedTargetObject.java?rev=1068677&r1=1068676&r2=1068677&view=diff
==============================================================================
--- incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/NamedTargetObject.java
(original)
+++ incubator/ace/trunk/ace-webui-vaadin/src/main/java/org/apache/ace/webui/vaadin/NamedTargetObject.java
Tue Feb  8 23:17:47 2011
@@ -1,11 +1,11 @@
 package org.apache.ace.webui.vaadin;
 
-import org.apache.ace.client.repository.object.GatewayObject;
+import org.apache.ace.client.repository.stateful.StatefulGatewayObject;
 
 class NamedTargetObject implements NamedObject {
-    private final GatewayObject m_target;
+    private final StatefulGatewayObject m_target;
 
-    public NamedTargetObject(GatewayObject target) {
+    public NamedTargetObject(StatefulGatewayObject target) {
         m_target = target;
     }
 

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=1068677&r1=1068676&r2=1068677&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
Tue Feb  8 23:17:47 2011
@@ -93,7 +93,9 @@ import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.GridLayout;
 import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
 import com.vaadin.ui.ProgressIndicator;
+import com.vaadin.ui.TabSheet;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.Table.TableTransferable;
 import com.vaadin.ui.TextField;
@@ -598,6 +600,61 @@ public class VaadinClient extends com.va
             private void remove(ArtifactObject artifact) {
                 removeItem(artifact.getName());
             }
+			@Override
+			public void showEditWindow(String objectName, final NamedObject object, Window main) {
+		        final Window featureWindow = new Window();
+		        featureWindow.setModal(true);
+		        featureWindow.setCaption("Edit " + objectName);
+		        featureWindow.setWidth("15em");
+
+		        // Configure the windws layout; by default a VerticalLayout
+		        VerticalLayout layout = (VerticalLayout) featureWindow.getContent();
+		        layout.setMargin(true);
+		        layout.setSpacing(true);
+
+		        final TextField name = new TextField("name");
+		        final TextField description = new TextField("description");
+
+		        name.setValue(object.getName());
+		        description.setValue(object.getDescription());
+
+		        layout.addComponent(name);
+		        layout.addComponent(description);
+		        
+		        TabSheet tabs = new TabSheet();
+		        VerticalLayout tab1 = new VerticalLayout();
+		        tab1.setCaption("Demo 1");
+		        VerticalLayout tab2 = new VerticalLayout();
+		        tab2.setCaption("Demo 2");
+		        tabs.addTab(tab1);
+		        tabs.addTab(tab2);
+		        layout.addComponent(tabs);
+
+		        Button close = new Button("Ok", new Button.ClickListener() {
+		            // inline click-listener
+		            public void buttonClick(ClickEvent event) {
+		                // close the window by removing it from the parent window
+		                (featureWindow.getParent()).removeWindow(featureWindow);
+		                // create the feature
+		                object.setDescription((String) description.getValue());
+		            }
+		        });
+		        // The components added to the window are actually added to the window's
+		        // layout; you can use either. Alignments are set using the layout
+		        layout.addComponent(close);
+		        layout.setComponentAlignment(close, "right");
+
+		        if (featureWindow.getParent() != null) {
+		            // window is already showing
+		            main.getWindow().showNotification("Window is already open");
+		        } else {
+		            // Open the subwindow by adding it to the parent
+		            // window
+		            main.getWindow().addWindow(featureWindow);
+		        }
+		        name.setReadOnly(true);
+		        description.focus();
+		    }
         };
     }
 
@@ -690,8 +747,62 @@ public class VaadinClient extends com.va
             private void remove(GroupObject go) {
                 removeItem(go.getName());
             }
-        };
-        
+			@Override
+			public void showEditWindow(String objectName, final NamedObject object, Window main) {
+		        final Window featureWindow = new Window();
+		        featureWindow.setModal(true);
+		        featureWindow.setCaption("Edit " + objectName);
+		        featureWindow.setWidth("15em");
+
+		        // Configure the windws layout; by default a VerticalLayout
+		        VerticalLayout layout = (VerticalLayout) featureWindow.getContent();
+		        layout.setMargin(true);
+		        layout.setSpacing(true);
+
+		        final TextField name = new TextField("name");
+		        final TextField description = new TextField("description");
+
+		        name.setValue(object.getName());
+		        description.setValue(object.getDescription());
+
+		        layout.addComponent(name);
+		        layout.addComponent(description);
+		        
+		        TabSheet tabs = new TabSheet();
+		        VerticalLayout tab1 = new VerticalLayout();
+		        tab1.setCaption("Demo 1");
+		        VerticalLayout tab2 = new VerticalLayout();
+		        tab2.setCaption("Demo 2");
+		        tabs.addTab(tab1);
+		        tabs.addTab(tab2);
+		        layout.addComponent(tabs);
+
+		        Button close = new Button("Ok", new Button.ClickListener() {
+		            // inline click-listener
+		            public void buttonClick(ClickEvent event) {
+		                // close the window by removing it from the parent window
+		                (featureWindow.getParent()).removeWindow(featureWindow);
+		                // create the feature
+		                object.setDescription((String) description.getValue());
+		            }
+		        });
+		        // The components added to the window are actually added to the window's
+		        // layout; you can use either. Alignments are set using the layout
+		        layout.addComponent(close);
+		        layout.setComponentAlignment(close, "right");
+
+		        if (featureWindow.getParent() != null) {
+		            // window is already showing
+		            main.getWindow().showNotification("Window is already open");
+		        } else {
+		            // Open the subwindow by adding it to the parent
+		            // window
+		            main.getWindow().addWindow(featureWindow);
+		        }
+		        name.setReadOnly(true);
+		        description.focus();
+		    }
+         };
     }
 
     public abstract class RemoveLinkButton<REPO_OBJECT extends RepositoryObject> extends
Button {
@@ -826,11 +937,66 @@ public class VaadinClient extends com.va
             private void remove(LicenseObject distribution) {
                 removeItem(distribution.getName());
             }
+			@Override
+			public void showEditWindow(String objectName, final NamedObject object, Window main) {
+		        final Window featureWindow = new Window();
+		        featureWindow.setModal(true);
+		        featureWindow.setCaption("Edit " + objectName);
+		        featureWindow.setWidth("15em");
+
+		        // Configure the windws layout; by default a VerticalLayout
+		        VerticalLayout layout = (VerticalLayout) featureWindow.getContent();
+		        layout.setMargin(true);
+		        layout.setSpacing(true);
+
+		        final TextField name = new TextField("name");
+		        final TextField description = new TextField("description");
+
+		        name.setValue(object.getName());
+		        description.setValue(object.getDescription());
+
+		        layout.addComponent(name);
+		        layout.addComponent(description);
+		        
+		        TabSheet tabs = new TabSheet();
+		        VerticalLayout tab1 = new VerticalLayout();
+		        tab1.setCaption("Demo 1");
+		        VerticalLayout tab2 = new VerticalLayout();
+		        tab2.setCaption("Demo 2");
+		        tabs.addTab(tab1);
+		        tabs.addTab(tab2);
+		        layout.addComponent(tabs);
+
+		        Button close = new Button("Ok", new Button.ClickListener() {
+		            // inline click-listener
+		            public void buttonClick(ClickEvent event) {
+		                // close the window by removing it from the parent window
+		                (featureWindow.getParent()).removeWindow(featureWindow);
+		                // create the feature
+		                object.setDescription((String) description.getValue());
+		            }
+		        });
+		        // The components added to the window are actually added to the window's
+		        // layout; you can use either. Alignments are set using the layout
+		        layout.addComponent(close);
+		        layout.setComponentAlignment(close, "right");
+
+		        if (featureWindow.getParent() != null) {
+		            // window is already showing
+		            main.getWindow().showNotification("Window is already open");
+		        } else {
+		            // Open the subwindow by adding it to the parent
+		            // window
+		            main.getWindow().addWindow(featureWindow);
+		        }
+		        name.setReadOnly(true);
+		        description.focus();
+		    }
         };
     }
 
     private ObjectPanel createTargetsPanel(Window main) {
-        return new ObjectPanel(m_associations, "Target", main, false, false) {
+        return new ObjectPanel(m_associations, "Target", main, true, false) {
             @Override
             protected RepositoryObject getFromId(String id) {
                 return getTarget(id);
@@ -896,12 +1062,6 @@ public class VaadinClient extends com.va
                 buttons.addComponent(removeLinkButton);
                 // next line commented out because removing stateful targets currently is
not possible
                 //buttons.addComponent(new RemoveItemButton<StatefulGatewayObject, StatefulGatewayRepository>(statefulTarget,
m_statefulTargetRepository));
-                Map<String, Object> context = new HashMap<String, Object>();
-                context.put("object", statefulTarget);
-                for (UIExtensionFactory factory : m_factories) {
-                    com.vaadin.ui.Component component = factory.create(context);
-                    buttons.addComponent(component);
-                }
                 item.getItemProperty(ACTIONS).setValue(buttons);
             }
             private void change(StatefulGatewayObject statefulTarget) {
@@ -911,6 +1071,71 @@ public class VaadinClient extends com.va
             private void remove(StatefulGatewayObject statefulTarget) {
                 removeItem(statefulTarget.getID());
             }
+			@Override
+			public void showEditWindow(String objectName, final NamedObject object, Window main) {
+				System.out.println("NO: " + object);
+		        final Window featureWindow = new Window();
+		        featureWindow.setModal(true);
+		        featureWindow.setCaption("Edit " + objectName + ": " + object.getName());
+		        featureWindow.setWidth("50em");
+
+		        // Configure the windws layout; by default a VerticalLayout
+		        VerticalLayout layout = (VerticalLayout) featureWindow.getContent();
+		        layout.setMargin(true);
+		        layout.setSpacing(true);
+
+//		        final TextField name = new TextField("name");
+//		        final TextField description = new TextField("description");
+//
+//		        name.setValue(object.getName());
+//		        description.setValue(object.getDescription());
+//
+//		        layout.addComponent(name);
+//		        layout.addComponent(description);
+		        
+		        TabSheet tabs = new TabSheet();
+		        tabs.setHeight("12em");
+                Map<String, Object> context = new HashMap<String, Object>();
+                context.put("object", object);
+                for (UIExtensionFactory factory : m_factories) {
+                    com.vaadin.ui.Component component = factory.create(context);
+                    tabs.addTab(component);
+                }
+		        VerticalLayout tab1 = new VerticalLayout();
+		        tab1.setCaption("Demo 1");
+		        tab1.addComponent(new Label("This is a hardcoded demo tab."));
+		        VerticalLayout tab2 = new VerticalLayout();
+		        tab2.setCaption("Demo 2");
+		        tab2.addComponent(new Label("This one is too, you cannot remove it for now."));
+		        tabs.addTab(tab1);
+		        tabs.addTab(tab2);
+		        layout.addComponent(tabs);
+
+		        Button close = new Button("Ok", new Button.ClickListener() {
+		            // inline click-listener
+		            public void buttonClick(ClickEvent event) {
+		                // close the window by removing it from the parent window
+		                (featureWindow.getParent()).removeWindow(featureWindow);
+		                // create the feature
+//		                object.setDescription((String) description.getValue());
+		            }
+		        });
+		        // The components added to the window are actually added to the window's
+		        // layout; you can use either. Alignments are set using the layout
+		        layout.addComponent(close);
+		        layout.setComponentAlignment(close, "right");
+
+		        if (featureWindow.getParent() != null) {
+		            // window is already showing
+		            main.getWindow().showNotification("Window is already open");
+		        } else {
+		            // Open the subwindow by adding it to the parent
+		            // window
+		            main.getWindow().addWindow(featureWindow);
+		        }
+//		        name.setReadOnly(true);
+//		        description.focus();
+		    }
         };
     }
 
@@ -978,53 +1203,6 @@ public class VaadinClient extends com.va
         protected abstract void associateFromRight(String left, String right);
     }
 
-    private static void showEditWindow(String objectName, final NamedObject object, Window
main) {
-        final Window featureWindow = new Window();
-        featureWindow.setModal(true);
-        featureWindow.setCaption("Edit " + objectName);
-        featureWindow.setWidth("15em");
-
-        // Configure the windws layout; by default a VerticalLayout
-        VerticalLayout layout = (VerticalLayout) featureWindow.getContent();
-        layout.setMargin(true);
-        layout.setSpacing(true);
-
-        final TextField name = new TextField("name");
-        final TextField description = new TextField("description");
-
-        name.setValue(object.getName());
-        description.setValue(object.getDescription());
-
-        layout.addComponent(name);
-        layout.addComponent(description);
-
-        Button close = new Button("Ok", new Button.ClickListener() {
-            // inline click-listener
-            public void buttonClick(ClickEvent event) {
-                // close the window by removing it from the parent window
-                (featureWindow.getParent()).removeWindow(featureWindow);
-                // create the feature
-                object.setDescription((String) description.getValue());
-            }
-        });
-        // The components added to the window are actually added to the window's
-        // layout; you can use either. Alignments are set using the layout
-        layout.addComponent(close);
-        layout.setComponentAlignment(close, "right");
-
-        if (featureWindow.getParent() != null) {
-            // window is already showing
-            main.getWindow().showNotification(
-                    "Window is already open");
-        } else {
-            // Open the subwindow by adding it to the parent
-            // window
-            main.getWindow().addWindow(featureWindow);
-        }
-        name.setReadOnly(true);
-        description.focus();
-    }
-
     private Button createAddFeatureButton(final Window main) {
         Button button = new Button("Add Feature...");
         button.addListener(new Button.ClickListener() {
@@ -1200,8 +1378,12 @@ public class VaadinClient extends com.va
                     public void itemClick(ItemClickEvent event) {
                         if (event.isDoubleClick()) {
                             String itemId = (String) event.getItemId();
+                            System.out.println("IID: " + itemId);
                             RepositoryObject object = getFromId(itemId);
-                            showEditWindow(name, m_associations.getNamedObject(object), main);
+                            System.out.println("ROB: " + object);
+                            NamedObject namedObject = m_associations.getNamedObject(object);
+                            System.out.println("NOB: " + namedObject);
+							showEditWindow(name, namedObject, main);
                         }
                     }
                 });
@@ -1209,6 +1391,7 @@ public class VaadinClient extends com.va
         }
         public abstract void populate();
         protected abstract RepositoryObject getFromId(String id);
+        public abstract void showEditWindow(String name, NamedObject object, Window main);
     }
 
     private class AddArtifactWindow extends Window {



Mime
View raw message