[jbpm-commits] JBoss JBPM SVN: r2660 - in projects/gwt-console/trunk: war/src/main/java/jmaki/xhp and 8 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 29 10:40:28 EDT 2008
Author: heiko.braun at jboss.com
Date: 2008-10-29 10:40:28 -0400 (Wed, 29 Oct 2008)
New Revision: 2660
Added:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MenuSection.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
Removed:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainCompositeView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenuSection.java
Modified:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java
projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxy.java
projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Authentication.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Header.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json
projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java
Log:
Added TaskListEditor. Login form credentials. Fine tune authentication helper
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReference.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -31,12 +31,12 @@
@XmlRootElement(name = "taskReference")
public class TaskReference
{
- private long taskId;
+ private long id;
private long tokenId;
private long processInstanceId;
- private String taskName;
- private String actorName;
+ private String name;
+ private String actor;
private boolean isBlocking;
private boolean isSignalling = true;
@@ -49,23 +49,23 @@
public TaskReference(long taskId, long tokenId, long processInstanceId, String taskName, String actorName, boolean blocking, boolean signalling)
{
- this.taskId = taskId;
+ this.id = taskId;
this.tokenId = tokenId;
this.processInstanceId = processInstanceId;
- this.taskName = taskName;
- this.actorName = actorName;
+ this.name = taskName;
+ this.actor = actorName;
isBlocking = blocking;
isSignalling = signalling;
}
- public long getTaskId()
+ public long getId()
{
- return taskId;
+ return id;
}
- public void setTaskId(long taskId)
+ public void setId(long id)
{
- this.taskId = taskId;
+ this.id = id;
}
public long getTokenId()
@@ -88,24 +88,24 @@
this.processInstanceId = processInstanceId;
}
- public String getTaskName()
+ public String getName()
{
- return taskName;
+ return name;
}
- public void setTaskName(String taskName)
+ public void setName(String name)
{
- this.taskName = taskName;
+ this.name = name;
}
- public String getActorName()
+ public String getActor()
{
- return actorName;
+ return actor;
}
- public void setActorName(String actorName)
+ public void setActor(String actor)
{
- this.actorName = actorName;
+ this.actor = actor;
}
public boolean isBlocking()
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/TaskReferenceWrapper.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -22,6 +22,7 @@
package org.jboss.bpm.console.client.model;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlElement;
import java.util.List;
import java.util.ArrayList;
@@ -33,7 +34,6 @@
{
List<TaskReference> tasks = new ArrayList<TaskReference>();
-
public TaskReferenceWrapper()
{
}
@@ -52,4 +52,10 @@
{
this.tasks = tasks;
}
+
+ @XmlElement(name = "totalCount")
+ public int getTotalCount()
+ {
+ return tasks.size();
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxy.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxy.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxy.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -146,6 +146,11 @@
in = httpclient.doPost(postData, postContentType);
}
+ if(null==in)
+ {
+ throw new IOException("Failed to open input stream");
+ }
+
// read the encoding from the incoming document and default to UTF-8
// if an encoding is not provided
String ce = httpclient.getContentEncoding();
Modified: projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/jmaki/xhp/XmlHttpProxyServlet.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -38,7 +38,8 @@
private String resourcesDir = "/resources/";
private String classpathResourcesDir = "/META-INF/resources/";
private String headerToken = "jmaki-";
-
+ private String testToken = "xtest-";
+
public XmlHttpProxyServlet() {
if (rDebug) {
logger = getLogger();
@@ -215,9 +216,13 @@
// Forward all request headers starting with the header token jmaki-
// and chop off the jmaki-
Enumeration hnum = req.getHeaderNames();
+
+ // test hack
+
while (hnum.hasMoreElements()) {
String name = (String)hnum.nextElement();
- if (name.startsWith(headerToken)) {
+ if (name.startsWith(headerToken))
+ {
if (headers == null) headers = new HashMap();
String value = "";
@@ -230,6 +235,12 @@
String sname = name.substring(headerToken.length(), name.length());
headers.put(sname,value);
}
+ else if(name.startsWith(testToken))
+ {
+ // hack test capabilities for authentication
+ if("xtest-user".equals(name)) userName = req.getHeader("xtest-user");
+ if("xtest-pass".equals(name)) password = req.getHeader("xtest-pass");
+ }
}
try
{
@@ -243,8 +254,10 @@
if (service.has("passthrough")) passthrough =
Boolean.valueOf(service.getString("passthrough"));
+
if (service.has("username")) userName = service.getString("username");
if (service.has("password")) password = service.getString("password");
+
String apikey = "";
if (service.has("apikey")) apikey = service.getString("apikey");
if (service.has("xslStyleSheet")) xslURLString = service.getString("xslStyleSheet");
@@ -357,13 +370,13 @@
iox.printStackTrace();
getLogger().severe("XmlHttpProxyServlet: caught " + iox);
res.setStatus(500);
- try {
+ /*try {
writer = res.getWriter();
writer.write("XmlHttpProxyServlet error loading service for " + serviceKey + " . Please notify the administrator.");
writer.flush();
} catch (java.io.IOException ix) {
ix.printStackTrace();
- }
+ }*/
return;
}
finally
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -7,17 +7,17 @@
*/
public class Application implements EntryPoint
{
- private MainCompositeView mainView;
+ private MainView mainView;
/**
* This is the entry point method.
*/
public void onModuleLoad()
{
- mainView = new MainCompositeView();
+ mainView = new MainView();
}
- public MainCompositeView getConsoleView()
+ public MainView getConsoleView()
{
return mainView;
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Authentication.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Authentication.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Authentication.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -22,13 +22,15 @@
package org.jboss.bpm.console.client;
import com.google.gwt.http.client.*;
+import com.google.gwt.core.client.GWT;
import org.jboss.bpm.console.client.model.DTOParser;
import java.util.List;
import java.util.ArrayList;
/**
- * Authentication helper
+ * Does HTTP Basic Auth and keeps assigned roles
+ * (piggy backed on response) and the username that was used.
*
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@@ -37,8 +39,8 @@
private String loginUrl;
private AuthCallback callback;
private List<String> rolesAssigned = new ArrayList<String>();
+ private String username;
-
public Authentication(String loginUrl)
{
this.loginUrl = loginUrl;
@@ -68,6 +70,8 @@
{
RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, loginUrl);
+ this.username = user;
+ // discard password
System.out.println("Authentication against: " + rb.getUrl());
@@ -75,6 +79,12 @@
{
rb.setUser(user);
rb.setPassword(pass);
+
+ if(!GWT.isScript()) // hosted mode only
+ {
+ rb.setHeader("xtest-user", user);
+ rb.setHeader("xtest-pass", pass); // NOTE: This is plaintext, use for testing only
+ }
}
try
@@ -85,23 +95,32 @@
public void onResponseReceived(Request request, Response response)
{
// parse roles
- rolesAssigned = DTOParser.parseRolesAssigned(response.getText());
- if(callback!=null) callback.onLoginSuccess(request, response);
+ if(200==response.getStatusCode())
+ {
+ rolesAssigned = DTOParser.parseRolesAssigned(response.getText());
+ if(callback!=null) callback.onLoginSuccess(request, response);
+ }
+ else
+ {
+ onError(request, new Exception(response.getText()));
+ }
}
public void onError(Request request, Throwable t)
{
// auth failed
+ // Couldn't connect to server (could be timeout, SOP violation, etc.)
if(callback!=null)
callback.onLoginFailed(request, t);
else
- throw new RuntimeException("Login failed", t);
+ throw new RuntimeException("Unknown exception upon login attempt", t);
}
});
}
catch (RequestException e1)
{
+ // Couldn't connect to server
throw new RuntimeException("Unknown error upon login attempt", e1);
}
}
@@ -123,4 +142,9 @@
{
return rolesAssigned;
}
+
+ public String getUsername()
+ {
+ return username;
+ }
}
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java (from rev 2652, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorView.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -0,0 +1,43 @@
+/*
+ * 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.gwtext.client.widgets.Panel;
+
+/**
+ * An editor can be plugged into a {@link org.jboss.bpm.console.client.Workspace}
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public abstract class Editor extends Panel
+{
+
+ protected Editor()
+ {
+ super();
+
+ }
+
+ public abstract String getEditorId();
+ public abstract String getTitle();
+ public abstract String getIconCSS();
+}
Property changes on: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Editor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -1,104 +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.gwtext.client.widgets.Component;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.TabPanel;
-import org.jboss.bpm.console.client.EditorView;
-
-/**
- * Maintains {@link org.jboss.bpm.console.client.EditorPanel}'s
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class EditorPanel extends TabPanel
-{
- protected MainCompositeView view;
-
- public EditorPanel()
- {
- super();
-
- this.setResizeTabs(true);
- this.setMinTabWidth(115);
- this.setTabWidth(135);
- this.setEnableTabScroll(true);
- this.setAutoScroll(true);
- this.setActiveTab(0);
- }
-
- private Panel addTab(EditorView editorView, boolean closeable) {
- Panel tab = new WrapperPanel(editorView.getId()+".tab");
- tab.setAutoScroll(true);
- tab.setTitle(editorView.getTitle());
- tab.setClosable(closeable);
- tab.setBorder(false);
- tab.setFrame(false);
- tab.setHideBorders(true);
- tab.setIconCls(editorView.getIconCSS());
- this.add(tab);
- return tab;
- }
-
- public void addEditor(EditorView editorView, boolean closeable)
- {
- Panel tab = addTab(editorView, closeable);
- tab.add(editorView);
- this.setActiveTab(tab.getId());
- }
-
- public boolean hasEditor(String id)
- {
- boolean b = false;
- final String tabId = id +".tab";
-
- Component[] tabs = this.getItems();
- for(int i=0; i<tabs.length; i++)
- {
- Component tab = tabs[i];
- if(tab.getId().equals(tabId))
- {
- b=true;
- break;
- }
- }
-
- return b;
- }
-
- public void showTab(String id)
- {
- final String tabId = id+".tab";
- this.setActiveTab(tabId);
- }
-
- class WrapperPanel extends Panel
- {
-
- public WrapperPanel(String id)
- {
- super();
- setId(id);
- }
- }
-}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorView.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorView.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -1,42 +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.gwtext.client.widgets.Panel;
-
-/**
- * An editor can be plugged into a {@link org.jboss.bpm.console.client.EditorPanel}
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public abstract class EditorView extends Panel
-{
-
- protected EditorView()
- {
- super();
- }
-
- public abstract String getEditorId();
- public abstract String getTitle();
- public abstract String getIconCSS();
-}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Header.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Header.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Header.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -23,17 +23,20 @@
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.layout.*;
+import com.google.gwt.user.client.ui.HTML;
+import java.util.List;
+
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class Header extends Panel
{
- private MainCompositeView view;
+ private MainView view;
public final static String ID = "org.jboss.bpm.headerPanel";
- public Header(MainCompositeView view)
+ public Header(MainView view)
{
super();
this.view = view;
@@ -45,49 +48,20 @@
this.setHeight(50);
this.setBaseCls("bpm-header");
+ }
- // --
-
- /* FormPanel formPanel = new FormPanel();
- formPanel.setUrl("");
- formPanel.setLabelAlign(Position.TOP);
- formPanel.setWidth(100);
+ public void setUserInfo(String username, List<String> roles)
+ {
+ Panel userInfo = new Panel();
+ userInfo.setBorder(false);
+ userInfo.setHeader(false);
+ userInfo.setFrame(false);
- // ---
-
- Panel topPanel = new Panel();
- topPanel.setLayout(new ColumnLayout());
-
- Panel columnOnePanel = new Panel();
- columnOnePanel.setLayout(new FormLayout());
-
- TextField name = new TextField("Username", "username", 230);
- name.setAllowBlank(false);
-
- columnOnePanel.add(name, new AnchorLayoutData("95%"));
-
- // ---
-
- Panel columnTwoPanel = new Panel();
- columnTwoPanel.setLayout(new FormLayout());
-
- TextField pass = new TextField("Password", "password", 230);
- pass.setAllowBlank(false);
- pass.setPassword(true);
-
- columnTwoPanel.add(pass, new AnchorLayoutData("95%"));
-
- // ---
-
- topPanel.add(name, new ColumnLayoutData(.5));
- topPanel.add(pass, new ColumnLayoutData(.5));
-
- formPanel.add(topPanel);
-
- // ---
+ userInfo.add( new HTML("<h3>User: "+view.getUsername()+"</h3>"));
- final Image image = new Image("images/Jbpm_logo_small.png");
- this.add(formPanel); */
+ this.clear();
+ this.add(userInfo);
+ this.doLayout();
}
}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainCompositeView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainCompositeView.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainCompositeView.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -1,236 +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.http.client.Request;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.core.Margins;
-import com.gwtext.client.core.RegionPosition;
-import com.gwtext.client.widgets.*;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-import com.gwtext.client.widgets.layout.BorderLayout;
-import com.gwtext.client.widgets.layout.BorderLayoutData;
-import com.gwtext.client.widgets.layout.FitLayout;
-import com.gwtext.client.widgets.layout.VerticalLayout;
-import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
-import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
-
-/**
- * The main composite that assembles the gwt console application.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class MainCompositeView extends Composite
-{
- private HTML status = new HTML();
- private Header header;
- private MainMenu mainMenu;
- private EditorPanel editorPanel;
- private URLBuilder urlBuilder;
-
- private String[] rolesAssigned = new String[] {};
- public final static String[] KNOWN_ROLES = {"admin", "user"};
-
- private Viewport viewport;
-
- public MainCompositeView()
- {
- if(!GWT.isScript()) // hosted mode used proxy by default
- urlBuilder = new URLBuilder(GWT.getModuleBaseURL(), "xhp");
- else
- urlBuilder = new URLBuilder( "http://localhost:8080", "gwt-console-server"); // TODO: make configureable
-
- Panel mainPanel = createMainPanel();
- assembleMainApplication(mainPanel);
- forceLogin(mainPanel);
- viewport = new Viewport(mainPanel);
- }
-
- 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.hide();
-
- initWidget( mainPanel );
- return mainPanel;
- }
-
- private void assembleMainApplication(Panel mainPanel)
- {
- Panel borderPanel = new Panel();
- borderPanel.setLayout(new BorderLayout());
-
- // ------------------------------------------
-
- header = new Header(this);
- borderPanel.add(header, new BorderLayoutData(RegionPosition.NORTH));
-
- // ------------------------------------------
-
- mainMenu = new MainMenu(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(mainMenu, menuData);
-
- // ------------------------------------------
-
- editorPanel = new EditorPanel();
- borderPanel.add(editorPanel, new BorderLayoutData(RegionPosition.CENTER));
-
- // ------------------------------------------
-
- editorPanel.addEditor( new ProcessDefinitionListEditor(this), false );
- editorPanel.addEditor( new MetricOverviewEditor(this), false);
-
- // ------------------------------------------
-
- mainPanel.add(borderPanel);
- }
-
- private void forceLogin(final Panel mainPanel)
- {
- Panel panel = new Panel();
- panel.setPaddings(20);
- panel.setStyleName("login-panel-content");
- panel.setLayout(new VerticalLayout(10));
- panel.add( new HTML("Welcome, please login.") );
-
- final Window window = new Window();
- window.setTitle("GWT-Console");
- window.setClosable(false);
- window.setResizable(false);
- window.setWidth(300);
- window.setHeight(180);
- window.setLayout(new BorderLayout());
- window.setCloseAction(Window.CLOSE);
-
- final Button submitBtn = new Button("Login",
- new ButtonListenerAdapter()
- {
- public void onClick(Button button, EventObject e)
- {
- String url = getUrlBuilder().getUserInRoleURL(KNOWN_ROLES);
- final Authentication authentication = new Authentication(url);
- authentication.setCallback(
- new Authentication.AuthCallback()
- {
-
- public void onLoginSuccess(Request request, Response response)
- {
- // parse roles
- rolesAssigned = authentication.getRolesAssigned().toArray(new String[] {});
-
- // display main console
- window.close();
- mainPanel.show();
- mainPanel.doLayout();
- }
-
- public void onLoginFailed(Request request, Throwable t)
- {
- // auth failed
- setError("Authentication failed.");
- t.printStackTrace(System.out);
- }
- }
- );
-
- authentication.doLogin();
-
- }
- });
-
- panel.add(submitBtn);
-
- BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
- centerData.setMargins(3, 0, 3, 3);
-
- window.add(panel, centerData);
- // ------------------------------------------
-
- window.show();
- }
-
-
- public void addEditorView(EditorView editorView)
- {
- editorPanel.addEditor(editorView, true);
- }
-
- public boolean hasEditorView(String id)
- {
- return editorPanel.hasEditor(id);
- }
-
- public URLBuilder getUrlBuilder()
- {
- return this.urlBuilder;
- }
-
- public void showEditor(String id)
- {
- editorPanel.showTab(id);
- }
-
- public void setError(final String error)
- {
- displayMessage(error, true);
- }
-
- public void displayMessage(final String message, final boolean isError)
- {
- status.setText(message);
-
- MessageBox.show(new MessageBoxConfig() {
- {
- String title = isError ? "Unknown error" : "System Message";
- setTitle(title);
- setMsg(message);
- setButtons(MessageBox.OK);
- setCallback(new MessageBox.PromptCallback()
- {
- public void execute(String btnID, String text)
- {
- }
- });
- }
- });
- }
-
- public String[] getRolesAssigned()
- {
- return rolesAssigned;
- }
-
-}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -1,188 +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.gwtext.client.core.EventObject;
-import com.gwtext.client.data.Node;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.layout.AccordionLayout;
-import com.gwtext.client.widgets.tree.TreeNode;
-import com.gwtext.client.widgets.tree.TreePanel;
-import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
-import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
-import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
-import org.jboss.bpm.console.client.MainMenuSection;
-
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * The main menu on the left hand.
- * Keeps a list of {@link org.jboss.bpm.console.client.MainMenuSection}.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class MainMenu extends Panel
-{
- private final MainCompositeView view;
- private List<Panel> sections = new ArrayList<Panel>();
-
- public MainMenu(final MainCompositeView view)
- {
- super();
- this.view = view;
-
- final AccordionLayout accordion = new AccordionLayout(true);
-
- this.setTitle("");
- this.setCollapsible(true);
- this.setWidth(200);
- this.setLayout(accordion);
-
- MainMenuSection navPanel = new MainMenuSection("Process Management", "bpm-process-icon", new ProcessTree());
- MainMenuSection taskPanel = new MainMenuSection("Task Management", "bpm-task-icon", null);
- MainMenuSection metricPanel = new MainMenuSection("Metrics and Stats", "bpm-metric-icon", new MetricTree());
- MainMenuSection settingsPanel = new MainMenuSection("Settings", "bpm-settings-icon", new SettingsTree());
-
- this.addSection(navPanel);
- this.addSection(taskPanel);
- this.addSection(metricPanel);
- this.addSection(settingsPanel);
- }
-
- public void addSection(MainMenuSection menuSection)
- {
- this.sections.add(menuSection);
- this.add(menuSection);
- }
-
- class ProcessTree extends TreePanel
- {
-
- public ProcessTree() {
-
- TreeNode root = new TreeNode("Process Definitions");
-
- TreeNode definitions = new TreeNode("View definitions");
- definitions.setExpanded(true);
- definitions.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- if(view.hasEditorView(ProcessDefinitionListEditor.ID))
- {
- view.showEditor(ProcessDefinitionListEditor.ID);
- }
- else
- {
- view.addEditorView( new ProcessDefinitionListEditor(view) );
- }
-
- }
- }
- );
- TreeNode upload = new TreeNode("Upload new definitions");
- upload.setExpanded(true);
-
- root.appendChild(definitions);
- root.appendChild(upload);
-
- setRootVisible(true);
- setRootNode(root);
- root.setExpanded(true);
- }
- }
-
- class MetricTree extends TreePanel
- {
-
- public MetricTree() {
-
- TreeNode root = new TreeNode("Process Metrics");
-
- TreeNode overview = new TreeNode("Process workload");
- overview.setExpanded(true);
- overview.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- if(view.hasEditorView(MetricOverviewEditor.ID))
- {
- view.showEditor(MetricOverviewEditor.ID);
- }
- else
- {
- view.addEditorView( new MetricOverviewEditor(view) );
- }
-
- }
- }
- );
-
- TreeNode export = new TreeNode("Export stats");
- export.setExpanded(true);
-
- root.appendChild(overview);
- root.appendChild(export);
-
- setRootVisible(true);
- setRootNode(root);
- root.setExpanded(true);
- }
- }
-
- class SettingsTree extends TreePanel
- {
-
- public SettingsTree()
- {
- TreeNode root = new TreeNode("Debug");
-
- TreeNode overview = new TreeNode("Assigned roles");
- overview.setExpanded(true);
- overview.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- StringBuffer sb = new StringBuffer();
- for(String roleName : view.getRolesAssigned())
- {
- sb.append("<br> - ").append(roleName);
- }
-
- view.displayMessage("Assigned roles: " + sb.toString(), false);
- }
- }
- );
-
- root.appendChild(overview);
-
- setRootVisible(true);
- setRootNode(root);
- root.setExpanded(true);
-
- }
- }
-}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenuSection.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenuSection.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenuSection.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -1,47 +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.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.Component;
-
-/**
- * One section in the lefthand main menu.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class MainMenuSection extends Panel
-{
-
- public MainMenuSection(String title, String iconClass, Component tree)
- {
- super();
-
- setTitle(title);
- setBorder(false);
- setHideBorders(true);
- setIconCls(iconClass);
-
- if(tree!=null)
- add(tree);
- }
-}
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java (from rev 2652, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainCompositeView.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -0,0 +1,261 @@
+/*
+ * 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.http.client.Request;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HTML;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.Margins;
+import com.gwtext.client.core.RegionPosition;
+import com.gwtext.client.widgets.*;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextField;
+import com.gwtext.client.widgets.layout.BorderLayout;
+import com.gwtext.client.widgets.layout.BorderLayoutData;
+import com.gwtext.client.widgets.layout.FitLayout;
+import com.gwtext.client.widgets.layout.VerticalLayout;
+import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
+import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
+import org.jboss.bpm.console.client.task.TaskListEditor;
+
+import java.util.List;
+
+/**
+ * The main composite that assembles the gwt console application.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class MainView extends Composite
+{
+ private HTML status = new HTML();
+ private Header header;
+ private Menu menu;
+ private Workspace workspace;
+ private URLBuilder urlBuilder;
+
+ public final static String[] KNOWN_ROLES = {"admin", "manager", "user"};
+
+ private Viewport viewport;
+
+ private Authentication auth;
+
+ public MainView()
+ {
+ if(!GWT.isScript()) // hosted mode used proxy by default
+ urlBuilder = new URLBuilder(GWT.getModuleBaseURL(), "xhp");
+ else
+ urlBuilder = new URLBuilder( "http://localhost:8080", "gwt-console-server"); // TODO: make configureable
+
+ Panel mainPanel = createMainPanel();
+ assembleMainApplication(mainPanel);
+ forceLogin(mainPanel);
+ viewport = new Viewport(mainPanel);
+ }
+
+ 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.hide();
+
+ initWidget( mainPanel );
+ return mainPanel;
+ }
+
+ private void assembleMainApplication(Panel mainPanel)
+ {
+ Panel borderPanel = new Panel();
+ borderPanel.setLayout(new BorderLayout());
+
+ // ------------------------------------------
+
+ header = new Header(this);
+ borderPanel.add(header, new BorderLayoutData(RegionPosition.NORTH));
+
+ // ------------------------------------------
+
+ 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();
+ borderPanel.add(workspace, new BorderLayoutData(RegionPosition.CENTER));
+
+ // ------------------------------------------
+
+ workspace.addEditor( new ProcessDefinitionListEditor(this), false );
+ workspace.addEditor( new TaskListEditor(this), false );
+ workspace.addEditor( new MetricOverviewEditor(this), false);
+
+ // ------------------------------------------
+
+ mainPanel.add(borderPanel);
+ }
+
+ private void forceLogin(final Panel mainPanel)
+ {
+ Panel panel = new Panel();
+ panel.setPaddings(20);
+ panel.setStyleName("login-panel-content");
+ panel.setLayout(new VerticalLayout(10));
+ panel.add( new HTML("Welcome, please login.") );
+
+ final Window window = new Window();
+ window.setTitle("GWT-Console");
+ window.setClosable(false);
+ window.setResizable(false);
+ window.setWidth(300);
+ window.setHeight(180);
+ window.setLayout(new BorderLayout());
+ window.setCloseAction(Window.CLOSE);
+
+ final FormPanel loginForm = new FormPanel();
+ loginForm.setBorder(false);
+ loginForm.add(new TextField("Username", "user"));
+ TextField passwordField = new TextField("Password", "pass");
+ passwordField.setPassword(true);
+ loginForm.add(passwordField);
+
+ final Button submitBtn = new Button("Login",
+ new ButtonListenerAdapter()
+ {
+ public void onClick(Button button, EventObject e)
+ {
+ String user = loginForm.getForm().findField("user").getValueAsString();
+ String pass = loginForm.getForm().findField("pass").getValueAsString();
+
+ String url = getUrlBuilder().getUserInRoleURL(KNOWN_ROLES);
+ auth = new Authentication(url);
+ auth.setCallback(
+ new Authentication.AuthCallback()
+ {
+
+ public void onLoginSuccess(Request request, Response response)
+ {
+ // clear the form
+ loginForm.getForm().reset();
+
+ // display main console
+ window.close();
+ mainPanel.show();
+ mainPanel.doLayout();
+
+ // update header
+ header.setUserInfo(auth.getUsername(), auth.getRolesAssigned());
+ }
+
+ public void onLoginFailed(Request request, Throwable t)
+ {
+ // auth failed
+ setError("Authentication failed." +t.getMessage());
+ t.printStackTrace(System.out);
+ }
+ }
+ );
+
+ auth.doLogin(user,pass);
+
+ }
+ });
+
+ loginForm.addButton(submitBtn);
+ panel.add(loginForm);
+
+ BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
+ centerData.setMargins(3, 0, 3, 3);
+
+ window.add(panel, centerData);
+ // ------------------------------------------
+
+ window.show();
+ }
+
+
+ public void addEditor(Editor editor)
+ {
+ workspace.addEditor(editor, true);
+ }
+
+ public boolean hasEditor(String id)
+ {
+ return workspace.hasEditor(id);
+ }
+
+ public void showEditor(String id)
+ {
+ workspace.showTab(id);
+ }
+
+ public URLBuilder getUrlBuilder()
+ {
+ return this.urlBuilder;
+ }
+
+ public void setError(final String error)
+ {
+ displayMessage(error, true);
+ }
+
+ public void displayMessage(final String message, final boolean isError)
+ {
+ status.setText(message);
+
+ MessageBox.show(new MessageBoxConfig() {
+ {
+ String title = isError ? "Unknown error" : "System Message";
+ setTitle(title);
+ setMsg(message);
+ setButtons(MessageBox.OK);
+ setCallback(new MessageBox.PromptCallback()
+ {
+ public void execute(String btnID, String text)
+ {
+ }
+ });
+ }
+ });
+ }
+
+ public List<String> getRolesAssigned()
+ {
+ return auth.getRolesAssigned();
+ }
+
+ public String getUsername()
+ {
+ return auth.getUsername();
+ }
+}
Property changes on: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainView.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java (from rev 2652, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenu.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -0,0 +1,187 @@
+/*
+ * 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.gwtext.client.core.EventObject;
+import com.gwtext.client.data.Node;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.AccordionLayout;
+import com.gwtext.client.widgets.tree.TreeNode;
+import com.gwtext.client.widgets.tree.TreePanel;
+import com.gwtext.client.widgets.tree.event.TreeNodeListenerAdapter;
+import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
+import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The main menu on the left hand.
+ * Keeps a list of {@link org.jboss.bpm.console.client.MenuSection}.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class Menu extends Panel
+{
+ private final MainView view;
+ private List<Panel> sections = new ArrayList<Panel>();
+
+ public Menu(final MainView view)
+ {
+ super();
+ this.view = view;
+
+ final AccordionLayout accordion = new AccordionLayout(true);
+
+ this.setTitle("");
+ this.setCollapsible(true);
+ this.setWidth(200);
+ this.setLayout(accordion);
+
+ MenuSection navPanel = new MenuSection("Process Management", "bpm-process-icon", new ProcessTree());
+ MenuSection taskPanel = new MenuSection("Task Management", "bpm-task-icon", null);
+ MenuSection metricPanel = new MenuSection("Metrics and Stats", "bpm-metric-icon", new MetricTree());
+ MenuSection settingsPanel = new MenuSection("Settings", "bpm-settings-icon", new SettingsTree());
+
+ this.addSection(navPanel);
+ this.addSection(taskPanel);
+ this.addSection(metricPanel);
+ this.addSection(settingsPanel);
+ }
+
+ public void addSection(MenuSection menuSection)
+ {
+ this.sections.add(menuSection);
+ this.add(menuSection);
+ }
+
+ class ProcessTree extends TreePanel
+ {
+
+ public ProcessTree() {
+
+ TreeNode root = new TreeNode("Process Definitions");
+
+ TreeNode definitions = new TreeNode("View definitions");
+ definitions.setExpanded(true);
+ definitions.addListener(
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ if(view.hasEditor(ProcessDefinitionListEditor.ID))
+ {
+ view.showEditor(ProcessDefinitionListEditor.ID);
+ }
+ else
+ {
+ view.addEditor( new ProcessDefinitionListEditor(view) );
+ }
+
+ }
+ }
+ );
+ TreeNode upload = new TreeNode("Upload new definitions");
+ upload.setExpanded(true);
+
+ root.appendChild(definitions);
+ root.appendChild(upload);
+
+ setRootVisible(true);
+ setRootNode(root);
+ root.setExpanded(true);
+ }
+ }
+
+ class MetricTree extends TreePanel
+ {
+
+ public MetricTree() {
+
+ TreeNode root = new TreeNode("Process Metrics");
+
+ TreeNode overview = new TreeNode("Process workload");
+ overview.setExpanded(true);
+ overview.addListener(
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ if(view.hasEditor(MetricOverviewEditor.ID))
+ {
+ view.showEditor(MetricOverviewEditor.ID);
+ }
+ else
+ {
+ view.addEditor( new MetricOverviewEditor(view) );
+ }
+
+ }
+ }
+ );
+
+ TreeNode export = new TreeNode("Export stats");
+ export.setExpanded(true);
+
+ root.appendChild(overview);
+ root.appendChild(export);
+
+ setRootVisible(true);
+ setRootNode(root);
+ root.setExpanded(true);
+ }
+ }
+
+ class SettingsTree extends TreePanel
+ {
+
+ public SettingsTree()
+ {
+ TreeNode root = new TreeNode("Debug");
+
+ TreeNode overview = new TreeNode("Assigned roles");
+ overview.setExpanded(true);
+ overview.addListener(
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ StringBuffer sb = new StringBuffer();
+ for(String roleName : view.getRolesAssigned())
+ {
+ sb.append("<br> - ").append(roleName);
+ }
+
+ view.displayMessage("Assigned roles: " + sb.toString(), false);
+ }
+ }
+ );
+
+ root.appendChild(overview);
+
+ setRootVisible(true);
+ setRootNode(root);
+ root.setExpanded(true);
+
+ }
+ }
+}
Property changes on: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Menu.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MenuSection.java (from rev 2652, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MainMenuSection.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MenuSection.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MenuSection.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -0,0 +1,47 @@
+/*
+ * 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.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Component;
+
+/**
+ * One section in the lefthand main menu.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class MenuSection extends Panel
+{
+
+ public MenuSection(String title, String iconClass, Component tree)
+ {
+ super();
+
+ setTitle(title);
+ setBorder(false);
+ setHideBorders(true);
+ setIconCls(iconClass);
+
+ if(tree!=null)
+ add(tree);
+ }
+}
Property changes on: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/MenuSection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -23,6 +23,8 @@
import org.jboss.bpm.console.client.model.ProcessInstance;
+import java.util.List;
+
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@@ -109,4 +111,18 @@
{
return getBaseUrl() + "/rs/jbpm3/definitions/new";
}
+
+ public String getTaskListByActorURL(List<String> actors)
+ {
+ StringBuffer sb = new StringBuffer();
+ int i = 0;
+ for(String s : actors)
+ {
+ sb.append(s);
+ if(i<actors.size()-1)
+ sb.append(",");
+ i++;
+ }
+ return getBaseUrl() + "/rs/tasks/actor?actors="+sb.toString();
+ }
}
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java (from rev 2652, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client;
+
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.TabPanel;
+import org.jboss.bpm.console.client.Editor;
+
+/**
+ * Maintains {@link org.jboss.bpm.console.client.Workspace}'s
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class Workspace extends TabPanel
+{
+ protected MainView view;
+
+ public Workspace()
+ {
+ super();
+
+ this.setResizeTabs(true);
+ this.setMinTabWidth(115);
+ this.setTabWidth(135);
+ this.setEnableTabScroll(true);
+ this.setAutoScroll(true);
+ this.setActiveTab(0);
+ }
+
+ private Panel addTab(Editor editor, boolean closeable) {
+ Panel tab = new WrapperPanel(editor.getId()+".tab");
+ tab.setAutoScroll(true);
+ tab.setTitle(editor.getTitle());
+ tab.setClosable(closeable);
+ tab.setBorder(false);
+ tab.setFrame(false);
+ tab.setHideBorders(true);
+ tab.setIconCls(editor.getIconCSS());
+ this.add(tab);
+ return tab;
+ }
+
+ public void addEditor(Editor editor, boolean closeable)
+ {
+ Panel tab = addTab(editor, closeable);
+ tab.add(editor);
+ this.setActiveTab(tab.getId());
+ }
+
+ public boolean hasEditor(String id)
+ {
+ boolean b = false;
+ final String tabId = id +".tab";
+
+ Component[] tabs = this.getItems();
+ for(int i=0; i<tabs.length; i++)
+ {
+ Component tab = tabs[i];
+ if(tab.getId().equals(tabId))
+ {
+ b=true;
+ break;
+ }
+ }
+
+ return b;
+ }
+
+ public void showTab(String id)
+ {
+ final String tabId = id+".tab";
+ this.setActiveTab(tabId);
+ }
+
+ class WrapperPanel extends Panel
+ {
+
+ public WrapperPanel(String id)
+ {
+ super();
+ setId(id);
+ }
+ }
+}
Property changes on: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/Workspace.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricEditor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -21,12 +21,12 @@
*/
package org.jboss.bpm.console.client.metric;
-import org.jboss.bpm.console.client.EditorView;
+import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
import org.jboss.bpm.console.client.widgets.HelpPanel;
import org.jboss.bpm.console.client.model.ProcessDefinition;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.process.ProcessInstanceEditor;
import org.jboss.bpm.console.client.process.ProcessInstanceListEditor;
import com.gwtext.client.widgets.layout.ColumnLayout;
@@ -41,14 +41,14 @@
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
-public class DefinitionMetricEditor extends EditorView
+public class DefinitionMetricEditor extends Editor
{
private ProcessDefinition parent;
- private MainCompositeView view;
+ private MainView view;
private Panel teaserPanel;
- public DefinitionMetricEditor(final MainCompositeView view, final ProcessDefinition proc)
+ public DefinitionMetricEditor(final MainView view, final ProcessDefinition proc)
{
super();
this.view = view;
@@ -80,10 +80,10 @@
{
String editorId = ProcessInstanceEditor.ID+"."+proc.getName();
- if(view.hasEditorView(editorId))
+ if(view.hasEditor(editorId))
view.showEditor(editorId);
else
- view.addEditorView( new ProcessInstanceListEditor(proc, view) );
+ view.addEditor( new ProcessInstanceListEditor(proc, view) );
}
})
);
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/DefinitionMetricView.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -26,7 +26,7 @@
import com.gwtext.client.widgets.form.FormPanel;
import com.gwtext.client.widgets.form.TextField;
import com.gwtext.client.core.Position;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.DAOFactory;
import org.jboss.bpm.console.client.model.ProcessDefinition;
@@ -43,9 +43,9 @@
{
private ProcessDefinition parent;
- private MainCompositeView view;
+ private MainView view;
- public DefinitionMetricView(MainCompositeView view, ProcessDefinition parent)
+ public DefinitionMetricView(MainView view, ProcessDefinition parent)
{
super();
this.view = view;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverview.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -32,7 +32,7 @@
import com.gwtext.client.widgets.form.ComboBox;
import com.gwtext.client.widgets.form.FormPanel;
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.DAOFactory;
import org.jboss.bpm.console.client.model.ProcessDefinition;
@@ -51,10 +51,10 @@
{
private Map row2ProcessMap = new HashMap();
- private final MainCompositeView view;
+ private final MainView view;
private int currentSelection=-1;
- public MetricOverview(final MainCompositeView view)
+ public MetricOverview(final MainView view)
{
super();
this.setHeader(false);
@@ -141,13 +141,13 @@
ProcessDefinition def = (ProcessDefinition)row2ProcessMap.get(new Integer(currentSelection));
String editorId = MetricOverviewEditor.ID+"."+def.getName();
- if(view.hasEditorView(editorId))
+ if(view.hasEditor(editorId))
{
view.showEditor(editorId);
}
else
{
- view.addEditorView(new DefinitionMetricEditor(view, def));
+ view.addEditor(new DefinitionMetricEditor(view, def));
}
}
else
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/metric/MetricOverviewEditor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -21,11 +21,11 @@
*/
package org.jboss.bpm.console.client.metric;
-import org.jboss.bpm.console.client.EditorView;
+import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.widgets.HelpPanel;
import org.jboss.bpm.console.client.widgets.TeaserPanel;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.model.DAOFactory;
import org.jboss.bpm.console.client.model.HelpDAO;
import com.gwtext.client.widgets.layout.ColumnLayout;
@@ -35,15 +35,15 @@
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
-public class MetricOverviewEditor extends EditorView
+public class MetricOverviewEditor extends Editor
{
- private MainCompositeView view;
+ private MainView view;
private Panel teaserPanel;
public final static String ID = "org.jboss.bpm.metric.ProcessMetric";
- public MetricOverviewEditor(MainCompositeView view)
+ public MetricOverviewEditor(MainView view)
{
super();
this.view = view;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -46,7 +46,6 @@
for (int i = 0; i < array.size(); ++i)
{
JSONObject item = array.get(i).isObject();
- System.out.println("!!!! "+ item);
boolean assigned = JSONWalk.on(item).next("isAssigned").asBool();
String roleName = JSONWalk.on(item).next("role").asString();
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -27,7 +27,7 @@
import com.gwtext.client.widgets.MessageBoxConfig;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.widgets.RemoteListView;
@@ -40,12 +40,12 @@
{
private Map<Integer, ProcessDefinition> row2ProcessMap = new HashMap<Integer,ProcessDefinition>();
- public ProcessDefinitionList(String titleName, final MainCompositeView view)
+ public ProcessDefinitionList(String titleName, final MainView view)
{
super(titleName, view, getResourceUrl(view), false);
}
- private static String getResourceUrl(MainCompositeView view)
+ private static String getResourceUrl(MainView view)
{
return view.getUrlBuilder().getProcessDefinitionURL();
}
@@ -85,10 +85,10 @@
ProcessDefinition proc = row2ProcessMap.get(row);
String editorId = ProcessInstanceEditor.createWidgetID(proc);
- if(view.hasEditorView(editorId))
+ if(view.hasEditor(editorId))
view.showEditor(editorId);
else
- view.addEditorView( new ProcessInstanceListEditor(proc, view) );
+ view.addEditor( new ProcessInstanceListEditor(proc, view) );
}
protected void onDelete(final int row)
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -33,8 +33,8 @@
import com.gwtext.client.widgets.layout.ColumnLayout;
import com.gwtext.client.widgets.layout.ColumnLayoutData;
import com.gwtext.client.widgets.layout.VerticalLayout;
-import org.jboss.bpm.console.client.MainCompositeView;
-import org.jboss.bpm.console.client.EditorView;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.metric.MetricOverviewEditor;
import org.jboss.bpm.console.client.model.DAOFactory;
@@ -47,17 +47,17 @@
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
-public class ProcessDefinitionListEditor extends EditorView
+public class ProcessDefinitionListEditor extends Editor
{
public final static String ID = "org.jboss.bpm.process.ProcessList";
private ProcessDefinitionList processDefinitionList;
- private MainCompositeView view;
+ private MainView view;
private Panel teaserPanel;
- public ProcessDefinitionListEditor(final MainCompositeView view)
+ public ProcessDefinitionListEditor(final MainView view)
{
super();
this.setId(ID);
@@ -176,13 +176,13 @@
new ToolbarButton("More metrics", new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e)
{
- if(view.hasEditorView(MetricOverviewEditor.ID))
+ if(view.hasEditor(MetricOverviewEditor.ID))
{
view.showEditor(MetricOverviewEditor.ID);
}
else
{
- view.addEditorView( new MetricOverviewEditor(view) );
+ view.addEditor( new MetricOverviewEditor(view) );
}
}
})
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessImageView.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -27,7 +27,7 @@
import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.model.ProcessInstance;
import org.jboss.bpm.console.client.model.jbpm3.ActiveNodeInfo;
import org.jboss.bpm.console.client.model.jbpm3.DiagramNodeInfo;
@@ -49,10 +49,10 @@
public class ProcessImageView extends Panel
{
private ProcessInstance instance;
- private MainCompositeView view;
+ private MainView view;
private ActiveNodeInfo activeNodeInfo = null;
- public ProcessImageView(final ProcessInstance instance, final MainCompositeView view)
+ public ProcessImageView(final ProcessInstance instance, final MainView view)
{
super();
this.instance = instance;
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -26,8 +26,8 @@
import com.gwtext.client.widgets.layout.ColumnLayout;
import com.gwtext.client.widgets.layout.ColumnLayoutData;
import com.gwtext.client.core.EventObject;
-import org.jboss.bpm.console.client.MainCompositeView;
-import org.jboss.bpm.console.client.EditorView;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.model.ProcessInstance;
@@ -39,7 +39,7 @@
*
* @see ProcessInstanceList#onExamine(int)
*/
-public class ProcessInstanceEditor extends EditorView
+public class ProcessInstanceEditor extends Editor
{
public final static String ID = "org.jboss.bpm.process.ProcessInstance";
@@ -47,11 +47,11 @@
private ProcessInstance processInstance;
- private MainCompositeView view;
+ private MainView view;
private Panel teaserPanel;
- public ProcessInstanceEditor(final ProcessDefinition proc, final ProcessInstance instance, final MainCompositeView view)
+ public ProcessInstanceEditor(final ProcessDefinition proc, final ProcessInstance instance, final MainView view)
{
super();
this.setId(ProcessInstanceEditor.ID+"."+instance.getInstanceId());
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -27,7 +27,7 @@
import com.gwtext.client.widgets.MessageBoxConfig;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.util.DateRenderer;
import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.model.ProcessInstance;
@@ -46,7 +46,7 @@
private ProcessDefinition parent;
private static final String DATE_FORMAT = "y-m-j H:i:s"; //08-10-02 13:51:27
- public ProcessInstanceList(ProcessDefinition procDef, String titleName, MainCompositeView view)
+ public ProcessInstanceList(ProcessDefinition procDef, String titleName, MainView view)
{
super(titleName, view, getResourceUrl(view, procDef.getProcessId()), true);
this.parent = procDef;
@@ -61,10 +61,10 @@
{
ProcessInstance instance = row2InstanceMap.get(row);
String id = ProcessInstanceEditor.ID+"."+instance.getInstanceId();
- if(view.hasEditorView(id))
+ if(view.hasEditor(id))
view.showEditor(id);
else
- view.addEditorView( new ProcessInstanceEditor(parent, instance, view) );
+ view.addEditor( new ProcessInstanceEditor(parent, instance, view) );
}
protected void onDelete(final int row)
@@ -224,7 +224,7 @@
return reader;
}
- private static String getResourceUrl(MainCompositeView view, long parentId)
+ private static String getResourceUrl(MainView view, long parentId)
{
return view.getUrlBuilder().getProcessInstanceURL(parentId);
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -38,8 +38,8 @@
import com.gwtext.client.widgets.form.TextField;
import com.gwtext.client.widgets.grid.RowSelectionModel;
import com.gwtext.client.widgets.grid.event.RowSelectionListenerAdapter;
-import org.jboss.bpm.console.client.MainCompositeView;
-import org.jboss.bpm.console.client.EditorView;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.Editor;
import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.model.ProcessInstance;
@@ -51,15 +51,15 @@
*
* @see org.jboss.bpm.console.client.process.ProcessDefinitionList#onExamine(int)
*/
-public class ProcessInstanceListEditor extends EditorView
+public class ProcessInstanceListEditor extends Editor
{
private ProcessDefinition parent;
private ProcessInstance selectedInstance;
- private MainCompositeView view;
+ private MainView view;
private ProcessInstanceList instanceList;
- public ProcessInstanceListEditor(ProcessDefinition proc, MainCompositeView view)
+ public ProcessInstanceListEditor(ProcessDefinition proc, MainView view)
{
super();
Added: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskList.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -0,0 +1,92 @@
+/*
+ * 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.task;
+
+import org.jboss.bpm.console.client.widgets.RemoteListView;
+import org.jboss.bpm.console.client.MainView;
+import com.gwtext.client.data.*;
+import com.gwtext.client.widgets.grid.ColumnModel;
+import com.gwtext.client.widgets.grid.ColumnConfig;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class TaskList extends RemoteListView
+{
+ public TaskList(String titleName, final MainView view)
+ {
+ super(titleName, view,
+ view.getUrlBuilder().getTaskListByActorURL(view.getRolesAssigned()),
+ false
+ );
+ }
+
+ protected void onAdd()
+ {
+ throw new RuntimeException("Tasks cannot be added manually!");
+ }
+
+ protected void onDelete(final int row)
+ {
+ throw new RuntimeException("Tasks cannot be deleted manually!");
+ }
+
+ protected void onExamine(final int row)
+ {
+
+ }
+
+ protected void onRecordsLoaded(Record[] records)
+ {
+
+ }
+
+ protected ColumnModel createColumnModel()
+ {
+ final ColumnModel columnModel = new ColumnModel(
+ new ColumnConfig[]
+ {
+ new ColumnConfig("ID", "id", 75, true),
+ new ColumnConfig("Task Name", "name", 300, true, null, "expand"),
+ new ColumnConfig("Assigned to", "actor", 75, true)
+ }
+ );
+ return columnModel;
+ }
+
+ protected JsonReader createReader()
+ {
+ final RecordDef recordDef = new RecordDef(
+ new FieldDef[]{
+ new IntegerFieldDef("id"),
+ new StringFieldDef("name"),
+ new StringFieldDef("actor")
+ }
+ );
+
+ final JsonReader reader = new JsonReader(recordDef);
+ reader.setRoot("tasks");
+ reader.setTotalProperty("totalCount");
+ reader.setId("id");
+ return reader;
+ }
+}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/task/TaskListEditor.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -21,26 +21,97 @@
*/
package org.jboss.bpm.console.client.task;
-import org.jboss.bpm.console.client.EditorView;
+import org.jboss.bpm.console.client.Editor;
+import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.UIConstants;
+import org.jboss.bpm.console.client.widgets.TeaserPanel;
+import com.gwtext.client.widgets.layout.ColumnLayout;
+import com.gwtext.client.widgets.layout.ColumnLayoutData;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Component;
+import com.gwtext.client.widgets.event.PanelListenerAdapter;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
-public class TaskListEditor extends EditorView
+public class TaskListEditor extends Editor
{
+ public final static String ID = "org.jboss.bpm.task.TaskList";
+ private MainView mainView;
+ private TaskList taskList;
+ private Panel teaserPanel;
+ private boolean initialized;
+
+ public TaskListEditor(MainView mainView )
+ {
+ super();
+ this.setId(ID);
+ this.mainView = mainView;
+
+ this.setLayout( new ColumnLayout() );
+ this.setWidth(UIConstants.EDITOR_WIDTH);
+
+ this.addListener(
+ new PanelListenerAdapter()
+ {
+
+ public boolean doBeforeRender(Component component)
+ {
+ return beforeRenderCallback();
+ }
+ }
+ );
+
+ }
+
public String getEditorId()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return ID;
}
public String getTitle()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return "Tasks";
}
public String getIconCSS()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ return "bpm-task-icon";
}
+
+ /**
+ * TaskList editor requires an authenticated user,
+ * hence the initialization through callback
+ */
+ public boolean beforeRenderCallback()
+ {
+ if(!initialized)
+ {
+ final Panel leftHand = new Panel();
+ leftHand.setFrame(false);
+ leftHand.setHeader(false);
+ leftHand.setBorder(false);
+
+ // ----------------------------------
+
+ taskList = new TaskList("Your tasks", mainView);
+ leftHand.add(taskList);
+
+ // ----------------------------------
+
+ teaserPanel = new TeaserPanel();
+
+ // ----------------------------------
+
+ this.add(leftHand, new ColumnLayoutData(0.7) );
+ this.add(teaserPanel , new ColumnLayoutData(0.3) );
+
+ doLayout();
+
+ initialized = true;
+ }
+
+ return true;
+ }
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -30,7 +30,7 @@
import com.gwtext.client.widgets.grid.ColumnModel;
import com.gwtext.client.widgets.grid.GridPanel;
import com.gwtext.client.widgets.grid.event.GridCellListener;
-import org.jboss.bpm.console.client.MainCompositeView;
+import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.UIConstants;
/**
@@ -46,7 +46,7 @@
public abstract class RemoteListView extends Panel
{
protected int selectedRowIndex = -1;
- protected MainCompositeView view;
+ protected MainView view;
protected static final int PAGE_SIZE = 25;
private GridPanel grid;
protected String title;
@@ -57,7 +57,7 @@
private boolean storeInit = false;
private boolean hasAddButton;
- public RemoteListView(String titleName, MainCompositeView view, String resourceUrl, boolean hasAddButton)
+ public RemoteListView(String titleName, MainView view, String resourceUrl, boolean hasAddButton)
{
super();
Modified: projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json
===================================================================
--- projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/main/resources/jmaki/xhp/xhp.json 2008-10-29 14:40:28 UTC (rev 2660)
@@ -4,8 +4,8 @@
{"id": "default",
"url":"http://localhost:8080/gwt-console-server",
"passthrough":true,
- "username":"admin",
- "password":"admin"
+ "username":"manager",
+ "password":"manager"
},
{"id": "jboss",
"url":"http://localhost:8080/gwt-console-server",
Modified: projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java
===================================================================
--- projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java 2008-10-29 14:37:50 UTC (rev 2659)
+++ projects/gwt-console/trunk/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java 2008-10-29 14:40:28 UTC (rev 2660)
@@ -56,7 +56,7 @@
public void testAuthentication()
{
- final MainCompositeView view = application.getConsoleView();
+ final MainView view = application.getConsoleView();
assertNotNull("View not initialized", view);
Timer timer = new Timer()
@@ -64,7 +64,7 @@
public void run()
{
- String inRoleURL = view.getUrlBuilder().getUserInRoleURL(MainCompositeView.KNOWN_ROLES);
+ String inRoleURL = view.getUrlBuilder().getUserInRoleURL(MainView.KNOWN_ROLES);
final Authentication auth = new Authentication(inRoleURL);
auth.setCallback(
new Authentication.AuthCallback() {
@@ -92,7 +92,7 @@
public void testProcessDefList()
{
- final MainCompositeView view = application.getConsoleView();
+ final MainView view = application.getConsoleView();
assertNotNull("View not initialized", view);
@@ -134,7 +134,7 @@
public void run()
{
System.out.println("Do authentication");
- String inRoleURL = view.getUrlBuilder().getUserInRoleURL(MainCompositeView.KNOWN_ROLES);
+ String inRoleURL = view.getUrlBuilder().getUserInRoleURL(MainView.KNOWN_ROLES);
final Authentication auth = new Authentication(inRoleURL);
auth.doLogin();
More information about the jbpm-commits
mailing list