[overlord-commits] Overlord SVN: r946 - in bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console: client/process and 1 other directories.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Tue Feb 2 06:25:31 EST 2010


Author: heiko.braun at jboss.com
Date: 2010-02-02 06:25:31 -0500 (Tue, 02 Feb 2010)
New Revision: 946

Added:
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/DataDriven.java
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/LoadingOverlay.java
Modified:
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java
   bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/public/console.css
Log:
Added DataDriven and LoadingOverlay

Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java	2010-02-01 18:08:40 UTC (rev 945)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -58,7 +58,11 @@
 
     try
     {
-      controller.handleEvent( LoadingStatusAction.ON );
+      //controller.handleEvent( LoadingStatusAction.ON );
+      if(getDataDriven(controller)!=null)
+      {
+         getDataDriven(controller).setLoading(true);
+      }
 
       final Request request = builder.sendRequest(null,
           new RequestCallback()
@@ -91,7 +95,11 @@
               }
               finally
               {
-                controller.handleEvent( LoadingStatusAction.OFF );
+                //controller.handleEvent( LoadingStatusAction.OFF );
+                if(getDataDriven(controller)!=null)
+                {
+                  getDataDriven(controller).setLoading(false);
+                }
               }
             }
           }
@@ -120,10 +128,20 @@
     {
       // Couldn't connect to server
       handleError(url, e);
-      controller.handleEvent( LoadingStatusAction.OFF );
+      //controller.handleEvent( LoadingStatusAction.OFF );
+
+      if(getDataDriven(controller)!=null)
+      {
+         getDataDriven(controller).setLoading(false);
+      }
     }
   }
 
