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.
by do-not-reply@jboss.org
Author: heiko.braun(a)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(a)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(a)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(a)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;
+ }
+}
15 years, 1 month
JBoss JBPM SVN: r4603 - jbpm4/branches.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-22 08:36:51 -0400 (Wed, 22 Apr 2009)
New Revision: 4603
Added:
jbpm4/branches/tbaeyens/
Log:
creating personal tbaeyens branch
Copied: jbpm4/branches/tbaeyens (from rev 4602, jbpm4/trunk)
15 years, 1 month
JBoss JBPM SVN: r4602 - in projects/gwt-console/branches/hbraun: plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-22 08:26:10 -0400 (Wed, 22 Apr 2009)
New Revision: 4602
Removed:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/View.java
Modified:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java
projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.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
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java
Log:
Remove legacy view interfaces. Implement claim task use case
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-04-22 12:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -29,14 +29,23 @@
/**
+ * <h2>Composition</h2>
* An editor can be plugged into a {@link org.jboss.bpm.console.client.Workspace}.
- * and aggregates {@link org.jboss.bpm.console.client.View}'s.<br>
- * View's are maintained through a {@link com.mvc4g.client.Controller}.
+ * Editors do aggregate {@link com.mvc4g.client.ViewInterface}'s and {@link com.mvc4g.client.ActionInterface}'s,
+ * which are maintained through a {@link com.mvc4g.client.Controller}.
+
+ * <h2>Event handling</h2>
+ * Views and actions communicate though a hirarchical controller chain by issuing events:<p>
+ * <code>
+ * Controller.handleEvent( new Event(...));
+ * </code>
* <p/>
- * Editor's can communicate though a hirarchical controller chain.
- * <p/>
+ * By default every editor get's it's own controller that delegates to the main {@link org.jboss.bpm.console.client.ApplicationContext}
+ * controller as it's parent.
+ *
+ * <h2>Layout</h2>
* Each Editor uses a {@link org.gwt.mosaic.ui.client.layout.BorderLayout} by default.
- *
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public abstract class Editor extends LayoutPanel implements LazyPanel
@@ -72,35 +81,6 @@
public abstract MenuSection provideMenuSection();
- @Deprecated
- public boolean hasView(String viewId)
- {
- return false;
- }
-
- @Deprecated
- public void showView(String viewId)
- {
- throw new RuntimeException("Not implemented");
- }
-
- @Deprecated
- public void addView(View view, boolean closable)
- {
- /*String tabId = view.getViewId() + ".tab";
-
- view.setId(tabId); // tabId != viewId
- view.setClosable(closable);
- view.setIconCls(view.getIconCSS());
- view.setAutoScroll(true);
-
- appContext.getWorkpace().add(view);
- appContext.getWorkpace().setActiveTab(view.getId());*/
-
- System.out.println("*** addView should be re-implemented ***");
-
- }
-
/**
* hack in order to correctly display widgets that have
* been rendered hidden
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/View.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/View.java 2009-04-22 12:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/View.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -1,55 +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;
-
-import com.mvc4g.client.ViewInterface;
-import com.mvc4g.client.Controller;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
-
-/**
- * View's are {@link org.jboss.bpm.console.client.Editor} components
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public abstract class View extends LayoutPanel implements ViewInterface
-{
-
- protected ApplicationContext mainMenu;
-
- protected Controller controller;
-
- protected View(ApplicationContext main)
- {
- super();
- this.mainMenu = main;
- }
-
- public abstract String getViewId();
-
- public abstract String getIconCSS();
-
-
- public void setController(Controller controller)
- {
- this.controller = controller;
- }
-}
Modified: projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java 2009-04-22 12:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -26,6 +26,8 @@
import org.jboss.bpm.console.client.ApplicationContext;
import org.jboss.bpm.console.client.View;
import com.google.gwt.user.client.ui.Frame;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Controller;
/**
* An example editor that embeds google maps into the console
@@ -39,32 +41,13 @@
{
super(appContext);
- // an example view component added to the editor
- final View defaultView = new View(appContext) {
-
- public String getViewId()
- {
- return ID+".defaultView";
- }
-
- public String getIconCSS()
- {
- return "";
- }
- };
-
// keep it simple, just use an iframe
Frame frame = new Frame();
frame.setWidth("660");
frame.setHeight("448");
frame.setUrl("http://maps.google.com");
-
- // assemble the view
- defaultView.add(frame);
- defaultView.setTitle("Maps");
-
- // add it to the editor
- addView(defaultView, false);
+
+ // TODO: reimplement
}
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:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -21,11 +21,51 @@
*/
package org.jboss.bpm.console.client.task;
+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 com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class ClaimTaskAction
+public class ClaimTaskAction extends AbstractRESTAction
{
public final static String ID = ClaimTaskAction.class.getName();
-
+
+ public ClaimTaskAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ ClaimTaskEvent claimEvent = (ClaimTaskEvent)event;
+
+ return appContext.getUrlBuilder().getTaskAssignURL(
+ claimEvent.getTask().getId(), claimEvent.getIdentity()
+ );
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.POST;
+ }
+
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ ClaimTaskEvent claimEvent = (ClaimTaskEvent)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:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -21,11 +21,11 @@
*/
package org.jboss.bpm.console.client.task;
-import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;
import com.mvc4g.client.Event;
import org.gwt.mosaic.ui.client.ListBox;
+import org.gwt.mosaic.ui.client.MessageBox;
import org.gwt.mosaic.ui.client.ToolBar;
import org.gwt.mosaic.ui.client.ToolButton;
import org.gwt.mosaic.ui.client.layout.BoxLayout;
@@ -33,6 +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 java.util.List;
@@ -42,7 +43,7 @@
class OpenTasksView extends AbstractTaskList
{
- public final static String ID = OpenTasksView.class.getName();
+ public final static String ID = OpenTasksView.class.getName();
public OpenTasksView()
{
@@ -83,19 +84,7 @@
}
}
});
-
- listBox.addChangeListener(new ChangeListener()
- {
- public void onChange(Widget widget)
- {
- int index = listBox.getSelectedIndex();
- if(index!=-1)
- {
- System.out.println("Selected row "+ index);
- }
- }
- });
-
+
// toolbar
final LayoutPanel toolBox = new LayoutPanel();
toolBox.setPadding(0);
@@ -107,7 +96,7 @@
public void onClick(Widget sender) {
// force loading
controller.handleEvent(
- new Event(LoadTasksAction.ID, identity)
+ new Event(LoadTasksAction.ID, getAssignedIdentity())
);
}
}
@@ -118,11 +107,23 @@
toolBar.add(
new ToolButton("Claim", new ClickListener() {
- public void onClick(Widget sender) {
- // force loading
- controller.handleEvent(
- new Event(ClaimTaskAction.ID, identity)
- );
+ public void onClick(Widget sender)
+ {
+ TaskRef selection = getSelection();
+
+ if(selection!=null)
+ {
+ controller.handleEvent(
+ new Event(
+ ClaimTaskAction.ID,
+ new ClaimTaskEvent(getAssignedIdentity(), selection)
+ )
+ );
+ }
+ else
+ {
+ MessageBox.alert("Missing selection", "Please select a task");
+ }
}
}
)
@@ -132,7 +133,7 @@
this.taskList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
this.taskList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
-
+
this.add(taskList);
isInitialized = true;
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:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -85,6 +85,7 @@
// create and register actions
registerAction(LoadTasksAction.ID, new LoadTasksAction(appContext));
+ registerAction(ClaimTaskAction.ID, new ClaimTaskAction(appContext));
// 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/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:13:48 UTC (rev 4601)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java 2009-04-22 12:26:10 UTC (rev 4602)
@@ -21,29 +21,29 @@
*/
package org.jboss.bpm.console.client.task.events;
-import com.mvc4g.client.Event;
import org.jboss.bpm.console.client.model.TaskRef;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-public class ClaimTaskEvent extends Event
+public final class ClaimTaskEvent
{
private String identity;
private TaskRef task;
- public ClaimTaskEvent(String string, Object object)
+ public ClaimTaskEvent(String identity, TaskRef task)
{
- super(string, object);
+ this.identity = identity;
+ this.task = task;
}
- public void setIdentity(String identity)
+ public String getIdentity()
{
- this.identity = identity;
+ return identity;
}
- public void setTask(TaskRef task)
+ public TaskRef getTask()
{
- this.task = task;
+ return task;
}
}
15 years, 1 month
JBoss JBPM SVN: r4601 - jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-22 08:13:48 -0400 (Wed, 22 Apr 2009)
New Revision: 4601
Modified:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
Log:
Query for unassigned tasks
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-04-22 09:16:35 UTC (rev 4600)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-04-22 12:13:48 UTC (rev 4601)
@@ -21,17 +21,18 @@
*/
package org.jbpm.integration.console;
-import java.util.ArrayList;
-import java.util.List;
-
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.server.integration.TaskManagement;
import org.jbpm.api.IdentityService;
+import org.jbpm.api.TaskQuery;
import org.jbpm.api.TaskService;
import org.jbpm.api.task.GroupRef;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Task;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -54,19 +55,20 @@
if(null==participationType || participationType.equals(Participation.CANDIDATE))
{
- // TODO: Paging
- List<Task> assignedTasks = taskService.findAssignedTasks(idRef);
- List<Task> takableTasks = taskService.findTakableTasks(idRef);
+ TaskQuery query = taskService.createTaskQuery();
+ query.unassigned();
+ List<Task> openTasks = query.list();
+ List<Task> assignedtasks = taskService.findAssignedTasks(idRef);
- adoptTasks(assignedTasks, results);
- adoptTasks(takableTasks, results);
+ adoptTasks(openTasks, results);
+ adoptTasks(assignedtasks, results);
}
else
{
throw new IllegalArgumentException("Unknown participation type: " +participationType);
}
- return results;
+ return new ArrayList<TaskRef>(results);
}
private void adoptTasks(List<Task> tasks, List<TaskRef> results)
15 years, 1 month
JBoss JBPM SVN: r4600 - in projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client: process and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-22 05:16:35 -0400 (Wed, 22 Apr 2009)
New Revision: 4600
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AbstractTaskList.java
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/LoadTasksAction.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/events/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java
Removed:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
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/StartNewInstanceAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java
Log:
Create abstract REST action class that deals with error handling
Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java 2009-04-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -1,38 +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.common;
-
-import com.mvc4g.client.ActionInterface;
-import org.jboss.bpm.console.client.ApplicationContext;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public abstract class AbstractContextAwareAction implements ActionInterface
-{
- protected ApplicationContext appContext;
-
- public AbstractContextAwareAction(ApplicationContext appContext)
- {
- this.appContext = appContext;
- }
-}
Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java 2009-04-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -1,132 +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.common;
-
-import com.google.gwt.http.client.*;
-import com.google.gwt.user.client.Timer;
-import com.mvc4g.client.ActionInterface;
-import com.mvc4g.client.Controller;
-import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.LoadingStatusAction;
-
-import java.io.IOException;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public abstract class AbstractDataRequestAction implements ActionInterface
-{
- protected ApplicationContext appContext;
-
- protected AbstractDataRequestAction(ApplicationContext appContetext)
- {
- this.appContext = appContetext;
- }
-
- public abstract String getId();
- public abstract String getUrl(Object event);
- public abstract RequestBuilder.Method getRequestMethod();
- public abstract void handleSuccessfulResponse(final Controller controller, final Object event, Response response);
-
- public void execute(final Controller controller, final Object object)
- {
- final String url = getUrl(object);
- RequestBuilder builder = new RequestBuilder(getRequestMethod(), URL.encode(url));
-
- try
- {
- controller.handleEvent( LoadingStatusAction.ON );
-
- final Request request = builder.sendRequest(null,
- new RequestCallback()
- {
- public void onError(Request request, Throwable exception) {
- // Couldn't connect to server (could be timeout, SOP violation, etc.)
- handleError(url, exception);
- controller.handleEvent( LoadingStatusAction.OFF );
- }
-
- public void onResponseReceived(Request request, Response response) {
- try
- {
- if (200 == response.getStatusCode())
- {
- handleSuccessfulResponse(controller, object, response);
- }
- else
- {
- final String msg = response.getText().equals("") ? "Unknown error" : response.getText();
- handleError(
- url,
- new RequestException("HTTP "+ response.getStatusCode()+ ": " + msg)
- );
- }
- }
- finally
- {
- controller.handleEvent( LoadingStatusAction.OFF );
- }
- }
- }
- );
-
- // Timer to handle pending request
- Timer t = new Timer() {
-
- public void run()
- {
- if(request.isPending())
- {
- request.cancel();
- handleError(
- url,
- new IOException("Request timeout")
- );
- }
-
- }
- };
- t.schedule(5000);
-
- }
- catch (RequestException e)
- {
- // Couldn't connect to server
- handleError(url, e);
- controller.handleEvent( LoadingStatusAction.OFF );
- }
- }
-
- protected void handleError(String url, Throwable t)
- {
- final String out =
- "<ul>"+
- "<li>URL: '" + url + "'\n"+
- "<li>Action: '" + getId() + "'\n" +
- "<li>Exception: '" + t.getClass() +
- "</ul>'\n\n"+
- t.getMessage();
-
- appContext.displayMessage(out, true);
-
- }
-}
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java (from rev 4595, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,132 @@
+/*
+ * 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.http.client.*;
+import com.google.gwt.user.client.Timer;
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.LoadingStatusAction;
+
+import java.io.IOException;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class AbstractRESTAction implements ActionInterface
+{
+ protected ApplicationContext appContext;
+
+ protected AbstractRESTAction(ApplicationContext appContetext)
+ {
+ this.appContext = appContetext;
+ }
+
+ public abstract String getId();
+ public abstract String getUrl(Object event);
+ public abstract RequestBuilder.Method getRequestMethod();
+ public abstract void handleSuccessfulResponse(final Controller controller, final Object event, Response response);
+
+ public void execute(final Controller controller, final Object object)
+ {
+ final String url = getUrl(object);
+ RequestBuilder builder = new RequestBuilder(getRequestMethod(), URL.encode(url));
+
+ try
+ {
+ controller.handleEvent( LoadingStatusAction.ON );
+
+ final Request request = builder.sendRequest(null,
+ new RequestCallback()
+ {
+ public void onError(Request request, Throwable exception) {
+ // Couldn't connect to server (could be timeout, SOP violation, etc.)
+ handleError(url, exception);
+ controller.handleEvent( LoadingStatusAction.OFF );
+ }
+
+ public void onResponseReceived(Request request, Response response) {
+ try
+ {
+ if (200 == response.getStatusCode())
+ {
+ handleSuccessfulResponse(controller, object, response);
+ }
+ else
+ {
+ final String msg = response.getText().equals("") ? "Unknown error" : response.getText();
+ handleError(
+ url,
+ new RequestException("HTTP "+ response.getStatusCode()+ ": " + msg)
+ );
+ }
+ }
+ finally
+ {
+ controller.handleEvent( LoadingStatusAction.OFF );
+ }
+ }
+ }
+ );
+
+ // Timer to handle pending request
+ Timer t = new Timer() {
+
+ public void run()
+ {
+ if(request.isPending())
+ {
+ request.cancel();
+ handleError(
+ url,
+ new IOException("Request timeout")
+ );
+ }
+
+ }
+ };
+ t.schedule(5000);
+
+ }
+ catch (RequestException e)
+ {
+ // Couldn't connect to server
+ handleError(url, e);
+ controller.handleEvent( LoadingStatusAction.OFF );
+ }
+ }
+
+ protected void handleError(String url, Throwable t)
+ {
+ final String out =
+ "<ul>"+
+ "<li>URL: '" + url + "'\n"+
+ "<li>Action: '" + getId() + "'\n" +
+ "<li>Exception: '" + t.getClass() +
+ "</ul>'\n\n"+
+ t.getMessage();
+
+ appContext.displayMessage(out, true);
+
+ }
+}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -27,7 +27,7 @@
import com.google.gwt.json.client.JSONValue;
import com.mvc4g.client.Controller;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.common.AbstractDataRequestAction;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
@@ -38,7 +38,7 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-class LoadDefinitionsAction extends AbstractDataRequestAction
+class LoadDefinitionsAction extends AbstractRESTAction
{
public final static String ID = LoadDefinitionsAction.class.getName();
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -27,7 +27,7 @@
import com.google.gwt.json.client.JSONValue;
import com.mvc4g.client.Controller;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.common.AbstractDataRequestAction;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
@@ -40,7 +40,7 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-class LoadInstancesAction extends AbstractDataRequestAction
+class LoadInstancesAction extends AbstractRESTAction
{
public final static String ID = LoadInstancesAction.class.getName();
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-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -94,14 +94,14 @@
this.add(tabPanel, new BorderLayoutData(Region.CENTER));
// create and register views
- addView(DefinitionListView.ID, new DefinitionListView());
- addView(InstanceListView.ID, new InstanceListView());
+ registerView(DefinitionListView.ID, new DefinitionListView());
+ registerView(InstanceListView.ID, new InstanceListView());
// create and register actions
- addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
- addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
- addAction(StartNewInstanceAction.ID, new StartNewInstanceAction(appContext));
- addAction(StateChangeAction.ID, new StateChangeAction(appContext));
+ registerAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
+ registerAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
+ registerAction(StartNewInstanceAction.ID, new StartNewInstanceAction(appContext));
+ registerAction(StateChangeAction.ID, new StateChangeAction(appContext));
// display tab, needs to visible for correct rendering
tabPanel.selectTab(0);
@@ -117,7 +117,7 @@
}
}
- private void addView(String id, Widget view)
+ private void registerView(String id, Widget view)
{
// register view with controller
super.controller.addView(id, (ViewInterface)view);
@@ -126,7 +126,7 @@
this.tabPanel.add(view, view.getTitle());
}
- private void addAction(String name, ActionInterface action)
+ private void registerAction(String name, ActionInterface action)
{
super.controller.addAction(name, action);
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-04-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -21,12 +21,12 @@
*/
package org.jboss.bpm.console.client.process;
+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 com.google.gwt.http.client.*;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.LoadingStatusAction;
-import org.jboss.bpm.console.client.common.AbstractContextAwareAction;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
/**
@@ -35,7 +35,7 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-class StartNewInstanceAction extends AbstractContextAwareAction
+class StartNewInstanceAction extends AbstractRESTAction
{
public final static String ID = StartNewInstanceAction.class.getName();
@@ -44,73 +44,29 @@
super(appContext);
}
- /**
- *
- * @param controller
- * @param object a {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
- */
- public void execute(final Controller controller, Object object)
+ public String getId()
{
- final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
+ return ID;
+ }
- String url = appContext.getUrlBuilder().getStartNewInstanceURL(def.getId());
- RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
+ public String getUrl(Object event)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
+ return appContext.getUrlBuilder().getStartNewInstanceURL(def.getId());
+ }
- try
- {
- controller.handleEvent( LoadingStatusAction.ON );
-
- Request request = builder.sendRequest(null,
- new RequestCallback()
- {
- public void onError(Request request, Throwable exception) {
- // Couldn't connect to server (could be timeout, SOP violation, etc.)
- handleError(exception);
- controller.handleEvent( LoadingStatusAction.OFF );
- }
-
- public void onResponseReceived(Request request, Response response) {
- try
- {
- if (200 == response.getStatusCode()) {
-
- // force reload instance list
- controller.handleEvent(
- new Event(LoadInstancesAction.ID, def)
- );
-
- } else {
- // Handle the error. Can get the status text from response.getStatusText()
- appContext.displayMessage("Failed to start new instance. " +
- "HTTP " + response.getStatusCode()+
- ": " +response.getText(),
- true
- );
- }
- }
- finally
- {
- controller.handleEvent( LoadingStatusAction.OFF );
- }
- }
- });
- }
- catch (RequestException e)
- {
- // Couldn't connect to server
- handleError(e);
- controller.handleEvent( LoadingStatusAction.OFF );
- }
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.POST;
}
- private void handleError(Throwable t)
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
{
- // Couldn't connect to server
- appContext.displayMessage("Failed to start new instance. " +
- "RequestException( "+t.getClass() +"): "+
- t.getMessage(),
- true
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
+
+ // force reload instance list
+ controller.handleEvent(
+ new Event(LoadInstancesAction.ID, def)
);
-
}
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java 2009-04-22 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -22,7 +22,7 @@
package org.jboss.bpm.console.client.process;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.common.AbstractContextAwareAction;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import com.mvc4g.client.Controller;
@@ -35,7 +35,7 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-class StateChangeAction extends AbstractContextAwareAction
+class StateChangeAction extends AbstractRESTAction
{
public final static String ID = StateChangeAction.class.getName();
@@ -44,63 +44,30 @@
super(appContext);
}
- /**
- *
- * @param controller
- * @param object a {@link org.jboss.bpm.console.client.model.ProcessInstanceRef}
- */
- public void execute(final Controller controller, Object object)
+ public String getId()
{
- final ProcessInstanceRef inst = (ProcessInstanceRef)object;
+ return ID;
+ }
- String url = appContext.getUrlBuilder().getStateChangeURL(inst.getId(), inst.getState());
- RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
+ public String getUrl(Object event)
+ {
+ final ProcessInstanceRef inst = (ProcessInstanceRef)event;
+ return appContext.getUrlBuilder().getStateChangeURL(inst.getId(), inst.getState());
+ }
- try {
- Request request = builder.sendRequest(null, new RequestCallback() {
- public void onError(Request request, Throwable exception) {
- // Couldn't connect to server (could be timeout, SOP violation, etc.)
- handleError(exception);
- }
-
- public void onResponseReceived(Request request, Response response) {
- if (200 == response.getStatusCode()) {
-
- InstanceListView view = (InstanceListView)
- controller.getView(InstanceListView.ID);
- ProcessDefinitionRef def = view.getCurrentDefinition();
-
- // force reload instance list
- controller.handleEvent(
- new Event(LoadInstancesAction.ID, def)
- );
-
- } else {
- // Handle the error. Can get the status text from response.getStatusText()
- appContext.displayMessage("Failed to cancel instance. " +
- "HTTP " + response.getStatusCode()+
- ": " +response.getText(),
- true
- );
- }
- }
- });
- }
- catch (RequestException e)
- {
- // Couldn't connect to server
- handleError(e);
- }
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.POST;
}
- private void handleError(Throwable t)
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
{
- // Couldn't connect to server
- appContext.displayMessage("Failed to cancel instance. " +
- "RequestException( "+t.getClass() +"): "+
- t.getMessage(),
- true
- );
+ InstanceListView view = (InstanceListView)
+ controller.getView(InstanceListView.ID);
+ ProcessDefinitionRef def = view.getCurrentDefinition();
+
+ // force reload instance list
+ controller.handleEvent( new Event(LoadInstancesAction.ID, def));
}
}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AbstractTaskList.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AbstractTaskList.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AbstractTaskList.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,77 @@
+/*
+ * 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 org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.gwt.mosaic.ui.client.list.DefaultListModel;
+import org.gwt.mosaic.ui.client.ListBox;
+import org.jboss.bpm.console.client.LazyPanel;
+import org.jboss.bpm.console.client.model.TaskRef;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Controller;
+
+import java.util.List;
+
+/**
+ * Base class for task lists.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public abstract class AbstractTaskList extends LayoutPanel
+ implements ViewInterface, LazyPanel
+{
+ protected Controller controller;
+ protected LayoutPanel taskList = null;
+ protected ListBox<TaskRef> listBox;
+ protected boolean isInitialized;
+ protected String identity;
+
+ public AbstractTaskList()
+ {
+ super();
+ }
+
+ public boolean isInitialized()
+ {
+ return isInitialized;
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public abstract void update(String identity, List<TaskRef> tasks);
+
+ public TaskRef getSelection()
+ {
+ TaskRef selection = null;
+ if(isInitialized() && listBox.getSelectedIndex()!=-1)
+ selection = listBox.getItem( listBox.getSelectedIndex());
+ return selection;
+ }
+
+ public String getAssignedIdentity()
+ {
+ return identity;
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/AssignedTasksView.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,149 @@
+/*
+ * 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 org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+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.list.DefaultListModel;
+import org.jboss.bpm.console.client.model.TaskRef;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.mvc4g.client.Event;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class AssignedTasksView extends AbstractTaskList
+{
+
+ public final static String ID = AssignedTasksView.class.getName();
+
+ public AssignedTasksView()
+ {
+ super();
+ setTitle("Your Tasks");
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ taskList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ taskList.setPadding(0);
+ taskList.setWidgetSpacing(0);
+
+ listBox =
+ new ListBox<TaskRef>(
+ new String[] {
+ "Task ID", "Name", "Assignee"}
+ );
+
+
+ listBox.setCellRenderer(new ListBox.CellRenderer<TaskRef>() {
+ public void renderCell(ListBox<TaskRef> listBox, int row, int column,
+ TaskRef item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, String.valueOf(item.getId()));
+ break;
+ case 1:
+ listBox.setText(row, column, item.getName());
+ break;
+ case 2:
+ listBox.setText(row, column, item.getAssignee());
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
+ }
+ }
+ });
+
+ listBox.addChangeListener(new ChangeListener()
+ {
+ public void onChange(Widget widget)
+ {
+ int index = listBox.getSelectedIndex();
+ if(index!=-1)
+ {
+ System.out.println("Selected row "+ index);
+ }
+ }
+ });
+
+ // toolbar
+ final LayoutPanel toolBox = new LayoutPanel();
+ toolBox.setPadding(0);
+ toolBox.setWidgetSpacing(5);
+ //toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
+
+ final ToolBar toolBar = new ToolBar();
+ toolBar.add(
+ new ToolButton("Refresh", new ClickListener() {
+ public void onClick(Widget sender) {
+ // force loading
+ controller.handleEvent(
+ new Event(LoadTasksAction.ID, identity)
+ );
+ }
+ }
+ )
+ );
+
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ this.taskList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ this.taskList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ this.add(taskList);
+
+ isInitialized = true;
+ }
+ }
+
+ public void update(String identity, List<TaskRef> tasks)
+ {
+
+ this.identity = identity;
+
+ // lazy init
+ initialize();
+
+ final DefaultListModel<TaskRef> model =
+ (DefaultListModel<TaskRef>) listBox.getModel();
+
+ model.clear();
+
+ for(TaskRef task : tasks)
+ {
+ if(TaskRef.STATE.ASSIGNED ==task.getCurrentState())
+ model.add(task);
+ }
+ }
+
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/ClaimTaskAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ClaimTaskAction
+{
+ public final static String ID = ClaimTaskAction.class.getName();
+
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/LoadTasksAction.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,79 @@
+/*
+ * 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 org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.TaskRef;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.mvc4g.client.Controller;
+
+import java.util.List;
+
+/**
+ * Loads a task list for a particular identity.
+ *
+ * @see org.jboss.bpm.console.client.task.AssignedTasksView
+ * @see org.jboss.bpm.console.client.task.OpenTasksView
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LoadTasksAction extends AbstractRESTAction
+{
+ public final static String ID = LoadTasksAction.class.getName();
+
+ public LoadTasksAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ String identity = (String)event;
+ return appContext.getUrlBuilder().getTaskListURL(identity);
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(
+ final Controller controller, final Object event, Response response)
+ {
+ String identity = (String)event;
+
+ List<TaskRef> tasks = DTOParser.parseTaskReferenceList(response.getText());
+ OpenTasksView openTasks = (OpenTasksView)controller.getView(OpenTasksView.ID);
+ AssignedTasksView personalTasks = (AssignedTasksView)controller.getView(AssignedTasksView.ID);
+
+ openTasks.update(identity, tasks);
+ personalTasks.update(identity, tasks);
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/OpenTasksView.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,162 @@
+/*
+ * 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.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.mvc4g.client.Event;
+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.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+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 java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class OpenTasksView extends AbstractTaskList
+{
+
+ public final static String ID = OpenTasksView.class.getName();
+
+ public OpenTasksView()
+ {
+ super();
+ setTitle("Open Tasks");
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ taskList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ taskList.setPadding(0);
+ taskList.setWidgetSpacing(0);
+
+ listBox =
+ new ListBox<TaskRef>(
+ new String[] {
+ "Task ID", "Name", "Status"}
+ );
+
+
+ listBox.setCellRenderer(new ListBox.CellRenderer<TaskRef>() {
+ public void renderCell(ListBox<TaskRef> listBox, int row, int column,
+ TaskRef item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, String.valueOf(item.getId()));
+ break;
+ case 1:
+ listBox.setText(row, column, item.getName());
+ break;
+ case 2:
+ listBox.setText(row, column, String.valueOf(item.getCurrentState()));
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
+ }
+ }
+ });
+
+ listBox.addChangeListener(new ChangeListener()
+ {
+ public void onChange(Widget widget)
+ {
+ int index = listBox.getSelectedIndex();
+ if(index!=-1)
+ {
+ System.out.println("Selected row "+ index);
+ }
+ }
+ });
+
+ // toolbar
+ final LayoutPanel toolBox = new LayoutPanel();
+ toolBox.setPadding(0);
+ toolBox.setWidgetSpacing(5);
+
+ final ToolBar toolBar = new ToolBar();
+ toolBar.add(
+ new ToolButton("Refresh", new ClickListener() {
+ public void onClick(Widget sender) {
+ // force loading
+ controller.handleEvent(
+ new Event(LoadTasksAction.ID, identity)
+ );
+ }
+ }
+ )
+ );
+
+ toolBar.addSeparator();
+
+ toolBar.add(
+ new ToolButton("Claim", new ClickListener() {
+ public void onClick(Widget sender) {
+ // force loading
+ controller.handleEvent(
+ new Event(ClaimTaskAction.ID, identity)
+ );
+ }
+ }
+ )
+ );
+
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ this.taskList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ this.taskList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ this.add(taskList);
+
+ isInitialized = true;
+ }
+ }
+
+ public void update(String identity, List<TaskRef> tasks)
+ {
+
+ this.identity = identity;
+
+ // lazy init
+ initialize();
+
+ final DefaultListModel<TaskRef> model =
+ (DefaultListModel<TaskRef>) listBox.getModel();
+
+ model.clear();
+
+ for(TaskRef task : tasks)
+ {
+ if(TaskRef.STATE.OPEN ==task.getCurrentState())
+ model.add(task);
+ }
+ }
+
+}
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 08:41:14 UTC (rev 4599)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -23,6 +23,10 @@
import com.google.gwt.user.client.ui.SourcesTabEvents;
import com.google.gwt.user.client.ui.TabListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Event;
import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
import org.gwt.mosaic.ui.client.TabLayoutPanel;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
@@ -76,18 +80,19 @@
this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
// create and register views
- //addView(DefinitionListView.ID, new DefinitionListView());
+ registerView(OpenTasksView.ID, new OpenTasksView());
+ registerView(AssignedTasksView.ID, new AssignedTasksView());
// create and register actions
- //addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
+ registerAction(LoadTasksAction.ID, new LoadTasksAction(appContext));
// display tab, needs to visible for correct rendering
tabPanel.selectTab(0);
// force loading
- /*super.controller.handleEvent(
- new Event(LoadDefinitionsAction.ID, null)
- );*/
+ super.controller.handleEvent(
+ new Event(LoadTasksAction.ID, appContext.getAuthentication().getUsername())
+ );
refreshView();
@@ -95,6 +100,20 @@
}
}
+ private void registerView(String id, Widget view)
+ {
+ // register view with controller
+ super.controller.addView(id, (ViewInterface)view);
+
+ // add to tab layout
+ this.tabPanel.add(view, view.getTitle());
+ }
+
+ private void registerAction(String name, ActionInterface action)
+ {
+ super.controller.addAction(name, action);
+ }
+
public String getEditorId()
{
return ID;
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/events/ClaimTaskEvent.java 2009-04-22 09:16:35 UTC (rev 4600)
@@ -0,0 +1,49 @@
+/*
+ * 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 com.mvc4g.client.Event;
+import org.jboss.bpm.console.client.model.TaskRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ClaimTaskEvent extends Event
+{
+ private String identity;
+ private TaskRef task;
+
+ public ClaimTaskEvent(String string, Object object)
+ {
+ super(string, object);
+ }
+
+ public void setIdentity(String identity)
+ {
+ this.identity = identity;
+ }
+
+ public void setTask(TaskRef task)
+ {
+ this.task = task;
+ }
+}
15 years, 1 month
JBoss JBPM SVN: r4599 - in jbpm4/trunk/modules/userguide/src/main/docbook/en: modules and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-22 04:41:14 -0400 (Wed, 22 Apr 2009)
New Revision: 4599
Added:
jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.variables.review.png
Removed:
jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.review.png
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
JBPM-2025 sub-process example and docs
Deleted: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.review.png
===================================================================
(Binary files differ)
Copied: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.variables.review.png (from rev 4597, jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.review.png)
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/images/process.subprocess.variables.review.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-22 08:00:50 UTC (rev 4598)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-22 08:41:14 UTC (rev 4599)
@@ -1198,6 +1198,7 @@
when it is created.
</entry>
</row>
+ <!--
<row>
<entry><literal>swimlane-mapping</literal></entry>
<entry>0..*</entry>
@@ -1205,6 +1206,7 @@
instance when the sub process is created.
</entry>
</row>
+ -->
<row>
<entry><literal>out-variable</literal></entry>
<entry>0..*</entry>
@@ -1239,7 +1241,6 @@
</table>
<!-- ~~~ SUB PROCESS VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-
<section id="subprocessvariables">
<title><literal>sub-process</literal> variables</title>
<para>The SubProcessVariables example scenario will show the basic workings of the
@@ -1247,9 +1248,9 @@
and how to extract information out of the subprocess when it ends.
</para>
<para>The parent process involves a document that needs to be reviewed.</para>
- <figure id="process.subprocess.document">
+ <figure id="process.subprocess.variables.document">
<title>The subprocess document example process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.document.png"/></imageobject></mediaobject>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.variables.document.png"/></imageobject></mediaobject>
</figure>
<programlisting><process name="SubProcessDocument" xmlns="http://jbpm.org/4/jpdl">
@@ -1270,9 +1271,9 @@
</process></programlisting>
<para>The review process is a reusable process for all kinds of reviews.</para>
- <figure id="process.subprocess.review">
+ <figure id="process.subprocess.variables.review">
<title>The subprocess review example process</title>
- <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.review.png"/></imageobject></mediaobject>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.variables.review.png"/></imageobject></mediaobject>
</figure>
<programlisting><process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
@@ -1322,6 +1323,153 @@
and leave the <link>review</link> activity.
</para>
</section>
+
+ <!-- ~~~ SUB PROCESS OUTCOME VALUE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <section id="subprocessoutcomevalue">
+ <title><literal>sub-process</literal> outcome value</title>
+ <para>In the <literal>SubProcessOutcomeValueTest</literal> example, the value
+ of a sub process variable is used to select the outgoing transition
+ of the <literal>sub-process</literal> activity.
+ </para>
+ <figure id="process.subprocess.outcomevalue.document">
+ <title>The subprocess document example process</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.outcomevalue.document.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="SubProcessDocument">
+
+ <start>
+ <transition to="review" />
+ </start>
+
+ <sub-process name="review"
+ sub-process-key="SubProcessReview"
+ <emphasis role="bold">outcome="#{result}"</emphasis>>
+
+ <transition <emphasis role="bold">name="ok"</emphasis> to="next step" />
+ <transition <emphasis role="bold">name="nok"</emphasis> to="update" />
+ <transition <emphasis role="bold">name="reject"</emphasis> to="close" />
+ </sub-process>
+
+ <state name="next step" />
+ <state name="update" />
+ <state name="close" />
+
+</process></programlisting>
+ <para>The <literal>SubProcessReview</literal> is the same as above in the
+ <link linkend="subprocessvariables">subprocess variables example</link>:</para>
+ <figure id="process.subprocess.outcomevalue.review">
+ <title>The subprocess review example process for outcome value</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.variables.review.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" />
+
+</process></programlisting>
+ <para>A new document process instance is started like usual:
+ </para>
+ <programlisting>ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");</programlisting>
+ <para>Then task is fetched from <literal>johndoe</literal>'s task list</para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");
+Task task = taskList.get(0);
+ </programlisting>
+ <para>Then the <literal>result</literal> variable is set and
+ the task is completed.
+ </para>
+ <programlisting>taskService.setVariable(task.getDbid(), "result", "ok");
+taskService.completeTask(task.getDbid());
+ </programlisting>
+ <para>In this scenario, the <literal>ok</literal> transition is taken in
+ the parent process out of the sub-process review activity. The example
+ test case also shows other scenarios.
+ </para>
+ </section>
+
+ <!-- ~~~ SUB PROCESS OUTCOME ACTIVITY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <section id="subprocessoutcomeactivity">
+ <title><literal>sub-process</literal> outcome activity</title>
+ <para>A process can have many end activities. In the <literal>SubProcessOutcomeActivityTest</literal>
+ example, the resulting end activity is used to select the outgoing transition of the <literal>sub-process</literal>
+ activity.
+ </para>
+ <figure id="process.subprocess.outcomeactivity.document">
+ <title>The subprocess document example process for outcome activity</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.outcomevalue.document.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="SubProcessDocument">
+
+ <start>
+ <transition to="review" />
+ </start>
+
+ <sub-process name="review"
+ sub-process-key="SubProcessReview">
+
+ <transition <emphasis role="bold">name="ok"</emphasis> to="next step" />
+ <transition <emphasis role="bold">name="nok"</emphasis> to="update" />
+ <transition <emphasis role="bold">name="reject"</emphasis> to="close" />
+ </sub-process>
+
+ <state name="next step" />
+ <state name="update" />
+ <state name="close" />
+
+</process></programlisting>
+ <para>The <literal>SubProcessReview</literal> now has multiple end activities:</para>
+ <figure id="process.subprocess.outcomeactivity.review">
+ <title>The subprocess review example process for outcome activity</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/process.subprocess.outcomeactivity.review.png"/></imageobject></mediaobject>
+ </figure>
+ <programlisting><process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
+
+ <start>
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe">
+
+ <transition name="ok" to="ok"/>
+ <transition name="nok" to="nok"/>
+ <transition name="reject" to="reject"/>
+ </task>
+
+ <emphasis role="bold"><end name="ok" />
+ <end name="nok" />
+ <end name="reject" /></emphasis>
+
+</process></programlisting>
+ <para>A new document process instance is started like usual:
+ </para>
+ <programlisting>ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");</programlisting>
+ <para>Then task is fetched from <literal>johndoe</literal>'s task list</para>
+ <programlisting>List<Task> taskList = taskService.findAssignedTasks("johndoe");
+Task task = taskList.get(0);
+ </programlisting>
+ <para>Then the task is completed with outcome <literal>ok</literal>.
+ </para>
+ <programlisting>taskService.completeTask(task.getDbid(), "ok");
+ </programlisting>
+ <para>This will cause the sub process to end in end activity <literal>ok</literal>.
+ The super process execution will then take outgoing transition <literal>ok</literal>
+ to <literal>next step</literal>.
+ </para>
+ <para>The example test case also shows the other scenarios.
+ </para>
+ </section>
+
</section>
</section>
15 years, 1 month
JBoss JBPM SVN: r4598 - in projects/gwt-console/branches/hbraun: war/src/main/java/org/jboss/bpm/console/client/process and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-22 04:00:50 -0400 (Wed, 22 Apr 2009)
New Revision: 4598
Added:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/LazyPanel.java
Removed:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/
Modified:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
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 api packages
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-04-21 15:25:39 UTC (rev 4597)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-04-22 08:00:50 UTC (rev 4598)
@@ -25,7 +25,7 @@
import com.google.gwt.user.client.Window;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
-import org.jboss.bpm.console.client.v2.LazyPanel;
+import org.jboss.bpm.console.client.LazyPanel;
/**
Copied: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/LazyPanel.java (from rev 4586, projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/v2/LazyPanel.java)
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/LazyPanel.java (rev 0)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/LazyPanel.java 2009-04-22 08:00:50 UTC (rev 4598)
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface LazyPanel
+{
+ boolean isInitialized();
+
+ /**
+ * Expected to be an idempotent implementation
+ */
+ void initialize();
+}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-04-21 15:25:39 UTC (rev 4597)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-04-22 08:00:50 UTC (rev 4598)
@@ -35,7 +35,7 @@
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.client.v2.LazyPanel;
+import org.jboss.bpm.console.client.LazyPanel;
import java.util.List;
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-04-21 15:25:39 UTC (rev 4597)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-04-22 08:00:50 UTC (rev 4598)
@@ -36,7 +36,7 @@
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-import org.jboss.bpm.console.client.v2.LazyPanel;
+import org.jboss.bpm.console.client.LazyPanel;
import java.util.List;
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:25:39 UTC (rev 4597)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-04-22 08:00:50 UTC (rev 4598)
@@ -35,7 +35,7 @@
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.v2.LazyPanel;
+import org.jboss.bpm.console.client.LazyPanel;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
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:25:39 UTC (rev 4597)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditor.java 2009-04-22 08:00:50 UTC (rev 4598)
@@ -30,7 +30,7 @@
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.v2.LazyPanel;
+import org.jboss.bpm.console.client.LazyPanel;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
15 years, 1 month
JBoss JBPM SVN: r4597 - in projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client: task and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)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(a)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()
15 years, 1 month
JBoss JBPM SVN: r4596 - in projects/gwt-console/branches/hbraun/war/src/main: java/org/jboss/bpm/console/client/process and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-21 11:16:18 -0400 (Tue, 21 Apr 2009)
New Revision: 4596
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/
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/TaskEditorNavigation.java
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/resources/org/jboss/bpm/console/workspace-default.cfg
Log:
Task Editor bare bone
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:02:50 UTC (rev 4595)
+++ 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)
@@ -164,7 +164,7 @@
public MenuSection provideMenuSection()
{
return new MenuSection(
- "Process Management",
+ "Processes",
"bpm-process-icon",
new ProcessEditorNavigation(appContext)
);
Added: 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 (rev 0)
+++ 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)
@@ -0,0 +1,68 @@
+/*
+ * 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 org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.MenuSection;
+import org.jboss.bpm.console.client.ApplicationContext;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class TaskEditor extends Editor
+{
+ public final static String ID = TaskEditor.class.getName();
+
+ public TaskEditor(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public void initialize()
+ {
+
+ }
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return "Task Management";
+ }
+
+ public String getIconCSS()
+ {
+ return "bpm-task-icon";
+ }
+
+ public MenuSection provideMenuSection()
+ {
+ return new MenuSection(
+ "Tasks",
+ "bpm-task-icon",
+ new TaskEditorNavigation(appContext)
+ );
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java 2009-04-21 15:16:18 UTC (rev 4596)
@@ -0,0 +1,61 @@
+/*
+ * 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.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.TreeListener;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.Workspace;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class TaskEditorNavigation extends Tree
+{
+ public TaskEditorNavigation(final ApplicationContext appContext)
+ {
+ super.setTitle("Tasks");
+
+ TreeItem root = addItem("Task Management");
+ TreeItem definitions = root.addItem("View Tasks");
+
+ addTreeListener(
+ new TreeListener()
+ {
+ public void onTreeItemSelected(TreeItem treeItem)
+ {
+ if("View Tasks".equals(treeItem.getText()))
+ {
+ Workspace workspace = appContext.getWorkpace();
+ workspace.showEditor(TaskEditor.ID);
+ }
+ }
+
+ public void onTreeItemStateChanged(TreeItem treeItem)
+ {
+
+ }
+ }
+ );
+ }
+}
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-04-21 15:02:50 UTC (rev 4595)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-04-21 15:16:18 UTC (rev 4596)
@@ -1,5 +1,5 @@
org.jboss.bpm.console.client.process.ProcessEditor
-#org.jboss.bpm.console.client.task.TaskEditor
+org.jboss.bpm.console.client.task.TaskEditor
# not yet implemented in jBPM4
#org.jboss.bpm.console.client.report.ReportEditor
\ No newline at end of file
15 years, 1 month
JBoss JBPM SVN: r4595 - in projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client: process and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-21 11:02:50 -0400 (Tue, 21 Apr 2009)
New Revision: 4595
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
Log:
lazy init InstanceListView
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java 2009-04-21 14:41:11 UTC (rev 4594)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java 2009-04-21 15:02:50 UTC (rev 4595)
@@ -42,10 +42,10 @@
this.appContext = appContetext;
}
- abstract String getId();
- abstract String getUrl(Object event);
- abstract RequestBuilder.Method getRequestMethod();
- abstract void handleSuccessfulResponse(final Controller controller, final Object event, Response response);
+ public abstract String getId();
+ public abstract String getUrl(Object event);
+ public abstract RequestBuilder.Method getRequestMethod();
+ public abstract void handleSuccessfulResponse(final Controller controller, final Object event, Response response);
public void execute(final Controller controller, final Object object)
{
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-04-21 14:41:11 UTC (rev 4594)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-04-21 15:02:50 UTC (rev 4595)
@@ -36,13 +36,15 @@
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.v2.LazyPanel;
import java.util.List;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-class InstanceListView extends LayoutPanel implements ViewInterface
+class InstanceListView extends LayoutPanel
+ implements ViewInterface, LazyPanel
{
public final static String ID = InstanceListView.class.getName();
@@ -54,116 +56,137 @@
private ProcessDefinitionRef currentDefinition;
+ private boolean isInitialized;
+
+ private List<ProcessInstanceRef> cachedInstances = null;
+
public InstanceListView()
{
super();
setTitle("Process Instances");
- instanceList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
- instanceList.setPadding(0);
- instanceList.setWidgetSpacing(0);
+ }
- listBox =
- new ListBox<ProcessInstanceRef>(
- new String[] {
- "Instance ID", "State", "Start Date"}
- );
+ public boolean isInitialized()
+ {
+ return isInitialized;
+ }
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ instanceList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ instanceList.setPadding(0);
+ instanceList.setWidgetSpacing(0);
- listBox.setCellRenderer(new ListBox.CellRenderer<ProcessInstanceRef>() {
- public void renderCell(ListBox<ProcessInstanceRef> listBox, int row, int column,
- ProcessInstanceRef item) {
- switch (column) {
- case 0:
- listBox.setText(row, column, item.getId());
- break;
- case 1:
- listBox.setText(row, column, item.getState().toString());
- break;
- case 2:
- listBox.setText(row, column, item.getStartDate().toString());
- break;
- default:
- throw new RuntimeException("Unexpected column size");
- }
- }
- });
+ listBox =
+ new ListBox<ProcessInstanceRef>(
+ new String[] {
+ "Instance ID", "State", "Start Date"}
+ );
- // toolbar
-
- final LayoutPanel toolBox = new LayoutPanel();
- toolBox.setPadding(0);
- toolBox.setWidgetSpacing(5);
- //toolBox.setLayout(new BoxLayout(BoxLayout.Orientation.VERTICAL));
-
- final ToolBar toolBar = new ToolBar();
- toolBar.add(
- new ToolButton("Refresh", new ClickListener() {
- public void onClick(Widget sender) {
- controller.handleEvent(
- new Event(
- LoadInstancesAction.ID,
- getCurrentDefinition()
- )
- );
+ listBox.setCellRenderer(new ListBox.CellRenderer<ProcessInstanceRef>() {
+ public void renderCell(ListBox<ProcessInstanceRef> listBox, int row, int column,
+ ProcessInstanceRef item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, item.getId());
+ break;
+ case 1:
+ listBox.setText(row, column, item.getState().toString());
+ break;
+ case 2:
+ listBox.setText(row, column, item.getStartDate().toString());
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
}
}
- )
- );
+ });
- toolBar.addSeparator();
+ // toolbar
+ final LayoutPanel toolBox = new LayoutPanel();
+ toolBox.setPadding(0);
+ toolBox.setWidgetSpacing(5);
- toolBar.add(
- new ToolButton("Start new instance", new ClickListener()
- {
- public void onClick(Widget sender)
- {
- controller.handleEvent(
- new Event(
- StartNewInstanceAction.ID,
- getCurrentDefinition()
- )
- );
+ final ToolBar toolBar = new ToolBar();
+ toolBar.add(
+ new ToolButton("Refresh", new ClickListener() {
+ public void onClick(Widget sender) {
+ controller.handleEvent(
+ new Event(
+ LoadInstancesAction.ID,
+ getCurrentDefinition()
+ )
+ );
+ }
}
- }
- )
- );
+ )
+ );
- toolBar.addSeparator();
+ toolBar.addSeparator();
- toolBar.add(
- new ToolButton("Cancel execution", new ClickListener()
- {
- public void onClick(Widget sender)
+ toolBar.add(
+ new ToolButton("Start new instance", new ClickListener()
{
- ProcessInstanceRef selection = getSelection();
- if(selection!=null)
+ public void onClick(Widget sender)
{
- selection.setState(ProcessInstanceRef.STATE.ENDED);
-
controller.handleEvent(
new Event(
- StateChangeAction.ID,
- selection
+ StartNewInstanceAction.ID,
+ getCurrentDefinition()
)
);
}
- else
+ }
+ )
+ );
+
+ toolBar.addSeparator();
+
+ toolBar.add(
+ new ToolButton("Cancel execution", new ClickListener()
+ {
+ public void onClick(Widget sender)
{
- MessageBox.alert("Missing selection", "Please select an instance");
+ ProcessInstanceRef selection = getSelection();
+ if(selection!=null)
+ {
+ selection.setState(ProcessInstanceRef.STATE.ENDED);
+
+ controller.handleEvent(
+ new Event(
+ StateChangeAction.ID,
+ selection
+ )
+ );
+ }
+ else
+ {
+ MessageBox.alert("Missing selection", "Please select an instance");
+ }
}
}
- }
- )
- );
+ )
+ );
- toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
- instanceList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
- instanceList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+ instanceList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ instanceList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
- this.add(instanceList);
-
+ // cached data?
+ if(this.cachedInstances!=null)
+ bindData(this.cachedInstances);
+
+ this.add(instanceList);
+
+
+
+ isInitialized = true;
+
+ }
}
public ProcessInstanceRef getSelection()
@@ -188,7 +211,16 @@
public void update(final ProcessDefinitionRef def, List<ProcessInstanceRef> instances)
{
this.currentDefinition = def;
+ this.cachedInstances = instances;
+ if(isInitialized())
+ {
+ bindData(instances);
+ }
+ }
+
+ private void bindData(List<ProcessInstanceRef> instances)
+ {
final DefaultListModel<ProcessInstanceRef> model =
(DefaultListModel<ProcessInstanceRef>) listBox.getModel();
model.clear();
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-21 14:41:11 UTC (rev 4594)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-21 15:02:50 UTC (rev 4595)
@@ -47,23 +47,22 @@
super(appContext);
}
-
- String getId()
+ public String getId()
{
return ID;
}
- String getUrl(Object event)
+ public String getUrl(Object event)
{
return appContext.getUrlBuilder().getProcessDefinitionsURL();
}
- RequestBuilder.Method getRequestMethod()
+ public RequestBuilder.Method getRequestMethod()
{
return RequestBuilder.GET;
}
- void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
{
if (200 == response.getStatusCode())
{
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-21 14:41:11 UTC (rev 4594)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-21 15:02:50 UTC (rev 4595)
@@ -49,23 +49,23 @@
super(appContext);
}
- String getId()
+ public String getId()
{
return ID;
}
- String getUrl(Object event)
+ public String getUrl(Object event)
{
final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
return appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
}
- RequestBuilder.Method getRequestMethod()
+ public RequestBuilder.Method getRequestMethod()
{
return RequestBuilder.GET;
}
- protected void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
{
final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
JSONValue json = JSONParser.parse(response.getText());
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 14:41:11 UTC (rev 4594)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-04-21 15:02:50 UTC (rev 4595)
@@ -35,6 +35,7 @@
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.v2.LazyPanel;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -57,6 +58,26 @@
// 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(Region.CENTER));
// create and register views
15 years, 1 month