[jbpm-commits] JBoss JBPM SVN: r4583 - in projects/gwt-console/branches/hbraun: war/src/main/java/org/jboss/bpm/console/client/v2/process and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Apr 20 09:11:35 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-04-20 09:11:35 -0400 (Mon, 20 Apr 2009)
New Revision: 4583

Modified:
   projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
Log:
Load instances upon row selection

Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java	2009-04-20 13:09:19 UTC (rev 4582)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java	2009-04-20 13:11:35 UTC (rev 4583)
@@ -28,5 +28,8 @@
 {
   boolean isInitialized();
 
+  /**
+   * Expected to be an idempotent implementation
+   */
   void initialize();
 }

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java	2009-04-20 13:09:19 UTC (rev 4582)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/DefinitionListView.java	2009-04-20 13:11:35 UTC (rev 4583)
@@ -23,6 +23,7 @@
 
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ChangeListener;
 import com.mvc4g.client.Controller;
 import com.mvc4g.client.Event;
 import com.mvc4g.client.ViewInterface;
@@ -72,7 +73,7 @@
     {
 
       System.out.println("init DefinitionListView");
-      
+
       definitionList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
       definitionList.setPadding(0);
       definitionList.setWidgetSpacing(0);
@@ -106,6 +107,23 @@
         }
       });
 
+      listBox.addChangeListener(new ChangeListener()
+      {
+        public void onChange(Widget widget)
+        {
+          int index = listBox.getSelectedIndex();
+          if(index!=-1)
+          {
+            controller.handleEvent(
+                new Event(
+                    LoadInstancesAction.ID,
+                    listBox.getItem( index )
+                )
+            );
+          }
+        }
+      });
+
       final DefaultListModel<ProcessDefinitionRef> model =
           (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
 
@@ -128,28 +146,7 @@
           }
           )
       );
-
-      toolBar.addSeparator();
-
-      toolBar.add(
-          new ToolButton("View Instances", new ClickListener() {
-            public void onClick(Widget sender) {
-              int index = listBox.getSelectedIndex();
-              if(index==-1)
-                MessageBox.alert("Missing selection", "Please select a process");
-              else
-                controller.handleEvent(
-                    new Event(
-                        LoadInstancesAction.ID,
-                        listBox.getItem( listBox.getSelectedIndex())
-                    )
-                );
-            }
-          }
-          )
-      );
-
-
+      
       toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
 
       this.definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
@@ -171,7 +168,7 @@
   {
     // lazy init
     initialize();
-    
+
     final DefaultListModel<ProcessDefinitionRef> model =
         (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
 
@@ -182,4 +179,12 @@
       model.add(def);
     }
   }
+
+  public ProcessDefinitionRef getSelection()
+  {
+    ProcessDefinitionRef selection = null;
+    if(isInitialized() && listBox.getSelectedIndex()!=-1)
+      selection = listBox.getItem( listBox.getSelectedIndex());
+    return selection;
+  }
 }

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java	2009-04-20 13:09:19 UTC (rev 4582)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java	2009-04-20 13:11:35 UTC (rev 4583)
@@ -21,18 +21,17 @@
  */
 package org.jboss.bpm.console.client.v2.process;
 
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+import com.google.gwt.user.client.ui.TabListener;
 import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.TabListener;
-import com.google.gwt.user.client.ui.SourcesTabEvents;
-import com.google.gwt.user.client.Window;
 import com.mvc4g.client.ActionInterface;
 import com.mvc4g.client.Event;
 import com.mvc4g.client.ViewInterface;
 import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
+import org.gwt.mosaic.ui.client.MessageBox;
 import org.gwt.mosaic.ui.client.TabLayoutPanel;
 import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
 import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
 import org.jboss.bpm.console.client.ApplicationContext;
 import org.jboss.bpm.console.client.Editor;
 import org.jboss.bpm.console.client.MenuSection;
@@ -48,7 +47,7 @@
 
   public ProcessEditor(ApplicationContext appContext)
   {
-    super(appContext);    
+    super(appContext);
   }
 
   public void initialize()
@@ -57,7 +56,7 @@
     {
       // create inner tab layout
       tabPanel = new DecoratedTabLayoutPanel();
-      tabPanel.setPadding(5);     
+      tabPanel.setPadding(5);
       this.add(tabPanel, new BorderLayoutData(Region.CENTER));
 
       // create and register views
@@ -68,6 +67,34 @@
       addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
       addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
 
+      // tab Listener
+      tabPanel.addTabListener(
+          new TabListener()
+          {
+
+            public boolean onBeforeTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+            {
+
+              if(i==0) return true; // definition tab
+
+              DefinitionListView view = ((DefinitionListView) controller.getView(DefinitionListView.ID));
+              boolean hasSelection = view.getSelection() != null;
+              if(hasSelection)
+                return true;
+              else
+              {
+                MessageBox.alert("Missing selection", "Please select a process");
+                return false;
+              }
+            }
+
+            public void onTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+            {
+
+            }
+          }
+      );
+
       // display tab, needs to visible for correct rendering
       tabPanel.selectTab(0);
 




More information about the jbpm-commits mailing list