[jbpm-commits] JBoss JBPM SVN: r4887 - in projects/gwt-console/trunk: gui/war/src/main/java/org/jboss/bpm/console/client/process/events and 8 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon May 25 10:31:11 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-05-25 10:31:11 -0400 (Mon, 25 May 2009)
New Revision: 4887
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDiagramView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ActiveNodeInfo.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramInfo.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramNodeInfo.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TokenReference.java
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java
Removed:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java
projects/gwt-console/trunk/server/server-core/server-core.iml
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/trunk/server/server-integration/server-integration.iml
Log:
Fix JBPM-2193: Process diagram, first cut
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -23,10 +23,28 @@
import com.mvc4g.client.Controller;
import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Event;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.Frame;
+import com.google.gwt.user.client.WindowCloseListener;
+import com.google.gwt.user.client.DOM;
import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
+import org.gwt.mosaic.ui.client.WindowPanel;
+import org.gwt.mosaic.ui.client.Caption;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
import org.jboss.bpm.console.client.common.PropertyGrid;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.TaskRef;
+import org.jboss.bpm.console.client.task.LoadTasksAction;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.util.WindowUtil;
+import org.jboss.bpm.console.client.ApplicationContext;
+import java.util.Date;
+
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@@ -40,21 +58,83 @@
private ProcessInstanceRef currentInstance;
- public InstanceDetailView()
+ private Button activityBtn;
+
+ private WindowPanel windowPanel;
+
+ private ApplicationContext appContext;
+
+ private ProcessDiagramView diagramView;
+
+ public InstanceDetailView(ApplicationContext appContext)
{
super("Instance details");
+ this.appContext = appContext;
+
super.setStyleName("bpm-detail-panel");
+ super.setLayout(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
grid = new PropertyGrid(
new String[] {"ID:", "Key:", "State", "Start Date:"}
);
- this.add(grid);
+ this.add(grid, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ activityBtn = new Button("Activity",
+ new ClickListener()
+ {
+ public void onClick(Widget widget)
+ {
+ if(currentInstance!=null)
+ {
+ createActivityWindow(currentInstance);
+ controller.handleEvent(
+ new Event(LoadActivityDiagramAction.ID, currentInstance)
+ );
+ }
+ }
+ }
+ );
+
+ activityBtn.setEnabled(false);
+ this.add(activityBtn);
}
+ private void createActivityWindow(ProcessInstanceRef inst)
+ {
+ windowPanel = new WindowPanel(inst.getId());
+ windowPanel.setAnimationEnabled(true);
+ windowPanel.setSize("320px", "240px");
+
+ windowPanel.addWindowCloseListener(new WindowCloseListener() {
+ public void onWindowClosed() {
+ windowPanel = null;
+
+ }
+
+ public String onWindowClosing() {
+ return null;
+ }
+ });
+
+
+ windowPanel.setWidget(diagramView);
+
+ WindowUtil.addMaximizeButton(windowPanel, Caption.CaptionRegion.RIGHT);
+ WindowUtil.addMinimizeButton(windowPanel, Caption.CaptionRegion.RIGHT);
+
+ // display
+ windowPanel.center();
+
+ }
+
public void setController(Controller controller)
{
this.controller = controller;
+
+ this.diagramView = new ProcessDiagramView();
+ controller.addView(ProcessDiagramView.ID, diagramView);
+ controller.addAction(LoadActivityDiagramAction.ID, new LoadActivityDiagramAction(appContext));
}
public void update(ProcessInstanceRef instance)
@@ -69,11 +149,15 @@
};
grid.update(values);
+
+ this.activityBtn.setEnabled(true);
}
public void clearView()
{
grid.clear();
this.currentInstance = null;
+ this.activityBtn.setEnabled(false);
+
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -38,6 +38,7 @@
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.util.SimpleDateFormat;
+import org.jboss.bpm.console.client.ApplicationContext;
import java.util.List;
@@ -62,9 +63,13 @@
private SimpleDateFormat dateFormat = new SimpleDateFormat();
- public InstanceListView()
+ private ApplicationContext appContext;
+
+ public InstanceListView(ApplicationContext appContext)
{
super();
+ this.appContext = appContext;
+
ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
setTitle("Process Instances");
setIcon(icons.instanceIcon());
@@ -271,9 +276,11 @@
layout.add(instanceList, new BorderLayoutData(BorderLayout.Region.CENTER));
// details
- InstanceDetailView detailsView = new InstanceDetailView();
+ InstanceDetailView detailsView = new InstanceDetailView(appContext);
controller.addView(InstanceDetailView.ID, detailsView);
+
controller.addAction(UpdateInstanceDetailAction.ID, new UpdateInstanceDetailAction());
+
layout.add(detailsView, new BorderLayoutData(BorderLayout.Region.SOUTH,10,200));
this.add(layout);
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadActivityDiagramAction.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,104 @@
+/*
+ * 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.process;
+
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.process.events.ActivityDiagramResultEvent;
+import org.jboss.bpm.console.client.util.JSONWalk;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.DiagramNodeInfo;
+import org.jboss.bpm.console.client.model.ActiveNodeInfo;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.json.client.JSONParser;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class LoadActivityDiagramAction extends AbstractRESTAction
+{
+ public final static String ID = LoadActivityDiagramAction.class.getName();
+
+ public LoadActivityDiagramAction(ApplicationContext appContetext)
+ {
+ super(appContetext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ ProcessInstanceRef inst = (ProcessInstanceRef)event;
+ return appContext.getUrlBuilder().getActiveNodeInfoURL(inst.getId());
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(
+ final Controller controller, final Object event, Response response)
+ {
+ ProcessInstanceRef inst = (ProcessInstanceRef)event;
+
+ ConsoleLog.debug("Parse: " + response.getText());
+
+ //TODO: move to DTO Parser
+ JSONValue root = JSONParser.parse(response.getText());
+ //int diagramWidth = JSONWalk.on(root).next("diagramWidth").asInt();
+ //int diagramHeight = JSONWalk.on(root).next("diagramHeight").asInt();
+
+ JSONObject activeNode = JSONWalk.on(root).next("activeNode").asObject();
+
+ int x = JSONWalk.on(activeNode).next("x").asInt();
+ int y = JSONWalk.on(activeNode).next("y").asInt();
+
+ int width = JSONWalk.on(activeNode).next("width").asInt();
+ int height = JSONWalk.on(activeNode).next("height").asInt();
+ String name = JSONWalk.on(activeNode).next("name").asString();
+
+ ActiveNodeInfo activeNodeInfo =
+ new ActiveNodeInfo(
+ -1, -1,
+ new DiagramNodeInfo(name, x, y, width, height)
+ );
+
+ // update view
+ ProcessDiagramView view = (ProcessDiagramView) controller.getView(ProcessDiagramView.ID);
+ view.update(
+ new ActivityDiagramResultEvent(
+ appContext.getUrlBuilder().getProcessImageURL(inst.getDefinitionId()),
+ activeNodeInfo
+ )
+ );
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDiagramView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDiagramView.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDiagramView.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,86 @@
+/*
+ * 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.process;
+
+import org.jboss.bpm.console.client.model.DiagramNodeInfo;
+import org.jboss.bpm.console.client.model.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.process.events.ActivityDiagramResultEvent;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.mvc4g.client.ViewInterface;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ProcessDiagramView extends LayoutPanel
+ implements ViewInterface
+{
+
+ public final static String ID = ProcessDiagramView.class.getName();
+
+ private ProcessDefinitionRef processRef;
+
+ private ProcessInstanceRef instanceRef;
+
+ private Controller controller;
+
+ public ProcessDiagramView()
+ {
+ super();
+ }
+
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void update(ActivityDiagramResultEvent event)
+ {
+
+ ActiveNodeInfo activeNodeInfo = event.getActiveNodeInfo();
+ DiagramNodeInfo activeNode = activeNodeInfo.getActiveNode();
+ String imageUrl = event.getImageUrl();
+
+ // remove contents
+ this.clear();
+
+ // add overlay
+ HTML html = new HTML(
+ "<div style='width:1024px; height:768px; background-color:#ffffff;'><div id=\"imageContainer\" style=\"position:relative;top:-1;left:-1;height:"+activeNodeInfo.getHeight()+"px;width:"+activeNodeInfo.getWidth()+"px\">" +
+ "<img src=\""+imageUrl+"\" style=\"position:absolute;top:0;left:0\" />" +
+ "" +
+ "<div class=\"activeNode\" style=\"top:"+ (activeNode.getY()) +"px;left:"+activeNode.getX()+"px;width:"+(activeNode.getWidth()-2)+"px;height:"+(activeNode.getHeight()-2)+"px\"></div>" +
+ "" +
+ "<div class=\"activeNode-header\" style=\"top:"+(activeNode.getY()-15)+"px;left:"+activeNode.getX()+"px;width:"+activeNode.getWidth()+"px;height:15px\">" +
+ " <div class=\"activeNode-header-link\"><a href=\"javascript:alert('Not implemented!')\">Running</a></div>" +
+ "</div>" +
+ "</div></div>"
+ );
+
+ this.add(html);
+ invalidate();
+ }
+}
\ No newline at end of file
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -98,7 +98,7 @@
// create and register views
registerView(DefinitionListView.ID, new DefinitionListView());
- registerView(InstanceListView.ID, new InstanceListView());
+ registerView(InstanceListView.ID, new InstanceListView(appContext));
// create and register actions
registerAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/ActivityDiagramResultEvent.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process.events;
+
+import org.jboss.bpm.console.client.model.ActiveNodeInfo;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ActivityDiagramResultEvent
+{
+ private String imageUrl;
+ private ActiveNodeInfo activeNodeInfo;
+
+ public ActivityDiagramResultEvent()
+ {
+ }
+
+ public ActivityDiagramResultEvent(String imageUrl, ActiveNodeInfo activeNodeInfo)
+ {
+ this.imageUrl = imageUrl;
+ this.activeNodeInfo = activeNodeInfo;
+ }
+
+ public String getImageUrl()
+ {
+ return imageUrl;
+ }
+
+ public void setImageUrl(String imageUrl)
+ {
+ this.imageUrl = imageUrl;
+ }
+
+ public ActiveNodeInfo getActiveNodeInfo()
+ {
+ return activeNodeInfo;
+ }
+
+ public void setActiveNodeInfo(ActiveNodeInfo activeNodeInfo)
+ {
+ this.activeNodeInfo = activeNodeInfo;
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-05-25 14:31:11 UTC (rev 4887)
@@ -190,7 +190,7 @@
position:absolute;
border-width:1px;
border-style:solid;
- border-color:#6699CC;
+ border-color:#339933;
}
div.activeNode-header {
@@ -208,8 +208,8 @@
padding-right:3px;
border-width:1px;
border-style:solid;
- border-color:#6699CC;
- background-color:#6699CC;
+ border-color:#339933;
+ background-color:#339933;
}
div.activeNode-header-link a {
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -24,7 +24,7 @@
import com.google.gwt.http.client.URL;
import com.google.gwt.core.client.GWT;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+import org.jboss.bpm.console.client.model.TokenReference;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -77,12 +77,12 @@
public String getProcessImageURL(String processId)
{
String encodedId = URL.encode(processId);
- return config.getConsoleServerUrl() + "/rs/jbpm3/definitions/" + encodedId+ "/image";
+ return config.getConsoleServerUrl() + "/rs/process/definitions/"+ encodedId+ "/image";
}
public String getActiveNodeInfoURL(String instanceId)
{
- return config.getConsoleServerUrl() + "/rs/jbpm3/instances/" + instanceId + "/activeNodeInfo";
+ return config.getConsoleServerUrl() + "/rs/process/instances/" + instanceId + "/activeNodeInfo";
}
public String getStateChangeURL(String instanceId, ProcessInstanceRef.STATE state)
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -22,9 +22,8 @@
package org.jboss.bpm.console.client.model;
import com.google.gwt.json.client.*;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-import org.jboss.bpm.console.client.util.JSONWalk;
import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.util.JSONWalk;
import java.util.ArrayList;
import java.util.Date;
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ActiveNodeInfo.java (from rev 4881, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/ActiveNodeInfo.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ActiveNodeInfo.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ActiveNodeInfo.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,82 @@
+/*
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+ at XmlRootElement(name = "activeNodeInfo")
+public class ActiveNodeInfo
+{
+ private int width = -1;
+ private int height = -1;
+
+ private DiagramNodeInfo activeNode;
+
+
+ public ActiveNodeInfo()
+ {
+ }
+
+ public ActiveNodeInfo(int width, int height, DiagramNodeInfo activeNode)
+ {
+ this.width = width;
+ this.height = height;
+ this.activeNode = activeNode;
+ }
+
+ @XmlElement(name = "diagramWidth")
+ public int getWidth()
+ {
+ return width;
+ }
+
+ public void setWidth(int width)
+ {
+ this.width = width;
+ }
+
+ @XmlElement(name = "diagramHeight")
+ public int getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(int height)
+ {
+ this.height = height;
+ }
+
+ @XmlElement(name = "activeNode")
+ public DiagramNodeInfo getActiveNode()
+ {
+ return activeNode;
+ }
+
+ public void setActiveNode(DiagramNodeInfo activeNode)
+ {
+ this.activeNode = activeNode;
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ActiveNodeInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramInfo.java (from rev 4881, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/DiagramInfo.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramInfo.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramInfo.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,81 @@
+/*
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.*;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+ at XmlRootElement(name = "diagramInfo")
+public class DiagramInfo
+{
+ private int width = -1;
+ private int height = -1;
+ private List<DiagramNodeInfo> nodeList = new ArrayList<DiagramNodeInfo>();
+
+ public DiagramInfo()
+ {
+ }
+
+ public DiagramInfo(final int height, final int width, final List<DiagramNodeInfo> l) {
+ this.height = height;
+ this.width = width;
+ final List<DiagramNodeInfo> list = new ArrayList<DiagramNodeInfo>();
+ for (DiagramNodeInfo nodeInfo : l) {
+ list.add(nodeInfo);
+ }
+ nodeList = Collections.unmodifiableList(list);
+ }
+
+ public int getWidth()
+ {
+ return width;
+ }
+
+ public void setWidth(int width)
+ {
+ this.width = width;
+ }
+
+ public int getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(int height)
+ {
+ this.height = height;
+ }
+
+ public List<DiagramNodeInfo> getNodeList()
+ {
+ return nodeList;
+ }
+
+ public void setNodeList(List<DiagramNodeInfo> nodeList)
+ {
+ this.nodeList = nodeList;
+ }
+
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramNodeInfo.java (from rev 4881, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/DiagramNodeInfo.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramNodeInfo.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramNodeInfo.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,103 @@
+/*
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+ at XmlRootElement(name = "nodeInfo")
+public class DiagramNodeInfo
+{
+ private String name;
+ private int x;
+ private int y;
+ private int width;
+ private int height;
+
+ public DiagramNodeInfo()
+ {
+ }
+
+ public DiagramNodeInfo(
+ final String name,
+ final int x, final int y,
+ final int width, final int height)
+ {
+ this.height = height;
+ this.name = name;
+ this.width = width;
+ this.x = x;
+ this.y = y;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public int getX()
+ {
+ return x;
+ }
+
+ public void setX(int x)
+ {
+ this.x = x;
+ }
+
+ public int getY()
+ {
+ return y;
+ }
+
+ public void setY(int y)
+ {
+ this.y = y;
+ }
+
+ public int getWidth()
+ {
+ return width;
+ }
+
+ public void setWidth(int width)
+ {
+ this.width = width;
+ }
+
+ public int getHeight()
+ {
+ return height;
+ }
+
+ public void setHeight(int height)
+ {
+ this.height = height;
+ }
+}
Property changes on: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DiagramNodeInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessInstanceRef.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -22,7 +22,7 @@
package org.jboss.bpm.console.client.model;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+import org.jboss.bpm.console.client.model.TokenReference;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
Copied: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TokenReference.java (from rev 4881, projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/jbpm3/TokenReference.java)
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TokenReference.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TokenReference.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,115 @@
+/*
+ * 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.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+ at XmlRootElement(name = "tokenReference")
+public class TokenReference
+{
+ private String id;
+ private String name;
+
+ private String currentNodeName;
+
+ private List<TokenReference> children = new ArrayList<TokenReference>();
+ private List<String> availableSignals = new ArrayList<String>();
+
+ private boolean canBeSignaled = true;
+
+ public TokenReference()
+ {
+ }
+
+ public TokenReference(String id, String name, String nodeName)
+ {
+ this.id = id;
+ this.name = name!=null ? name : "";
+ this.currentNodeName = nodeName;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setCurrentNodeName(String currentNodeName)
+ {
+ this.currentNodeName = currentNodeName;
+ }
+
+ public void setChildren(List<TokenReference> children)
+ {
+ this.children = children;
+ }
+
+ public void setAvailableSignals(List<String> availableSignals)
+ {
+ this.availableSignals = availableSignals;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public List<TokenReference> getChildren()
+ {
+ return children;
+ }
+
+ public List<String> getAvailableSignals()
+ {
+ return availableSignals;
+ }
+
+ public String getCurrentNodeName()
+ {
+ return currentNodeName;
+ }
+
+ public boolean canBeSignaled()
+ {
+ return canBeSignaled;
+ }
+
+ public void setCanBeSignaled(boolean canBeSignaled)
+ {
+ this.canBeSignaled = canBeSignaled;
+ }
+
+}
Modified: projects/gwt-console/trunk/server/server-core/server-core.iml
===================================================================
--- projects/gwt-console/trunk/server/server-core/server-core.iml 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/server/server-core/server-core.iml 2009-05-25 14:31:11 UTC (rev 4887)
@@ -11,6 +11,8 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="gwt-parent" />
+ <orderEntry type="module" module-name="server-integration" />
+ <orderEntry type="module" module-name="gwt-rpc" />
<orderEntry type="module-library" exported="">
<library name="M2 Dep: org.slf4j:slf4j-simple:jar:1.5.2:compile">
<CLASSES>
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -23,12 +23,12 @@
import org.jboss.bpm.console.server.plugin.TaskDispatcherPlugin;
import org.jboss.bpm.console.server.plugin.PluginMgr;
+import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.client.model.ServerStatus;
import org.jboss.bpm.console.client.model.PluginInfo;
import javax.ws.rs.Path;
-import javax.ws.rs.POST;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
@@ -42,7 +42,10 @@
public class InfoFacade
{
- private Class[] pluginInterfaces = {TaskDispatcherPlugin.class};
+ private Class[] pluginInterfaces = {
+ TaskDispatcherPlugin.class,
+ GraphViewerPlugin.class
+ };
private ServerStatus status = null;
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -21,29 +21,30 @@
*/
package org.jboss.bpm.console.server;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Context;
-import javax.servlet.http.HttpServletRequest;
-
+import com.google.gson.Gson;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.jboss.bpm.console.client.model.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.ProcessDefinitionRefWrapper;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRefWrapper;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jboss.bpm.console.server.plugin.PluginMgr;
+import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
-import com.google.gson.Gson;
-
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import java.io.InputStream;
import java.util.Iterator;
import java.util.List;
-import java.io.InputStream;
/**
* REST server module for accessing process related data.
@@ -54,7 +55,9 @@
public class ProcessMgmtFacade
{
private static final Log log = LogFactory.getLog(ProcessMgmtFacade.class);
+
private ProcessManagement processManagement;
+ private GraphViewerPlugin graphViewerPlugin;
private ProcessManagement getProcessManagement()
{
@@ -68,6 +71,18 @@
return this.processManagement;
}
+ private GraphViewerPlugin getProcessGraphViewPlugin()
+ {
+ if(graphViewerPlugin==null)
+ {
+ graphViewerPlugin = PluginMgr.load(
+ GraphViewerPlugin.class
+ );
+ }
+
+ return graphViewerPlugin;
+ }
+
@GET
@Path("definitions")
@Produces("application/json")
@@ -252,7 +267,46 @@
return Response.ok().build();
}
+ @GET
+ @Path("definitions/{id}/image")
+ @Produces("image/*")
+ public Response getProcessImage(
+ @PathParam("id")
+ String id
+ )
+ {
+ GraphViewerPlugin plugin = getProcessGraphViewPlugin();
+ if(plugin !=null)
+ {
+ return Response.ok(plugin.getProcessImage(id)).type("image/png").build();
+ }
+ throw new RuntimeException(
+ GraphViewerPlugin.class.getName()+ " not available."
+ );
+ }
+
+ @GET
+ @Path("instances/{id}/activeNodeInfo")
+ @Produces("application/json")
+ public Response getActiveNodeInfo(
+ @PathParam("id")
+ String id)
+ {
+
+ GraphViewerPlugin plugin = getProcessGraphViewPlugin();
+ if(plugin !=null)
+ {
+ ActiveNodeInfo info = plugin.getActiveNodeInfo(id);
+ return createJsonResponse(info);
+ }
+
+ throw new RuntimeException(
+ GraphViewerPlugin.class.getName()+ " not available."
+ );
+
+ }
+
private Response createJsonResponse(Object wrapper)
{
Gson gson = GsonFactory.createInstance();
Modified: projects/gwt-console/trunk/server/server-integration/server-integration.iml
===================================================================
--- projects/gwt-console/trunk/server/server-integration/server-integration.iml 2009-05-25 14:15:29 UTC (rev 4886)
+++ projects/gwt-console/trunk/server/server-integration/server-integration.iml 2009-05-25 14:31:11 UTC (rev 4887)
@@ -78,6 +78,7 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module" module-name="gwt-rpc" />
<orderEntryProperties />
</component>
</module>
Added: projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java
===================================================================
--- projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java (rev 0)
+++ projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java 2009-05-25 14:31:11 UTC (rev 4887)
@@ -0,0 +1,39 @@
+/*
+ * 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.server.plugin;
+
+import org.jboss.bpm.console.client.model.ActiveNodeInfo;
+import org.jboss.bpm.console.client.model.DiagramInfo;
+
+/**
+ * Access process graph image and coordinates.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public interface GraphViewerPlugin
+{
+ byte[] getProcessImage(String processId);
+
+ DiagramInfo getDiagramInfo(String processId);
+
+ ActiveNodeInfo getActiveNodeInfo(String instanceId);
+}
More information about the jbpm-commits
mailing list