+  protected DataDriven getDataDriven(Controller controller)
+  {
+    return null;
+  }
+
   protected void handleError(String url, Throwable t)
   {
     final String out =

Added: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/DataDriven.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/DataDriven.java	                        (rev 0)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/DataDriven.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -0,0 +1,32 @@
+/*
+ * 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.common;
+
+/**
+ * Simple marker for data driven view components
+ */
+public interface DataDriven
+{
+  void reset();
+  void update(Object... data);
+  void setLoading(boolean isLoading);
+}

Added: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/LoadingOverlay.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/LoadingOverlay.java	                        (rev 0)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/LoadingOverlay.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -0,0 +1,60 @@
+/*
+ * 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.common;
+
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+import org.gwt.mosaic.ui.client.infopanel.InfoPanel;
+
+public class LoadingOverlay
+{
+
+  static InfoPanel p = null;
+
+  public static void on(Widget parent, boolean loading)
+  {
+    if(loading)
+    {
+      int left = parent.getAbsoluteLeft();
+      int top = parent.getAbsoluteTop();
+
+      int width = parent.getOffsetWidth();
+      int height = parent.getOffsetHeight();
+
+      p = new InfoPanel();
+      p.setStylePrimaryName("bpm-loading-overy");
+      p.setWidget(new Image("images/loading_lite.gif"));     
+      p.setPopupPosition(left+(width/2)-15, top+(height/2)-15);
+      p.show();
+
+    }
+    else
+    {
+      if(p!=null)
+      {
+        p.hide();
+        p = null;
+      }
+    }
+  }
+}

Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java	2010-02-01 18:08:40 UTC (rev 945)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -36,12 +36,13 @@
 import org.gwt.mosaic.ui.client.ToolBar;
 import org.gwt.mosaic.ui.client.layout.*;
 import org.gwt.mosaic.ui.client.list.DefaultListModel;
+import org.jboss.bpm.console.client.common.DataDriven;
+import org.jboss.bpm.console.client.common.LoadingOverlay;
 import org.jboss.bpm.console.client.common.PagingCallback;
 import org.jboss.bpm.console.client.common.PagingPanel;
 import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
 import org.jboss.errai.common.client.framework.WSComponent;
 import org.jboss.errai.workspaces.client.Registry;
-import org.jboss.errai.workspaces.client.framework.annotations.LoadTool;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -50,7 +51,7 @@
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */
 //@LoadTool(name = "Definitions", group = "Processes")
-public class DefinitionListView implements WSComponent, ViewInterface
+public class DefinitionListView implements WSComponent, ViewInterface, DataDriven
 {
   public final static String ID = DefinitionListView.class.getName();
 
@@ -70,9 +71,8 @@
   private List<ProcessDefinitionRef> definitions = null;
   private PagingPanel pagingPanel;
 
-  MosaicPanel panel;
+  private MosaicPanel panel;
 
-  @Override
   public Widget getWidget()
   {
 
@@ -132,10 +132,14 @@
           new Button("Refresh", new ClickHandler() {
             public void onClick(ClickEvent clickEvent)
             {
+              final DefaultListModel<ProcessDefinitionRef> model =
+                  (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
+              model.clear();
+
               // force loading
               controller.handleEvent(
                   new Event(UpdateDefinitionsAction.ID, null)
-              );
+              );              
             }
           }
           )
@@ -274,22 +278,43 @@
     this.controller = controller;
   }
 
-  public void update(List<ProcessDefinitionRef> definitions)
+  public void reset()
   {
-    this.definitions = definitions;
+    final DefaultListModel<ProcessDefinitionRef> model =
+        (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
+
+    model.clear();
+
+    // clear details
+    controller.handleEvent(
+        new Event(UpdateProcessDetailAction.ID, null)
+    );
+
+    // clear instance panel
+    controller.handleEvent(new Event(ClearInstancesAction.ID, null));
+  }
+
+  public void update(Object... data)
+  {
+    this.definitions = (List<ProcessDefinitionRef>)data[0];
     pagingPanel.reset();
     renderFiltered();
   }
 
+  public void setLoading(boolean isLoading)
+  {
+    LoadingOverlay.on(panel, isLoading);
+  }
+
   private void renderFiltered()
   {
     if(this.definitions!=null)
     {
+      reset();
+
       final DefaultListModel<ProcessDefinitionRef> model =
-          (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
+          (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();      
 
-      model.clear();
-
       List<ProcessDefinitionRef> tmp = new ArrayList<ProcessDefinitionRef>();
       for(ProcessDefinitionRef def : definitions)
       {
@@ -311,13 +336,6 @@
       if(listBox.getSelectedIndex()!=-1)
         listBox.setItemSelected(listBox.getSelectedIndex(), false);
 
-      // clear details
-      controller.handleEvent(
-          new Event(UpdateProcessDetailAction.ID, null)
-      );
-
-      // clear instance panel
-      controller.handleEvent(new Event(ClearInstancesAction.ID, null));
     }
   }
 

Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java	2010-02-01 18:08:40 UTC (rev 945)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -36,10 +36,7 @@
 import org.gwt.mosaic.ui.client.layout.*;
 import org.gwt.mosaic.ui.client.list.DefaultListModel;
 import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.common.IFrameWindowCallback;
-import org.jboss.bpm.console.client.common.IFrameWindowPanel;
-import org.jboss.bpm.console.client.common.PagingCallback;
-import org.jboss.bpm.console.client.common.PagingPanel;
+import org.jboss.bpm.console.client.common.*;
 import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
 import org.jboss.bpm.console.client.model.ProcessInstanceRef;
 import org.jboss.bpm.console.client.process.events.InstanceEvent;
@@ -54,7 +51,7 @@
  * @author Heiko.Braun <heiko.braun at jboss.com>
  */
 //@LoadTool(name = "Instances", group = "Processes")
-public class InstanceListView implements WSComponent, ViewInterface
+public class InstanceListView implements WSComponent, ViewInterface, DataDriven
 {
   public final static String ID = InstanceListView.class.getName();
 
@@ -406,14 +403,19 @@
     deleteBtn.setEnabled(false);
   }
 
-  public void update(final ProcessDefinitionRef def, List<ProcessInstanceRef> instances)
+  public void update(Object... data)
   {
-    this.currentDefinition = def;
-    this.cachedInstances = instances;
+    this.currentDefinition = (ProcessDefinitionRef)data[0];
+    this.cachedInstances = (List<ProcessInstanceRef>)data[1];
 
     if(isInitialized()) pagingPanel.reset();
     renderUpdate();
   }
+   
+  public void setLoading(boolean isLoading)
+  {
+    LoadingOverlay.on(instanceList, isLoading);
+  }
 
   private void renderUpdate()
   {

Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java	2010-02-01 18:08:40 UTC (rev 945)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -26,6 +26,7 @@
 import com.mvc4g.client.Controller;
 import org.jboss.bpm.console.client.URLBuilder;
 import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.common.DataDriven;
 import org.jboss.bpm.console.client.model.JSOParser;
 import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
 import org.jboss.bpm.console.client.util.ConsoleLog;
@@ -46,9 +47,9 @@
   {
     return ID;
   }
-
+  
   public String getUrl(Object event)
-  {
+  {    
     return URLBuilder.getInstance().getProcessDefinitionsURL();
   }
 
@@ -57,6 +58,12 @@
     return RequestBuilder.GET;
   }
 
+  @Override
+  protected DataDriven getDataDriven(Controller controller)
+  {
+    return (DefinitionListView) controller.getView(DefinitionListView.ID);
+  }
+
   public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
   {
     long start = System.currentTimeMillis();

Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java	2010-02-01 18:08:40 UTC (rev 945)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java	2010-02-02 11:25:31 UTC (rev 946)
@@ -26,6 +26,7 @@
 import com.mvc4g.client.Controller;
 import org.jboss.bpm.console.client.URLBuilder;
 import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.common.DataDriven;
 import org.jboss.bpm.console.client.model.JSOParser;
 import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
 import org.jboss.bpm.console.client.model.ProcessInstanceRef;
@@ -60,6 +61,12 @@
     return RequestBuilder.GET;
   }
 
+  @Override
+  protected DataDriven getDataDriven(Controller controller)
+  {
+    return (InstanceListView) controller.getView(InstanceListView.ID);
+  }
+
   public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
   {
     final long start = System.currentTimeMillis();

Modified: bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/public/console.css
===================================================================
--- bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/public/console.css	2010-02-01 18:08:40 UTC (rev 945)
+++ bpm-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/public/console.css	2010-02-02 11:25:31 UTC (rev 946)
@@ -357,6 +357,7 @@
   border-bottom: 1px solid #bbbbbb;
 }
 
+
 /* mosaic overrides */
 
 .mosaic-Label {
@@ -367,4 +368,16 @@
     font-size: 10px;
     -moz-border-radius: 3px;
     -webkit-border-radius: 3px;
+}
+
+.bpm-loading-overy {
+    font-size: 10px;
+    -moz-border-radius: 2px;
+    -webkit-border-radius: 2px;
+    background-color: #ffffff;
+    border: 1px solid #cccccc;
+    width: 25px;
+    height: 25px;
+    margin:0px;
+    padding:0px;
 }
\ No newline at end of file



More information about the overlord-commits mailing list