[jbpm-commits] JBoss JBPM SVN: r5196 - in projects/gwt-console/trunk: gui/war/src/main/java/org/jboss/bpm/console/client/icons and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Jul 2 17:12:57 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-07-02 17:12:56 -0400 (Thu, 02 Jul 2009)
New Revision: 5196
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/InstanceEvent.java
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java
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/UpdateInstanceDetailAction.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/ProcessDefinitionRef.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/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java
Log:
Process diagram is optional
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -210,8 +210,10 @@
{
if(isError)
{
+ ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
+
WindowPanel err = new WindowPanel("Error");
- err.getHeader().add( new Image("images/icons/error.png") );
+ err.getHeader().add( icons.errorIcon().createImage() );
err.setAnimationEnabled(true);
err.setSize("320px", "240px");
ScrollLayoutPanel scrollLayoutPanel = new ScrollLayoutPanel();
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java 2009-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/ConsoleIconBundle.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -75,7 +75,7 @@
AbstractImagePrototype collapseLeftIcon();
/**
- * @gwt.resource dialog-error.png
+ * @gwt.resource errorIcon.png
*/
AbstractImagePrototype errorIcon();
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-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceDetailView.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -29,15 +29,13 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.WindowCloseListener;
import com.google.gwt.user.client.WindowResizeListener;
-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.Label;
+import org.gwt.mosaic.ui.client.*;
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.jboss.bpm.console.client.common.PropertyGrid;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.util.SimpleDateFormat;
import org.jboss.bpm.console.client.util.WindowUtil;
import org.jboss.bpm.console.client.ApplicationContext;
@@ -73,8 +71,9 @@
private boolean hasDiagramPlugin;
private SimpleDateFormat dateFormat = new SimpleDateFormat();
-
- public InstanceDetailView(ApplicationContext appContext)
+ private ProcessDefinitionRef currentDefintion;
+
+ public InstanceDetailView(final ApplicationContext appContext)
{
super("Instance details");
this.appContext = appContext;
@@ -94,13 +93,23 @@
{
public void onClick(Widget widget)
{
- if(currentInstance!=null)
+ String diagramUrl = getCurrentDefintion().getDiagramUrl();
+ if(diagramUrl !=null && !diagramUrl.equals(""))
{
- createDiagramWindow(currentInstance);
- controller.handleEvent(
- new Event(LoadActivityDiagramAction.ID, currentInstance)
- );
+ ProcessInstanceRef selection = getCurrentInstance();
+ if(selection!=null)
+ {
+ createDiagramWindow(selection);
+ controller.handleEvent(
+ new Event(LoadActivityDiagramAction.ID, selection)
+ );
+ }
}
+ else
+ {
+ MessageBox.alert("Incomplete deployment", "No diagram associated with process");
+ }
+
}
}
);
@@ -146,7 +155,7 @@
Label header = new Label("Instance: "+inst.getId());
header.setStyleName("bpm-label-header");
layout.add(header, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
-
+
diagramWindowPanel.addWindowCloseListener(new WindowCloseListener() {
public void onWindowClosed() {
diagramWindowPanel = null;
@@ -192,7 +201,7 @@
new WindowResizeListener() {
public void onWindowResized(int i, int i1)
- {
+ {
instanceDataView.invalidate();
}
}
@@ -221,8 +230,9 @@
controller.addAction(UpdateInstanceDataAction.ID, new UpdateInstanceDataAction(appContext));
}
- public void update(ProcessInstanceRef instance)
+ public void update(ProcessDefinitionRef def, ProcessInstanceRef instance)
{
+ this.currentDefintion = def;
this.currentInstance = instance;
String[] values = new String[] {
@@ -244,9 +254,21 @@
public void clearView()
{
grid.clear();
+ this.currentDefintion=null;
this.currentInstance = null;
this.diagramBtn.setEnabled(false);
instanceDataBtn.setEnabled(false);
}
+
+
+ private ProcessDefinitionRef getCurrentDefintion()
+ {
+ return currentDefintion;
+ }
+
+ private ProcessInstanceRef getCurrentInstance()
+ {
+ return currentInstance;
+ }
}
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-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -34,6 +34,7 @@
import org.gwt.mosaic.ui.client.layout.*;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.process.events.InstanceEvent;
import org.jboss.bpm.console.client.common.AbstractView;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
@@ -131,7 +132,9 @@
// update details
controller.handleEvent(
- new Event(UpdateInstanceDetailAction.ID, item)
+ new Event(UpdateInstanceDetailAction.ID,
+ new InstanceEvent(currentDefinition, item)
+ )
);
}
}
@@ -171,7 +174,7 @@
{
if(doIt)
{
- String url = getCurrentDefinition().getUrl();
+ String url = getCurrentDefinition().getFormUrl();
boolean hasForm = (url !=null && !url.equals(""));
if(hasForm)
{
@@ -347,7 +350,7 @@
);
ConsoleLog.debug(frame.getElement().toString());
- frame.setUrl(process.getUrl());
+ frame.setUrl(process.getFormUrl());
layout.add(frame, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
windowPanel.setWidget(layout);
@@ -391,7 +394,9 @@
// clear details
controller.handleEvent(
- new Event(UpdateInstanceDetailAction.ID, null)
+ new Event(UpdateInstanceDetailAction.ID,
+ new InstanceEvent(def, null)
+ )
);
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDetailAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDetailAction.java 2009-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstanceDetailAction.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -24,6 +24,7 @@
import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Controller;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.process.events.InstanceEvent;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -34,11 +35,12 @@
public void execute(Controller controller, Object object)
{
- ProcessInstanceRef instance = object!=null ? (ProcessInstanceRef)object : null;
+ InstanceEvent event = (InstanceEvent)object;
+
InstanceDetailView view = (InstanceDetailView)controller.getView(InstanceDetailView.ID);
- if(instance!=null)
- view.update(instance);
+ if(event.getInstance()!=null)
+ view.update(event.getDefinition(), event.getInstance());
else
view.clearView();
}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/InstanceEvent.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/InstanceEvent.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/events/InstanceEvent.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -0,0 +1,50 @@
+/*
+ * 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.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class InstanceEvent
+{
+ private ProcessDefinitionRef definition;
+ private ProcessInstanceRef instance;
+
+ public InstanceEvent(ProcessDefinitionRef definition, ProcessInstanceRef instance)
+ {
+ this.definition = definition;
+ this.instance = instance;
+ }
+
+ public ProcessDefinitionRef getDefinition()
+ {
+ return definition;
+ }
+
+ public ProcessInstanceRef getInstance()
+ {
+ return instance;
+ }
+}
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-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -61,10 +61,15 @@
ref.setSuspended(isSuspended);
// optional start form url
- JSONWalk.JSONWrapper url = JSONWalk.on(root).next("url");
- if(url!=null)
- ref.setUrl(url.asString());
-
+ JSONWalk.JSONWrapper formUrl = JSONWalk.on(root).next("formUrl");
+ if(formUrl !=null)
+ ref.setFormUrl(formUrl.asString());
+
+ // optional diagram url
+ JSONWalk.JSONWrapper diagramUrl = JSONWalk.on(root).next("diagramUrl");
+ if(diagramUrl !=null)
+ ref.setDiagramUrl(diagramUrl.asString());
+
return ref;
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2009-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -40,7 +40,8 @@
private String deploymentId;
private boolean suspended;
- private String url = null;
+ private String formUrl = null;
+ private String diagramUrl = null;
public ProcessDefinitionRef()
{
@@ -165,13 +166,23 @@
return result;
}
- public void setUrl(String s)
+ public void setFormUrl(String s)
{
- this.url = s;
+ this.formUrl = s;
}
- public String getUrl()
+ public String getFormUrl()
{
- return url;
+ return formUrl;
}
+
+ public String getDiagramUrl()
+ {
+ return diagramUrl;
+ }
+
+ public void setDiagramUrl(String diagramUrl)
+ {
+ this.diagramUrl = diagramUrl;
+ }
}
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-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -32,13 +32,13 @@
import org.jboss.bpm.console.server.plugin.FormDispatcherPlugin;
import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
import org.jboss.bpm.console.server.plugin.PluginMgr;
+import org.jboss.bpm.console.server.util.Payload2XML;
import org.jboss.bpm.console.server.util.RsComment;
-import org.jboss.bpm.console.server.util.Payload2XML;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Context;
-import javax.servlet.http.HttpServletRequest;
import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -87,7 +87,7 @@
return this.processManagement;
}
- private GraphViewerPlugin getProcessGraphViewPlugin()
+ private GraphViewerPlugin getGraphViewerPlugin()
{
if(graphViewerPlugin==null)
{
@@ -108,6 +108,10 @@
return decorateProcessDefintions(processDefinitions);
}
+ /**
+ * Enriches {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef} with
+ * form and diagram URLs if applicable.
+ */
private Response decorateProcessDefintions( List<ProcessDefinitionRef> processDefinitions)
{
// decorate process form URL if plugin available
@@ -121,11 +125,25 @@
);
if(processFormURL!=null)
{
- def.setUrl(processFormURL.toExternalForm());
+ def.setFormUrl(processFormURL.toExternalForm());
}
}
}
+ // decorate the diagram URL if available
+ GraphViewerPlugin graphViewer = getGraphViewerPlugin();
+ if(graphViewer!=null)
+ {
+ for(ProcessDefinitionRef def : processDefinitions)
+ {
+ URL diagramUrl = graphViewer.getDiagramURL(def.getId());
+ if(diagramUrl!=null)
+ {
+ def.setDiagramUrl(diagramUrl.toExternalForm());
+ }
+ }
+ }
+
ProcessDefinitionRefWrapper wrapper =
new ProcessDefinitionRefWrapper(processDefinitions);
return createJsonResponse(wrapper);
@@ -188,7 +206,7 @@
{
Map<String, Object> javaPayload = getProcessManagement().getInstanceData(instanceId);
Payload2XML payload2XML = new Payload2XML();
- StringBuffer sb = payload2XML.convert(instanceId, javaPayload);
+ StringBuffer sb = payload2XML.convert(instanceId, javaPayload);
return Response.ok(sb.toString()).build();
}
@@ -270,13 +288,13 @@
@Path("definition/{id}/image")
@Produces("image/*")
public Response getProcessImage(
- @Context
- HttpServletRequest request,
- @PathParam("id")
- String id
+ @Context
+ HttpServletRequest request,
+ @PathParam("id")
+ String id
)
{
- GraphViewerPlugin plugin = getProcessGraphViewPlugin();
+ GraphViewerPlugin plugin = getGraphViewerPlugin();
if(plugin !=null)
{
byte[] processImage = plugin.getProcessImage(id);
@@ -299,7 +317,7 @@
String id)
{
- GraphViewerPlugin plugin = getProcessGraphViewPlugin();
+ GraphViewerPlugin plugin = getGraphViewerPlugin();
if(plugin !=null)
{
List<ActiveNodeInfo> info = plugin.getActiveNodeInfo(id);
Modified: 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 2009-07-02 21:11:53 UTC (rev 5195)
+++ projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/GraphViewerPlugin.java 2009-07-02 21:12:56 UTC (rev 5196)
@@ -22,6 +22,7 @@
package org.jboss.bpm.console.server.plugin;
import java.util.List;
+import java.net.URL;
import org.jboss.bpm.console.client.model.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.DiagramInfo;
@@ -33,9 +34,17 @@
*/
public interface GraphViewerPlugin
{
+ /**
+ * Check {@link #getDiagramURL(String)} != null before invoking.
+ */
byte[] getProcessImage(String processId);
DiagramInfo getDiagramInfo(String processId);
List<ActiveNodeInfo> getActiveNodeInfo(String instanceId);
+
+ /**
+ * Can be null, in case no diagram is associated with the process
+ */
+ URL getDiagramURL(String id);
}
More information about the jbpm-commits
mailing list