[jbpm-commits] JBoss JBPM SVN: r2890 - in projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client: task and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 12 05:17:14 EST 2008


Author: heiko.braun at jboss.com
Date: 2008-11-12 05:17:13 -0500 (Wed, 12 Nov 2008)
New Revision: 2890

Modified:
   projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
   projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
   projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
Log:
Fix row selection models in instance list and task list

Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java	2008-11-12 10:08:22 UTC (rev 2889)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java	2008-11-12 10:17:13 UTC (rev 2890)
@@ -29,6 +29,7 @@
 import com.gwtext.client.widgets.Button;
 import com.gwtext.client.widgets.PaddedPanel;
 import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.TabPanel;
 import com.gwtext.client.widgets.event.ButtonListenerAdapter;
 import com.gwtext.client.widgets.form.DateField;
 import com.gwtext.client.widgets.form.FieldSet;
@@ -38,6 +39,7 @@
 import com.gwtext.client.widgets.grid.event.RowSelectionListenerAdapter;
 import com.gwtext.client.widgets.layout.ColumnLayout;
 import com.gwtext.client.widgets.layout.ColumnLayoutData;
+import com.gwtext.client.widgets.layout.FormLayout;
 import org.jboss.bpm.console.client.Editor;
 import org.jboss.bpm.console.client.MainView;
 import org.jboss.bpm.console.client.UIConstants;
@@ -85,40 +87,65 @@
 
       // ---------------
 
+      TabPanel tabPanel = new TabPanel();
+      tabPanel.setPaddings(10);
+      tabPanel.setPlain(true);      
+      tabPanel.setActiveTab(0);
+      tabPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
+
+      PaddedPanel tabPadding = new PaddedPanel(tabPanel, 0,10,0,10);      
+
+      Panel detailsForm = assembleDetailsForm();
+
+      // ----------------------------------------
+
+      tabPanel.add(detailsForm);
+      tabPanel.add( new Panel("Advanced") );
+      // ----------------------------------
+      
+      HelpPanel help = new HelpPanel(UIConstants.TEASER_PANEL_WIDTH, 200, "Managing process instances");      
+
+      TeaserPanel teaserPanel = new TeaserPanel();
+      teaserPanel.add(help);
+
+      // ----------------------------------
+
+      leftHand.add(instanceList);
+      leftHand.add(tabPadding);
+      
+      this.add(leftHand, new ColumnLayoutData(0.7) );
+      this.add(teaserPanel , new ColumnLayoutData(0.3) );      
+
+   }
+
+   private Panel assembleDetailsForm()
+   {
+      // ---------------
+
       Panel outerFormPanel = new Panel();
+      outerFormPanel.setTitle("Instance Details");
       outerFormPanel.setBorder(false);
       outerFormPanel.setFrame(false);
-      outerFormPanel.setPaddings(10);
 
       // ---------------
 
-      final FormPanel formPanel = new FormPanel();
-      formPanel.setLabelAlign(Position.LEFT);
-      formPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
-      formPanel.setHeader(false);
-      formPanel.setFrame(false);
-      formPanel.setPaddings(5, 5, 5, 0);
-      formPanel.setLabelWidth(120);
+      final FormPanel detailsForm = new FormPanel();
+      detailsForm.setLabelAlign(Position.LEFT);
+      detailsForm.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
+      detailsForm.setHeader(false);
+      detailsForm.setFrame(false);
+      detailsForm.setBorder(false);
+      detailsForm.setPaddings(5, 5, 5, 0);
+      detailsForm.setLabelWidth(120);
 
       // ---------------
 
-      FieldSet fieldSet = new FieldSet();
-      fieldSet.setLabelWidth(90);
-      fieldSet.setTitle("Process Instance Details");
-      fieldSet.setAutoHeight(true);
-      fieldSet.setBorder(false);
+      detailsForm.add(new TextField("Id", "instanceId", 230));
+      detailsForm.add(new TextField("Key", "key", 230));
+      detailsForm.add(new TextField("State", "state", 230));
+      detailsForm.add(new DateField("Start Date", "startDate", 230));
+      detailsForm.add(new DateField("End Date", "endDate", 230));
 
-      // ---------------
-      //the field names must match the data field values from the Store
-      fieldSet.add(new TextField("Id", "instanceId", 230));
-      fieldSet.add(new TextField("Key", "key", 230));
-      fieldSet.add(new TextField("State", "state", 230));
-      fieldSet.add(new DateField("Start Date", "startDate", 230));
-      fieldSet.add(new DateField("End Date", "endDate", 230));
-      Panel inner = new PaddedPanel(fieldSet, 0, 10, 0, 0);
-
-      formPanel.add(inner);
-
       final Button suspendButton = new Button("Suspend",
         new ButtonListenerAdapter()
         {
@@ -128,9 +155,8 @@
               selectedInstance.setState(ProcessInstance.STATE.SUSPENDED);
               persistStateChange();
            }
-        }       
-      );                        
-      //suspendButton.setIcon("images/icons/pause.png");
+        }
+      );
 
       final Button resumeButton = new Button("Resume",
         new ButtonListenerAdapter()
@@ -143,11 +169,10 @@
            }
         }
       );
