[jbpm-commits] JBoss JBPM SVN: r1940 - in jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client: metric and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Aug 20 09:09:23 EDT 2008


Author: heiko.braun at jboss.com
Date: 2008-08-20 09:09:23 -0400 (Wed, 20 Aug 2008)
New Revision: 1940

Added:
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/InstanceMetricView.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/MainMenuPanel.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/TeaserPanel.java
Modified:
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/HelpDAO.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockHelpDAO.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BarChart.java
   jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/UIConstants.java
Log:
Begin metrics and stats views

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -30,6 +30,7 @@
 import com.gwtext.client.widgets.layout.BorderLayout;
 import com.gwtext.client.widgets.layout.BorderLayoutData;
 import com.gwtext.client.widgets.layout.FitLayout;
+import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
 import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
 import org.jboss.bpm.console.client.widgets.EditorView;
 import org.jboss.bpm.console.client.widgets.UIConstants;
@@ -81,6 +82,7 @@
       // ------------------------------------------
            
       editorPanel.addEditor( new ProcessDefinitionListEditor(this), false );
+      editorPanel.addEditor( new MetricOverviewEditor(this), false);
       
       // ------------------------------------------
 

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -69,11 +69,13 @@
    public boolean hasEditor(String id)
    {
       boolean b = false;
+      final String tabId = id +".tab";
+
       Component[] tabs = this.getItems();
       for(int i=0; i<tabs.length; i++)
       {
          Component tab = tabs[i];
-         if(tab.getId().equals(id))
+         if(tab.getId().equals(tabId))
          {
             b=true;
             break;
@@ -85,7 +87,8 @@
 
    public void showTab(String id)
    {
-      this.setActiveTab(id);   
+      final String tabId = id+".tab";
+      this.setActiveTab(tabId);   
    }
 
    class WrapperPanel extends Panel

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -21,10 +21,16 @@
  */
 package org.jboss.bpm.console.client;
 
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.data.Node;
 import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.AccordionLayout;
+import com.gwtext.client.widgets.tree.TreeNode;
 import com.gwtext.client.widgets.tree.TreePanel;
-import com.gwtext.client.widgets.tree.TreeNode;
-import com.gwtext.client.widgets.layout.AccordionLayout;
+import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
+import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
+import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
+import org.jboss.bpm.console.client.widgets.MainMenuPanel;
 
 /**
  * @author Heiko.Braun <heiko.braun at jboss.com>
@@ -45,33 +51,14 @@
       this.setWidth(200);
       this.setLayout(accordion);
 
-      Panel navPanel = new Panel();
-      navPanel.setTitle("Process Management");
-      navPanel.setBorder(false);
-      navPanel.setHideBorders(true);
-      navPanel.setIconCls("bpm-process-icon");
-      navPanel.add(new ProcessTree());
+      Panel navPanel = new MainMenuPanel("Process Management", "bpm-process-icon", new ProcessTree());      
+      Panel taskPanel = new MainMenuPanel("Task Management", "bpm-task-icon", null);
+      Panel metricPanel = new MainMenuPanel("Metrics and Stats", "bpm-metric-icon", new MetricTree());
+      Panel settingsPanel = new MainMenuPanel("Settings", "bpm-settings-icon", null);
+
       this.add(navPanel);
-
-      Panel taskPanel = new Panel();
-      taskPanel.setHtml("<p>Task Management</p>");
-      taskPanel.setTitle("Task Management");
-      taskPanel.setBorder(false);
-      taskPanel.setIconCls("bpm-task-icon");
       this.add(taskPanel);
-
-      Panel metricPanel = new Panel();
-      metricPanel.setHtml("<p>Metrics and Stats</p>");
-      metricPanel.setTitle("Metrics and Stats");
-      metricPanel.setBorder(false);
-      metricPanel.setIconCls("bpm-metric-icon");
       this.add(metricPanel);
-
-      Panel settingsPanel = new Panel();
-      settingsPanel.setHtml("<p>Settings</p>");
-      settingsPanel.setTitle("Settings");
-      settingsPanel.setBorder(false);
-      settingsPanel.setIconCls("bpm-settings-icon");
       this.add(settingsPanel);
    }
 
@@ -82,19 +69,71 @@
 
          TreeNode root = new TreeNode("Process Definitions");
 
-         TreeNode view = new TreeNode("View definitions");
-         view.setExpanded(true);
+         TreeNode definitions = new TreeNode("View definitions");
+         definitions.setExpanded(true);
+         definitions.addListener(
+            new TreeNodeListenerAdapter()
+           {
+              public void onClick(Node node, EventObject eventObject)
+              {
+                 if(view.hasEditorView(ProcessDefinitionListEditor.ID))
+                 {
+                    view.showEditor(ProcessDefinitionListEditor.ID);
+                 }
+                 else
+                 {
+                    view.addEditorView( new ProcessDefinitionListEditor(view) );
+                 }
+
+              }
+           }
+         );
          TreeNode upload = new TreeNode("Upload new definitions");
          upload.setExpanded(true);
 
-         root.appendChild(view);
+         root.appendChild(definitions);
          root.appendChild(upload);
 
+         setRootVisible(true);        
+         setRootNode(root);
+         root.setExpanded(true);
+      }
+   }
+
+   class MetricTree extends TreePanel
+   {
+
+      public MetricTree() {
+
+         TreeNode root = new TreeNode("Process Metrics");
+
+         TreeNode overview = new TreeNode("Process workload");
+         overview.setExpanded(true);
+         overview.addListener(
+           new TreeNodeListenerAdapter()
+           {
+              public void onClick(Node node, EventObject eventObject)
+              {
+                 if(view.hasEditorView(MetricOverviewEditor.ID))
+                 {
+                    view.showEditor(MetricOverviewEditor.ID);
+                 }
+                 else
+                 {
+                    view.addEditorView( new MetricOverviewEditor(view) );
+                 }
+
+              }
+           }
+         );
+
+         TreeNode export = new TreeNode("Export stats");
+         export.setExpanded(true);
+
+         root.appendChild(overview);
+         root.appendChild(export);
+         
          setRootVisible(true);
-
-         /*setTitle("Company");
-         setWidth(200);
-         setHeight(400);*/
          setRootNode(root);
          root.setExpanded(true);
       }

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.metric;
+
+import org.jboss.bpm.console.client.widgets.EditorView;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.ConsoleView;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DefinitionMetricEditor extends EditorView
+{
+
+   private ProcessDefinition parent;
+   private ConsoleView view;
+
+
+   public DefinitionMetricEditor(ConsoleView view, ProcessDefinition processDefinition)
+   {
+      super();
+      this.view = view;
+      this.parent = processDefinition;
+
+      this.setId(MetricOverviewEditor.ID+"."+processDefinition.getName());
+
+      // -----------------------------------------------
+   }
+
+   public String getEditorId()
+   {
+      return getId(); 
+   }
+
+   public String getTitle()
+   {
+      return parent.getName() + " metrics"; 
+   }
+
+   public String getIconCSS()
+   {
+      return "bpm-metric-icon"; 
+   }
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.metric;
+
+import com.gwtext.client.widgets.Panel;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.ConsoleView;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DefinitionMetricView extends Panel
+{
+   private ProcessDefinition parent;
+
+   private ConsoleView view;
+
+   public DefinitionMetricView(ConsoleView view, ProcessDefinition parent)
+   {
+      super();
+      this.view = view;
+      this.parent = parent;
+
+      this.setHeader(false);
+      this.setBorder(false);
+
+      
+   }
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/InstanceMetricView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/InstanceMetricView.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/InstanceMetricView.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.metric;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class InstanceMetricView
+{
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/InstanceMetricView.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.metric;
+
+import com.gwtext.client.data.Record;
+import com.gwtext.client.data.SimpleStore;
+import com.gwtext.client.data.Store;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.*;
+import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
+import com.gwtext.client.core.EventObject;
+import org.jboss.bpm.console.client.model.DAOFactory;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+import org.jboss.bpm.console.client.model.ProcessDefinitionDAO;
+import org.jboss.bpm.console.client.widgets.BarChart;
+import org.jboss.bpm.console.client.widgets.UIConstants;
+import org.jboss.bpm.console.client.ConsoleView;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class MetricOverview extends Panel
+{
+
+   private Map row2ProcessMap = new HashMap();
+   private final ConsoleView view;
+   private int currentSelection=-1;
+
+   public MetricOverview(final ConsoleView view)
+   {
+      super();
+      this.setHeader(false);
+      this.setBorder(false);
+
+      this.view = view;
+      // ----------------------------------
+
+      // stats
+      Map barValues = new HashMap();
+
+      barValues.put("Order Process", new Double(12.00));
+      barValues.put("VacationManagement", new Double(24.00));
+      barValues.put("New Employee walkthrough", new Double(5.00));
+      barValues.put("Source code review", new Double(8.00));
+      barValues.put("Loan application", new Double(54.00));
+      barValues.put("Expense report review", new Double(10.00));
+
+      BarChart chart = new BarChart(360,250, "Most used processes", "Process Name", barValues );
+      chart.setLegendVisible(false);
+      chart.setFontFamily("sans-serif");
+
+      Panel chartPanel = new Panel("Most active process definitions");
+      chartPanel.setPaddings(15);
+      chartPanel.setHeader(false);
+      chartPanel.setBorder(false);
+      chartPanel.setWidth(UIConstants.EDITOR_PANE_WIDTH);
+      chartPanel.add( chart );
+      
+      // -------------------------------
+
+      Panel panel = new Panel();
+      panel.setBorder(false);
+      panel.setPaddings(15);
+
+      final FormPanel formPanel = new FormPanel();
+      formPanel.setFrame(true);
+      formPanel.setTitle("Simple Form");
+
+      formPanel.setWidth(450);
+      formPanel.setLabelWidth(75);
+      //formPanel.setUrl("save-form.php");  
+
+      //create a Store using local array data
+      final Store store = new SimpleStore(
+        new String[]{"procId", "name", "version"}, getData()
+      );
+      store.load();
+
+      final ComboBox cb = new ComboBox();
+      cb.setForceSelection(true);
+      cb.setMinChars(1);
+      cb.setFieldLabel("Process");
+      cb.setStore(store);
+      cb.setDisplayField("name");
+      cb.setMode(ComboBox.LOCAL);
+      cb.setTriggerAction(ComboBox.ALL);
+      cb.setEmptyText("Enter name");
+      cb.setLoadingText("Searching...");
+      cb.setTypeAhead(true);
+      cb.setSelectOnFocus(true);
+      cb.setWidth(200);
+
+      cb.setHideTrigger(false);
+
+      cb.addListener(
+        new ComboBoxListenerAdapter()
+        {
+
+           public void onSelect(ComboBox comboBox, Record record, int i)
+           {
+              currentSelection = i;
+           }
+        }
+      );
+
+      // -------------------------------
+
+      ButtonListenerAdapter listener = new ButtonListenerAdapter()
+      {
+         public void onClick(Button button, EventObject e)
+         {
+            if(currentSelection!=-1)
+            {
+               ProcessDefinition def = (ProcessDefinition)row2ProcessMap.get(new Integer(currentSelection));
+
+               String editorId = MetricOverviewEditor.ID+"."+def.getName();
+               if(view.hasEditorView(editorId))
+               {
+                  view.showEditor(editorId);
+               }
+               else
+               {
+                  view.addEditorView(new DefinitionMetricEditor(view, def));
+               }
+            }
+            else
+            {
+               MessageBox.alert("Please select a process.");
+            }
+         }
+      };
+      Button button = new Button("View details", listener);
+
+      formPanel.add(cb);
+      formPanel.add(button);
+      
+      panel.add(formPanel);
+
+      this.add(chartPanel);
+      this.add(panel);
+      
+      // -------------------------------
+
+      // required after ext init
+      chart.update();
+   }
+   
+   protected Object[][] getData()
+   {
+      ProcessDefinitionDAO dao = DAOFactory.createProcessDefinitionDAO();
+      List processDefs = dao.getAllProcessDefinitions();
+
+      Object[][] records = new Object[processDefs.size()][];
+
+      Iterator it = processDefs.iterator();
+      int row = 0;
+      while(it.hasNext())
+      {
+         ProcessDefinition pd = (ProcessDefinition)it.next();
+         records[row] = new Object[3];
+         records[row][0] = new Long(pd.getId());
+         records[row][1] = pd.getName();
+         records[row][2] = pd.getVersion();
+
+         row2ProcessMap.put(new Integer(row), pd);
+
+         row++;
+      }
+
+      return records;
+   }
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.metric;
+
+import org.jboss.bpm.console.client.widgets.EditorView;
+import org.jboss.bpm.console.client.widgets.UIConstants;
+import org.jboss.bpm.console.client.widgets.HelpPanel;
+import org.jboss.bpm.console.client.widgets.TeaserPanel;
+import org.jboss.bpm.console.client.ConsoleView;
+import org.jboss.bpm.console.client.model.DAOFactory;
+import org.jboss.bpm.console.client.model.HelpDAO;
+import com.gwtext.client.widgets.layout.ColumnLayout;
+import com.gwtext.client.widgets.layout.ColumnLayoutData;
+import com.gwtext.client.widgets.Panel;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class MetricOverviewEditor extends EditorView
+{
+
+   private ConsoleView view;
+   private Panel teaserPanel;
+
+   public final static String ID = "org.jboss.bpm.metric.ProcessMetric";
+
+   public MetricOverviewEditor(ConsoleView view)
+   {
+      super();
+      this.view = view;
+      this.setId(ID);
+
+      // -------------------------------------
+
+      this.setLayout( new ColumnLayout() );
+      this.setWidth(UIConstants.EDITOR_PANE_WIDTH);
+
+      // -------------------------------------
+
+      HelpPanel help = new HelpPanel(200, 180, "Process workload explained");
+      help.setContent( DAOFactory.getHelpDAO().getHelpByReference(HelpDAO.REF_PROCESS_METRIC));
+
+      // -------------------------------------
+
+      teaserPanel = new TeaserPanel();
+      teaserPanel.add(help);
+
+      // -------------------------------------
+
+      MetricOverview usageView = new MetricOverview(view);
+
+      // -------------------------------------
+
+      this.add(usageView, new ColumnLayoutData(0.7) );
+      this.add(teaserPanel , new ColumnLayoutData(0.3) );
+
+   }
+
+   public String getEditorId()
+   {
+      return ID;
+   }
+
+   public String getTitle()
+   {
+      return "Metrics and Stats";
+   }
+
+   public String getIconCSS()
+   {
+      return "bpm-metric-icon";
+   }
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/HelpDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/HelpDAO.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/HelpDAO.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -27,6 +27,7 @@
 public interface HelpDAO
 {
    public final static int REF_PROCESS_DEFINITIONS = 100;
+   public final static int REF_PROCESS_METRIC = 200;
 
    String getHelpByReference(int ref);
 }

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockHelpDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockHelpDAO.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/MockHelpDAO.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -38,6 +38,12 @@
         "Process definitions are the base classs for any process instance. " +
         "They act as an execution template for BPM engine"
       );
+
+      ref2text.put(
+        new Integer(HelpDAO.REF_PROCESS_METRIC),
+        "The chart on the left displays the most used process definitions. " +
+          "Usage is defined by the number of instances that have been created for a particular definition."
+        );
    }
 
    public String getHelpByReference(int ref)

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -86,7 +86,7 @@
    protected void onExamine(final Integer row)
    {
       ProcessDefinition proc = (ProcessDefinition)row2ProcessMap.get(row);
-      String editorId = ProcessInstanceEditor.ID+"."+proc.getName()+".tab";
+      String editorId = ProcessInstanceEditor.ID+"."+proc.getName();
       
       if(view.hasEditorView(editorId))
          view.showEditor(editorId);

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -30,11 +30,10 @@
 import com.gwtext.client.core.EventObject;
 import com.google.gwt.user.client.ui.HTML;
 import org.jboss.bpm.console.client.ConsoleView;
+import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
 import org.jboss.bpm.console.client.model.DAOFactory;
 import org.jboss.bpm.console.client.model.HelpDAO;
-import org.jboss.bpm.console.client.widgets.EditorView;
-import org.jboss.bpm.console.client.widgets.PieChart;
-import org.jboss.bpm.console.client.widgets.HelpPanel;
+import org.jboss.bpm.console.client.widgets.*;
 
 import java.util.Map;
 import java.util.HashMap;
@@ -50,7 +49,9 @@
 
    private ConsoleView view;
 
-   public ProcessDefinitionListEditor(ConsoleView view)
+   private Panel teaserPanel;
+
+   public ProcessDefinitionListEditor(final ConsoleView view)
    {
       super();
       this.setId(ID);
@@ -58,35 +59,14 @@
       this.view = view;
 
       this.setLayout( new ColumnLayout() );
-      this.setWidth(680);      
+      this.setWidth(UIConstants.EDITOR_PANE_WIDTH);      
 
       // ----------------------------------
 
-      // stats
-      /*Map barValues = new HashMap();
-      
-      barValues.put("Order Process", new Double(12.00));
-      barValues.put("VacationManagement", new Double(24.00));
-      barValues.put("New Employee walkthrough", new Double(5.00));
-      barValues.put("Source code review", new Double(8.00));
-      barValues.put("Loan application", new Double(54.00));
-      barValues.put("Expense report review", new Double(10.00));
-
-      BarChart chart = new BarChart(320,240, "Most used processes", "process", barValues );
-      
-      Panel chartPanel = new Panel("Most active process definitions");
-      chartPanel.setPaddings(15);
-      chartPanel.setHeader(false);
-      chartPanel.setBorder(false);
-      chartPanel.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
-      chartPanel.add( chart );
-      this.add(chartPanel);
-      chart.update();*/
-
-      // definitions
       processDefinitions = new ProcessDefinitionList("Process Definitions", view);
 
       // ----------------------------------
+
       // TODO: introduce abstractions and integrate with DAO
       Map chartValues = new HashMap();
       chartValues.put("1", new Double(0.65));
@@ -124,7 +104,14 @@
         new ToolbarButton("More metrics", new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject e)
            {
-              // TODO: display metric tab
+              if(view.hasEditorView(MetricOverviewEditor.ID))
+              {
+                 view.showEditor(MetricOverviewEditor.ID);
+              }
+              else
+              {
+                 view.addEditorView( new MetricOverviewEditor(view) );
+              }
            }
         })
       );
@@ -136,19 +123,16 @@
       HelpPanel help = new HelpPanel(200, 180, "About process definitions");
       help.setContent( DAOFactory.getHelpDAO().getHelpByReference(HelpDAO.REF_PROCESS_DEFINITIONS));
 
+       // ----------------------------------
 
-      Panel leftPanel = new Panel();
-      leftPanel.setPaddings(10,0,0,5);
-      leftPanel.setLayout(new VerticalLayout(10));
-      leftPanel.setHideBorders(true);
-      leftPanel.setFrame(false);
-      leftPanel.setBorder(false);
+      teaserPanel = new TeaserPanel();
+      teaserPanel.add(help);
+      teaserPanel.add(metricPanel);
+
+       // ----------------------------------
       
-      leftPanel.add(help);
-      leftPanel.add(metricPanel);
-      
       this.add(processDefinitions, new ColumnLayoutData(0.7) );
-      this.add(leftPanel , new ColumnLayoutData(0.3) );
+      this.add(teaserPanel , new ColumnLayoutData(0.3) );
 
       // init gchart
       pieChart.update();

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -24,7 +24,6 @@
 import com.gwtext.client.data.*;
 import com.gwtext.client.widgets.grid.ColumnConfig;
 import com.gwtext.client.widgets.grid.ColumnModel;
-import com.google.gwt.i18n.client.DateTimeFormat;
 import org.jboss.bpm.console.client.ConsoleView;
 import org.jboss.bpm.console.client.model.DAOFactory;
 import org.jboss.bpm.console.client.model.ProcessDefinition;
@@ -134,7 +133,7 @@
    protected void onExamine(final Integer row)
    {
       ProcessInstance instance = (ProcessInstance)row2InstanceMap.get(row);
-      String id = ProcessInstanceEditor.ID+"."+instance.getId()+".tab";
+      String id = ProcessInstanceEditor.ID+"."+instance.getId();
       if(view.hasEditorView(id))
          view.showEditor(id);
       else

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -33,8 +33,6 @@
 public class ProcessInstanceListEditor extends EditorView
 {
 
-   public final static String ID = "org.jboss.bpm.process.ProcessInstanceList";
-
    private ProcessDefinition parent;
 
    public ProcessInstanceListEditor(ProcessDefinition proc, ConsoleView view)
@@ -52,7 +50,7 @@
 
    public String getEditorId()
    {
-      return ID;
+      return getId();
    }
 
    public String getTitle()

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BarChart.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BarChart.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/BarChart.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -32,7 +32,7 @@
 {
    String[] groupLabels;
    
-   final static String BAR_COLOR = "blue";
+   final static String BAR_COLOR = "#66CC66";
 
    final int MAX_REVENUE = 1000;
    

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/MainMenuPanel.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/MainMenuPanel.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/MainMenuPanel.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Component;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class MainMenuPanel extends Panel
+{
+
+   public MainMenuPanel(String title, String iconClass, Component tree)
+   {
+      super();
+
+      setTitle(title);
+      setBorder(false);
+      setHideBorders(true);
+      setIconCls(iconClass);
+
+      if(tree!=null)
+         add(tree);
+   }
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/MainMenuPanel.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/TeaserPanel.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/TeaserPanel.java	                        (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/TeaserPanel.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.widgets;
+
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.VerticalLayout;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class TeaserPanel extends Panel
+{
+
+   public TeaserPanel()
+   {
+      super();
+
+      setPaddings(10,0,0,5);
+      setLayout(new VerticalLayout(10));
+      setHideBorders(true);
+      setFrame(false);
+      setBorder(false);
+   }
+}


Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/TeaserPanel.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/UIConstants.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/UIConstants.java	2008-08-20 11:48:55 UTC (rev 1939)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/widgets/UIConstants.java	2008-08-20 13:09:23 UTC (rev 1940)
@@ -29,4 +29,5 @@
    final static int EDITOR_PANEL_WIDTH = 450;
    public static final int MAIN_MENU_MIN = 175;
    public static final int MAIN_MENU_MAX = 400;
+   public static final int EDITOR_PANE_WIDTH = 680;
 }




More information about the jbpm-commits mailing list