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

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 22 09:05:44 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-04-22 09:05:43 -0400 (Wed, 22 Apr 2009)
New Revision: 4604

Added:
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/TaskIdentityEvent.java
Removed:
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java
Modified:
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java
   projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
Log:
Implement release task

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java	2009-04-22 12:36:51 UTC (rev 4603)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -27,8 +27,10 @@
 import org.gwt.mosaic.ui.client.ListBox;
 import org.gwt.mosaic.ui.client.ToolBar;
 import org.gwt.mosaic.ui.client.ToolButton;
+import org.gwt.mosaic.ui.client.MessageBox;
 import org.gwt.mosaic.ui.client.list.DefaultListModel;
 import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
 import com.google.gwt.user.client.ui.ChangeListener;
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwt.user.client.ui.ClickListener;
@@ -108,13 +110,40 @@
             public void onClick(Widget sender) {
               // force loading
               controller.handleEvent(
-                  new Event(LoadTasksAction.ID, identity)
+                  new Event(LoadTasksAction.ID, getAssignedIdentity())
               );
             }
           }
           )
       );
 
+      toolBar.addSeparator();
+
+      toolBar.add(
+          new ToolButton("Release", new ClickListener() {
+            public void onClick(Widget sender) {
+
+              TaskRef selection = getSelection();
+
+              if(selection!=null)
+              {
+                controller.handleEvent(
+                    new Event(
+                        ReleaseTaskAction.ID,
+                        new TaskIdentityEvent(getAssignedIdentity(), selection)
+                    )
+                );
+              }
+              else
+              {
+                MessageBox.alert("Missing selection", "Please select a task");
+              }
+            }
+          }
+          )
+      );
+
+
       toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
 
       this.taskList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
@@ -144,6 +173,6 @@
       if(TaskRef.STATE.ASSIGNED ==task.getCurrentState())
         model.add(task);
     }
-  }   
+  }
 
 }

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java	2009-04-22 12:36:51 UTC (rev 4603)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -23,7 +23,7 @@
 
 import org.jboss.bpm.console.client.common.AbstractRESTAction;
 import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.task.events.ClaimTaskEvent;
+import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
 import com.google.gwt.http.client.RequestBuilder;
 import com.google.gwt.http.client.Response;
 import com.mvc4g.client.Controller;
@@ -48,7 +48,7 @@
 
   public String getUrl(Object event)
   {
-    ClaimTaskEvent claimEvent = (ClaimTaskEvent)event;
+    TaskIdentityEvent claimEvent = (TaskIdentityEvent)event;
     
     return appContext.getUrlBuilder().getTaskAssignURL(
         claimEvent.getTask().getId(), claimEvent.getIdentity()
@@ -62,7 +62,7 @@
 
   public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
   {
-    ClaimTaskEvent claimEvent = (ClaimTaskEvent)event;
+    TaskIdentityEvent claimEvent = (TaskIdentityEvent)event;
 
     controller.handleEvent(
         new Event(LoadTasksAction.ID, claimEvent.getIdentity())

Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java	2009-04-22 12:36:51 UTC (rev 4603)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -33,7 +33,7 @@
 import org.gwt.mosaic.ui.client.layout.LayoutPanel;
 import org.gwt.mosaic.ui.client.list.DefaultListModel;
 import org.jboss.bpm.console.client.model.TaskRef;
-import org.jboss.bpm.console.client.task.events.ClaimTaskEvent;
+import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
 
 import java.util.List;
 
@@ -116,7 +116,7 @@
                 controller.handleEvent(
                     new Event(
                         ClaimTaskAction.ID,
-                        new ClaimTaskEvent(getAssignedIdentity(), selection)
+                        new TaskIdentityEvent(getAssignedIdentity(), selection)
                     )
                 );
               }

Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java	                        (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ReleaseTaskAction.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -0,0 +1,69 @@
+/*
+ * 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.task;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.task.events.TaskIdentityEvent;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ReleaseTaskAction extends AbstractRESTAction
+{
+  public final static String ID = ReleaseTaskAction.class.getName();
+
+  public ReleaseTaskAction(ApplicationContext appContetext)
+  {
+    super(appContetext);
+  }
+
+  public String getId()
+  {
+    return ID;
+  }
+
+  public String getUrl(Object event)
+  {
+    TaskIdentityEvent tie = (TaskIdentityEvent)event;
+    return appContext.getUrlBuilder().getTaskReleaseURL(tie.getTask().getId());
+  }
+
+  public RequestBuilder.Method getRequestMethod()
+  {
+    return RequestBuilder.POST;
+  }
+
+  public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+  {
+    TaskIdentityEvent tie = (TaskIdentityEvent)event;
+
+    // force refresh reload
+    controller.handleEvent(
+        new Event(LoadTasksAction.ID, tie.getIdentity())
+    );
+  }
+}

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-22 12:36:51 UTC (rev 4603)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -86,6 +86,7 @@
       // create and register actions
       registerAction(LoadTasksAction.ID, new LoadTasksAction(appContext));
       registerAction(ClaimTaskAction.ID, new ClaimTaskAction(appContext));
+      registerAction(ReleaseTaskAction.ID, new ReleaseTaskAction(appContext));
 
       // display tab, needs to visible for correct rendering
       tabPanel.selectTab(0);

Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java	2009-04-22 12:36:51 UTC (rev 4603)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -1,49 +0,0 @@
-/*
- * 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.task.events;
-
-import org.jboss.bpm.console.client.model.TaskRef;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public final class ClaimTaskEvent
-{
-  private String identity;
-  private TaskRef task;
-
-  public ClaimTaskEvent(String identity, TaskRef task)
-  {
-    this.identity = identity;
-    this.task = task;
-  }
-
-  public String getIdentity()
-  {
-    return identity;
-  }
-
-  public TaskRef getTask()
-  {
-    return task;
-  }
-}

Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/TaskIdentityEvent.java (from rev 4602, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/TaskIdentityEvent.java	                        (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/TaskIdentityEvent.java	2009-04-22 13:05:43 UTC (rev 4604)
@@ -0,0 +1,51 @@
+/*
+ * 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.task.events;
+
+import org.jboss.bpm.console.client.model.TaskRef;
+
+/**
+ * Composite event that represents Identities working on tasks.
+ * 
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public final class TaskIdentityEvent
+{
+  private String identity;
+  private TaskRef task;
+
+  public TaskIdentityEvent(String identity, TaskRef task)
+  {
+    this.identity = identity;
+    this.task = task;
+  }
+
+  public String getIdentity()
+  {
+    return identity;
+  }
+
+  public TaskRef getTask()
+  {
+    return task;
+  }
+}




More information about the jbpm-commits mailing list