-      //resumeButton.setIcon("images/icons/play.png");
-      
-      formPanel.addButton(suspendButton);
-      formPanel.addButton(resumeButton);
 
+      detailsForm.addButton(suspendButton);
+      detailsForm.addButton(resumeButton);
+
       // ----------------
 
       final RowSelectionModel sm = new RowSelectionModel(true);
@@ -168,30 +193,15 @@
                  suspendButton.enable();
               }
 
-              formPanel.getForm().loadRecord(record);
-              formPanel.doLayout();
+              detailsForm.getForm().loadRecord(record);
+              detailsForm.doLayout();
            }
         }
       );
       instanceList.setRowSelectionModel(sm);
-      
-      outerFormPanel.add(formPanel);
 
-      // ----------------------------------
-      
-      HelpPanel help = new HelpPanel(UIConstants.TEASER_PANEL_WIDTH, 200, "Managing process instances");      
-
-      TeaserPanel teaserPanel = new TeaserPanel();
-      teaserPanel.add(help);
-
-      // ----------------------------------
-
-      leftHand.add(instanceList);
-      leftHand.add(outerFormPanel);
-      
-      this.add(leftHand, new ColumnLayoutData(0.7) );
-      this.add(teaserPanel , new ColumnLayoutData(0.3) );      
-
+      outerFormPanel.add(detailsForm);
+      return outerFormPanel;
    }
 
    private void persistStateChange()

Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java	2008-11-12 10:08:22 UTC (rev 2889)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java	2008-11-12 10:17:13 UTC (rev 2890)
@@ -34,6 +34,7 @@
 import com.gwtext.client.widgets.event.ButtonListenerAdapter;
 import com.gwtext.client.widgets.form.FormPanel;
 import com.gwtext.client.widgets.grid.*;
+import com.gwtext.client.widgets.grid.event.GridCellListener;
 import org.jboss.bpm.console.client.MainView;
 import org.jboss.bpm.console.client.UIConstants;
 import org.jboss.bpm.console.client.model.DTOParser;
@@ -56,7 +57,8 @@
    private String title;
    private RowSelectionModel rowSelectionModel;
    public static final int PAGE_SIZE = 15;
-
+   private int selectedRowIndex = -1;
+   
    public TaskList(String titleName, final MainView view)
    {
       this.mainView = view;
@@ -305,8 +307,12 @@
       {
          grid.setSelectionModel(rowSelectionModel);
          grid.doOnRender(new Function() {
-            public void execute() {
-               rowSelectionModel.selectFirstRow();
+            public void execute()
+            {
+               if(-1==selectedRowIndex)
+                  rowSelectionModel.selectFirstRow();
+               else
+                  rowSelectionModel.selectRow(selectedRowIndex);
             }
          }, 10);
       }
@@ -317,7 +323,7 @@
       grid.setEnableHdMenu(false);
 
       grid.setBottomToolbar(createToolbar(store));
-      
+
       return grid;
    }
 
@@ -327,7 +333,7 @@
       pagingToolbar.setPageSize(PAGE_SIZE);
       pagingToolbar.setDisplayInfo(true);
       pagingToolbar.setDisplayMsg("{0} - {1} of {2}");
-    
+
       pagingToolbar.addSeparator();
       pagingToolbar.addSpacer();
 
@@ -350,4 +356,23 @@
    {
       this.rowSelectionModel = model;
    }
+
+   public class ListViewCellListener implements GridCellListener
+   {
+      public void onCellClick(GridPanel grid, int rowIndex, int colindex, EventObject e)
+      {
+         selectedRowIndex = rowIndex;
+      }
+
+
+      public void onCellContextMenu(GridPanel gridPanel, int i, int i1, EventObject eventObject)
+      {
+
+      }
+
+      public void onCellDblClick(GridPanel gridPanel, int i, int i1, EventObject eventObject)
+      {
+
+      }
+   }
 }

Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java	2008-11-12 10:08:22 UTC (rev 2889)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java	2008-11-12 10:17:13 UTC (rev 2890)
@@ -22,6 +22,7 @@
 package org.jboss.bpm.console.client.widgets;
 
 import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.Function;
 import com.gwtext.client.data.*;
 import com.gwtext.client.data.event.StoreListenerAdapter;
 import com.gwtext.client.widgets.*;
@@ -124,6 +125,18 @@
       grid.stripeRows(true);
       grid.setLoadMask(true);
 
+      if(rowSelectionModel!=null)
+      {
+         grid.setSelectionModel(rowSelectionModel);
+         grid.doOnRender(new Function() {
+            public void execute() {
+               if(-1==selectedRowIndex)
+                  rowSelectionModel.selectFirstRow();
+               else
+                  rowSelectionModel.selectRow(selectedRowIndex);
+            }
+         }, 10);
+      }
       grid.addGridCellListener( new ListViewCellListener() );
 
       return grid;




More information about the jbpm-commits mailing list