[jbpm-commits] JBoss JBPM SVN: r2998 - in projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client: widgets and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Nov 19 08:05:33 EST 2008
Author: heiko.braun at jboss.com
Date: 2008-11-19 08:05:33 -0500 (Wed, 19 Nov 2008)
New Revision: 2998
Added:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java
Removed:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
Log:
Move token editor and form to process package
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-11-19 13:05:19 UTC (rev 2997)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -24,7 +24,6 @@
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.http.client.*;
import com.gwtext.client.core.EventObject;
-import com.gwtext.client.core.Position;
import com.gwtext.client.data.Record;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.PaddedPanel;
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java (from rev 2996, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenEditor.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -0,0 +1,146 @@
+/*
+ * 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.gwtext.client.core.EventObject;
+import com.gwtext.client.data.Node;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.layout.ColumnLayout;
+import com.gwtext.client.widgets.layout.ColumnLayoutData;
+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.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class TokenEditor extends Panel
+{
+
+ private TokenForm tokenForm;
+ private TokenTree tokenTree;
+
+ public TokenEditor(final ProcessInstance instance, final SignalCallback callback)
+ {
+ super();
+
+ this.setHeader(false);
+ this.setBorder(false);
+ this.setFrame(false);
+
+ this.setLayout(new ColumnLayout());
+
+ // ----------------
+
+ tokenTree = new TokenTree(instance.getRootToken(),
+ new TokenSelectionCallback()
+ {
+ public void onSelectedToken(TokenReference tok)
+ {
+ // update form
+ tokenForm.display(instance, tok);
+ }
+ }
+ );
+
+ tokenTree.expandAll();
+
+ // ----------------
+
+ tokenForm = new TokenForm(callback);
+
+ // ----------------
+
+ this.add(tokenTree, new ColumnLayoutData(0.3));
+ this.add(tokenForm, new ColumnLayoutData(0.7));
+ }
+
+ public void resetEditor()
+ {
+ tokenForm.resetForm();
+ }
+
+ class TokenTree extends TreePanel
+ {
+ private TokenSelectionCallback callback;
+
+ public TokenTree(final TokenReference rootToken,
+ final TokenSelectionCallback callback)
+ {
+ this.callback = callback;
+
+ this.setBorder(false);
+
+ TreeNode outermost = new TreeNode("Tokens");
+ TreeNode rootNode = buildTreeNode(rootToken);
+ outermost.appendChild(rootNode);
+
+ buildChildNodes(rootNode, rootToken);
+
+ setRootVisible(true);
+ setRootNode(outermost);
+ outermost.setExpanded(true);
+ }
+
+ private void buildChildNodes(TreeNode parent, TokenReference rootToken)
+ {
+ for(final TokenReference childToken : rootToken.getChildren())
+ {
+ TreeNode child = buildTreeNode(childToken);
+ buildChildNodes(child, childToken); // recursive
+ parent.appendChild(child);
+ }
+ }
+
+ private TreeNode buildTreeNode(final TokenReference tok)
+ {
+ TreeNode treeNode = new TreeNode("Token " +tok.getId());
+ treeNode.setExpanded(true);
+ treeNode.addListener(
+ new TreeNodeListenerAdapter()
+ {
+ public void onClick(Node node, EventObject eventObject)
+ {
+ callback.onSelectedToken(tok);
+ }
+ }
+ );
+
+ if(!tok.canBeSignaled())
+ treeNode.setIcon("images/icons/lock.png");
+ return treeNode;
+ }
+ }
+
+ interface TokenSelectionCallback
+ {
+ void onSelectedToken(TokenReference tok);
+ }
+
+ public interface SignalCallback
+ {
+ void onSignalToken(TokenReference tok, String signal);
+ }
+}
+
Copied: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java (from rev 2996, projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java)
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java (rev 0)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/TokenForm.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -0,0 +1,154 @@
+/*
+ * 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.gwtext.client.core.EventObject;
+import com.gwtext.client.core.Position;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.MessageBox;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtext.client.widgets.form.ComboBox;
+import com.gwtext.client.widgets.form.Form;
+import com.gwtext.client.widgets.form.FormPanel;
+import com.gwtext.client.widgets.form.TextField;
+import org.jboss.bpm.console.client.UIConstants;
+import org.jboss.bpm.console.client.widgets.RefreshableComboBox;
+import org.jboss.bpm.console.client.model.ProcessInstance;
+import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class TokenForm extends Panel
+{
+ private final FormPanel tokenForm;
+ private final Button signalButton;
+ private TokenReference lastSelectedToken;
+
+ public TokenForm(final TokenEditor.SignalCallback callback)
+ {
+ super();
+
+ this.setHeader(false);
+ this.setBorder(false);
+ this.setFrame(false);
+
+ tokenForm = new FormPanel();
+ tokenForm.setLabelAlign(Position.LEFT);
+ tokenForm.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
+ tokenForm.setHeader(false);
+ tokenForm.setFrame(false);
+ tokenForm.setBorder(false);
+ tokenForm.setPaddings(5, 5, 5, 0);
+ tokenForm.setLabelWidth(50);
+
+ // ----------
+
+ TextField idField = new TextField("Id", "id", 230);
+ idField.setReadOnly(true);
+ tokenForm.add(idField);
+
+ //tokenForm.add(new TextField("Token Name", "name", 230));
+ TextField nameField = new TextField("Node Name", "nodeName", 230);
+ nameField.setReadOnly(true);
+ tokenForm.add(nameField);
+
+
+ // ----------
+ RefreshableComboBox cb = new RefreshableComboBox("signal", "Signal");
+ tokenForm.add(cb);
+
+ final ButtonListenerAdapter listenerAdapter = new ButtonListenerAdapter()
+ {
+ public void onClick(Button button, EventObject eventObject)
+ {
+ ComboBox cb = (ComboBox)tokenForm.getForm().findField("signal");
+
+ String signalValue = cb.getValueAsString();
+ if(signalValue.equals(""))
+ MessageBox.alert("Please select a signal");
+ else
+ callback.onSignalToken(lastSelectedToken, signalValue);
+ }
+
+ };
+ signalButton = new Button("Signal", listenerAdapter);
+
+
+ tokenForm.addButton(signalButton);
+
+ // -------------------
+
+ this.add(tokenForm);
+
+ }
+
+ /**
+ * display the root token
+ */
+ void display(ProcessInstance processInstance)
+ {
+ display(processInstance, processInstance.getRootToken());
+ }
+
+ /**
+ * display a particular token
+ */
+ void display(final ProcessInstance processInstance, final TokenReference tok)
+ {
+ Form form = tokenForm.getForm();
+
+ if(form.findField("id")!=null) // TODO: the fields are not initialized on first callback?
+ {
+ form.findField("id").setRawValue(tok.getId()+"");
+ form.findField("nodeName").setRawValue(tok.getCurrentNodeName());
+
+ // display combo box
+ RefreshableComboBox cb = (RefreshableComboBox)form.findField("signal");
+ cb.reset();
+ cb.display( tok.getAvailableSignals());
+
+ // suspended instances cannot be signaled
+ if(processInstance.isSuspended() || !tok.canBeSignaled())
+ {
+ signalButton.disable();
+ cb.disable();
+ }
+ else
+ {
+ signalButton.enable();
+ cb.enable();
+ }
+ }
+
+ // -----------
+
+
+ lastSelectedToken = tok;
+ }
+
+ public void resetForm()
+ {
+ tokenForm.getForm().reset();
+ }
+}
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java 2008-11-19 13:05:19 UTC (rev 2997)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenEditor.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -1,146 +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.widgets;
-
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.data.Node;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.layout.ColumnLayout;
-import com.gwtext.client.widgets.layout.ColumnLayoutData;
-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.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class TokenEditor extends Panel
-{
-
- private TokenForm tokenForm;
- private TokenTree tokenTree;
-
- public TokenEditor(final ProcessInstance instance, final SignalCallback callback)
- {
- super();
-
- this.setHeader(false);
- this.setBorder(false);
- this.setFrame(false);
-
- this.setLayout(new ColumnLayout());
-
- // ----------------
-
- tokenTree = new TokenTree(instance.getRootToken(),
- new TokenSelectionCallback()
- {
- public void onSelectedToken(TokenReference tok)
- {
- // update form
- tokenForm.display(instance, tok);
- }
- }
- );
-
- tokenTree.expandAll();
-
- // ----------------
-
- tokenForm = new TokenForm(callback);
-
- // ----------------
-
- this.add(tokenTree, new ColumnLayoutData(0.3));
- this.add(tokenForm, new ColumnLayoutData(0.7));
- }
-
- public void resetEditor()
- {
- tokenForm.resetForm();
- }
-
- class TokenTree extends TreePanel
- {
- private TokenSelectionCallback callback;
-
- public TokenTree(final TokenReference rootToken,
- final TokenSelectionCallback callback)
- {
- this.callback = callback;
-
- this.setBorder(false);
-
- TreeNode outermost = new TreeNode("Tokens");
- TreeNode rootNode = buildTreeNode(rootToken);
- outermost.appendChild(rootNode);
-
- buildChildNodes(rootNode, rootToken);
-
- setRootVisible(true);
- setRootNode(outermost);
- outermost.setExpanded(true);
- }
-
- private void buildChildNodes(TreeNode parent, TokenReference rootToken)
- {
- for(final TokenReference childToken : rootToken.getChildren())
- {
- TreeNode child = buildTreeNode(childToken);
- buildChildNodes(child, childToken); // recursive
- parent.appendChild(child);
- }
- }
-
- private TreeNode buildTreeNode(final TokenReference tok)
- {
- TreeNode treeNode = new TreeNode("Token " +tok.getId());
- treeNode.setExpanded(true);
- treeNode.addListener(
- new TreeNodeListenerAdapter()
- {
- public void onClick(Node node, EventObject eventObject)
- {
- callback.onSelectedToken(tok);
- }
- }
- );
-
- if(!tok.canBeSignaled())
- treeNode.setIcon("images/icons/lock.png");
- return treeNode;
- }
- }
-
- interface TokenSelectionCallback
- {
- void onSelectedToken(TokenReference tok);
- }
-
- public interface SignalCallback
- {
- void onSignalToken(TokenReference tok, String signal);
- }
-}
-
Deleted: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java 2008-11-19 13:05:19 UTC (rev 2997)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/TokenForm.java 2008-11-19 13:05:33 UTC (rev 2998)
@@ -1,153 +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.widgets;
-
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.core.Position;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.MessageBox;
-import com.gwtext.client.widgets.Panel;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.Form;
-import com.gwtext.client.widgets.form.FormPanel;
-import com.gwtext.client.widgets.form.TextField;
-import org.jboss.bpm.console.client.UIConstants;
-import org.jboss.bpm.console.client.model.ProcessInstance;
-import org.jboss.bpm.console.client.model.jbpm3.TokenReference;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class TokenForm extends Panel
-{
- private final FormPanel tokenForm;
- private final Button signalButton;
- private TokenReference lastSelectedToken;
-
- public TokenForm(final TokenEditor.SignalCallback callback)
- {
- super();
-
- this.setHeader(false);
- this.setBorder(false);
- this.setFrame(false);
-
- tokenForm = new FormPanel();
- tokenForm.setLabelAlign(Position.LEFT);
- tokenForm.setWidth(UIConstants.EDITOR_PANEL_WIDTH);
- tokenForm.setHeader(false);
- tokenForm.setFrame(false);
- tokenForm.setBorder(false);
- tokenForm.setPaddings(5, 5, 5, 0);
- tokenForm.setLabelWidth(50);
-
- // ----------
-
- TextField idField = new TextField("Id", "id", 230);
- idField.setReadOnly(true);
- tokenForm.add(idField);
-
- //tokenForm.add(new TextField("Token Name", "name", 230));
- TextField nameField = new TextField("Node Name", "nodeName", 230);
- nameField.setReadOnly(true);
- tokenForm.add(nameField);
-
-
- // ----------
- RefreshableComboBox cb = new RefreshableComboBox("signal", "Signal");
- tokenForm.add(cb);
-
- final ButtonListenerAdapter listenerAdapter = new ButtonListenerAdapter()
- {
- public void onClick(Button button, EventObject eventObject)
- {
- ComboBox cb = (ComboBox)tokenForm.getForm().findField("signal");
-
- String signalValue = cb.getValueAsString();
- if(signalValue.equals(""))
- MessageBox.alert("Please select a signal");
- else
- callback.onSignalToken(lastSelectedToken, signalValue);
- }
-
- };
- signalButton = new Button("Signal", listenerAdapter);
-
-
- tokenForm.addButton(signalButton);
-
- // -------------------
-
- this.add(tokenForm);
-
- }
-
- /**
- * display the root token
- */
- void display(ProcessInstance processInstance)
- {
- display(processInstance, processInstance.getRootToken());
- }
-
- /**
- * display a particular token
- */
- void display(final ProcessInstance processInstance, final TokenReference tok)
- {
- Form form = tokenForm.getForm();
-
- if(form.findField("id")!=null) // TODO: the fields are not initialized on first callback?
- {
- form.findField("id").setRawValue(tok.getId()+"");
- form.findField("nodeName").setRawValue(tok.getCurrentNodeName());
-
- // display combo box
- RefreshableComboBox cb = (RefreshableComboBox)form.findField("signal");
- cb.reset();
- cb.display( tok.getAvailableSignals());
-
- // suspended instances cannot be signaled
- if(processInstance.isSuspended() || !tok.canBeSignaled())
- {
- signalButton.disable();
- cb.disable();
- }
- else
- {
- signalButton.enable();
- cb.enable();
- }
- }
-
- // -----------
-
-
- lastSelectedToken = tok;
- }
-
- public void resetForm()
- {
- tokenForm.getForm().reset();
- }
-}
More information about the jbpm-commits
mailing list