[jbpm-commits] JBoss JBPM SVN: r5097 - in projects/gwt-console/trunk: gui/war/src/main/java/org/jboss/bpm/console/client/common and 8 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Jun 23 11:57:34 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-06-23 11:57:33 -0400 (Tue, 23 Jun 2009)
New Revision: 5097
Added:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ViewDeploymentAction.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/deployment.png
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeploymentPanel.java
Modified:
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java
projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.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/ProcessDetailView.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/Menu.java
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Workspace.java
projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java
Log:
More work on deployment editor for jbpm
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/MainLayout.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -36,6 +36,8 @@
import org.gwt.mosaic.ui.client.util.ButtonHelper;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.jboss.bpm.console.client.util.WindowUtil;
+import org.jboss.bpm.console.client.deployment.ViewDeploymentAction;
+import org.jboss.bpm.console.client.deployment.UpdateDeploymentListAction;
/**
* The main composite that assembles the gwt console application.
@@ -105,38 +107,40 @@
{
final LayoutPanel layoutPanel = new LayoutPanel(new BorderLayout());
-// header
+ // header
header = new Header(this, auth.getUsername(), auth.getRolesAssigned());
layoutPanel.add(header, new BorderLayoutData(Region.NORTH, 50));
-// menu
+ // menu
menu = new Menu();
layoutPanel.add(menu, new BorderLayoutData(Region.WEST, 200));
-// workspace
+ // workspace
workspace = createWorkspace();
layoutPanel.add(workspace, new BorderLayoutData(Region.CENTER, false));
-// register views and actions
+ // register global views and actions, available across editors
controller.addView(Header.ID, header);
-
controller.addAction(LoadingStatusAction.ID, new LoadingStatusAction());
+ controller.addAction(ViewDeploymentAction.ID, new ViewDeploymentAction(this));
+ controller.addAction(UpdateDeploymentListAction.ID, new UpdateDeploymentListAction(this));
-// message Panel
+ // message Panel
final CaptionLayoutPanel messagePanel = createMessagePanel(layoutPanel);
messagePanel.add(Log.getDivLogger().getWidget());
messagePanel.setCollapsed(true);
layoutPanel.add(messagePanel, new BorderLayoutData(Region.SOUTH, true));
-// Turn on DivLogger
+ // Turn on DivLogger
Log.getDivLogger().getWidget().setVisible(true);
-// default editor
+ // default editor
if(workspace.hasEditor(SettingsEditor.ID))
workspace.showEditor(SettingsEditor.ID);
return layoutPanel;
+
}
private CaptionLayoutPanel createMessagePanel(final LayoutPanel layoutPanel)
@@ -170,7 +174,7 @@
private Workspace createWorkspace()
{
- Workspace workspace = new Workspace(menu);
+ Workspace workspace = new Workspace(menu, this);
WorkspaceLauncher launcher = GWT.create(WorkspaceLauncher.class);
launcher.launch(this, workspace); // calls Workspace.addEditor()
return workspace;
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/common/PropertyGrid.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -24,6 +24,7 @@
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import org.gwt.mosaic.ui.client.Label;
+import org.gwt.mosaic.ui.client.ScrollLayoutPanel;
/**
* A simple property grid that displays name-value pairs.
@@ -38,15 +39,21 @@
*
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
-public class PropertyGrid extends Grid
+public class PropertyGrid extends ScrollLayoutPanel
{
private String[] fieldNames;
+ private Grid grid;
+
public PropertyGrid(String[] fieldDesc)
{
- super(fieldDesc.length, 2);
- this.setStyleName("bpm-prop-grid");
+ super();
+ this.grid = new Grid(fieldDesc.length, 2);
+ grid.setStyleName("bpm-prop-grid");
this.fieldNames = fieldDesc;
+
+ this.add(grid);
+
initReset();
}
@@ -56,18 +63,18 @@
{
Label label = new Label(fieldNames[i]);
label.setStyleName("bpm-prop-grid-label");
- this.setWidget(i,0, label);
- this.setWidget(i,1, new HTML(""));
+ grid.setWidget(i,0, label);
+ grid.setWidget(i,1, new HTML(""));
if (i % 2 == 0)
{
// even
- this.getRowFormatter().setStyleName(i, "bpm-prop-grid-even");
+ grid.getRowFormatter().setStyleName(i, "bpm-prop-grid-even");
}
else
{
// odd
- this.getRowFormatter().setStyleName(i, "bpm-prop-grid-odd");
+ grid.getRowFormatter().setStyleName(i, "bpm-prop-grid-odd");
}
}
}
@@ -86,8 +93,8 @@
{
Label label = new Label(fieldNames[i]);
label.setStyleName("bpm-prop-grid-label");
- this.setWidget(i,0, label);
- this.setWidget(i,1, new HTML(fieldValues[i]));
+ grid.setWidget(i,0, label);
+ grid.setWidget(i,1, new HTML(fieldValues[i]));
}
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentEditor.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -45,7 +45,7 @@
public final static String ID = DeploymentEditor.class.getName();
private TabLayoutPanel tabPanel;
-
+
public DeploymentEditor(ApplicationContext appContext)
{
super(appContext);
@@ -86,9 +86,10 @@
// create and register views
registerView(DeploymentListView.ID, new DeploymentListView());
- // create and register actions
+ // create and register actions
controller.addAction(UpdateDeploymentListAction.ID, new UpdateDeploymentListAction(appContext));
-
+ //controller.addAction(ViewDeploymentAction.ID, new ViewDeploymentAction());
+
// 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/deployment/DeploymentListView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/DeploymentListView.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -36,8 +36,6 @@
import org.jboss.bpm.console.client.common.AbstractView;
import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
import org.jboss.bpm.console.client.model.DeploymentRef;
-import org.jboss.bpm.console.client.process.UpdateInstancesAction;
-import org.jboss.bpm.console.client.process.UpdateProcessDetailAction;
import java.util.List;
@@ -221,4 +219,21 @@
new Event(UpdateProcessDetailAction.ID, null)
);*/
}
+
+ public void select(String deploymentId)
+ {
+ final DefaultListModel<DeploymentRef> model =
+ (DefaultListModel<DeploymentRef>) listBox.getModel();
+
+ for(int i=0; i<model.size(); i++)
+ {
+ DeploymentRef ref = model.get(i);
+ if(ref.getId().equals(deploymentId))
+ {
+ listBox.setSelectedIndex(i);
+ break;
+ }
+ }
+
+ }
}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/UpdateDeploymentListAction.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -35,6 +35,8 @@
import java.util.List;
/**
+ * Updates a list of deployment and can optionally select a particular one.
+ *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class UpdateDeploymentListAction extends AbstractRESTAction
@@ -70,6 +72,18 @@
List<DeploymentRef> deployments = DTOParser.parseDeploymentRefList(json);
DeploymentListView view = (DeploymentListView)controller.getView(DeploymentListView.ID);
+ if(null==view)
+ throw new RuntimeException("View not initialzed: " + DeploymentListView.ID);
+
view.update(deployments);
+
+ // optional
+ String deploymentId = (String)event;
+ if(deploymentId!=null)
+ {
+ System.out.println("activate " + deploymentId);
+ view.select(deploymentId);
+ }
+
}
}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ViewDeploymentAction.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ViewDeploymentAction.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/deployment/ViewDeploymentAction.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -0,0 +1,64 @@
+/*
+ * 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.deployment;
+
+import com.mvc4g.client.ActionInterface;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.jboss.bpm.console.client.ApplicationContext;
+import org.jboss.bpm.console.client.Workspace;
+
+/**
+ * Cross editor view toggle.
+ * Event requires to be a deployment ID.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ViewDeploymentAction implements ActionInterface
+{
+ public final static String ID = ViewDeploymentAction.class.getName();
+
+ private ApplicationContext appContext;
+
+ public ViewDeploymentAction(ApplicationContext appContext)
+ {
+ this.appContext = appContext;
+ }
+
+ public void execute(Controller controller, Object object)
+ {
+ String dplId = (String)object;
+ System.out.println("view deployment " + dplId);
+
+ Workspace workspace = appContext.getWorkpace();
+ if(workspace.hasEditor(DeploymentEditor.ID))
+ {
+ workspace.showEditor(DeploymentEditor.ID);
+ }
+
+ controller.handleEvent(
+ new Event(UpdateDeploymentListAction.ID, dplId)
+ );
+
+
+ }
+}
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/deployment.png
===================================================================
(Binary files differ)
Property changes on: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/icons/deployment.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
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-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DefinitionListView.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -99,7 +99,10 @@
)
);
- toolBar.addSeparator();
+ /*
+ drools currently doesn't use it and jbpm uses the DeploymentEditor
+
+ toolBar.addSeparator();
toolBar.add(
new ToolButton("Delete", new ClickListener() {
@@ -119,7 +122,7 @@
}
}
)
- );
+ ); */
toolBox.add(toolBar, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
Added: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeploymentPanel.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeploymentPanel.java (rev 0)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/DeploymentPanel.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.bpm.console.client.process;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+import com.mvc4g.client.Controller;
+import com.mvc4g.client.Event;
+import org.gwt.mosaic.ui.client.layout.BoxLayout;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
+import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import org.jboss.bpm.console.client.common.PropertyGrid;
+import org.jboss.bpm.console.client.deployment.UpdateDeploymentListAction;
+import org.jboss.bpm.console.client.deployment.ViewDeploymentAction;
+import org.jboss.bpm.console.client.icons.ConsoleIconBundle;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeploymentPanel extends LayoutPanel
+{
+
+ private Controller controller;
+
+ private PropertyGrid propGrid;
+
+ String deploymentId = null;
+
+ private boolean initialized;
+
+ public DeploymentPanel()
+ {
+ super(new BoxLayout(BoxLayout.Orientation.HORIZONTAL));
+
+ }
+
+ private void initialize()
+ {
+ if(!initialized)
+ {
+ this.propGrid = new PropertyGrid(new String[]{"Deployment ID:"});
+
+ ConsoleIconBundle icons = GWT.create(ConsoleIconBundle.class);
+
+ Image image = icons.deploymentIcon().createImage();
+ LayoutPanel imgPanel = new LayoutPanel();
+ imgPanel.setStyleName("bpm-property-image");
+ imgPanel.add(image);
+
+ this.add(imgPanel);
+ this.add(propGrid, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+ final Button button = new Button("View Deployment", new ClickListener(){
+
+ public void onClick(Widget widget)
+ {
+ controller.handleEvent(
+ new Event(ViewDeploymentAction.ID, getSelection())
+ );
+ }
+ });
+
+ this.add(button);
+
+ this.initialized = true;
+ }
+ }
+
+ public void setController(Controller controller)
+ {
+ this.controller = controller;
+ }
+
+ public void update(String id)
+ {
+ initialize();
+ this.deploymentId = id;
+ propGrid.update(new String[]{id});
+ }
+
+ public void clearView()
+ {
+ initialize();
+ this.deploymentId = null;
+ propGrid.clear();
+ }
+
+ private String getSelection()
+ {
+ return this.deploymentId;
+ }
+}
Modified: projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java
===================================================================
--- projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDetailView.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -21,11 +21,17 @@
*/
package org.jboss.bpm.console.client.process;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.Widget;
+import com.mvc4g.client.Controller;
import com.mvc4g.client.ViewInterface;
-import com.mvc4g.client.Controller;
+import org.gwt.mosaic.ui.client.Caption;
+import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
+import org.gwt.mosaic.ui.client.DeckLayoutPanel;
+import org.gwt.mosaic.ui.client.layout.BoxLayoutData;
import org.jboss.bpm.console.client.common.PropertyGrid;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.gwt.mosaic.ui.client.CaptionLayoutPanel;
+import org.jboss.bpm.console.client.ApplicationContext;
/**
* @author Heiko.Braun <heiko.braun at jboss.com>
@@ -40,6 +46,8 @@
private ProcessDefinitionRef currentProcess;
+ private DeploymentPanel deploymentPanel;
+
public ProcessDetailView()
{
super("Process details");
@@ -49,12 +57,41 @@
new String[] {"ID:", "Key:", "Name:", "Package:", "Description:"}
);
- this.add(grid);
+
+ // properties
+ final DeckLayoutPanel deck = new DeckLayoutPanel();
+ deck.add(grid);
+
+ // deployment info
+ deploymentPanel = new DeploymentPanel();
+
+ deck.add(deploymentPanel);
+
+ // selection
+ final com.google.gwt.user.client.ui.ListBox dropBox = new com.google.gwt.user.client.ui.ListBox(false);
+ dropBox.setStyleName("bpm-operation-ui");
+ dropBox.addItem("Properties");
+ dropBox.addItem("Deployment");
+ dropBox.addChangeListener(new ChangeListener() {
+ public void onChange(Widget sender) {
+ deck.showWidget(dropBox.getSelectedIndex());
+ deck.layout();
+ }
+ });
+
+ this.getHeader().add(dropBox, Caption.CaptionRegion.RIGHT);
+ this.add(deck, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
+ deck.showWidget(dropBox.getSelectedIndex());
+
+ this.add(deck, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH));
+
}
public void setController(Controller controller)
{
this.controller = controller;
+ deploymentPanel.setController(controller);
}
public void update(ProcessDefinitionRef process)
@@ -66,15 +103,17 @@
process.getKey(),
process.getName(),
process.getPackageName(),
- process.getDescription()
+ process.getDescription()
};
grid.update(values);
+ deploymentPanel.update(process.getDeploymentId());
}
public void clearView()
{
grid.clear();
+ deploymentPanel.clearView();
this.currentProcess = null;
}
}
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-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/war/src/main/resources/org/jboss/bpm/console/public/console.css 2009-06-23 15:57:33 UTC (rev 5097)
@@ -37,6 +37,10 @@
color: #C8C8C8;
}
+.bpm-property-image {
+ padding-top:10px;
+}
+
.bpm-editor-info {
font-family: sans-serif;
font-size:18px;
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Menu.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Menu.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Menu.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -29,6 +29,9 @@
import com.mvc4g.client.ViewInterface;
import com.mvc4g.client.Controller;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* The main menu on the left hand.
* Keeps a list of {@link org.jboss.bpm.console.client.MenuSection}.
@@ -40,6 +43,9 @@
private StackLayoutPanel stack;
private Controller controller;
+ private Map<String, Integer> name2Index = new HashMap<String, Integer>();
+ private int stackCount = 0;
+
public Menu()
{
super(new BoxLayout(BoxLayout.Orientation.VERTICAL));
@@ -51,13 +57,26 @@
this.add(stack, new BoxLayoutData(BoxLayoutData.FillStyle.BOTH, true));
}
- public void addSection(MenuSection menuSection)
- {
+ public void createMenu(Editor editor)
+ {
+ MenuSection menuSection = editor.provideMenuSection();
this.stack.add(menuSection, menuSection.getMenuTitle(), true);
+ name2Index.put(editor.getEditorId(), stackCount);
+ stackCount++;
}
public void setController(Controller controller)
{
this.controller = controller;
}
+
+ public void toggle(String editorId)
+ {
+ if(!name2Index.containsKey(editorId))
+ throw new IllegalArgumentException("Unknown menu for Editor: "+editorId);
+
+ int index = name2Index.get(editorId);
+ stack.showStack(index);
+ stack.layout();
+ }
}
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Workspace.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Workspace.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/Workspace.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -23,6 +23,10 @@
import org.gwt.mosaic.ui.client.DeckLayoutPanel;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DOM;
/**
* Maintains {@link Editor}'s
@@ -34,9 +38,10 @@
protected ApplicationContext appContext;
private Menu menu;
- public Workspace(Menu menu)
+ public Workspace(Menu menu, ApplicationContext appContext)
{
super();
+ this.appContext = appContext;
this.menu = menu;
this.setPadding(5);
@@ -47,7 +52,7 @@
// Menu
MenuSection menuSection = editor.provideMenuSection();
if(menuSection!=null) // some editors don't contribute to the menu
- menu.addSection(menuSection);
+ menu.createMenu(editor);
// Editor deck
EditorDeck deck = createDeck(editor);
@@ -60,14 +65,22 @@
return findEditor(id)!=null;
}
- public void showEditor(String id)
+ public void showEditor(final String id)
{
EditorDeck deck = findEditor(id);
if(null==deck)
throw new IllegalArgumentException("No such editor: " +id);
+
+ // display editor
this.showWidget(deck.index);
-
- deck.editor.initialize();
+ deck.editor.initialize();
+
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ menu.toggle(id);
+ }
+ });
+
}
private EditorDeck createDeck(Editor editor)
Modified: projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/gui/workspace-api/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -30,8 +30,6 @@
import java.util.List;
/**
- * TODO: run integrated (gwt-console-server) test
- *
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class DTOParser
@@ -56,7 +54,10 @@
Long version = JSONWalk.on(root).next("version").asLong();
String name = JSONWalk.on(root).next("name").asString();
- return new ProcessDefinitionRef(id, name, version);
+ String dplId = JSONWalk.on(root).next("deploymentId").asString();
+ ProcessDefinitionRef ref = new ProcessDefinitionRef(id, name, version);
+ ref.setDeploymentId(dplId);
+ return ref;
}
public static ProcessDefinitionRef parseProcessDefinition(String json)
@@ -342,6 +343,12 @@
ref.setTimestamp(ts);
// todo: parse definitions
+ JSONArray defArr = JSONWalk.on(item).next("definitions").asArray();
+ for (int c = 0; c < defArr.size(); c++)
+ {
+ String defId = defArr.get(c).isString().stringValue();
+ ref.getDefinitions().add(defId);
+ }
result.add(ref);
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -37,7 +37,7 @@
private long timestamp;
- private List<ProcessDefinitionRef> definitions = new ArrayList<ProcessDefinitionRef>();
+ private List<String> definitions = new ArrayList<String>();
public DeploymentRef()
{
@@ -69,7 +69,7 @@
this.suspended = suspended;
}
- public List<ProcessDefinitionRef> getDefinitions()
+ public List<String> getDefinitions()
{
return definitions;
}
Modified: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/ProcessDefinitionRef.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -38,6 +38,8 @@
private String description;
private String packageName;
+ private String deploymentId;
+
public ProcessDefinitionRef()
{
}
@@ -116,7 +118,16 @@
this.packageName = packageName;
}
+ public String getDeploymentId()
+ {
+ return deploymentId;
+ }
+ public void setDeploymentId(String deploymentId)
+ {
+ this.deploymentId = deploymentId;
+ }
+
public boolean equals(Object o)
{
if (this == o) return true;
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java 2009-06-23 15:17:20 UTC (rev 5096)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/InfoFacade.java 2009-06-23 15:57:33 UTC (rev 5097)
@@ -24,6 +24,7 @@
import org.jboss.bpm.console.server.plugin.TaskDispatcherPlugin;
import org.jboss.bpm.console.server.plugin.PluginMgr;
import org.jboss.bpm.console.server.plugin.GraphViewerPlugin;
+import org.jboss.bpm.console.server.plugin.DeploymentPlugin;
import org.jboss.bpm.console.server.gson.GsonFactory;
import org.jboss.bpm.console.client.model.ServerStatus;
import org.jboss.bpm.console.client.model.PluginInfo;
@@ -44,7 +45,8 @@
private Class[] pluginInterfaces = {
TaskDispatcherPlugin.class,
- GraphViewerPlugin.class
+ GraphViewerPlugin.class,
+ DeploymentPlugin.class
};
private ServerStatus status = null;
More information about the jbpm-commits
mailing list