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

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 21 11:25:39 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-04-21 11:25:39 -0400 (Tue, 21 Apr 2009)
New Revision: 4597

Modified:
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
Log:
Cleanup TabListener in ProcessEditor

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java	2009-04-21 15:16:18 UTC (rev 4596)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java	2009-04-21 15:25:39 UTC (rev 4597)
@@ -63,7 +63,20 @@
           {
             public boolean onBeforeTabSelected(SourcesTabEvents sourcesTabEvents, int i)
             {
-              return true;
+              boolean showTab = true;
+
+              if(i!=0)
+              {
+                DefinitionListView view = ((DefinitionListView) controller.getView(DefinitionListView.ID));
+                boolean hasSelection = view.getSelection() != null;
+                if(!hasSelection)
+                {
+                  MessageBox.alert("Missing selection", "Please select a process");
+                  showTab=false;
+                }
+              }
+
+              return showTab;
             }
 
             public void onTabSelected(SourcesTabEvents sourcesTabEvents, int i)
@@ -89,35 +102,7 @@
       addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
       addAction(StartNewInstanceAction.ID, new StartNewInstanceAction(appContext));
       addAction(StateChangeAction.ID, new StateChangeAction(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);
 

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java	2009-04-21 15:16:18 UTC (rev 4596)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java	2009-04-21 15:25:39 UTC (rev 4597)
@@ -21,9 +21,16 @@
  */
 package org.jboss.bpm.console.client.task;
 
+import com.google.gwt.user.client.ui.SourcesTabEvents;
+import com.google.gwt.user.client.ui.TabListener;
+import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
+import org.gwt.mosaic.ui.client.TabLayoutPanel;
+import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.jboss.bpm.console.client.ApplicationContext;
 import org.jboss.bpm.console.client.Editor;
 import org.jboss.bpm.console.client.MenuSection;
-import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.v2.LazyPanel;
 
 /**
  * @author Heiko.Braun <heiko.braun at jboss.com>
@@ -32,6 +39,8 @@
 {
   public final static String ID = TaskEditor.class.getName();
 
+  private TabLayoutPanel tabPanel;
+
   public TaskEditor(ApplicationContext appContext)
   {
     super(appContext);
@@ -39,7 +48,51 @@
 
   public void initialize()
   {
+    if(!isInitialized)
+    {
+      // create inner tab layout
+      tabPanel = new DecoratedTabLayoutPanel();
+      tabPanel.setPadding(5);
+      tabPanel.addTabListener(
+          new TabListener()
+          {
+            public boolean onBeforeTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+            {
+              return true;
+            }
 
+            public void onTabSelected(SourcesTabEvents sourcesTabEvents, int i)
+            {
+              LazyPanel lazyPanel = (LazyPanel) tabPanel.getWidget(i);
+              if(!lazyPanel.isInitialized())
+              {
+                lazyPanel.initialize();
+                refreshView(); // TODO: hack around rendering problems
+              }
+            }
+          }
+      );
+
+      this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
+
+      // create and register views
+      //addView(DefinitionListView.ID, new DefinitionListView());
+
+      // create and register actions
+      //addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
+
+      // display tab, needs to visible for correct rendering
+      tabPanel.selectTab(0);
+
+      // force loading
+      /*super.controller.handleEvent(
+          new Event(LoadDefinitionsAction.ID, null)
+      );*/
+
+      refreshView();
+
+      isInitialized = true;
+    }
   }
 
   public String getEditorId()
@@ -54,7 +107,7 @@
 
   public String getIconCSS()
   {
-    return "bpm-task-icon"; 
+    return "bpm-task-icon";
   }
 
   public MenuSection provideMenuSection()




More information about the jbpm-commits mailing list