[jbpm-commits] JBoss JBPM SVN: r4910 - in projects/gwt-console/trunk/gui: war/src/main/java/org/jboss/bpm/console/client/common and 6 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed May 27 05:20:30 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-05-27 05:20:30 -0400 (Wed, 27 May 2009)
New Revision: 4910
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDefinitionView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDelegate.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchWindow.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/UpdateSearchDefinitionsAction.java
Removed:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportView.java
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteDefinitionAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteInstanceAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditor.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditorNavigation.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java
projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Editor.java
Log:
Added definition search. More work on ReportView
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/AbstractRESTAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -108,7 +108,7 @@
}
};
- t.schedule(5000);
+ t.schedule(20000);
}
catch (RequestException e)
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -33,6 +33,7 @@
import org.gwt.mosaic.ui.client.ToolButton;
import org.gwt.mosaic.ui.client.layout.*;
import org.gwt.mosaic.ui.client.list.DefaultListModel;
+import org.gwt.mosaic.ui.client.list.ListModel;
import org.jboss.bpm.console.client.common.AbstractView;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
@@ -60,6 +61,9 @@
ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
setTitle("Process Definitions");
setIcon(icons.processIcon());
+
+ listBox = createListBox();
+
}
public boolean isInitialized()
@@ -75,60 +79,6 @@
definitionList.setPadding(0);
definitionList.setWidgetSpacing(0);
- listBox =
- new ListBox<ProcessDefinitionRef>(
- new String[] {
- "Process ID", "Version", "Name"}
- );
-
-
- 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, String.valueOf(item.getVersion()));
- break;
- case 2:
- listBox.setText(row, column, item.getName());
- break;
- default:
- throw new RuntimeException("Unexpected column size");
- }
- }
- });
-
- listBox.addChangeListener(new ChangeListener()
- {
- public void onChange(Widget widget)
- {
- int index = listBox.getSelectedIndex();
- if(index!=-1)
- {
- ProcessDefinitionRef item = listBox.getItem(index);
-
- // update details
- controller.handleEvent(
- new Event(UpdateProcessDetailAction.ID, item)
- );
-
- // load instances
- controller.handleEvent(
- new Event(
- LoadInstancesAction.ID,
- item
- )
- );
- }
- }
- });
-
- final DefaultListModel<ProcessDefinitionRef> model =
- (DefaultListModel<ProcessDefinitionRef>) listBox.getModel();
-
// toolbar
final LayoutPanel toolBox = new LayoutPanel();
@@ -142,7 +92,7 @@
public void onClick(Widget sender) {
// force loading
controller.handleEvent(
- new Event(LoadDefinitionsAction.ID, null)
+ new Event(UpdateDefinitionsAction.ID, null)
);
}
}
@@ -192,17 +142,70 @@
}
}
+ private ListBox createListBox()
+ {
+ final ListBox<ProcessDefinitionRef> listBox =
+ new ListBox<ProcessDefinitionRef>(
+ new String[] {
+ "Process ID", "Version", "Name"}
+ );
+
+ 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, String.valueOf(item.getVersion()));
+ break;
+ case 2:
+ listBox.setText(row, column, item.getName());
+ break;
+ default:
+ throw new RuntimeException("Unexpected column size");
+ }
+ }
+ });
+
+ listBox.addChangeListener(new ChangeListener()
+ {
+ public void onChange(Widget widget)
+ {
+ int index = listBox.getSelectedIndex();
+ if(index!=-1)
+ {
+ ProcessDefinitionRef item = listBox.getItem(index);
+
+ // update details
+ controller.handleEvent(
+ new Event(UpdateProcessDetailAction.ID, item)
+ );
+
+ // load instances
+ controller.handleEvent(
+ new Event(
+ UpdateInstancesAction.ID,
+ item
+ )
+ );
+ }
+ }
+ });
+
+ return listBox;
+ }
+
+
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();
@@ -226,4 +229,5 @@
selection = listBox.getItem( listBox.getSelectedIndex());
return selection;
}
+
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteDefinitionAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteDefinitionAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteDefinitionAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -61,7 +61,7 @@
{
// refresh
controller.handleEvent(
- new Event(LoadDefinitionsAction.ID, null)
+ new Event(UpdateDefinitionsAction.ID, null)
);
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteInstanceAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteInstanceAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeleteInstanceAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -67,7 +67,7 @@
// refresh instances
controller.handleEvent(
new Event(
- LoadInstancesAction.ID,
+ UpdateInstancesAction.ID,
def
)
);
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/InstanceListView.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -39,8 +39,6 @@
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.client.model.util.SimpleDateFormat;
import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.ServerStatusView;
-import org.jboss.bpm.console.client.ServerPlugins;
import java.util.List;
@@ -144,7 +142,7 @@
public void onClick(Widget sender) {
controller.handleEvent(
new Event(
- LoadInstancesAction.ID,
+ UpdateInstancesAction.ID,
getCurrentDefinition()
)
);
Deleted: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.client.process;
-
-import com.google.gwt.http.client.RequestBuilder;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.json.client.JSONValue;
-import com.mvc4g.client.Controller;
-import com.mvc4g.client.Event;
-import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-import org.jboss.bpm.console.client.common.AbstractRESTAction;
-import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-
-import java.util.List;
-
-/**
- * Loads a process definition list.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-class LoadDefinitionsAction extends AbstractRESTAction
-{
- public final static String ID = LoadDefinitionsAction.class.getName();
-
- public LoadDefinitionsAction(ApplicationContext appContext)
- {
- super(appContext);
- }
-
- public String getId()
- {
- return ID;
- }
-
- public String getUrl(Object event)
- {
- return appContext.getUrlBuilder().getProcessDefinitionsURL();
- }
-
- public RequestBuilder.Method getRequestMethod()
- {
- return RequestBuilder.GET;
- }
-
- public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
- {
- if (200 == response.getStatusCode())
- {
- JSONValue json = JSONParser.parse(response.getText());
- List<ProcessDefinitionRef> definitions = DTOParser.parseProcessDefinitions(json);
- DefinitionListView view = (DefinitionListView) controller.getView(DefinitionListView.ID);
- view.update(definitions);
-
- ConsoleLog.info("Loaded " + definitions.size() + " process definitions");
- }
- else
- {
- // Handle the error. Can get the status text from response.getStatusText()
- String message = "Failed to load instances. " +
- "HTTP " + response.getStatusCode() +
- ": " + response.getText();
- ConsoleLog.error(message);
- appContext.displayMessage(message,true);
- }
- }
-}
Deleted: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.client.process;
-
-import com.google.gwt.http.client.RequestBuilder;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.json.client.JSONValue;
-import com.mvc4g.client.Controller;
-import com.mvc4g.client.Event;
-import org.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-import org.jboss.bpm.console.client.common.AbstractRESTAction;
-import org.jboss.bpm.console.client.model.DTOParser;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-
-import java.util.List;
-
-/**
- * Force loading of a process instance list.
- * Triggered through {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-class LoadInstancesAction extends AbstractRESTAction
-{
- public final static String ID = LoadInstancesAction.class.getName();
-
- public LoadInstancesAction(ApplicationContext appContext)
- {
- super(appContext);
- }
-
- public String getId()
- {
- return ID;
- }
-
- public String getUrl(Object event)
- {
- final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
- return appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
- }
-
- public RequestBuilder.Method getRequestMethod()
- {
- return RequestBuilder.GET;
- }
-
- public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
- {
- final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
- JSONValue json = JSONParser.parse(response.getText());
-
- List<ProcessInstanceRef> instances = DTOParser.parseProcessInstances(json);
- InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
- view.update(def, instances);
-
- ConsoleLog.info("Loaded " + instances.size() + " process instance(s)");
-
- }
-
-}
-
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditor.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -23,11 +23,9 @@
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.google.gwt.core.client.GWT;
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;
@@ -101,8 +99,8 @@
registerView(InstanceListView.ID, new InstanceListView(appContext));
// create and register actions
- registerAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
- registerAction(LoadInstancesAction.ID, new LoadInstancesAction(appContext));
+ registerAction(UpdateDefinitionsAction.ID, new UpdateDefinitionsAction(appContext));
+ registerAction(UpdateInstancesAction.ID, new UpdateInstancesAction(appContext));
registerAction(StartNewInstanceAction.ID, new StartNewInstanceAction(appContext));
registerAction(StateChangeAction.ID, new StateChangeAction(appContext));
registerAction(DeleteDefinitionAction.ID, new DeleteDefinitionAction(appContext));
@@ -113,7 +111,7 @@
// force loading
super.controller.handleEvent(
- new Event(LoadDefinitionsAction.ID, null)
+ new Event(UpdateDefinitionsAction.ID, null)
);
appContext.refreshView();
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessEditorNavigation.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -38,14 +38,14 @@
super.setTitle("Processes");
TreeItem root = addItem("Process Definitions");
- TreeItem definitions = root.addItem("View definitions");
+ TreeItem definitions = root.addItem("Definition List");
addTreeListener(
new TreeListener()
{
public void onTreeItemSelected(TreeItem treeItem)
{
- if("View definitions".equals(treeItem.getText()))
+ if("Definition List".equals(treeItem.getText()))
{
Workspace workspace = appContext.getWorkpace();
workspace.showEditor(ProcessEditor.ID);
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StartNewInstanceAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -66,7 +66,7 @@
// force reload instance list
controller.handleEvent(
- new Event(LoadInstancesAction.ID, def)
+ new Event(UpdateInstancesAction.ID, def)
);
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/StateChangeAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -69,7 +69,7 @@
ProcessDefinitionRef def = view.getCurrentDefinition();
// force reload instance list
- controller.handleEvent( new Event(LoadInstancesAction.ID, def));
+ controller.handleEvent( new Event(UpdateInstancesAction.ID, def));
}
}
Copied: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java (from rev 4881, projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadDefinitionsAction.java)
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateDefinitionsAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+
+import java.util.List;
+
+/**
+ * Loads a process definition list
+ * and updates {@link org.jboss.bpm.console.client.process.DefinitionListView}
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class UpdateDefinitionsAction extends AbstractRESTAction
+{
+ public final static String ID = UpdateDefinitionsAction.class.getName();
+
+ public UpdateDefinitionsAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ return appContext.getUrlBuilder().getProcessDefinitionsURL();
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ JSONValue json = JSONParser.parse(response.getText());
+ List<ProcessDefinitionRef> definitions = DTOParser.parseProcessDefinitions(json);
+
+ DefinitionListView view = (DefinitionListView) controller.getView(DefinitionListView.ID);
+ view.update(definitions);
+
+ ConsoleLog.info("Loaded " + definitions.size() + " process definitions");
+
+ }
+}
Copied: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java (from rev 4881, projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/LoadInstancesAction.java)
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/UpdateInstancesAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+import org.jboss.bpm.console.client.model.ProcessInstanceRef;
+
+import java.util.List;
+
+/**
+ * Loads a process instance list and updates
+ * {@link org.jboss.bpm.console.client.process.InstanceListView}.<br>
+ * Triggered by {@link org.jboss.bpm.console.client.model.ProcessDefinitionRef}.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class UpdateInstancesAction extends AbstractRESTAction
+{
+ public final static String ID = UpdateInstancesAction.class.getName();
+
+ public UpdateInstancesAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
+ return appContext.getUrlBuilder().getProcessInstancesURL(def.getId());
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ final ProcessDefinitionRef def = (ProcessDefinitionRef)event;
+ JSONValue json = JSONParser.parse(response.getText());
+
+ List<ProcessInstanceRef> instances = DTOParser.parseProcessInstances(json);
+ InstanceListView view = (InstanceListView) controller.getView(InstanceListView.ID);
+ view.update(def, instances);
+
+ ConsoleLog.info("Loaded " + instances.size() + " process instance(s)");
+
+ }
+
+}
+
Deleted: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportView.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportView.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -1,134 +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.report;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Frame;
-import com.google.gwt.user.client.ui.Widget;
-import com.mvc4g.client.Controller;
-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.jboss.bpm.console.client.ApplicationContext;
-import org.jboss.bpm.console.client.common.AbstractView;
-import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
-import org.jboss.bpm.console.client.util.ConsoleLog;
-
-import java.util.Date;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class OverviewReportView extends AbstractView
-{
- public final static String ID = OverviewReportView.class.getName();
-
- private Controller controller;
-
- private boolean isInitialized;
-
- private ApplicationContext appContext;
-
- private LayoutPanel layout;
-
- private Frame frame;
-
- public OverviewReportView(ApplicationContext appContext)
- {
- super();
- this.appContext = appContext;
- ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
- setTitle("Process Activity");
- setIcon(icons.reportIcon());
- }
-
- public boolean isInitialized()
- {
- return isInitialized;
- }
-
- public void initialize()
- {
- if(!isInitialized)
- {
-
- // layout
- layout = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
- layout.setPadding(0);
- layout.setWidgetSpacing(0);
-
- // report frame
- frame = new Frame();
- DOM.setStyleAttribute(frame.getElement(), "border", "none");
-
- setFrameUrl(appContext.getUrlBuilder().getOverviewReportUrl());
-
-
- // 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) {
- setFrameUrl(appContext.getUrlBuilder().getOverviewReportUrl());
- }
- }
- )
- );
-
- toolBar.addSeparator();
-
- toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
-
- // assembly
- layout.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
- layout.add(frame, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
-
- this.add(layout);
- this.isInitialized = true;
- }
- }
-
- public void setController(Controller controller)
- {
- this.controller = controller;
- }
-
- private void setFrameUrl(String url)
- {
- // https://jira.jboss.org/jira/browse/JBPM-2244
- frame.getElement().setId(
- String.valueOf( new Date().getTime())
- );
-
- frame.setUrl(url);
-
- }
-}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditor.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditor.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -26,24 +26,15 @@
import org.jboss.bpm.console.client.ApplicationContext;
import org.jboss.bpm.console.client.LazyPanel;
import org.jboss.bpm.console.client.common.AbstractView;
-import org.jboss.bpm.console.client.process.*;
-import org.jboss.bpm.console.client.util.ConsoleLog;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.gwt.mosaic.ui.client.DecoratedTabLayoutPanel;
-import org.gwt.mosaic.ui.client.MessageBox;
import org.gwt.mosaic.ui.client.layout.BorderLayoutData;
import org.gwt.mosaic.ui.client.layout.BorderLayout;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.TabListener;
import com.google.gwt.user.client.ui.SourcesTabEvents;
-import com.google.gwt.user.client.ui.TabPanel;
-import com.google.gwt.user.client.DOM;
-import com.mvc4g.client.Event;
import com.mvc4g.client.ActionInterface;
-import java.util.Date;
-
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
@@ -100,10 +91,10 @@
this.add(tabPanel, new BorderLayoutData(BorderLayout.Region.CENTER));
// create and register views
- registerView(OverviewReportView.ID, new OverviewReportView(appContext));
+ registerView(ReportView.ID, new ReportView(appContext));
// create and register actions
- //registerAction(LoadDefinitionsAction.ID, new LoadDefinitionsAction(appContext));
+ //registerAction(UpdateDefinitionsAction.ID, new UpdateDefinitionsAction(appContext));
// display tab, needs to visible for correct rendering
tabPanel.selectTab(0);
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditorNavigation.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditorNavigation.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportEditorNavigation.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -36,15 +36,15 @@
{
super.setTitle("Reporting");
- TreeItem root = addItem("Processes");
- TreeItem definitions = root.addItem("Overview");
+ TreeItem root = addItem("Available Reports");
+ TreeItem definitions = root.addItem("Processes");
addTreeListener(
new TreeListener()
{
public void onTreeItemSelected(TreeItem treeItem)
{
- if("Overview".equals(treeItem.getText()))
+ if("Processes".equals(treeItem.getText()))
{
Workspace workspace = appContext.getWorkpace();
workspace.showEditor(ReportEditor.ID);
Copied: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportView.java (from rev 4901, projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/OverviewReportView.java)
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportView.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/report/ReportView.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,227 @@
+/*
+ * 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.report;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.Frame;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.MenuBar;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.ui.client.ToolBar;
+import org.gwt.mosaic.ui.client.ToolButton;
+import org.gwt.mosaic.ui.client.PopupMenu;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.common.AbstractView;
+import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
+import org.jboss.bpm.console.client.search.SearchDefinitionView;
+import org.jboss.bpm.console.client.search.SearchDelegate;
+import org.jboss.bpm.console.client.search.SearchWindow;
+import org.jboss.bpm.console.client.search.UpdateSearchDefinitionsAction;
+
+import java.util.Date;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ReportView extends AbstractView
+{
+ public final static String ID = ReportView.class.getName();
+
+ private Controller controller;
+ private boolean isInitialized;
+ private ApplicationContext appContext;
+ private LayoutPanel layout;
+ private Frame frame;
+
+ private SearchDefinitionView search;
+
+ public ReportView(ApplicationContext appContext)
+ {
+ super();
+ this.appContext = appContext;
+ ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
+ setTitle("Process Reports");
+ setIcon(icons.reportIcon());
+ }
+
+ public boolean isInitialized()
+ {
+ return isInitialized;
+ }
+
+ public void initialize()
+ {
+ if(!isInitialized)
+ {
+
+ // layout
+ layout = new LayoutPanel( new BoxLayout(BoxLayout.Orientation.VERTICAL));
+ layout.setPadding(0);
+ layout.setWidgetSpacing(0);
+
+ // search capabilities
+ search = new SearchDefinitionView(
+ appContext,
+ new SearchDelegate()
+ {
+ public void handleResult(String procDefId)
+ {
+ String reportUrl = appContext.getUrlBuilder().getDefinitionReportUrl(
+ procDefId
+ );
+
+ setFrameUrl(reportUrl);
+ }
+
+ public String getActionName()
+ {
+ return "Open report";
+ }
+ }
+ );
+
+
+ // report frame
+ frame = new Frame();
+ DOM.setStyleAttribute(frame.getElement(), "border", "none");
+
+ // 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(createMenuBtn());
+ toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ // assembly
+ layout.add(toolBox, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+ layout.add(frame, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ this.add(layout);
+
+ // views and actions
+ controller.addView(
+ "report.definition.search", search
+ );
+
+ controller.addAction(
+ UpdateSearchDefinitionsAction.ID, new UpdateSearchDefinitionsAction(appContext)
+ );
+
+ // default report
+ setFrameUrl(appContext.getUrlBuilder().getOverviewReportUrl());
+
+ this.isInitialized = true;
+ }
+ }
+
+ private Widget createMenuBtn()
+ {
+ // Add a menu button
+ ToolButton menuButton = new ToolButton("Available Reports");
+ menuButton.setStyle(ToolButton.ToolButtonStyle.MENU);
+
+ // Make a command that we will execute from all menu items.
+ Command cmd1 = new Command() {
+ public void execute() {
+ setFrameUrl(appContext.getUrlBuilder().getOverviewReportUrl());
+ }
+ };
+
+ Command cmd2 = new Command() {
+ public void execute()
+ {
+ SearchWindow sw = new SearchWindow("Open execution report", search);
+ sw.center();
+
+ controller.handleEvent(
+ new Event(
+ UpdateSearchDefinitionsAction.ID,
+ "report.definition.search"
+ )
+ );
+
+ }
+ };
+
+ PopupMenu menuBtnMenu = new PopupMenu();
+ menuBtnMenu.addItem("Process Activity", cmd1);
+ menuBtnMenu.addItem("Execution Details", cmd2);
+
+ menuButton.setMenu(menuBtnMenu);
+
+ return menuButton;
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ private void setFrameUrl(String url)
+ {
+ // https://jira.jboss.org/jira/browse/JBPM-2244
+ frame.getElement().setId(
+ String.valueOf( new Date().getTime())
+ );
+
+ frame.setUrl(url);
+
+ }
+
+ /**
+ * Create the menu bar.
+ */
+ private MenuBar createMenuBar() {
+ // Create a command that will execute on menu item selection
+ Command menuCommand = new Command()
+ {
+ public void execute() {
+
+ }
+ };
+
+ // Create a menu bar
+ MenuBar menu = new MenuBar();
+ menu.setAnimationEnabled(true);
+
+ // Create a sub menu of recent documents
+ MenuBar reportMenu = new MenuBar(true);
+ reportMenu.addItem("Process Activity Report", menuCommand);
+ reportMenu.addItem("Execution Report", menuCommand);
+
+
+ // Create the help menu
+ MenuBar helpMenu = new MenuBar(true);
+ menu.addSeparator();
+
+ return menu;
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDefinitionView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDefinitionView.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDefinitionView.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,130 @@
+/*
+ * 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.search;
+
+import com.google.gwt.user.client.ui.*;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.ViewInterface;
+import org.gwt.mosaic.ui.client.Label;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class SearchDefinitionView
+ extends LayoutPanel implements ViewInterface
+{
+
+ private Controller controller;
+ private ApplicationContext appContext;
+ private SearchDelegate delegate;
+ private SuggestBox suggestBox;
+
+ private String selection = null;
+
+ private SearchWindow parent;
+
+ public SearchDefinitionView(ApplicationContext appContext, SearchDelegate delegate)
+ {
+ super(new BoxLayout(BoxLayout.Orientation.VERTICAL));
+
+ this.appContext = appContext;
+ this.delegate = delegate;
+ this.setPadding(10);
+
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ private MultiWordSuggestOracle createOracle(List<ProcessDefinitionRef> definitions)
+ {
+ MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
+
+ for(ProcessDefinitionRef p : definitions)
+ {
+ oracle.add(p.getId());
+ }
+
+ return oracle;
+ }
+
+ public void update(List<ProcessDefinitionRef> definitions)
+ {
+ this.clear();
+ this.selection = null;
+
+ HTML desc = new HTML("Please enter a process definition ID.");
+ this.add(desc, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ suggestBox = new SuggestBox(
+ createOracle(definitions)
+ );
+
+ suggestBox.addEventHandler(
+ new SuggestionHandler()
+ {
+ public void onSuggestionSelected(SuggestionEvent suggestionEvent)
+ {
+ selection = suggestionEvent.getSelectedSuggestion().getReplacementString();
+ }
+ }
+ );
+
+ this.add(suggestBox);
+
+ Grid g = new Grid(2,2);
+ g.setWidget(0,0, new Label("ID: "));
+ g.setWidget(0,1, suggestBox);
+
+ Button button = new Button(delegate.getActionName(),
+ new ClickListener()
+ {
+ public void onClick(Widget widget)
+ {
+ if(selection!=null)
+ {
+ delegate.handleResult(selection);
+ parent.close();
+ }
+ }
+ });
+
+ g.setWidget(1,1, button);
+ this.add(g, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
+
+ invalidate();
+ }
+
+ void setParent(SearchWindow window)
+ {
+ this.parent = window;
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDelegate.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDelegate.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchDelegate.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,32 @@
+/*
+ * 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.search;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public interface SearchDelegate
+{
+ void handleResult(String procDefId);
+
+ String getActionName();
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchWindow.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchWindow.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/SearchWindow.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,72 @@
+/*
+ * 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.search;
+
+import com.google.gwt.user.client.WindowCloseListener;
+import org.gwt.mosaic.ui.client.WindowPanel;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class SearchWindow
+{
+ private WindowPanel window;
+
+ public SearchWindow(String title, SearchDefinitionView view)
+ {
+ view.setParent(this);
+ createLayoutWindowPanel(title, view);
+
+ }
+
+ /**
+ * The 'layout' window panel.
+ */
+ private void createLayoutWindowPanel(String title, SearchDefinitionView view) {
+ window = new WindowPanel(title);
+ window.setAnimationEnabled(true);
+ window.setSize("320px", "180px");
+
+ window.setWidget(view);
+
+ window.addWindowCloseListener(new WindowCloseListener() {
+ public void onWindowClosed() {
+ window = null;
+ }
+
+ public String onWindowClosing() {
+ return null;
+ }
+ });
+ }
+
+ public void center()
+ {
+ window.center();
+ }
+
+ public void close()
+ {
+ window.hide();
+ window = null;
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/UpdateSearchDefinitionsAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/UpdateSearchDefinitionsAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/search/UpdateSearchDefinitionsAction.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -0,0 +1,79 @@
+/*
+ * 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.search;
+
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONValue;
+import com.mvc4g.client.Controller;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.util.ConsoleLog;
+import org.jboss.bpm.console.client.common.AbstractRESTAction;
+import org.jboss.bpm.console.client.model.DTOParser;
+import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
+
+import java.util.List;
+
+/**
+ * Loads a process definition list
+ * and updates a search view.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class UpdateSearchDefinitionsAction extends AbstractRESTAction
+{
+ public final static String ID = UpdateSearchDefinitionsAction.class.getName();
+
+ public UpdateSearchDefinitionsAction(ApplicationContext appContext)
+ {
+ super(appContext);
+ }
+
+ public String getId()
+ {
+ return ID;
+ }
+
+ public String getUrl(Object event)
+ {
+ return appContext.getUrlBuilder().getProcessDefinitionsURL();
+ }
+
+ public RequestBuilder.Method getRequestMethod()
+ {
+ return RequestBuilder.GET;
+ }
+
+ public void handleSuccessfulResponse(final Controller controller, final Object event, Response response)
+ {
+ String target = (String)event;
+
+ JSONValue json = JSONParser.parse(response.getText());
+ List<ProcessDefinitionRef> definitions = DTOParser.parseProcessDefinitions(json);
+
+ SearchDefinitionView view = (SearchDefinitionView)controller.getView(target);
+ view.update(definitions);
+
+ ConsoleLog.info("Loaded " + definitions.size() + " process definitions");
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/task/TaskEditorNavigation.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -37,14 +37,14 @@
super.setTitle("Tasks");
TreeItem root = addItem("Task Management");
- TreeItem definitions = root.addItem("View Tasks");
+ TreeItem definitions = root.addItem("Task Lists");
addTreeListener(
new TreeListener()
{
public void onTreeItemSelected(TreeItem treeItem)
{
- if("View Tasks".equals(treeItem.getText()))
+ if("Task Lists".equals(treeItem.getText()))
{
Workspace workspace = appContext.getWorkpace();
workspace.showEditor(TaskEditor.ID);
Modified: projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-05-27 09:20:30 UTC (rev 4910)
@@ -267,3 +267,8 @@
}
/* end - custom widgets */
+
+.gwt-SuggestBoxPopup { z-index:100000; border: 1px solid #C3D9FF;}
+.gwt-SuggestBoxPopup .item { padding: 2px;}
+.gwt-SuggestBoxPopup .item-selected { background-color: #C3D9FF; padding: 2px;}
+
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/ApplicationContext.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -46,5 +46,4 @@
Viewport getViewport();
void refreshView();
-
}
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Editor.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-05-27 09:14:59 UTC (rev 4909)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Editor.java 2009-05-27 09:20:30 UTC (rev 4910)
@@ -62,8 +62,10 @@
this.appContext = appContext;
// hmvc controller chain.
- this.controller = new Controller();
- this.controller.setParent(appContext.getController());
+ //this.controller = new Controller();
+ //this.controller.setParent(appContext.getController());
+
+ this.controller = appContext.getController();
}
public boolean isInitialized()
More information about the jbpm-commits
mailing list