[jbpm-commits] 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.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Apr 22 08:26:10 EDT 2009
Author: heiko.braun at 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 at 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 at 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 at 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 at 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;
}
}
More information about the jbpm-commits
mailing list