[jbpm-commits] JBoss JBPM SVN: r4587 - in projects/gwt-console/branches/hbraun/war/src: main/java/org/jboss/bpm/console/client/events and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Apr 20 12:11:30 EDT 2009


Author: heiko.braun at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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();
-
-   }
-}




More information about the jbpm-commits mailing list