JBoss JBPM SVN: r4594 - in projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client: common and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-21 10:41:11 -0400 (Tue, 21 Apr 2009)
New Revision: 4594
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/
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
Removed:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/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/StartNewInstanceAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java
Log:
Create common package
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java (from rev 4587, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractContextAwareAction.java 2009-04-21 14:41:11 UTC (rev 4594)
@@ -0,0 +1,38 @@
+/*
+ * 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;
+ }
+}
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java (from rev 4592, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/common/AbstractDataRequestAction.java (rev 0)
+++ 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)
@@ -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 AbstractDataRequestAction implements ActionInterface
+{
+ protected ApplicationContext appContext;
+
+ protected AbstractDataRequestAction(ApplicationContext appContetext)
+ {
+ 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 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);
+
+ }
+}
Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java 2009-04-21 14:26:36 UTC (rev 4593)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java 2009-04-21 14:41:11 UTC (rev 4594)
@@ -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.process;
-
-import com.mvc4g.client.ActionInterface;
-import org.jboss.bpm.console.client.ApplicationContext;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-abstract class AbstractContextAwareAction implements ActionInterface
-{
- ApplicationContext appContext;
-
- public AbstractContextAwareAction(ApplicationContext appContext)
- {
- this.appContext = appContext;
- }
-}
Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java 2009-04-21 14:26:36 UTC (rev 4593)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java 2009-04-21 14:41:11 UTC (rev 4594)
@@ -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.process;
-
-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>
- */
-abstract class AbstractDataRequestAction implements ActionInterface
-{
- protected ApplicationContext appContext;
-
- protected AbstractDataRequestAction(ApplicationContext appContetext)
- {
- 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 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-21 14:26:36 UTC (rev 4593)
+++ 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)
@@ -27,6 +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.model.DTOParser;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
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:26:36 UTC (rev 4593)
+++ 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)
@@ -27,6 +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.model.DTOParser;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
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-21 14:26:36 UTC (rev 4593)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-04-21 14:41:11 UTC (rev 4594)
@@ -26,6 +26,7 @@
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.model.ProcessDefinitionRef;
/**
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-21 14:26:36 UTC (rev 4593)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java 2009-04-21 14:41:11 UTC (rev 4594)
@@ -22,6 +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.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import com.mvc4g.client.Controller;
15 years, 1 month
JBoss JBPM SVN: r4593 - 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 10:26:36 -0400 (Tue, 21 Apr 2009)
New Revision: 4593
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
Log:
Enable scrolling in error window
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-04-21 14:08:03 UTC (rev 4592)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-04-21 14:26:36 UTC (rev 4593)
@@ -134,7 +134,9 @@
err.getHeader().add( new Image("images/icons/error.png") );
err.setAnimationEnabled(true);
err.setSize("320px", "240px");
- err.setWidget( new HTML(message) );
+ ScrollLayoutPanel scrollLayoutPanel = new ScrollLayoutPanel();
+ scrollLayoutPanel.add(new HTML(message));
+ err.setWidget(scrollLayoutPanel);
WindowUtil.addMaximizeButton(err, Caption.CaptionRegion.RIGHT);
WindowUtil.addMinimizeButton(err, Caption.CaptionRegion.RIGHT);
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-21 14:26:36 UTC (rev 4593)
@@ -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.process;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONParser;
+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.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+
+import java.util.List;
+
+/**
+ * Force loading of a process instance list.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class LoadInstancesAction extends AbstractDataRequestAction
+{
+ public final static String ID = LoadInstancesAction.class.getName();
+
+ public LoadInstancesAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ String getId()
+ {
+ return ID;
+ }
+
+ String getUrl(Object event)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
+ return appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
+ }
+
+ RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ protected void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
+ JSONValue json = JSONParser.parse(response.getText());
+
+ List<ProcessInstanceRef> instances = DTOParser.parseProcessInstances(json);
+ InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
+ view.update(def, instances);
+
+ appContext.displayMessage("Loaded " + instances.size() + " process instances", false);
+
+ }
+
+}
+
15 years, 1 month
JBoss JBPM SVN: r4592 - in projects/gwt-console/branches/hbraun: plugin-api/src/main/java/org/jboss/bpm/console/client/util and 5 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-21 10:08:03 -0400 (Tue, 21 Apr 2009)
New Revision: 4592
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/util/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/util/WindowUtil.java
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/icons/error.png
Removed:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequest.java
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequestHandler.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/resources/org/jboss/bpm/console/public/js/ext/
Modified:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
Log:
Drop JSON request handler. Improve error handling and verbosity upon HTTP requests
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-04-21 11:54:32 UTC (rev 4591)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -21,7 +21,6 @@
*/
package org.jboss.bpm.console.client.model;
-import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.*;
import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
import org.jboss.bpm.console.client.util.ConsoleLog;
@@ -38,11 +37,11 @@
*/
public class DTOParser
{
- public static List<ProcessDefinitionRef> parseProcessDefinitions(JavaScriptObject jso)
+ public static List<ProcessDefinitionRef> parseProcessDefinitions(JSONValue jso)
{
List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
- JSONArray arr = JSONWalk.on( new JSONObject(jso)).next("definitions").asArray();
+ JSONArray arr = JSONWalk.on(jso).next("definitions").asArray();
for(int i=0; i<arr.size(); i++)
{
results.add(parseProcessDefinition(arr.get(i)));
@@ -178,11 +177,11 @@
return p;
}
- public static List<ProcessInstanceRef> parseProcessInstances(JavaScriptObject jso)
+ public static List<ProcessInstanceRef> parseProcessInstances(JSONValue jso)
{
List<ProcessInstanceRef> results = new ArrayList<ProcessInstanceRef>();
- JSONArray arr = JSONWalk.on( new JSONObject(jso)).next("instances").asArray();
+ JSONArray arr = JSONWalk.on(jso).next("instances").asArray();
for(int i=0; i<arr.size(); i++)
{
results.add(parseProcessInstance(arr.get(i)));
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequest.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequest.java 2009-04-21 11:54:32 UTC (rev 4591)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequest.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -1,57 +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.util;
-
-/**
- * Request helper, to bypass SOP restrictions.<br>
- * Can only be used to retrieve Json data, wrapped in a script tag.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class JSONRequest
-{
- public static void get(String url, JSONRequestHandler handler)
- {
- String callbackName = "JSONCallback" + handler.hashCode();
- get(url + "?callback=" + callbackName, callbackName, handler);
- }
-
- public static void get(String url, String callbackName, JSONRequestHandler handler)
- {
- createCallbackFunction(handler, callbackName);
- addScript(url);
- }
-
- public static native void addScript(String url) /*-{
- var scr = document.createElement("script");
- scr.setAttribute("language", "JavaScript");
- scr.setAttribute("src", url);
- document.getElementsByTagName("body")[0].appendChild(scr);
- }-*/;
-
- private native static void createCallbackFunction(JSONRequestHandler obj, String callbackName)/*-{
- tmpcallback = function(j) {
- obj.@org.jboss.bpm.console.client.util.JSONRequestHandler::onRequestComplete(Lcom/google/gwt/core/client/JavaScriptObject;)(j);
- };
- eval( "window." + callbackName + "=tmpcallback" );
- }-*/;
-}
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequestHandler.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequestHandler.java 2009-04-21 11:54:32 UTC (rev 4591)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/JSONRequestHandler.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -1,32 +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.util;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface JSONRequestHandler
-{
- void onRequestComplete(JavaScriptObject json);
-}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-04-21 11:54:32 UTC (rev 4591)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -24,14 +24,15 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
import com.mvc4g.client.Controller;
-import org.gwt.mosaic.ui.client.InfoPanel;
-import org.gwt.mosaic.ui.client.MessageBox;
-import org.gwt.mosaic.ui.client.Viewport;
+import org.gwt.mosaic.ui.client.*;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.util.WindowUtil;
/**
* The main composite that assembles the gwt console application.
@@ -128,7 +129,18 @@
public void displayMessage(final String message, final boolean isError)
{
if(isError)
- MessageBox.error("Error", message);
+ {
+ WindowPanel err = new WindowPanel("Error");
+ err.getHeader().add( new Image("images/icons/error.png") );
+ err.setAnimationEnabled(true);
+ err.setSize("320px", "240px");
+ err.setWidget( new HTML(message) );
+
+ WindowUtil.addMaximizeButton(err, Caption.CaptionRegion.RIGHT);
+ WindowUtil.addMinimizeButton(err, Caption.CaptionRegion.RIGHT);
+
+ err.center();
+ }
else
{
InfoPanel.show("", message, "");
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java (from rev 4588, 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/AbstractDataRequestAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractDataRequestAction.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -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.process;
+
+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>
+ */
+abstract class AbstractDataRequestAction implements ActionInterface
+{
+ protected ApplicationContext appContext;
+
+ protected AbstractDataRequestAction(ApplicationContext appContetext)
+ {
+ 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 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-21 11:54:32 UTC (rev 4591)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -21,14 +21,14 @@
*/
package org.jboss.bpm.console.client.process;
-import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONParser;
+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.LoadingStatusAction;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.client.util.JSONRequest;
-import org.jboss.bpm.console.client.util.JSONRequestHandler;
import java.util.List;
@@ -37,7 +37,7 @@
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
-class LoadDefinitionsAction extends AbstractContextAwareAction
+class LoadDefinitionsAction extends AbstractDataRequestAction
{
public final static String ID = LoadDefinitionsAction.class.getName();
@@ -46,48 +46,41 @@
super(appContext);
}
- /**
- *
- * @param controller
- * @param object - ignored, can be null
- */
- public void execute(final Controller controller, Object object)
+
+ String getId()
{
- String url = appContext.getUrlBuilder().getProcessDefinitionsURL();
+ return ID;
+ }
- controller.handleEvent( LoadingStatusAction.ON );
+ String getUrl(Object event)
+ {
+ return appContext.getUrlBuilder().getProcessDefinitionsURL();
+ }
- JSONRequest.get(
- url, new JSONRequestHandler()
+ RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ if (200 == response.getStatusCode())
{
- public void onRequestComplete(JavaScriptObject json)
- {
- try
- {
- if (json == null) {
- appContext.displayMessage("Couldn't retrieve process definition data", true);
- return;
- }
+ JSONValue json = JSONParser.parse(response.getText());
+ List<ProcessDefinitionRef> definitions = DTOParser.parseProcessDefinitions(json);
+ DefinitionListView view = (DefinitionListView) controller.getView(DefinitionListView.ID);
+ view.update(definitions);
- List<ProcessDefinitionRef> definitions = DTOParser.parseProcessDefinitions(json);
- DefinitionListView view = (DefinitionListView) controller.getView(DefinitionListView.ID);
- view.update(definitions);
-
- appContext.displayMessage("Loaded " + definitions.size() + " process definitions", false);
-
- }
- catch (Throwable e)
- {
- e.printStackTrace();
- appContext.displayMessage(e.getMessage(), true);
- }
- finally
- {
- controller.handleEvent( LoadingStatusAction.OFF );
- }
- }
+ appContext.displayMessage("Loaded " + definitions.size() + " process definitions", false);
}
- );
-
+ else
+ {
+ // Handle the error. Can get the status text from response.getStatusText()
+ appContext.displayMessage("Failed to load instances. " +
+ "HTTP " + response.getStatusCode()+
+ ": " +response.getText(),
+ true
+ );
+ }
}
}
Deleted: 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 11:54:32 UTC (rev 4591)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -1,95 +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.process;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.mvc4g.client.Controller;
-import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.LoadingStatusAction;
-import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-import org.jboss.bpm.console.client.util.JSONRequest;
-import org.jboss.bpm.console.client.util.JSONRequestHandler;
-
-import java.util.List;
-
-/**
- * Force loading of a process instance list.
- * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-class LoadInstancesAction extends AbstractContextAwareAction
-{
- public final static String ID = LoadInstancesAction.class.getName();
-
- public LoadInstancesAction(ApplicationContext appContext)
- {
- super(appContext);
- }
-
- /**
- *
- * @param controller
- * @param object - a {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
- */
- public void execute(final Controller controller, Object object)
- {
- final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
-
- String url = appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
-
- controller.handleEvent( LoadingStatusAction.ON );
-
- JSONRequest.get(
- url, new JSONRequestHandler()
- {
- public void onRequestComplete(JavaScriptObject json)
- {
- try
- {
- if (json == null) {
- appContext.displayMessage("Couldn't retrieve process instance data", true);
- return;
- }
-
- List<ProcessInstanceRef> instances = DTOParser.parseProcessInstances(json);
- InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
- view.update(def, instances);
-
- appContext.displayMessage("Loaded " + instances.size() + " process instances", false);
- }
- catch (Throwable e)
- {
- e.printStackTrace();
- appContext.displayMessage(e.getMessage(), true);
- }
- finally
- {
- controller.handleEvent( LoadingStatusAction.OFF );
- }
- }
- }
- );
- }
-}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/util/WindowUtil.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/util/WindowUtil.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/util/WindowUtil.java 2009-04-21 14:08:03 UTC (rev 4592)
@@ -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.util;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+import org.gwt.mosaic.ui.client.Caption;
+import org.gwt.mosaic.ui.client.ImageButton;
+import org.gwt.mosaic.ui.client.WindowPanel;
+
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class WindowUtil
+{
+ /**
+ *
+ * @param windowPanel
+ */
+ public static void addMaximizeButton(final WindowPanel windowPanel,
+ Caption.CaptionRegion captionRegion) {
+ final ImageButton maximizeBtn = new ImageButton(
+ Caption.IMAGES.windowMaximize());
+ maximizeBtn.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ if (windowPanel.getWindowState() == WindowPanel.WindowState.MAXIMIZED) {
+ windowPanel.setWindowState(WindowPanel.WindowState.NORMAL);
+ } else {
+ windowPanel.setWindowState(WindowPanel.WindowState.MAXIMIZED);
+ }
+ }
+ });
+ windowPanel.addWindowStateListener(new WindowPanel.WindowStateListener() {
+ public void onWindowStateChange(WindowPanel sender) {
+ if (sender.getWindowState() == WindowPanel.WindowState.MAXIMIZED) {
+ maximizeBtn.setImage(Caption.IMAGES.windowRestore().createImage());
+ } else {
+ maximizeBtn.setImage(Caption.IMAGES.windowMaximize().createImage());
+ }
+
+ }
+ });
+ windowPanel.getHeader().add(maximizeBtn, captionRegion);
+ }
+
+ /**
+ *
+ * @param windowPanel
+ */
+ public static void addMinimizeButton(final WindowPanel windowPanel,
+ Caption.CaptionRegion captionRegion) {
+ final ImageButton minimizeBtn = new ImageButton(
+ Caption.IMAGES.windowMinimize());
+ minimizeBtn.addClickListener(new ClickListener() {
+ public void onClick(Widget sender) {
+ windowPanel.setWindowState(WindowPanel.WindowState.NORMAL);
+ }
+ });
+ windowPanel.getHeader().add(minimizeBtn, captionRegion);
+ }
+
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/icons/error.png
===================================================================
(Binary files differ)
Property changes on: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/icons/error.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
15 years, 1 month
JBoss JBPM SVN: r4591 - in projects/gwt-console/branches/hbraun: plugin-api and 6 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-21 07:54:32 -0400 (Tue, 21 Apr 2009)
New Revision: 4591
Added:
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/js/ox.ajast.js
Removed:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/DateRenderer.java
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelChangeListener.java
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelListenerRegistry.java
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelModificationCallback.java
Modified:
projects/gwt-console/branches/hbraun/plugin-api/pom.xml
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/View.java
projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java
projects/gwt-console/branches/hbraun/pom.xml
projects/gwt-console/branches/hbraun/war/pom.xml
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
Log:
Remove the dependency on gwtext
Modified: projects/gwt-console/branches/hbraun/plugin-api/pom.xml
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/pom.xml 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-api/pom.xml 2009-04-21 11:54:32 UTC (rev 4591)
@@ -38,13 +38,8 @@
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
- <groupId>com.gwtext</groupId>
- <artifactId>gwtext</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.google.code.gwt-log</groupId>
<artifactId>gwt-log</artifactId>
</dependency>
Modified: 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-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/View.java 2009-04-21 11:54:32 UTC (rev 4591)
@@ -21,16 +21,16 @@
*/
package org.jboss.bpm.console.client;
-import com.gwtext.client.widgets.Panel;
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 Panel implements ViewInterface
+public abstract class View extends LayoutPanel implements ViewInterface
{
protected ApplicationContext mainMenu;
@@ -40,8 +40,7 @@
protected View(ApplicationContext main)
{
super();
- this.mainMenu = main;
- this.setPaddings(10);
+ this.mainMenu = main;
}
public abstract String getViewId();
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/DateRenderer.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/DateRenderer.java 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/DateRenderer.java 2009-04-21 11:54:32 UTC (rev 4591)
@@ -1,61 +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.util;
-
-import com.gwtext.client.widgets.grid.Renderer;
-import com.gwtext.client.widgets.grid.CellMetadata;
-import com.gwtext.client.data.Store;
-import com.gwtext.client.data.Record;
-
-import java.util.Date;
-
-import org.jboss.bpm.console.client.model.util.SimpleDateFormat;
-
-/**
- * Renders a Date according to {@link org.jboss.bpm.console.client.model.util.SimpleDateFormat#DEFAULT_FORMAT}
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class DateRenderer implements Renderer
-{
- private String fieldName;
-
- public DateRenderer(String fieldName)
- {
- this.fieldName = fieldName;
- }
-
- /**
- * Returns an empty string (field is null) or a formatted date (field is set).
- */
- public String render(Object value, CellMetadata cellMetadata, Record record,
- int rowIndex, int colNum, Store store)
- {
- String s = "";
- SimpleDateFormat df = new SimpleDateFormat();
- Date d = record.getAsDate(fieldName);
- if (d != null)
- s = df.format(d);
-
- return s;
- }
-}
\ No newline at end of file
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelChangeListener.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelChangeListener.java 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelChangeListener.java 2009-04-21 11:54:32 UTC (rev 4591)
@@ -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.util;
-
-import com.gwtext.client.data.Record;
-
-/**
- * Get's notified when model change events are fire on {@link ModelListenerRegistry}
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface ModelChangeListener
-{
- void onModelChange(ModelListenerRegistry parent, Object changeEvent);
-
- void onRecordChange(ModelListenerRegistry parent, Record record);
-
- void onReset();
-}
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelListenerRegistry.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelListenerRegistry.java 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelListenerRegistry.java 2009-04-21 11:54:32 UTC (rev 4591)
@@ -1,66 +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.util;
-
-import com.gwtext.client.data.Record;
-
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Utility to propagate model change events to {@link ModelChangeListener}
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class ModelListenerRegistry
-{
- private List<ModelChangeListener> listeners = new ArrayList<ModelChangeListener>();
-
- public void addListener(ModelChangeListener listener)
- {
- this.listeners.add(listener);
- }
-
- public void fireRecordChangeEvent(Record record)
- {
- for (ModelChangeListener l : listeners)
- {
- l.onRecordChange(this, record);
- }
- }
-
- public void fireModelChangeEvent(Object event)
- {
- for (ModelChangeListener l : listeners)
- {
- l.onModelChange(this, event);
- }
- }
-
- public void fireResetEvent()
- {
- for (ModelChangeListener l : listeners)
- {
- l.onReset();
- }
- }
-}
Deleted: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelModificationCallback.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelModificationCallback.java 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/util/ModelModificationCallback.java 2009-04-21 11:54:32 UTC (rev 4591)
@@ -1,32 +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.util;
-
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public interface ModelModificationCallback
-{
- void onStaleModel();
-}
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-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/plugin-example/src/main/java/org/jboss/bpm/console/client/mapsplugin/MapsEditor.java 2009-04-21 11:54:32 UTC (rev 4591)
@@ -60,8 +60,7 @@
frame.setUrl("http://maps.google.com");
// assemble the view
- defaultView.add(frame);
- defaultView.setPaddings(10,0,0,0);
+ defaultView.add(frame);
defaultView.setTitle("Maps");
// add it to the editor
Modified: projects/gwt-console/branches/hbraun/pom.xml
===================================================================
--- projects/gwt-console/branches/hbraun/pom.xml 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/pom.xml 2009-04-21 11:54:32 UTC (rev 4591)
@@ -23,7 +23,7 @@
<commons-config.version>1.6</commons-config.version>
<gson.version>1.2.2</gson.version>
<gwt.version>1.5.3</gwt.version>
- <gwtext.version>2.0.5</gwtext.version>
+
<gwt-mosaic.version>0.1.9</gwt-mosaic.version>
<gwt-log.version>2.5.2</gwt-log.version>
<jaf.version>1.1</jaf.version>
@@ -74,11 +74,6 @@
</dependency>
<dependency>
- <groupId>com.gwtext</groupId>
- <artifactId>gwtext</artifactId>
- <version>${gwtext.version}</version>
- </dependency>
- <dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gchart</artifactId>
<version>${gchart.version}</version>
Modified: projects/gwt-console/branches/hbraun/war/pom.xml
===================================================================
--- projects/gwt-console/branches/hbraun/war/pom.xml 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/war/pom.xml 2009-04-21 11:54:32 UTC (rev 4591)
@@ -72,10 +72,6 @@
<!-- GWT extensions -->
<dependency>
- <groupId>com.gwtext</groupId>
- <artifactId>gwtext</artifactId>
- </dependency>
- <dependency>
<groupId>com.google.code.gwt-log</groupId>
<artifactId>gwt-log</artifactId>
</dependency>
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2009-04-20 20:43:59 UTC (rev 4590)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/Application.gwt.xml 2009-04-21 11:54:32 UTC (rev 4591)
@@ -3,8 +3,7 @@
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.json.JSON'/>
- <inherits name="com.google.gwt.i18n.I18N"/>
- <inherits name='com.gwtext.GwtExt' />
+ <inherits name="com.google.gwt.i18n.I18N"/>
<!-- Add gwt-log support, default level `DEBUG` -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
@@ -63,9 +62,5 @@
<!-- Specify a css to load into your gwt application -->
<stylesheet src='console.css' />
- <stylesheet src="js/ext/resources/css/ext-all.css" />
- <script src="js/ext/adapter/ext/ext-base.js" />
- <script src="js/ext/ext-all.js" />
-
</module>
\ No newline at end of file
Added: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/js/ox.ajast.js
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/js/ox.ajast.js (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/js/ox.ajast.js 2009-04-21 11:54:32 UTC (rev 4591)
@@ -0,0 +1,123 @@
+// This file contains a simple Javascript broker that encapsulates
+// the AJAST technique, allowing for cross-domain REST
+// (REpresentatoinal State Transfer) calls.
+//
+// Copyright (c) 2008 H�vard Stranden <havard.stranden(a)gmail.com>
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+if(typeof(OX) === 'undefined') OX = {};
+OX.AJAST =
+{
+ Broker : function(url, callbackparameter, optional_decode_json_response, optional_timeout_milliseconds, optional_default_params)
+ {
+ this.url = url;
+ this.cb = callbackparameter;
+ this.params = [];
+ this.timeout = optional_timeout_milliseconds || 5000; // Timeout in milliseconds
+ if(typeof(optional_default_params) !== 'undefined')
+ {
+ for(p in optional_default_params)
+ this.params.push(p + '=' + encodeURIComponent(optional_default_params[p]));
+ }
+
+ this.jsonmode = optional_decode_json_response || false;
+ },
+
+ __callbacks__ : {},
+
+ __callid__ : 1,
+
+ call: function(url, callbackparameter, callbackfunction, optional_timeout, optional_decode_json_response)
+ {
+ var callbackid = 'callback' + OX.AJAST.__callid__;
+
+ // Append callback parameter (this also implicitly avoids caching, since the callback id is different for each call)
+ url += '&' + encodeURIComponent(callbackparameter) + '=' + encodeURIComponent('OX.AJAST.__callbacks__.' + callbackid);
+
+ // Create script tag for the call
+ var tag = OX.AJAST.createScriptTag(url);
+ // Get the head of the document
+ var head = document.getElementsByTagName('head').item(0);
+
+
+ // Create a timeout function
+ var timedout = function()
+ {
+ if(OX.AJAST.__callbacks__[callbackid] !== 'undefined') // If the callback still exists...
+ {
+ // Replace original wrapped callback with a dummy that just deletes itself
+ OX.AJAST.__callbacks__[callbackid] = function(){ delete OX.AJAST.__callbacks__[callbackid]; };
+ // Signal that the call timed out
+ callbackfunction(false);
+ // Remove the script tag (timed out)
+ head.removeChild(tag);
+ }
+ };
+
+ // Create timer for the timeout function
+ var timer = setTimeout(timedout, optional_timeout || 5000);
+
+ var decode_response = optional_decode_json_response || false;
+
+ // Create the callback function
+ OX.AJAST.__callbacks__[callbackid] = function(data)
+ {
+ // Clear the timeout
+ clearTimeout(timer);
+
+ if(typeof(data) === 'undefined')
+ callbackfunction(false); // Callback with nothing
+ else
+ {
+ callbackfunction(true, decode_response ? eval(data) : data);
+ }
+ // Replace original callback with a dummy function
+ delete OX.AJAST.__callbacks__[callbackid];
+ // Remove the script tag (finished)
+ head.removeChild(tag);
+ };
+
+ // Inject the call
+ head.appendChild(tag);
+ },
+
+ createScriptTag: function(url)
+ {
+ var s = document.createElement('script');
+ s.setAttribute('type', 'text/javascript');
+ s.setAttribute('id', 'oxajastcall' + OX.AJAST.Broker.__callid__++);
+ s.setAttribute('src', url);
+ return s;
+ }
+};
+
+OX.AJAST.Broker.prototype.call = function(params, callback)
+{
+ // Create arguments
+ var args = [];
+ for(p in params)
+ args.push(p + '=' + encodeURIComponent(params[p]));
+ for(p in this.params)
+ args.push(this.params[p]);
+ OX.AJAST.call(this.url + '?' + args.join('&'), this.cb, callback, this.timeout, this.jsonmode);
+};
\ No newline at end of file
15 years, 1 month
JBoss JBPM SVN: r4590 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/subprocess and 8 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-04-20 16:43:59 -0400 (Mon, 20 Apr 2009)
New Revision: 4590
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeactivity/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeactivity/SubProcessOutcomeActivityTest.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessDocument.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessDocument.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml
Modified:
jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
Log:
JBPM-2025 sub process activity : outcome mapping examples
Modified: jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-20 17:32:22 UTC (rev 4589)
+++ jbpm4/trunk/modules/api/src/main/resources/jpdl-4.0.xsd 2009-04-20 20:43:59 UTC (rev 4590)
@@ -395,11 +395,6 @@
<group ref="tns:wireObjectGroup" />
</complexType>
</element>
- <element name="outcome">
- <complexType>
- <attribute name="activity" type="string" use="required" />
- </complexType>
- </element>
</sequence>
</extension>
</complexContent>
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeactivity/SubProcessOutcomeActivityTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeactivity/SubProcessOutcomeActivityTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeactivity/SubProcessOutcomeActivityTest.java 2009-04-20 20:43:59 UTC (rev 4590)
@@ -0,0 +1,108 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.examples.subprocess.outcomeactivity;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessOutcomeActivityTest extends JbpmTestCase {
+
+ long subProcessReviewDeploymentDbid;
+ long subProcessDocumentDeploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ subProcessReviewDeploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml")
+ .deploy();
+
+ subProcessDocumentDeploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomeactivity/SubProcessDocument.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(subProcessReviewDeploymentDbid);
+ repositoryService.deleteDeploymentCascade(subProcessDocumentDeploymentDbid);
+
+ super.tearDown();
+ }
+
+ public void testSubProcessResultOk() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid(), "ok");
+
+ // we check that the process instance has moved to the next step
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("next step"));
+ }
+
+ public void testSubProcessResultNok() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid(), "nok");
+
+ // we check that the process instance has moved to update
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("update"));
+ }
+
+ public void testSubProcessResultReject() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid(), "reject");
+
+ // we check that the process instance has moved to close
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("close"));
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeactivity/SubProcessOutcomeActivityTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java 2009-04-20 20:43:59 UTC (rev 4590)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jbpm.examples.subprocess.outcomevalue;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessOutcomeValueTest extends JbpmTestCase {
+
+ long subProcessReviewDeploymentDbid;
+ long subProcessDocumentDeploymentDbid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ subProcessReviewDeploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml")
+ .deploy();
+
+ subProcessDocumentDeploymentDbid = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomevalue/SubProcessDocument.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(subProcessReviewDeploymentDbid);
+ repositoryService.deleteDeploymentCascade(subProcessDocumentDeploymentDbid);
+
+ super.tearDown();
+ }
+
+ public void testSubProcessResultOk() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ taskService.setVariable(task.getDbid(), "result", "ok");
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid());
+
+ // we check that the process instance has moved to the next step
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("next step"));
+ }
+
+ public void testSubProcessResultNok() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ taskService.setVariable(task.getDbid(), "result", "nok");
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid());
+
+ // we check that the process instance has moved to update
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("update"));
+ }
+
+ public void testSubProcessResultReject() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findAssignedTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ taskService.setVariable(task.getDbid(), "result", "reject");
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getDbid());
+
+ // we check that the process instance has moved to close
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("close"));
+ }
+}
Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomevalue/SubProcessOutcomeValueTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java 2009-04-20 17:32:22 UTC (rev 4589)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/variables/SubProcessVariablesTest.java 2009-04-20 20:43:59 UTC (rev 4590)
@@ -35,24 +35,24 @@
*/
public class SubProcessVariablesTest extends JbpmTestCase {
- long reviewDeploymentDbid;
- long subProcessDeploymentDbid;
+ long subProcessReviewDeploymentDbid;
+ long subProcessDocumentDeploymentDbid;
protected void setUp() throws Exception {
super.setUp();
- reviewDeploymentDbid = repositoryService.createDeployment()
+ subProcessReviewDeploymentDbid = repositoryService.createDeployment()
.addResourceFromClasspath("org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml")
.deploy();
- subProcessDeploymentDbid = repositoryService.createDeployment()
+ subProcessDocumentDeploymentDbid = repositoryService.createDeployment()
.addResourceFromClasspath("org/jbpm/examples/subprocess/variables/SubProcessDocument.jpdl.xml")
.deploy();
}
protected void tearDown() throws Exception {
- repositoryService.deleteDeploymentCascade(reviewDeploymentDbid);
- repositoryService.deleteDeploymentCascade(subProcessDeploymentDbid);
+ repositoryService.deleteDeploymentCascade(subProcessReviewDeploymentDbid);
+ repositoryService.deleteDeploymentCascade(subProcessDocumentDeploymentDbid);
super.tearDown();
}
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessDocument.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessDocument.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessDocument.jpdl.xml 2009-04-20 20:43:59 UTC (rev 4590)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessDocument" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <sub-process name="review"
+ sub-process-key="SubProcessReview"
+ g="96,16,127,52">
+
+ <transition name="ok" to="next step" />
+ <transition name="nok" to="update" />
+ <transition name="reject" to="close" />
+ </sub-process>
+
+ <state name="next step" g="255,16,88,52"/>
+ <state name="update" g="255,36,88,52"/>
+ <state name="close" g="255,56,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessDocument.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml 2009-04-20 20:43:59 UTC (rev 4590)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition name="ok" to="ok"/>
+ <transition name="nok" to="nok"/>
+ <transition name="reject" to="reject"/>
+ </task>
+
+ <end name="ok" g="254,19,88,52" />
+ <end name="nok" g="254,19,88,52" />
+ <end name="reject" g="254,19,88,52" />
+
+</process>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessDocument.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessDocument.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessDocument.jpdl.xml 2009-04-20 20:43:59 UTC (rev 4590)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessDocument" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="review" />
+ </start>
+
+ <sub-process name="review"
+ sub-process-key="SubProcessReview"
+ outcome="#{result}"
+ g="96,16,127,52">
+
+ <transition name="ok" to="next step" />
+ <transition name="nok" to="update" />
+ <transition name="reject" to="close" />
+ </sub-process>
+
+ <state name="next step" g="255,16,88,52"/>
+ <state name="update" g="255,36,88,52"/>
+ <state name="close" g="255,56,88,52"/>
+
+</process>
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessDocument.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml 2009-04-20 20:43:59 UTC (rev 4590)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessReview" xmlns="http://jbpm.org/4/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" g="254,19,88,52" />
+
+</process>
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-20 17:32:22 UTC (rev 4589)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessActivity.java 2009-04-20 20:43:59 UTC (rev 4590)
@@ -27,6 +27,7 @@
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.api.env.Environment;
+import org.jbpm.api.model.Activity;
import org.jbpm.api.session.RepositorySession;
import org.jbpm.jpdl.internal.model.JpdlExecution;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -49,7 +50,6 @@
protected List<VariableDefinitionImpl> variableDefinitions;
protected VariableOutDefinitionSet variableOutDefinitionSet;
- protected Map<String, String> outcomeActivityMappings;
protected String outcomeExpression;
protected Map<Object, String> outcomeVariableMappings;
@@ -97,17 +97,25 @@
String transitionName = null;
+ Activity activity = execution.getActivity();
+ String subProcessActivityName = subProcessInstance.getActivityName();
if (outcomeExpression!=null) {
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
Object value = scriptManager.evaluateExpression(outcomeExpression, subProcessInstance, null);
- transitionName = outcomeActivityMappings.get(value);
+ // if the value is a String and matches the name of an outgoing transition
+ if ( (value instanceof String)
+ && (activity.hasOutgoingTransition(((String) value)))
+ ) {
+ // then take that one
+ transitionName = (String) value;
+ } else {
+ // else see if there is a value mapping
+ transitionName = outcomeVariableMappings.get(value);
+ }
- } else if ( (outcomeActivityMappings!=null)
- && (!outcomeActivityMappings.isEmpty())
- ) {
- String subProcessActivityName = subProcessInstance.getActivityName();
- transitionName = outcomeActivityMappings.get(subProcessActivityName);
+ } else if (activity.hasOutgoingTransition(subProcessActivityName)) {
+ transitionName = subProcessActivityName;
}
if (transitionName!=null) {
@@ -120,9 +128,6 @@
public void setSwimlaneMappings(Map<String, String> swimlaneMappings) {
this.swimlaneMappings = swimlaneMappings;
}
- public void setOutcomeActivityMappings(Map<String, String> outcomeActivityMappings) {
- this.outcomeActivityMappings = outcomeActivityMappings;
- }
public void setOutcomeVariableMappings(Map<Object, String> outcomeVariableMappings) {
this.outcomeVariableMappings = outcomeVariableMappings;
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-20 17:32:22 UTC (rev 4589)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-04-20 20:43:59 UTC (rev 4590)
@@ -64,11 +64,12 @@
Map<String, String> swimlaneMappings = parseSwimlaneMappings(element, parse);
subProcessActivity.setSwimlaneMappings(swimlaneMappings);
- Map<String, String> outcomeActivityMappings = new HashMap<String, String>();
Map<Object, String> outcomeVariableMappings = new HashMap<Object, String>();
String outcomeExpression = XmlUtil.attribute(element, "outcome");
if (outcomeExpression!=null) {
+ subProcessActivity.setOutcomeExpression(outcomeExpression);
+
for (Element transitionElement: XmlUtil.elements(element, "transition")) {
Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
if (outcomeValueElement!=null) {
@@ -87,22 +88,6 @@
}
}
- } else { // no outcome expression
-
- // search for end activity mappings
- for (Element transitionElement: XmlUtil.elements(element, "transition")) {
- Element outcomeElement = XmlUtil.element(transitionElement, "outcome");
- if (outcomeElement!=null) {
- String transitionName = XmlUtil.attribute(transitionElement, "name");
- if (transitionName==null) {
- parse.addProblem("transitions with an outcome must have a name", transitionElement);
- }
- String activity = XmlUtil.attribute(outcomeElement, "activity");
- if (activity!=null) {
- outcomeActivityMappings.put(activity, transitionName);
- }
- }
- }
}
return subProcessActivity;
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-20 17:32:22 UTC (rev 4589)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-04-20 20:43:59 UTC (rev 4590)
@@ -1238,51 +1238,6 @@
</tgroup>
</table>
- <table><title>Extra <literal>transition</literal> elements in case of activity mappings:</title>
- <tgroup cols="3" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Element</entry>
- <entry>Multiplicity</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>outcome</literal></entry>
- <entry>0..1</entry>
- <entry>Specifies
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table><title><literal>outcome</literal> attributes:</title>
- <tgroup cols="5" rowsep="1" colsep="1">
- <thead>
- <row>
- <entry>Attribute</entry>
- <entry>Type</entry>
- <entry>Default</entry>
- <entry>Required?</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><literal>activity</literal></entry>
- <entry>string</entry>
- <entry></entry>
- <entry><emphasis role="bold">required</emphasis></entry>
- <entry>Refers to an <literal>end</literal> activity name of the
- sub-process. This transition is taken when the sub process ends in
- that specific <literal>end</literal> activity.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
<!-- ~~~ SUB PROCESS VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<section id="subprocessvariables">
15 years, 1 month
JBoss JBPM SVN: r4589 - projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 13:32:22 -0400 (Mon, 20 Apr 2009)
New Revision: 4589
Modified:
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css
Log:
Fix loading image dimensions
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-04-20 17:08:22 UTC (rev 4588)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-04-20 17:32:22 UTC (rev 4589)
@@ -53,8 +53,8 @@
.bpm-loading-image {
background-color:#ffffff;
- width:16px;
- height:16px;
+ width:16pt;
+ height:16pt;
}
.bpm-ProcessImage {
15 years, 1 month
JBoss JBPM SVN: r4588 - 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-20 13:08:22 -0400 (Mon, 20 Apr 2009)
New Revision: 4588
Added:
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading-circle.gif
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.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/StartNewInstanceAction.java
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading.gif
Log:
Implement loading status
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java 2009-04-20 16:11:30 UTC (rev 4587)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java 2009-04-20 17:08:22 UTC (rev 4588)
@@ -22,23 +22,32 @@
package org.jboss.bpm.console.client;
import com.google.gwt.user.client.ui.*;
+import com.google.gwt.user.client.Timer;
import com.mvc4g.client.Controller;
import com.mvc4g.client.ViewInterface;
import java.util.List;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
public class Header extends HorizontalPanel implements ViewInterface
{
+ public final static String ID = Header.class.getName();
+
private ApplicationContext appContext;
private Controller controller;
+ private Image loadingImage;
- public final static String ID = Header.class.getName();
+ // avoid flickering image
+ final Timer turnOffLoading = new Timer() {
+ public void run() {
+ loadingImage.setVisible(false);
+ }
+ };
- private Image loading;
-
public Header(ApplicationContext appContext, String username, List<String> roles)
{
super();
@@ -47,7 +56,7 @@
this.setStyleName("bpm-header");
this.appContext = appContext;
-
+
createInfoPanel();
}
@@ -57,9 +66,15 @@
p.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
p.setStyleName("bpm-header-userinfo");
- loading = new Image("images/loading.gif");
+ // load status image
+ LayoutPanel loadingImageContainer = new LayoutPanel();
+ loadingImageContainer.setStyleName("bpm-loading-image");
+ loadingImage = new Image("images/loading.gif");
+ loadingImageContainer.add(loadingImage);
+
setLoading(false);
+ // account info
Image img = new Image("images/icons/05.png");
HTML html = new HTML(appContext.getAuthentication().getUsername());
@@ -73,13 +88,13 @@
}
);
- p.add(loading);
+ p.add(loadingImageContainer);
p.add(img);
p.add(html);
p.add(btn);
this.add(p);
-
+
}
@@ -88,8 +103,11 @@
this.controller = controller;
}
- public void setLoading(boolean b)
+ public void setLoading(boolean doDisplay)
{
- loading.setVisible(b);
+ if(doDisplay)
+ loadingImage.setVisible(doDisplay);
+ else
+ turnOffLoading.schedule(1000);
}
}
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-20 16:11:30 UTC (rev 4587)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-20 17:08:22 UTC (rev 4588)
@@ -57,40 +57,37 @@
controller.handleEvent( LoadingStatusAction.ON );
- try
+ JSONRequest.get(
+ url, new JSONRequestHandler()
{
- JSONRequest.get(
- url, new JSONRequestHandler()
+ public void onRequestComplete(JavaScriptObject json)
{
- public void onRequestComplete(JavaScriptObject json)
+ try
{
if (json == null) {
appContext.displayMessage("Couldn't retrieve process definition data", true);
return;
}
- List<ProcessDefinitionRef> definitions = null;
- try
- {
- definitions = DTOParser.parseProcessDefinitions(json);
- }
- catch (Throwable e)
- {
- e.printStackTrace();
- appContext.displayMessage(e.getMessage(), true);
- }
-
-
+ List<ProcessDefinitionRef> definitions = DTOParser.parseProcessDefinitions(json);
DefinitionListView view = (DefinitionListView) controller.getView(DefinitionListView.ID);
view.update(definitions);
appContext.displayMessage("Loaded " + definitions.size() + " process definitions", false);
+
}
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ appContext.displayMessage(e.getMessage(), true);
+ }
+ finally
+ {
+ controller.handleEvent( LoadingStatusAction.OFF );
+ }
}
- );
}
- finally{
- controller.handleEvent( LoadingStatusAction.OFF );
- }
+ );
+
}
}
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-20 16:11:30 UTC (rev 4587)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-20 17:08:22 UTC (rev 4588)
@@ -24,6 +24,7 @@
import com.google.gwt.core.client.JavaScriptObject;
import com.mvc4g.client.Controller;
import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.LoadingStatusAction;
import org.jboss.bpm.console.client.model.DTOParser;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
@@ -35,7 +36,7 @@
/**
* Force loading of a process instance list.
* Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
- *
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
class LoadInstancesAction extends AbstractContextAwareAction
@@ -44,7 +45,7 @@
public LoadInstancesAction(ApplicationContext appContext)
{
- super(appContext);
+ super(appContext);
}
/**
@@ -58,32 +59,35 @@
String url = appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
+ controller.handleEvent( LoadingStatusAction.ON );
+
JSONRequest.get(
url, new JSONRequestHandler()
{
public void onRequestComplete(JavaScriptObject json)
{
- if (json == null) {
- appContext.displayMessage("Couldn't retrieve process instance data", true);
- return;
- }
-
- List<ProcessInstanceRef> instances = null;
try
{
- instances = DTOParser.parseProcessInstances(json);
+ if (json == null) {
+ appContext.displayMessage("Couldn't retrieve process instance data", true);
+ return;
+ }
+
+ List<ProcessInstanceRef> instances = DTOParser.parseProcessInstances(json);
+ InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
+ view.update(def, instances);
+
+ appContext.displayMessage("Loaded " + instances.size() + " process instances", false);
}
catch (Throwable e)
{
e.printStackTrace();
appContext.displayMessage(e.getMessage(), true);
}
-
-
- InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
- view.update(def, instances);
-
- appContext.displayMessage("Loaded " + instances.size() + " process instances", false);
+ finally
+ {
+ controller.handleEvent( LoadingStatusAction.OFF );
+ }
}
}
);
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-20 16:11:30 UTC (rev 4587)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-04-20 17:08:22 UTC (rev 4588)
@@ -25,12 +25,13 @@
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.model.ProcessDefinitionRef;
/**
* Starts a new process instance.
* Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
- *
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
class StartNewInstanceAction extends AbstractContextAwareAction
@@ -54,46 +55,61 @@
String url = appContext.getUrlBuilder().getStartNewInstanceURL(def.getId());
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
- 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);
- }
+ try
+ {
+ controller.handleEvent( LoadingStatusAction.ON );
- public void onResponseReceived(Request request, Response response) {
- if (200 == response.getStatusCode()) {
+ 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 );
+ }
- // force reload instance list
- controller.handleEvent(
- new Event(LoadInstancesAction.ID, def)
- );
+ public void onResponseReceived(Request request, Response response) {
+ try
+ {
+ if (200 == response.getStatusCode()) {
- } 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
- );
- }
- }
- });
+ // 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 );
}
}
private void handleError(Throwable t)
{
// Couldn't connect to server
- appContext.displayMessage("Failed to start new instance. " +
- "RequestException( "+t.getClass() +"): "+
- t.getMessage(),
- true
- );
+ appContext.displayMessage("Failed to start new instance. " +
+ "RequestException( "+t.getClass() +"): "+
+ t.getMessage(),
+ true
+ );
+
}
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-04-20 16:11:30 UTC (rev 4587)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-04-20 17:08:22 UTC (rev 4588)
@@ -51,6 +51,12 @@
}
+.bpm-loading-image {
+ background-color:#ffffff;
+ width:16px;
+ height:16px;
+}
+
.bpm-ProcessImage {
border: 0px;
}
Added: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading-circle.gif
===================================================================
(Binary files differ)
Property changes on: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading-circle.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading.gif
===================================================================
(Binary files differ)
15 years, 1 month
JBoss JBPM SVN: r4587 - in projects/gwt-console/branches/hbraun/war/src: main/java/org/jboss/bpm/console/client/events and 5 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 12:11:30 -0400 (Mon, 20 Apr 2009)
New Revision: 4587
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoadingStatusAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/events/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/events/BootstrapEvent.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.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/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/ProcessEditorNavigation.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/resources/org/jboss/bpm/console/public/images/loading.gif
Removed:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Application.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/widgets/
projects/gwt-console/branches/hbraun/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java
projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml
projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg
Log:
Package refactoring
Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Application.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Application.java 2009-04-20 15:06:01 UTC (rev 4586)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Application.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -1,201 +0,0 @@
-package org.jboss.bpm.console.client;
-
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.WindowCloseListener;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
-import org.gwt.mosaic.forms.client.builder.DefaultFormBuilder;
-import org.gwt.mosaic.forms.client.layout.FormLayout;
-import org.gwt.mosaic.ui.client.WindowPanel;
-import org.gwt.mosaic.ui.client.HTML;
-import org.gwt.mosaic.ui.client.layout.BorderLayout;
-import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-
-/**
- * Entry point classes define <code>onModuleLoad()</code>.
- * Does the authentication and reads the comfiguration before launching
- * the {@link org.jboss.bpm.console.client.MainView}
- */
-public class Application implements EntryPoint
-{
- private ApplicationContext mainView;
- private Authentication auth;
- private ConsoleConfig config;
- private URLBuilder urlBuilder;
-
- WindowPanel window = null;
- TextBox usernameInput;
- TextBox passwordInput;
-
- public final static String[] KNOWN_ROLES = {"admin", "manager", "user"};
-
- /**
- * Note, we defer all application initialization code to
- * {@link #onModuleLoad2()} so that the UncaughtExceptionHandler
- * can catch any unexpected exceptions.
- */
- public void onModuleLoad()
- {
-
- ConsoleLog.setEnabled(true);
-
- /* Install an UncaughtExceptionHandler which will
- * produce <code>FATAL</code> log messages
- */
- ConsoleLog.setUncaughtExceptionHandler();
-
- /* Use a deferred command so that the UncaughtExceptionHandler
- * catches any exceptions in onModuleLoad2()
- */
- DeferredCommand.addCommand(new Command()
- {
- public void execute()
- {
- onModuleLoad2();
- }
- });
- }
-
- /**
- * This is the entry point method.
- */
- public void onModuleLoad2()
- {
- config = new ConsoleConfig();
-
- // setup
-
- if (!GWT.isScript())
- {
- String proxyUrl = GWT.getModuleBaseURL() + "xhp";
- config.setConsoleServerUrl(proxyUrl);
- }
-
- ConsoleLog.debug("Console server: " + config.getConsoleServerUrl());
- ConsoleLog.debug("Report server: " + config.getReportServerUrl());
-
- urlBuilder = new URLBuilder(config);
-
- // authentiction
- forceLogin();
- }
-
- public ApplicationContext getConsoleView()
- {
- return mainView;
- }
-
- private void forceLogin()
- {
- createLayoutWindowPanel();
- //window.pack();
- window.center();
- }
-
- /**
- * The 'layout' window panel.
- */
- private void createLayoutWindowPanel() {
- window = new WindowPanel("jBPM Management Console");
- window.setAnimationEnabled(false);
- window.setSize("320px", "180px");
-
- LayoutPanel panel = new LayoutPanel();
- window.setWidget(panel);
- createLayoutContent(panel);
-
- window.addWindowCloseListener(new WindowCloseListener() {
- public void onWindowClosed() {
- window = null;
- }
-
- public String onWindowClosing() {
- return null;
- }
- });
- }
-
- /**
- * Create content for layout.
- */
- private void createLayoutContent(LayoutPanel layoutPanel) {
-
- layoutPanel.setLayout(new BorderLayout());
- layoutPanel.setPadding(5);
-
- final Button submit = new Button("Submit");
- submit.addClickListener(new ClickListener()
- {
-
- public void onClick(Widget widget)
- {
- String user = usernameInput.getText();
- String pass = passwordInput.getText();
-
- String url = urlBuilder.getUserInRoleURL(KNOWN_ROLES);
- auth = new Authentication(url);
- auth.setCallback(
- new Authentication.AuthCallback()
- {
-
- public void onLoginSuccess(Request request, Response response)
- {
- // clear the form
- usernameInput.setText("");
- passwordInput.setText("");
-
- // display main console
- window.hide();
-
- // assemble main view
- mainView = new MainView(auth, urlBuilder, config);
- }
-
- public void onLoginFailed(Request request, Throwable t)
- {
- // auth failed
- ConsoleLog.error("Authentication failed.", t);
- }
- }
- );
-
- auth.doLogin(user, pass);
- }
- });
-
- layoutPanel.add(createForm(), new BorderLayoutData(BorderLayout.Region.CENTER, 10, 200));
- layoutPanel.add(submit, new BorderLayoutData(BorderLayout.Region.SOUTH, 10, 200));
-
- }
-
- private Widget createForm()
- {
- FormLayout layout = new FormLayout(
- "right:pref, 10px, left:pref:grow", // 3 columns
- "pref, pref, 5px, pref"); // 4 rows
-
- DefaultFormBuilder builder = new DefaultFormBuilder(layout);
- builder.appendSeparator("Login");
-
- usernameInput = new TextBox();
- builder.append("Username:", usernameInput);
- builder.nextLine();
-
- builder.nextLine(); // empty space
-
- passwordInput = new TextBox();
- builder.append("Password:", passwordInput);
- builder.nextLine();
-
- return builder.getPanel();
- }
-}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java 2009-04-20 15:06:01 UTC (rev 4586)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/Header.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -35,8 +35,10 @@
private ApplicationContext appContext;
private Controller controller;
- public final static String ID = "org.jboss.bpm.headerPanel";
+ public final static String ID = Header.class.getName();
+ private Image loading;
+
public Header(ApplicationContext appContext, String username, List<String> roles)
{
super();
@@ -46,15 +48,18 @@
this.appContext = appContext;
- createUserInfo(username, roles);
+ createInfoPanel();
}
- private void createUserInfo(String username, List<String> roles)
+ private void createInfoPanel()
{
HorizontalPanel p = new HorizontalPanel();
p.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
p.setStyleName("bpm-header-userinfo");
+ loading = new Image("images/loading.gif");
+ setLoading(false);
+
Image img = new Image("images/icons/05.png");
HTML html = new HTML(appContext.getAuthentication().getUsername());
@@ -68,6 +73,7 @@
}
);
+ p.add(loading);
p.add(img);
p.add(html);
p.add(btn);
@@ -81,4 +87,9 @@
{
this.controller = controller;
}
+
+ public void setLoading(boolean b)
+ {
+ loading.setVisible(b);
+ }
}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoadingStatusAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoadingStatusAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoadingStatusAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -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;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LoadingStatusAction implements ActionInterface
+{
+
+ public final static String ID = LoadingStatusAction.class.getName();
+
+ public final static Event ON = new Event(LoadingStatusAction.ID, true);
+ public final static Event OFF = new Event(LoadingStatusAction.ID, false);
+
+ /**
+ * @param controller
+ * @param object Boolean
+ */
+ public void execute(Controller controller, Object object)
+ {
+ Boolean b = (Boolean)object;
+ Header header = (Header)controller.getView(Header.ID);
+ header.setLoading(b);
+ }
+}
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginAction.java (from rev 4565, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginAction.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,38 @@
+/*
+ * 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.ActionInterface;
+import com.mvc4g.client.Controller;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LoginAction implements ActionInterface
+{
+
+ public void execute(Controller controller, Object object)
+ {
+ LoginView loginView = (LoginView)controller.getView(LoginView.NAME);
+ loginView.display();
+ }
+}
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginView.java (from rev 4581, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/LoginView.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginView.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/LoginView.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,197 @@
+/*
+ * 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.google.gwt.http.client.Request;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.WindowCloseListener;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.core.client.GWT;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+import org.gwt.mosaic.forms.client.builder.DefaultFormBuilder;
+import org.gwt.mosaic.forms.client.layout.FormLayout;
+import org.gwt.mosaic.ui.client.WindowPanel;
+import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.Authentication;
+import org.jboss.bpm.console.client.ConsoleConfig;
+import org.jboss.bpm.console.client.URLBuilder;
+import org.jboss.bpm.console.client.MainLayout;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class LoginView implements ViewInterface
+{
+ public final static String NAME = "loginView";
+
+ private ConsoleConfig config;
+ private URLBuilder urlBuilder;
+ private Authentication auth;
+
+ private WindowPanel window = null;
+ private TextBox usernameInput;
+ private TextBox passwordInput;
+
+ public final static String[] KNOWN_ROLES = {"admin", "manager", "user"};
+
+ private Controller controller;
+
+ public LoginView()
+ {
+ config = new ConsoleConfig();
+
+ // setup
+
+ if (!GWT.isScript())
+ {
+ String proxyUrl = GWT.getModuleBaseURL() + "xhp";
+ config.setConsoleServerUrl(proxyUrl);
+ }
+
+ ConsoleLog.debug("Console server: " + config.getConsoleServerUrl());
+ ConsoleLog.debug("Report server: " + config.getReportServerUrl());
+
+ urlBuilder = new URLBuilder(config);
+
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void display()
+ {
+ createLayoutWindowPanel();
+
+ // remove later on
+ usernameInput.setText("alex");
+ passwordInput.setText("password");
+
+ window.center();
+ }
+
+ /**
+ * The 'layout' window panel.
+ */
+ private void createLayoutWindowPanel() {
+ window = new WindowPanel("jBPM Management Console");
+ window.setAnimationEnabled(false);
+ window.setSize("320px", "180px");
+
+ LayoutPanel panel = new LayoutPanel();
+ window.setWidget(panel);
+ createLayoutContent(panel);
+
+ window.addWindowCloseListener(new WindowCloseListener() {
+ public void onWindowClosed() {
+ window = null;
+ }
+
+ public String onWindowClosing() {
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Create content for layout.
+ */
+ private void createLayoutContent(LayoutPanel layoutPanel) {
+
+ layoutPanel.setLayout(new BorderLayout());
+ layoutPanel.setPadding(5);
+
+ final Button submit = new Button("Submit");
+ submit.addClickListener(new ClickListener()
+ {
+
+ public void onClick(Widget widget)
+ {
+ String user = usernameInput.getText();
+ String pass = passwordInput.getText();
+
+ String url = urlBuilder.getUserInRoleURL(KNOWN_ROLES);
+ auth = new Authentication(url);
+ auth.setCallback(
+ new Authentication.AuthCallback()
+ {
+
+ public void onLoginSuccess(Request request, Response response)
+ {
+ // clear the form
+ usernameInput.setText("");
+ passwordInput.setText("");
+
+ // display main console
+ window.hide();
+
+ // assemble main layout
+ new MainLayout(controller, auth, urlBuilder, config);
+ }
+
+ public void onLoginFailed(Request request, Throwable t)
+ {
+ // auth failed
+ ConsoleLog.error("Authentication failed.", t);
+ }
+ }
+ );
+
+ auth.doLogin(user, pass);
+ }
+ });
+
+ layoutPanel.add(createForm(), new BorderLayoutData(BorderLayout.Region.CENTER, 10, 200));
+ layoutPanel.add(submit, new BorderLayoutData(BorderLayout.Region.SOUTH, 10, 200));
+
+ }
+
+ private Widget createForm()
+ {
+ FormLayout layout = new FormLayout(
+ "right:pref, 10px, left:pref:grow", // 3 columns
+ "pref, pref, 5px, pref"); // 4 rows
+
+ DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+ builder.appendSeparator("Login");
+
+ usernameInput = new TextBox();
+ builder.append("Username:", usernameInput);
+ builder.nextLine();
+
+ builder.nextLine(); // empty space
+
+ passwordInput = new TextBox();
+ builder.append("Password:", passwordInput);
+ builder.nextLine();
+
+ return builder.getPanel();
+ }
+}
Copied: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java (from rev 4581, projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/MainLayout.java)
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,153 @@
+/*
+ * 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.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.mvc4g.client.Controller;
+import org.gwt.mosaic.ui.client.InfoPanel;
+import org.gwt.mosaic.ui.client.MessageBox;
+import org.gwt.mosaic.ui.client.Viewport;
+import org.gwt.mosaic.ui.client.layout.BorderLayout;
+import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
+import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+
+/**
+ * The main composite that assembles the gwt console application.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class MainLayout extends Composite implements ApplicationContext
+{
+
+ public final static String NAME = "mainLayout";
+
+ private Header header;
+ private Menu menu;
+
+ private Workspace workspace;
+ private URLBuilder urlBuilder;
+ private Authentication auth;
+ private ConsoleConfig config;
+
+ private Controller controller;
+ private Viewport viewport;
+
+ public MainLayout(Controller controller, Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
+ {
+ this.controller = controller;
+ this.auth = auth;
+ this.config = config;
+ this.urlBuilder = urlBuilder;
+
+ display();
+ }
+
+ public void display()
+ {
+ viewport = new Viewport();
+
+ LayoutPanel layout = createLayout();
+ viewport.add(layout);
+
+ RootPanel.get().add(viewport);
+ }
+
+ private LayoutPanel createLayout()
+ {
+ final LayoutPanel layoutPanel = new LayoutPanel(new BorderLayout());
+
+ // header
+ header = new Header(this, auth.getUsername(), auth.getRolesAssigned());
+ layoutPanel.add(header, new BorderLayoutData(Region.NORTH, 50));
+
+ // menu
+ menu = new Menu();
+ layoutPanel.add(menu, new BorderLayoutData(Region.WEST, 200));
+
+ // workspace
+ workspace = createWorkspace();
+ layoutPanel.add(workspace, new BorderLayoutData(Region.CENTER, false));
+
+
+ // register views and actions
+ controller.addView(Header.ID, header);
+
+ controller.addAction(LoadingStatusAction.ID, new LoadingStatusAction());
+
+ return layoutPanel;
+ }
+
+ private Workspace createWorkspace()
+ {
+ Workspace workspace = new Workspace(menu);
+ WorkspaceLauncher launcher = GWT.create(WorkspaceLauncher.class);
+ launcher.launch(this, workspace); // calls Workspace.addEditor()
+ return workspace;
+ }
+
+ // ---- ApplicationContext interface ----
+
+
+ public Viewport getViewport()
+ {
+ return viewport;
+ }
+
+ public Controller getController()
+ {
+ return this.controller;
+ }
+
+ public URLBuilder getUrlBuilder()
+ {
+ return this.urlBuilder;
+ }
+
+ public void displayMessage(final String message, final boolean isError)
+ {
+ if(isError)
+ MessageBox.error("Error", message);
+ else
+ {
+ InfoPanel.show("", message, "");
+ }
+ }
+
+ public Authentication getAuthentication()
+ {
+ return auth;
+ }
+
+ public ConsoleConfig getConfig()
+ {
+ return config;
+ }
+
+ public Workspace getWorkpace()
+ {
+ return workspace;
+ }
+}
+
Deleted: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2009-04-20 15:06:01 UTC (rev 4586)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -1,199 +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.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.mvc4g.client.Controller;
-import org.gwt.mosaic.ui.client.MessageBox;
-import org.gwt.mosaic.ui.client.Viewport;
-import org.gwt.mosaic.ui.client.layout.BorderLayout;
-import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
-import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
-import org.gwt.mosaic.ui.client.layout.LayoutPanel;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-
-/**
- * The main composite that assembles the gwt console application.
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class MainView extends Composite implements ApplicationContext
-{
-
- private HTML status = new HTML();
- private Header header;
- private Menu menu;
- private Workspace workspace;
-
- private URLBuilder urlBuilder;
- private Authentication auth;
-
- private ConsoleConfig config;
-
- public MainView(Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
- {
- this.auth = auth;
- this.config = config;
- this.urlBuilder = urlBuilder;
-
- Viewport viewport = new Viewport();
-
- LayoutPanel layout = createLayout();
- viewport.add(layout);
-
- RootPanel.get().add(viewport);
- }
-
-
- public Viewport getViewport()
- {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public Controller getController()
- {
- throw new RuntimeException("NYI");
- }
-
- private LayoutPanel createLayout()
- {
- final LayoutPanel layoutPanel = new LayoutPanel(new BorderLayout());
-
- // header
- header = new Header(this, auth.getUsername(), auth.getRolesAssigned());
- layoutPanel.add(header, new BorderLayoutData(Region.NORTH, 50));
-
- // menu
- menu = new Menu();
- layoutPanel.add(menu, new BorderLayoutData(Region.WEST, 200));
-
- // workspace
- workspace = createWorkspace(layoutPanel);
- layoutPanel.add(workspace, new BorderLayoutData(Region.CENTER, false));
-
- return layoutPanel;
- }
-
- private Workspace createWorkspace(LayoutPanel layoutPanel)
- {
- Workspace workspace = new Workspace(menu);
- WorkspaceLauncher launcher = GWT.create(WorkspaceLauncher.class);
- launcher.launch(this, workspace);
- return workspace;
- }
-
- /*private Panel createMainPanel()
- {
- Panel mainPanel = new Panel();
- mainPanel.setBorder(false);
- mainPanel.setPaddings(5); // outer most padding
- mainPanel.setLayout(new FitLayout());
- mainPanel.setWidth(UIConstants.OVERALL_WIDTH);
- mainPanel.setHeight(UIConstants.OVERALL_WIDTH);
- mainPanel.setAutoWidth(false);
- return mainPanel;
- }
-
- private void assembleMainApplication(Panel mainPanel)
- {
- Panel borderPanel = new Panel();
- borderPanel.setBorder(false);
- borderPanel.setLayout(new BorderLayout());
-
- // ------------------------------------------
-
- header = new Header(this);
- borderPanel.add(header, new BorderLayoutData(RegionPosition.NORTH));
- header.setUserInfo(auth.getUsername(), auth.getRolesAssigned());
-
- // ------------------------------------------
-
- menu = new Menu(this);
- BorderLayoutData menuData = new BorderLayoutData(RegionPosition.WEST);
- menuData.setSplit(false);
- menuData.setMinSize(UIConstants.MAIN_MENU_MIN);
- menuData.setMaxSize(UIConstants.MAIN_MENU_MAX);
- menuData.setMargins(new Margins(0, 5, 0, 0));
- borderPanel.add(menu, menuData);
-
- // ------------------------------------------
-
- workspace = new Workspace(menu);
- WorkspaceLauncher launcher = GWT.create(WorkspaceLauncher.class);
- launcher.launch(this, workspace);
-
- borderPanel.add(workspace, new BorderLayoutData(RegionPosition.CENTER));
-
- // ------------------------------------------
-
- mainPanel.add(borderPanel);
- } */
-
- public void addEditor(Editor editor)
- {
- ConsoleLog.debug("Add editor " + editor.getEditorId());
- workspace.addEditor(editor, true);
- }
-
- public boolean hasEditor(String id)
- {
- return workspace.hasEditor(id);
- }
-
- public void showEditor(String id)
- {
- workspace.showEditor(id);
- }
-
- public URLBuilder getUrlBuilder()
- {
- return this.urlBuilder;
- }
-
- public void displayMessage(final String message, final boolean isError)
- {
- status.setText(message);
-
- if(isError)
- MessageBox.error("Error", message);
- else
- MessageBox.alert("Alert", message);
- }
-
- public Authentication getAuthentication()
- {
- return auth;
- }
-
- public ConsoleConfig getConfig()
- {
- return config;
- }
-
- public Workspace getWorkpace()
- {
- return workspace;
- }
-}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/events/BootstrapEvent.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/events/BootstrapEvent.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/events/BootstrapEvent.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,58 @@
+/*
+ * 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.events;
+
+import org.jboss.bpm.console.client.Authentication;
+import org.jboss.bpm.console.client.URLBuilder;
+import org.jboss.bpm.console.client.ConsoleConfig;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public final class BootstrapEvent
+{
+ Authentication auth;
+ URLBuilder urlBuilder;
+ ConsoleConfig config;
+
+ public BootstrapEvent(Authentication auth, URLBuilder urlBuilder, ConsoleConfig config)
+ {
+ this.auth = auth;
+ this.urlBuilder = urlBuilder;
+ this.config = config;
+ }
+
+ public Authentication getAuth()
+ {
+ return auth;
+ }
+
+ public URLBuilder getUrlBuilder()
+ {
+ return urlBuilder;
+ }
+
+ public ConsoleConfig getConfig()
+ {
+ return config;
+ }
+}
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/AbstractContextAwareAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,38 @@
+/*
+ * 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 com.mvc4g.client.ActionInterface;
+import org.jboss.bpm.console.client.ApplicationContext;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+abstract class AbstractContextAwareAction implements ActionInterface
+{
+ ApplicationContext appContext;
+
+ public AbstractContextAwareAction(ApplicationContext appContext)
+ {
+ this.appContext = appContext;
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,186 @@
+/*
+ * 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 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.Controller;
+import com.mvc4g.client.Event;
+import com.mvc4g.client.ViewInterface;
+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.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.v2.LazyPanel;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class DefinitionListView extends LayoutPanel
+ implements ViewInterface, LazyPanel
+{
+ public final static String ID = DefinitionListView.class.getName();
+
+ private Controller controller;
+
+ private LayoutPanel definitionList = null;
+
+ private ListBox<ProcessDefinitionRef> listBox;
+
+ private boolean isInitialized;
+
+ public DefinitionListView()
+ {
+ super();
+ setTitle("Process Definitions");
+ }
+
+ public boolean isInitialized()
+ {
+ return isInitialized;
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ definitionList = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ definitionList.setPadding(0);
+ definitionList.setWidgetSpacing(0);
+
+ listBox =
+ new ListBox<ProcessDefinitionRef>(
+ new String[] {
+ "Process ID", "Name", "Key", "Version"}
+ );
+
+
+ listBox.setCellRenderer(new ListBox.CellRenderer<ProcessDefinitionRef>() {
+ public void renderCell(ListBox<ProcessDefinitionRef> listBox, int row, int column,
+ ProcessDefinitionRef item) {
+ switch (column) {
+ case 0:
+ listBox.setText(row, column, item.getId());
+ break;
+ case 1:
+ listBox.setText(row, column, item.getName());
+ break;
+ case 2:
+ listBox.setText(row, column, item.getKey());
+ break;
+ case 3:
+ listBox.setText(row, column, String.valueOf(item.getVersion()));
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
+ }
+ }
+ });
+
+ listBox.addChangeListener(new ChangeListener()
+ {
+ public void onChange(Widget widget)
+ {
+ int index = listBox.getSelectedIndex();
+ if(index!=-1)
+ {
+ controller.handleEvent(
+ new Event(
+ LoadInstancesAction.ID,
+ listBox.getItem( index )
+ )
+ );
+ }
+ }
+ });
+
+ final DefaultListModel<ProcessDefinitionRef> model =
+ (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
+
+ // 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(LoadDefinitionsAction.ID, null)
+ );
+ }
+ }
+ )
+ );
+
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ this.definitionList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ this.definitionList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ this.add(definitionList);
+
+ isInitialized = true;
+ }
+ }
+
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void update(List<ProcessDefinitionRef> definitions)
+ {
+ // lazy init
+ initialize();
+
+ final DefaultListModel<ProcessDefinitionRef> model =
+ (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
+
+ model.clear();
+
+ for(ProcessDefinitionRef def : definitions)
+ {
+ model.add(def);
+ }
+ }
+
+ public ProcessDefinitionRef getSelection()
+ {
+ ProcessDefinitionRef selection = null;
+ if(isInitialized() && listBox.getSelectedIndex()!=-1)
+ selection = listBox.getItem( listBox.getSelectedIndex());
+ return selection;
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,204 @@
+/*
+ * 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 com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+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.MessageBox;
+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.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class InstanceListView extends LayoutPanel implements ViewInterface
+{
+ public final static String ID = InstanceListView.class.getName();
+
+ private Controller controller;
+
+ private LayoutPanel instanceList = null;
+
+ private ListBox<ProcessInstanceRef> listBox;
+
+ private ProcessDefinitionRef currentDefinition;
+
+ 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"}
+ );
+
+
+ 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
+
+ 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()
+ )
+ );
+ }
+ }
+ )
+ );
+
+ toolBar.addSeparator();
+
+ toolBar.add(
+ new ToolButton("Start new instance", new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ controller.handleEvent(
+ new Event(
+ StartNewInstanceAction.ID,
+ getCurrentDefinition()
+ )
+ );
+ }
+ }
+ )
+ );
+
+ toolBar.addSeparator();
+
+ toolBar.add(
+ new ToolButton("Cancel execution", new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ 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));
+
+ instanceList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ instanceList.add(listBox, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ this.add(instanceList);
+
+ }
+
+ public ProcessInstanceRef getSelection()
+ {
+ ProcessInstanceRef selection = null;
+ if(listBox.getSelectedIndex()!=-1)
+ selection = listBox.getItem( listBox.getSelectedIndex());
+ return selection;
+ }
+
+ public ProcessDefinitionRef getCurrentDefinition()
+ {
+ return this.currentDefinition;
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+
+ public void update(final ProcessDefinitionRef def, List<ProcessInstanceRef> instances)
+ {
+ this.currentDefinition = def;
+
+ final DefaultListModel<ProcessInstanceRef> model =
+ (DefaultListModel<ProcessInstanceRef>) listBox.getModel();
+ model.clear();
+
+ for(ProcessInstanceRef inst : instances)
+ {
+ model.add(inst);
+ }
+
+ // layout again
+ this.invalidate();
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,96 @@
+/*
+ * 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 com.google.gwt.core.client.JavaScriptObject;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.LoadingStatusAction;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.util.JSONRequest;
+import org.jboss.bpm.console.client.util.JSONRequestHandler;
+
+import java.util.List;
+
+/**
+ * Loads a process definition list.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class LoadDefinitionsAction extends AbstractContextAwareAction
+{
+ public final static String ID = LoadDefinitionsAction.class.getName();
+
+ public LoadDefinitionsAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ /**
+ *
+ * @param controller
+ * @param object - ignored, can be null
+ */
+ public void execute(final Controller controller, Object object)
+ {
+ String url = appContext.getUrlBuilder().getProcessDefinitionsURL();
+
+ controller.handleEvent( LoadingStatusAction.ON );
+
+ try
+ {
+ JSONRequest.get(
+ url, new JSONRequestHandler()
+ {
+ public void onRequestComplete(JavaScriptObject json)
+ {
+ if (json == null) {
+ appContext.displayMessage("Couldn't retrieve process definition data", true);
+ return;
+ }
+
+ List<ProcessDefinitionRef> definitions = null;
+ try
+ {
+ definitions = DTOParser.parseProcessDefinitions(json);
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ appContext.displayMessage(e.getMessage(), true);
+ }
+
+
+ DefinitionListView view = (DefinitionListView) controller.getView(DefinitionListView.ID);
+ view.update(definitions);
+
+ appContext.displayMessage("Loaded " + definitions.size() + " process definitions", false);
+ }
+ }
+ );
+ }
+ finally{
+ controller.handleEvent( LoadingStatusAction.OFF );
+ }
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,91 @@
+/*
+ * 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 com.google.gwt.core.client.JavaScriptObject;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.util.JSONRequest;
+import org.jboss.bpm.console.client.util.JSONRequestHandler;
+
+import java.util.List;
+
+/**
+ * Force loading of a process instance list.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class LoadInstancesAction extends AbstractContextAwareAction
+{
+ public final static String ID = LoadInstancesAction.class.getName();
+
+ public LoadInstancesAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ /**
+ *
+ * @param controller
+ * @param object - a {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
+ */
+ public void execute(final Controller controller, Object object)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
+
+ String url = appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
+
+ JSONRequest.get(
+ url, new JSONRequestHandler()
+ {
+ public void onRequestComplete(JavaScriptObject json)
+ {
+ if (json == null) {
+ appContext.displayMessage("Couldn't retrieve process instance data", true);
+ return;
+ }
+
+ List<ProcessInstanceRef> instances = null;
+ try
+ {
+ instances = DTOParser.parseProcessInstances(json);
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ appContext.displayMessage(e.getMessage(), true);
+ }
+
+
+ InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
+ view.update(def, instances);
+
+ appContext.displayMessage("Loaded " + instances.size() + " process instances", false);
+ }
+ }
+ );
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,152 @@
+/*
+ * 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 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.ActionInterface;
+import com.mvc4g.client.Event;
+import com.mvc4g.client.ViewInterface;
+import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
+import org.gwt.mosaic.ui.client.MessageBox;
+import org.gwt.mosaic.ui.client.TabLayoutPanel;
+import static org.gwt.mosaic.ui.client.layout.BorderLayout.Region;
+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;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class ProcessEditor extends Editor
+{
+ public final static String ID = ProcessEditor.class.getName();
+
+ private TabLayoutPanel tabPanel;
+
+ public ProcessEditor(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+ // create inner tab layout
+ tabPanel = new DecoratedTabLayoutPanel();
+ tabPanel.setPadding(5);
+ this.add(tabPanel, new BorderLayoutData(Region.CENTER));
+
+ // create and register views
+ addView(DefinitionListView.ID, new DefinitionListView());
+ addView(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));
+
+ // 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);
+
+ // force loading
+ super.controller.handleEvent(
+ new Event(LoadDefinitionsAction.ID, null)
+ );
+
+ refreshView();
+
+ isInitialized = true;
+ }
+ }
+
+ private void addView(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 addAction(String name, ActionInterface action)
+ {
+ super.controller.addAction(name, action);
+ }
+
+ public String getEditorId()
+ {
+ return ID;
+ }
+
+ public String getTitle()
+ {
+ return "Processes";
+ }
+
+ public String getIconCSS()
+ {
+ return "bpm-process-icon";
+ }
+
+ public MenuSection provideMenuSection()
+ {
+ return new MenuSection(
+ "Process Management",
+ "bpm-process-icon",
+ new ProcessEditorNavigation(appContext)
+ );
+ }
+}
+
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,62 @@
+/*
+ * 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 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 ProcessEditorNavigation extends Tree
+{
+
+ public ProcessEditorNavigation(final ApplicationContext appContext)
+ {
+ super.setTitle("Processes");
+
+ TreeItem root = addItem("Process Definitions");
+ TreeItem definitions = root.addItem("View definitions");
+
+ addTreeListener(
+ new TreeListener()
+ {
+ public void onTreeItemSelected(TreeItem treeItem)
+ {
+ if("View definitions".equals(treeItem.getText()))
+ {
+ Workspace workspace = appContext.getWorkpace();
+ workspace.showEditor(ProcessEditor.ID);
+ }
+ }
+
+ public void onTreeItemStateChanged(TreeItem treeItem)
+ {
+
+ }
+ }
+ );
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,99 @@
+/*
+ * 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 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.model.ProcessDefinitionRef;
+
+/**
+ * Starts a new process instance.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class StartNewInstanceAction extends AbstractContextAwareAction
+{
+ public final static String ID = StartNewInstanceAction.class.getName();
+
+ public StartNewInstanceAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ /**
+ *
+ * @param controller
+ * @param object a {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
+ */
+ public void execute(final Controller controller, Object object)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
+
+ String url = appContext.getUrlBuilder().getStartNewInstanceURL(def.getId());
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
+
+ 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()) {
+
+ // 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
+ );
+ }
+ }
+ });
+ }
+ catch (RequestException e)
+ {
+ // Couldn't connect to server
+ handleError(e);
+ }
+ }
+
+ private void handleError(Throwable t)
+ {
+ // Couldn't connect to server
+ appContext.displayMessage("Failed to start new instance. " +
+ "RequestException( "+t.getClass() +"): "+
+ t.getMessage(),
+ true
+ );
+ }
+}
Added: 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 (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -0,0 +1,105 @@
+/*
+ * 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.ApplicationContext;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import com.google.gwt.http.client.*;
+
+/**
+ * Starts a new process instance.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessInstanceRef}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class StateChangeAction extends AbstractContextAwareAction
+{
+ public final static String ID = StateChangeAction.class.getName();
+
+ public StateChangeAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ /**
+ *
+ * @param controller
+ * @param object a {@link org.jboss.bpm.console.client.model.ProcessInstanceRef}
+ */
+ public void execute(final Controller controller, Object object)
+ {
+ final ProcessInstanceRef inst = (ProcessInstanceRef)object;
+
+ String url = appContext.getUrlBuilder().getStateChangeURL(inst.getId(), inst.getState());
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
+
+ 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);
+ }
+ }
+
+ private void handleError(Throwable t)
+ {
+ // Couldn't connect to server
+ appContext.displayMessage("Failed to cancel instance. " +
+ "RequestException( "+t.getClass() +"): "+
+ t.getMessage(),
+ true
+ );
+ }
+}
+
Modified: projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml 2009-04-20 15:06:01 UTC (rev 4586)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/mvc4g-conf.xml 2009-04-20 16:11:30 UTC (rev 4587)
@@ -7,10 +7,10 @@
<mvc4g>
<controller name="mainController" class="com.mvc4g.client.Controller">
<views>
- <view name="loginView" class="org.jboss.bpm.console.client.v2.LoginView" />
+ <view name="loginView" class="org.jboss.bpm.console.client.LoginView" />
</views>
<actions>
- <action name="login" class="org.jboss.bpm.console.client.v2.LoginAction" />
+ <action name="login" class="org.jboss.bpm.console.client.LoginAction" />
</actions>
</controller>
Added: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading.gif
===================================================================
(Binary files differ)
Property changes on: projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/public/images/loading.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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-20 15:06:01 UTC (rev 4586)
+++ projects/gwt-console/branches/hbraun/war/src/main/resources/org/jboss/bpm/console/workspace-default.cfg 2009-04-20 16:11:30 UTC (rev 4587)
@@ -1,4 +1,4 @@
-org.jboss.bpm.console.client.v2.process.ProcessEditor
+org.jboss.bpm.console.client.process.ProcessEditor
#org.jboss.bpm.console.client.task.TaskEditor
# not yet implemented in jBPM4
Deleted: projects/gwt-console/branches/hbraun/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java 2009-04-20 15:06:01 UTC (rev 4586)
+++ projects/gwt-console/branches/hbraun/war/src/test/java/org/jboss/bpm/console/client/AbstractConsoleTC.java 2009-04-20 16:11:30 UTC (rev 4587)
@@ -1,89 +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.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.core.client.GWT;
-
-import java.util.Map;
-
-/**
- * Base class for console tests
- *
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class AbstractConsoleTC extends GWTTestCase
-{
-
- protected static Application application = null;
- protected static final String GWT_TEST_HARNESS = "GWT_Test_Harness";
- protected URLBuilder urlBuilder;
-
- public String getModuleName()
- {
- return "org.jboss.bpm.console.Application";
- }
-
- protected void gwtSetUp() throws Exception
- {
- super.gwtSetUp();
-
- if(null==application)
- {
- application = new Application();
- application.onModuleLoad2();
- }
-
- String proxyUrl = GWT.getModuleBaseURL() + "xhp";
- ConsoleConfig config = new ConsoleConfig(proxyUrl, proxyUrl);
- urlBuilder = new URLBuilder(config);
- }
-
- protected abstract class ChainedTimer extends Timer
- {
- protected Map<String,Object> context;
-
- protected ChainedTimer(Map<String, Object> context)
- {
- this.context = context;
- }
-
- protected void proceedOrFinish()
- {
-
- ChainedTimer next = getNext();
- if(next !=null)
- {
- next.schedule(2000);
- delayTestFinish(5000);
- }
- else
- {
- finishTest();
- }
- }
-
- public abstract ChainedTimer getNext();
-
- }
-}
15 years, 1 month
JBoss JBPM SVN: r4586 - in projects/gwt-console/branches/hbraun: server/src/main/java/org/jboss/bpm/console/server and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 11:06:01 -0400 (Mon, 20 Apr 2009)
New Revision: 4586
Added:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StateChangeAction.java
Modified:
projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/branches/hbraun/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
Log:
Implement cancel instance
Modified: projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-04-20 14:30:21 UTC (rev 4585)
+++ projects/gwt-console/branches/hbraun/plugin-api/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2009-04-20 15:06:01 UTC (rev 4586)
@@ -86,7 +86,7 @@
public String getStateChangeURL(String instanceId, ProcessInstanceRef.STATE state)
{
- return getConsoleServerUrl() + "/rs/process/instances/" + adoptExecutionId(instanceId) + "/state/" + state;
+ return getConsoleServerUrl() + "/rs/process/instances/" + instanceId + "/state/" + state;
}
public String getStartNewInstanceURL(String processId)
@@ -132,21 +132,15 @@
public String getExecutionSignalUrl(TokenReference tok)
{
- return getConsoleServerUrl() + "/rs/process/tokens/" + adoptExecutionId(tok.getId()) + "/transition/default";
+ return getConsoleServerUrl() + "/rs/process/tokens/" + tok.getId() + "/transition/default";
}
public String getExecutionSignalUrl(TokenReference tok, String signal)
{
String encodedSignal = URL.encode(signal);
- return getConsoleServerUrl() + "/rs/process/tokens/" + adoptExecutionId(tok.getId()) + "/transition?signal=" + encodedSignal;
+ return getConsoleServerUrl() + "/rs/process/tokens/" + tok.getId() + "/transition?signal=" + encodedSignal;
}
- private String adoptExecutionId(String actual)
- {
- // TDOD: https://jira.jboss.org/jira/browse/JBPM-2054
- return actual.replace("/", "_");
- }
-
public String getAvailableActorsUrl(String actorId)
{
return getConsoleServerUrl() + "/rs/identity/user/" + actorId + "/actors";
Modified: projects/gwt-console/branches/hbraun/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java
===================================================================
--- projects/gwt-console/branches/hbraun/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-04-20 14:30:21 UTC (rev 4585)
+++ projects/gwt-console/branches/hbraun/server/src/main/java/org/jboss/bpm/console/server/ProcessMgmtFacade.java 2009-04-20 15:06:01 UTC (rev 4586)
@@ -134,11 +134,9 @@
@PathParam("next")
String next)
{
- String actualExecutionId = adoptExecutionId(executionId);
- log.debug("Change instance (ID "+actualExecutionId+") to state " +next);
-
- //ProcessInstanceRef.STATE state = ProcessInstanceRef.STATE.valueOf(next);
- getProcessManagement().setProcessState(actualExecutionId, ProcessInstanceRef.STATE.ENDED);
+ ProcessInstanceRef.STATE state = ProcessInstanceRef.STATE.valueOf(next);
+ log.debug("Change instance (ID "+executionId+") to state " +state);
+ getProcessManagement().setProcessState(executionId, state);
return Response.ok().type("application/json").build();
}
@@ -156,7 +154,7 @@
if ("default transition".equals(signalName))
signalName = null;
- getProcessManagement().signalExecution(adoptExecutionId(id), signalName);
+ getProcessManagement().signalExecution(id, signalName);
return Response.ok().type("application/json").build();
}
@@ -169,16 +167,10 @@
{
log.debug("Signal token " + id);
- getProcessManagement().signalExecution(adoptExecutionId(id), null);
+ getProcessManagement().signalExecution(id, null);
return Response.ok().type("application/json").build();
}
- private String adoptExecutionId(String modified)
- {
- // TODO: https://jira.jboss.org/jira/browse/JBPM-2054
- return modified.replace("_", "/");
- }
-
@POST
@Path("definitions/new")
@Produces("application/json")
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java 2009-04-20 14:30:21 UTC (rev 4585)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/InstanceListView.java 2009-04-20 15:06:01 UTC (rev 4586)
@@ -29,6 +29,7 @@
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.layout.BoxLayout;
import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
@@ -113,8 +114,10 @@
toolBar.addSeparator();
toolBar.add(
- new ToolButton("Start new instance", new ClickListener() {
- public void onClick(Widget sender) {
+ new ToolButton("Start new instance", new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
controller.handleEvent(
new Event(
StartNewInstanceAction.ID,
@@ -126,7 +129,34 @@
)
);
+ toolBar.addSeparator();
+ toolBar.add(
+ new ToolButton("Cancel execution", new ClickListener()
+ {
+ public void onClick(Widget sender)
+ {
+ 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));
instanceList.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
@@ -136,8 +166,16 @@
}
- private ProcessDefinitionRef getCurrentDefinition()
+ public ProcessInstanceRef getSelection()
{
+ ProcessInstanceRef selection = null;
+ if(listBox.getSelectedIndex()!=-1)
+ selection = listBox.getItem( listBox.getSelectedIndex());
+ return selection;
+ }
+
+ public ProcessDefinitionRef getCurrentDefinition()
+ {
return this.currentDefinition;
}
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 14:30:21 UTC (rev 4585)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/ProcessEditor.java 2009-04-20 15:06:01 UTC (rev 4586)
@@ -67,7 +67,8 @@
addAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
addAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
addAction(StartNewInstanceAction.ID, new StartNewInstanceAction(appContext));
-
+ addAction(StateChangeAction.ID, new StateChangeAction(appContext));
+
// tab Listener
tabPanel.addTabListener(
new TabListener()
Added: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StateChangeAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StateChangeAction.java (rev 0)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StateChangeAction.java 2009-04-20 15:06:01 UTC (rev 4586)
@@ -0,0 +1,105 @@
+/*
+ * 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.v2.process;
+
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import com.google.gwt.http.client.*;
+
+/**
+ * Starts a new process instance.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessInstanceRef}
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+class StateChangeAction extends AbstractContextAwareAction
+{
+ public final static String ID = StateChangeAction.class.getName();
+
+ public StateChangeAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ /**
+ *
+ * @param controller
+ * @param object a {@link org.jboss.bpm.console.client.model.ProcessInstanceRef}
+ */
+ public void execute(final Controller controller, Object object)
+ {
+ final ProcessInstanceRef inst = (ProcessInstanceRef)object;
+
+ String url = appContext.getUrlBuilder().getStateChangeURL(inst.getId(), inst.getState());
+ RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));
+
+ 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);
+ }
+ }
+
+ private void handleError(Throwable t)
+ {
+ // Couldn't connect to server
+ appContext.displayMessage("Failed to cancel instance. " +
+ "RequestException( "+t.getClass() +"): "+
+ t.getMessage(),
+ true
+ );
+ }
+}
+
15 years, 1 month
JBoss JBPM SVN: r4585 - projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-04-20 10:30:21 -0400 (Mon, 20 Apr 2009)
New Revision: 4585
Modified:
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java
projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java
Log:
Update javadocs for action classes
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java 2009-04-20 14:23:39 UTC (rev 4584)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadDefinitionsAction.java 2009-04-20 14:30:21 UTC (rev 4585)
@@ -33,7 +33,7 @@
import java.util.List;
/**
- * Fire's a new event when definitions are loaded.
+ * Loads a process definition list.
*
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -46,6 +46,11 @@
super(appContext);
}
+ /**
+ *
+ * @param controller
+ * @param object - ignored, can be null
+ */
public void execute(final Controller controller, Object object)
{
String url = appContext.getUrlBuilder().getProcessDefinitionsURL();
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java 2009-04-20 14:23:39 UTC (rev 4584)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/LoadInstancesAction.java 2009-04-20 14:30:21 UTC (rev 4585)
@@ -33,6 +33,9 @@
import java.util.List;
/**
+ * Force loading of a process instance list.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
class LoadInstancesAction extends AbstractContextAwareAction
@@ -44,6 +47,11 @@
super(appContext);
}
+ /**
+ *
+ * @param controller
+ * @param object - a {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
+ */
public void execute(final Controller controller, Object object)
{
final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
Modified: projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java
===================================================================
--- projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java 2009-04-20 14:23:39 UTC (rev 4584)
+++ projects/gwt-console/branches/hbraun/war/src/main/java/org/jboss/bpm/console/client/v2/process/StartNewInstanceAction.java 2009-04-20 14:30:21 UTC (rev 4585)
@@ -28,6 +28,9 @@
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
/**
+ * Starts a new process instance.
+ * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
+ *
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
class StartNewInstanceAction extends AbstractContextAwareAction
@@ -39,6 +42,11 @@
super(appContext);
}
+ /**
+ *
+ * @param controller
+ * @param object a {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}
+ */
public void execute(final Controller controller, Object object)
{
final ProcessDefinitionRef def = (ProcessDefinitionRef)object;
15 years, 1 month