[jboss-svn-commits] JBL Code SVN: r22304 - labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 2 04:13:33 EDT 2008


Author: Rikkola
Date: 2008-09-02 04:13:33 -0400 (Tue, 02 Sep 2008)
New Revision: 22304

Added:
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ActionNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/AttributableNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EmailNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EndNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachTransferNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskTransferNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/JoinNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/LogNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/MileStoneNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowBaseNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowConnectionFactory.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowNodeFactory.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundPanel.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundedPanel.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowViewer.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleSetNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitTransferNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/StartNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SubProcessNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TimerNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferConnection.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferRuleFlowNodeFactory.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemNode.java
   labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemTransferNode.java
Log:
Adding the missing rule flow package

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ActionNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ActionNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ActionNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ActionNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getImagePath() {
+        return ACTION_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/AttributableNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/AttributableNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/AttributableNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,30 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Map;
+
+public interface AttributableNode {
+
+    Map<String, String> getParameters();
+
+    void addAttribute(String key,
+                      String value);
+
+    void setAttributes(Map<String, String> map);
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EmailNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EmailNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EmailNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,26 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class EmailNode extends WorkItemNode {
+
+    @Override
+    public String getImagePath() {
+        return IMPORT_STATEMENT_GIF;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EndNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EndNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/EndNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class EndNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.NONE;
+    }
+
+    @Override
+    public String getImagePath() {
+        return PROCESS_STOP_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return WHITE_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,84 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import pl.balon.gwt.diagrams.client.connection.Connection;
+
+import com.google.gwt.user.client.ui.Widget;
+
+public class ForEachNode extends RuleFlowBaseNode {
+
+    private Map<Long, RuleFlowBaseNode> nodes       = new HashMap<Long, RuleFlowBaseNode>();
+    private Collection<Connection>      connections = new ArrayList<Connection>();
+
+    @Override
+    public Corners getCorners() {
+        return Corners.NONE;
+    }
+
+    @Override
+    public String getImagePath() {
+        return null;
+    }
+
+    @Override
+    public String getStyle() {
+        return WHITE_RULE_FLOW_NODE_STYLE;
+    }
+
+    public void update() {
+        if ( connections != null ) {
+            for ( Connection c : connections ) {
+                c.update();
+            }
+        }
+
+        // For each nodes have connections too.
+        for ( RuleFlowBaseNode node : nodes.values() ) {
+            if ( node instanceof ForEachNode ) {
+                ((ForEachNode) node).update();
+            }
+        }
+    }
+
+    public Map<Long, RuleFlowBaseNode> getNodes() {
+        return nodes;
+    }
+
+    public void setNodes(Map<Long, RuleFlowBaseNode> nodes) {
+        this.nodes = nodes;
+    }
+
+    public Collection<Connection> getConnections() {
+        return connections;
+    }
+
+    public void setConnections(Collection<Connection> connections) {
+        this.connections = connections;
+    }
+
+    @Override
+    public void onClick(Widget arg0) {
+        // TODO Auto-generated method stub
+        //        super.onClick( arg0 );
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachTransferNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachTransferNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/ForEachTransferNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,33 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.guvnor.client.rpc.RuleFlowContentModel;
+
+public class ForEachTransferNode extends TransferNode {
+
+    private RuleFlowContentModel contentModel;
+
+    public void setContentModel(RuleFlowContentModel contentModel) {
+        this.contentModel = contentModel;
+    }
+
+    public RuleFlowContentModel getContentModel() {
+        return contentModel;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,95 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Map;
+
+import com.google.gwt.user.client.ui.FocusListener;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public class HumanTaskNode extends RuleFlowBaseNode
+    implements
+    AttributableNode {
+
+    private Map<String, String> attributes;
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getImagePath() {
+        return HUMAN_TASK_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+    /**
+     * Show parameters when clicked.
+     */
+    public void onClick(Widget arg0) {
+
+        if ( parametersForm != null ) {
+
+            parametersForm.clear();
+
+            for ( final String key : attributes.keySet() ) {
+
+                final String value = attributes.get( key );
+
+                final TextBox tb = new TextBox();
+                tb.setWidth( "300px" );
+                tb.setText( value );
+
+                tb.addFocusListener( new FocusListener() {
+                    public void onFocus(Widget arg1) {
+                        tb.selectAll();
+                    }
+
+                    public void onLostFocus(Widget arg1) {
+                        attributes.put( key,
+                                        tb.getText() );
+                    }
+                } );
+
+                parametersForm.addAttribute( key,
+                                             tb );
+            }
+
+        }
+    }
+
+    public void addAttribute(String key,
+                             String value) {
+        attributes.put( key,
+                        value );
+    }
+
+    public Map<String, String> getParameters() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, String> map) {
+        attributes = map;
+
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskTransferNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskTransferNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/HumanTaskTransferNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,34 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class HumanTaskTransferNode extends TransferNode {
+
+    private Map<String, String> parameters = new HashMap<String, String>();
+
+    public void setParameters(Map<String, String> parameters) {
+        this.parameters = parameters;
+    }
+
+    public Map<String, String> getParameters() {
+        return parameters;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/JoinNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/JoinNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/JoinNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class JoinNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUND;
+    }
+
+    @Override
+    public String getImagePath() {
+        return null;
+    }
+
+    @Override
+    public String getStyle() {
+        return BLUE_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/LogNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/LogNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/LogNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,25 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class LogNode extends WorkItemNode {
+
+    @Override
+    public String getImagePath() {
+        return ACTION_GIF;
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/MileStoneNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/MileStoneNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/MileStoneNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class MileStoneNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getImagePath() {
+        return QUESTION_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowBaseNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowBaseNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowBaseNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,100 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.guvnor.client.common.FormStyleLayout;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.FocusPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+abstract class RuleFlowBaseNode extends FocusPanel
+    implements
+    ClickListener {
+
+    protected enum Corners {
+        NONE, ROUNDED, ROUND
+    }
+
+    protected static final int    CORNER_HEIGHT               = 8;
+    protected static final int    CORNER_ROUND_HEIGHT         = 16;
+
+    protected static final String IMAGE_STYLE                 = "ruleflow-image";
+    protected static final String WHITE_RULE_FLOW_NODE_STYLE  = "white-ruleflow-node";
+    protected static final String YELLOW_RULE_FLOW_NODE_STYLE = "yellow-ruleflow-node";
+    protected static final String BLUE_RULE_FLOW_NODE_STYLE   = "blue-ruleflow-node";
+
+    protected static final String PROCESS_START_GIF           = "images/ruleflow/process_start.gif";
+    protected static final String PROCESS_STOP_GIF            = "images/ruleflow/process_stop.gif";
+    protected static final String HUMAN_TASK_GIF              = "images/ruleflow/human_task.gif";
+    protected static final String IMPORT_STATEMENT_GIF        = "images/ruleflow/import_statement.gif";
+    protected static final String ACTION_GIF                  = "images/ruleflow/action.gif";
+    protected static final String PROCESS_GIF                 = "images/ruleflow/process.gif";
+    protected static final String QUESTION_GIF                = "images/ruleflow/question.gif";
+    protected static final String TIMER_GIF                   = "images/ruleflow/timer.gif";
+
+    private long                  id;
+    private int                   x;
+    private int                   y;
+
+    protected FormStyleLayout     parametersForm              = null;
+
+    public abstract String getImagePath();
+
+    public abstract String getStyle();
+
+    public abstract Corners getCorners();
+
+    /**
+     * Clear parameters when clicked.
+     */
+    public void onClick(Widget arg0) {
+
+        if ( parametersForm != null ) {
+
+            parametersForm.clear();
+        }
+    }
+
+    public void addParametersForm(FormStyleLayout parametersForm) {
+        this.parametersForm = parametersForm;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setX(int x) {
+        this.x = x;
+    }
+
+    public int getX() {
+        return x;
+    }
+
+    public void setY(int y) {
+        this.y = y;
+    }
+
+    public int getY() {
+        return y;
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowConnectionFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowConnectionFactory.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowConnectionFactory.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,41 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Map;
+
+import pl.balon.gwt.diagrams.client.connection.Connection;
+import pl.balon.gwt.diagrams.client.connection.RectilinearTwoEndedConnection;
+import pl.balon.gwt.diagrams.client.connector.UIObjectConnector;
+
+public class RuleFlowConnectionFactory {
+
+    public static Connection createConnection(TransferConnection c,
+                                              Map<Long, RuleFlowBaseNode> nodes) {
+
+        long fromId = c.getFromId();
+        long toId = c.getToId();
+
+        RuleFlowBaseNode from = nodes.get( fromId );
+        RuleFlowBaseNode to = nodes.get( toId );
+
+        RectilinearTwoEndedConnection connection = new RectilinearTwoEndedConnection( UIObjectConnector.wrap( from ),
+                                                                                      UIObjectConnector.wrap( to ) );
+
+        return connection;
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowNodeFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowNodeFactory.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowNodeFactory.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,317 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.cobogw.gwt.user.client.ui.RoundedPanel;
+import org.drools.guvnor.client.rulefloweditor.RuleFlowBaseNode.Corners;
+import org.drools.guvnor.client.rulefloweditor.TransferNode.Type;
+
+import pl.balon.gwt.diagrams.client.connection.Connection;
+
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+public class RuleFlowNodeFactory {
+
+    public static RuleFlowBaseNode createNode(TransferNode tn) {
+
+        RuleFlowBaseNode n;
+
+        if ( tn.getType() == Type.START ) {
+
+            n = new StartNode();
+
+        } else if ( tn.getType() == Type.HUMANTASK ) {
+
+            n = createHumanTask( (HumanTaskTransferNode) tn );
+
+        } else if ( tn.getType() == Type.JOIN ) {
+
+            n = new JoinNode();
+
+        } else if ( tn.getType() == Type.SUB_PROCESS ) {
+
+            n = new SubProcessNode();
+
+        } else if ( tn.getType() == Type.MILESTONE ) {
+
+            n = new MileStoneNode();
+
+        } else if ( tn.getType() == Type.TIMER ) {
+
+            n = new TimerNode();
+
+        } else if ( tn.getType() == Type.ACTION_NODE ) {
+
+            n = new ActionNode();
+
+        } else if ( tn.getType() == Type.WORK_ITEM ) {
+
+            n = createWorkItemNode( (WorkItemTransferNode) tn );
+
+        } else if ( tn.getType() == Type.RULESET ) {
+
+            n = new RuleSetNode();
+
+        } else if ( tn.getType() == Type.SPLIT ) {
+
+            n = createSplit( (SplitTransferNode) tn );
+
+        } else if ( tn.getType() == Type.FOR_EACH ) {
+
+            n = createForEach( (ForEachTransferNode) tn );
+
+        } else if ( tn.getType() == Type.END ) {
+
+            n = new EndNode();
+
+        } else {
+
+            throw new IllegalArgumentException();
+        }
+
+        fillRuleFlowBaseNode( n,
+                              tn );
+        return n;
+    }
+
+    private static RuleFlowBaseNode createForEach(ForEachTransferNode tn) {
+
+        ForEachNode node = new ForEachNode();
+
+        for ( TransferNode subNode : tn.getContentModel().getNodes() ) {
+            RuleFlowBaseNode baseNode = createNode( subNode );
+
+            node.getNodes().put( baseNode.getId(),
+                                 baseNode );
+        }
+
+        for ( TransferConnection c : tn.getContentModel().getConnections() ) {
+            node.getConnections().add( RuleFlowConnectionFactory.createConnection( c,
+                                                                                   node.getNodes() ) );
+        }
+
+        return node;
+    }
+
+    private static RuleFlowBaseNode createWorkItemNode(WorkItemTransferNode node) {
+
+        WorkItemNode workItemNode = null;
+
+        if ( node.getWorkName().equals( WorkItemNode.EMAIL ) ) {
+
+            workItemNode = new EmailNode();
+
+        } else if ( node.getWorkName().equals( WorkItemNode.LOG ) ) {
+
+            workItemNode = new LogNode();
+        }
+
+        workItemNode.setAttributes( node.getParameters() );
+
+        return workItemNode;
+    }
+
+    private static RuleFlowBaseNode createSplit(SplitTransferNode tn) {
+
+        SplitNode splitNode = new SplitNode();
+
+        splitNode.type = tn.getSplitType();
+
+        splitNode.constraints = tn.getConstraints();
+
+        return splitNode;
+    }
+
+    private static RuleFlowBaseNode createHumanTask(HumanTaskTransferNode node) {
+        HumanTaskNode n = new HumanTaskNode();
+
+        n.setAttributes( node.getParameters() );
+
+        return n;
+    }
+
+    private static void fillRuleFlowBaseNode(RuleFlowBaseNode node,
+                                             TransferNode tn) {
+        fillIdAndCoordinates( node,
+                              tn );
+
+        Widget panel;
+        if ( node.getImagePath() == null ) {
+            panel = createContentWithoutImage( tn.getName(),
+                                               node,
+                                               tn.getWidth() );
+        } else {
+            panel = createContentWithImage( tn.getName(),
+                                            node,
+                                            tn.getWidth() );
+        }
+
+        if ( node.getCorners() == Corners.ROUNDED ) {
+            int cornerHeight = LayoutCalculator.calculateCornerHeight( tn.getWidth() );
+            panel.setHeight( LayoutCalculator.calculateNodeHeight( tn.getHeight(),
+                                                                   cornerHeight ) + "px" );
+            RuleFlowRoundedPanel rp = new RuleFlowRoundedPanel( RoundedPanel.ALL,
+                                                                RuleFlowBaseNode.CORNER_HEIGHT );
+
+            rp.setTopAndBottomRowColor( "Black" );
+            rp.setCornerStyleName( node.getStyle() );
+
+            rp.add( panel );
+            node.add( rp );
+
+        } else if ( node.getCorners() == Corners.ROUND ) {
+            int cornerHeight = LayoutCalculator.calculateRoundCornerHeight( tn.getWidth() );
+            panel.setHeight( "1px" );
+
+            RuleFlowRoundPanel rp = new RuleFlowRoundPanel( cornerHeight );
+
+            rp.setTopAndBottomRowColor( "Black" );
+            rp.setCornerStyleName( node.getStyle() );
+
+            rp.add( panel );
+            node.add( rp );
+
+        } else {
+            panel.setHeight( tn.getHeight() + "px" );
+
+            if ( node instanceof ForEachNode ) {
+
+                // Add nodes that are in for each node 
+                AbsolutePanel ap = new AbsolutePanel();
+
+                ForEachNode fen = (ForEachNode) node;
+
+                for ( RuleFlowBaseNode baseNode : fen.getNodes().values() ) {
+                    ap.add( baseNode,
+                            baseNode.getX(),
+                            baseNode.getY() );
+                }
+
+                // Add connections that are in for each node
+                for ( Connection c : fen.getConnections() ) {
+                    c.appendTo( ap );
+                }
+
+                ap.add( panel );
+
+                node.add( ap );
+
+            } else {
+                node.add( panel );
+            }
+        }
+    }
+
+    private static Widget createContentWithoutImage(String name,
+                                                    RuleFlowBaseNode node,
+                                                    int width) {
+        Label label = new Label( name );
+
+        label.setStyleName( node.getStyle() );
+
+        label.setWidth( width + "px" );
+
+        return label;
+    }
+
+    private static Widget createContentWithImage(String name,
+                                                 RuleFlowBaseNode node,
+                                                 int width) {
+        Label label = new Label( name );
+
+        Image image = new Image();
+        image.setStyleName( RuleFlowBaseNode.IMAGE_STYLE );
+        image.setUrl( node.getImagePath() );
+
+        HorizontalPanel panel = new HorizontalPanel();
+
+        panel.setStyleName( node.getStyle() );
+
+        panel.add( image );
+        panel.add( label );
+        panel.setWidth( width + "px" );
+
+        return panel;
+    }
+
+    protected static void fillIdAndCoordinates(RuleFlowBaseNode node,
+                                               TransferNode tn) {
+
+        node.addClickListener( node );
+
+        node.setId( tn.getId() );
+        node.setX( tn.getX() );
+        node.setY( tn.getY() );
+    }
+
+    protected static class LayoutCalculator {
+        /**
+         * Subtracts the border height from nodes height.
+         * 
+         * @return node height
+         */
+        static int calculateNodeHeight(int height,
+                                       int cornerHeight) {
+            int newHeight = 0;
+
+            if ( height < (2 * cornerHeight) ) {
+                newHeight = height;
+            } else {
+                newHeight = height - (2 * cornerHeight);
+            }
+
+            return newHeight;
+        }
+
+        /**
+         * Calculates the corner height. If the width is too short, adding the
+         * corner divs go over the node edges.
+         * 
+         * @param width
+         * @return The fixed corner height
+         */
+        static int calculateCornerHeight(int width) {
+            int newWidth = 1;
+
+            if ( width < RuleFlowBaseNode.CORNER_HEIGHT ) {
+                newWidth = width - 4;
+            } else if ( width <= 20 ) {
+                newWidth = 6;
+            } else {
+                newWidth = RuleFlowBaseNode.CORNER_HEIGHT;
+            }
+
+            if ( newWidth <= 0 ) {
+                return 1;
+            } else {
+                return newWidth;
+            }
+        }
+
+        static int calculateRoundCornerHeight(int width) {
+            if ( width < 44 ) {
+                return width / 2 - 1;
+            } else {
+                return 16;
+            }
+        }
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundPanel.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundPanel.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundPanel.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,71 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+
+public class RuleFlowRoundPanel extends RuleFlowRoundedPanel {
+
+    /**
+     * Lookup table for corner border width
+     */
+    private final static String[] CORNERBORDER = {"1px", "1px", "1px", "1px", "1px", "1px", "1px", "2px", "2px", "2px", "3px", "3px", "2px", "2px", "4px", "1px"};
+
+    /**
+     * Lookup table for corner height
+     */
+    private final static String[] CORNERHEIGHT = {"1px", "2px", "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px", "1px", "1px", "1px", "1px", "1px", "1px"};
+
+    private final static String[] CORNERMARGIN = {"1px", "1px", "1px", "2px", "2px", "3px", "4px", "5px", "6px", "8px", "9px", "11px", "14px", "16px", "18px", "22px"};
+
+    public RuleFlowRoundPanel(int cornerHeight) {
+        //        super( ALL,
+        //               cornerHeight );
+        super( ALL,
+               9 );
+    }
+
+    protected Element addLine(int corner,
+                              int heightIndex) {
+        String margin = "0 " + RuleFlowRoundPanel.CORNERMARGIN[heightIndex];
+
+        Element div = DOM.createDiv();
+
+        DOM.setStyleAttribute( div,
+                               "fontSize",
+                               "0px" );
+        DOM.setStyleAttribute( div,
+                               "height",
+                               RuleFlowRoundPanel.CORNERHEIGHT[heightIndex] );
+        DOM.setStyleAttribute( div,
+                               "borderWidth",
+                               "0 " + RuleFlowRoundPanel.CORNERBORDER[heightIndex] );
+        DOM.setStyleAttribute( div,
+                               "lineHeight",
+                               RuleFlowRoundPanel.CORNERHEIGHT[heightIndex] );
+        DOM.setStyleAttribute( div,
+                               "margin",
+                               margin );
+        DOM.setInnerHTML( div,
+                          "&nbsp;" );
+        DOM.appendChild( getElement(), // body
+                         div );
+
+        return div;
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundedPanel.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundedPanel.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowRoundedPanel.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.guvnor.client.rulefloweditor;
+
+import org.cobogw.gwt.user.client.ui.RoundedPanel;
+
+import com.google.gwt.user.client.DOM;
+
+/**
+ * @author trikkola
+ *
+ */
+public class RuleFlowRoundedPanel extends RoundedPanel {
+
+    /**
+     * @param all
+     * @param cornerHeight
+     */
+    public RuleFlowRoundedPanel(int all,
+                                int cornerHeight) {
+        super( all,
+               cornerHeight );
+    }
+
+    /**
+     * Sets this nodes top and bottom row to black.
+     * 
+     * @param node
+     * @param rp
+     */
+    public void setTopAndBottomRowColor(String color) {
+        DOM.setStyleAttribute( divt[0],
+                               "backgroundColor",
+                               color );
+        DOM.setStyleAttribute( divb[0],
+                               "backgroundColor",
+                               color );
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowViewer.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowViewer.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleFlowViewer.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,119 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.guvnor.client.common.FormStyleLayout;
+import org.drools.guvnor.client.rpc.RuleFlowContentModel;
+
+import pl.balon.gwt.diagrams.client.connection.Connection;
+
+import com.google.gwt.user.client.ui.AbsolutePanel;
+
+public class RuleFlowViewer extends AbsolutePanel {
+
+    private Map<Long, RuleFlowBaseNode> nodes       = new HashMap<Long, RuleFlowBaseNode>();
+    private List<Connection>            connections = new ArrayList<Connection>();
+
+    public RuleFlowViewer(RuleFlowContentModel rfcm,
+                          FormStyleLayout parametersForm) {
+
+        this.setHeight( "600px" );
+        this.setHeight( "600px" );
+
+        // Handle nodes
+        for ( TransferNode tn : rfcm.getNodes() ) {
+
+            RuleFlowBaseNode node = RuleFlowNodeFactory.createNode( tn );
+
+            if ( node != null ) {
+
+                if ( node instanceof ForEachNode ) {
+                    addForEachSubNodes( (ForEachNode) node,
+                                        parametersForm );
+                }
+
+                node.addParametersForm( parametersForm );
+
+                add( node,
+                     node.getX(),
+                     node.getY() );
+
+                nodes.put( node.getId(),
+                           node );
+            }
+        }
+
+        for ( TransferConnection c : rfcm.getConnections() ) {
+
+            Connection connection = RuleFlowConnectionFactory.createConnection( c,
+                                                                                nodes );
+
+            connections.add( connection );
+
+            connection.appendTo( this );
+
+        }
+    }
+
+    private void addForEachSubNodes(ForEachNode fen,
+                                    FormStyleLayout parametersForm) {
+        for ( RuleFlowBaseNode node : fen.getNodes().values() ) {
+
+            node.addParametersForm( parametersForm );
+
+            if ( node instanceof ForEachNode ) {
+                addForEachSubNodes( (ForEachNode) node,
+                                    parametersForm );
+            }
+        }
+    }
+
+    /**
+     * Update the connections that this graph has.
+     */
+    public void update() {
+        if ( connections != null ) {
+            for ( Connection c : connections ) {
+                c.update();
+            }
+        }
+
+        // For each nodes have connections too.
+        for ( RuleFlowBaseNode node : nodes.values() ) {
+            if ( node instanceof ForEachNode ) {
+                ((ForEachNode) node).update();
+            }
+        }
+    }
+
+    public Collection<TransferNode> getTransferNodes() {
+
+        Collection<TransferNode> transferNodes = new ArrayList<TransferNode>();
+
+        for ( RuleFlowBaseNode node : nodes.values() ) {
+            transferNodes.add( TransferRuleFlowNodeFactory.createNode( node ) );
+        }
+
+        return transferNodes;
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleSetNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleSetNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/RuleSetNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class RuleSetNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getImagePath() {
+        return null;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,203 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Map;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+import com.google.gwt.user.client.ui.FocusListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public class SplitNode extends RuleFlowBaseNode {
+
+    SplitTransferNode.Type                type;
+
+    public Map<ConnectionRef, Constraint> constraints;
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUND;
+    }
+
+    @Override
+    public String getImagePath() {
+        return null;
+    }
+
+    @Override
+    public String getStyle() {
+        return BLUE_RULE_FLOW_NODE_STYLE;
+    }
+
+    /**
+     * Show parameters when clicked.
+     */
+    public void onClick(Widget arg0) {
+
+        if ( parametersForm != null ) {
+
+            parametersForm.clear();
+
+            // Add Type:
+            parametersForm.addAttribute( "Type",
+                                         new Label( type.toString() ) );
+
+            for ( final ConnectionRef connectionRef : constraints.keySet() ) {
+
+                final Constraint constraint = constraints.get( connectionRef );
+
+                final TextBox priorityTextBox = new TextBox();
+                priorityTextBox.setWidth( "30px" );
+                priorityTextBox.setText( constraint.getPriority() + "" );
+
+                priorityTextBox.addFocusListener( new FocusListener() {
+                    public void onFocus(Widget arg1) {
+                        priorityTextBox.selectAll();
+                    }
+
+                    public void onLostFocus(Widget arg1) {
+
+                        final Constraint constraint = constraints.get( connectionRef );
+                        constraint.setPriority( Integer.parseInt( priorityTextBox.getText() ) );
+                        constraints.put( connectionRef,
+                                         constraint );
+                    }
+                } );
+
+                final TextBox constraintTextBox = new TextBox();
+                constraintTextBox.setWidth( "300px" );
+                constraintTextBox.setText( constraint.getConstraint() );
+
+                constraintTextBox.addFocusListener( new FocusListener() {
+                    public void onFocus(Widget arg1) {
+                        constraintTextBox.selectAll();
+                    }
+
+                    public void onLostFocus(Widget arg1) {
+
+                        final Constraint constraint = constraints.get( connectionRef );
+                        constraint.setConstraint( constraintTextBox.getText() );
+                        constraints.put( connectionRef,
+                                         constraint );
+                    }
+                } );
+
+                Panel panel = new HorizontalPanel();
+                panel.add( new Label( " Priority: " ) );
+                panel.add( priorityTextBox );
+                panel.add( new Label( " Value: " ) );
+                panel.add( constraintTextBox );
+
+                parametersForm.addAttribute( constraint.getName(),
+                                             panel );
+            }
+        }
+    }
+
+    public static class Constraint
+        implements
+        IsSerializable {
+
+        private String constraint;
+        private String dialect;
+        private int    priority;
+        private String name;
+        private String type;
+
+        public String getConstraint() {
+            return this.constraint;
+        }
+
+        public String getDialect() {
+            return this.dialect;
+        }
+
+        public String getName() {
+            return this.name;
+        }
+
+        public int getPriority() {
+            return this.priority;
+        }
+
+        public String getType() {
+            return this.type;
+        }
+
+        public void setConstraint(String constraint) {
+            this.constraint = constraint;
+        }
+
+        public void setDialect(String dialect) {
+            this.dialect = dialect;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        public void setPriority(int priority) {
+            this.priority = priority;
+        }
+
+        public void setType(String type) {
+            this.type = type;
+        }
+
+    }
+
+    public static class ConnectionRef
+        implements
+        IsSerializable {
+
+        private String toType;
+        private long   nodeId;
+
+        public void setToType(String toType) {
+            this.toType = toType;
+        }
+
+        public void setNodeId(long nodeId) {
+            this.nodeId = nodeId;
+        }
+
+        public String getToType() {
+            return toType;
+        }
+
+        public long getNodeId() {
+            return nodeId;
+        }
+
+        public boolean equals(Object o) {
+            if ( o instanceof ConnectionRef ) {
+                ConnectionRef c = (ConnectionRef) o;
+                return toType.equals( c.toType ) && nodeId == c.nodeId;
+            }
+            return false;
+        }
+
+        public int hashCode() {
+            return 7 * toType.hashCode() + (int) nodeId;
+        }
+
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitTransferNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitTransferNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SplitTransferNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,82 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.guvnor.client.rulefloweditor.SplitNode.ConnectionRef;
+import org.drools.guvnor.client.rulefloweditor.SplitNode.Constraint;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class SplitTransferNode extends TransferNode
+    implements
+    IsSerializable {
+
+    private Map<ConnectionRef, Constraint> constraints = new HashMap<ConnectionRef, Constraint>();
+    private Type                           splitType;
+
+    public enum Type
+            implements IsSerializable {
+        UNDEFINED(
+                0), AND(
+                1), XOR(
+                2), OR(
+                3);
+
+        private final int value;
+
+        Type(int i) {
+            value = i;
+        }
+
+        int getValue() {
+            return value;
+        }
+
+        public static Type getType(int i) {
+            switch ( i ) {
+                case 0 :
+                    return Type.UNDEFINED;
+                case 1 :
+                    return Type.AND;
+                case 2 :
+                    return Type.XOR;
+                case 3 :
+                default :
+                    return Type.OR;
+            }
+        }
+    }
+
+    public void setConstraints(Map<ConnectionRef, Constraint> constraints) {
+        this.constraints = constraints;
+    }
+
+    public Map<ConnectionRef, Constraint> getConstraints() {
+        return constraints;
+    }
+
+    public void setSplitType(Type splitType) {
+        this.splitType = splitType;
+    }
+
+    public Type getSplitType() {
+        return splitType;
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/StartNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/StartNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/StartNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class StartNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.NONE;
+    }
+
+    @Override
+    public String getImagePath() {
+        return PROCESS_START_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return WHITE_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SubProcessNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SubProcessNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/SubProcessNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class SubProcessNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getImagePath() {
+        return PROCESS_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TimerNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TimerNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TimerNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TimerNode extends RuleFlowBaseNode {
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getImagePath() {
+        return TIMER_GIF;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferConnection.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferConnection.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferConnection.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,44 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class TransferConnection
+    implements
+    IsSerializable {
+
+    private long fromId;
+    private long toId;
+
+    public void setFromId(long fromId) {
+        this.fromId = fromId;
+    }
+
+    public long getFromId() {
+        return fromId;
+    }
+
+    public void setToId(long toId) {
+        this.toId = toId;
+    }
+
+    public long getToId() {
+        return toId;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,102 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+public class TransferNode
+    implements
+    IsSerializable {
+
+    public static enum Type
+            implements IsSerializable {
+        START, HUMANTASK, JOIN, SUB_PROCESS, MILESTONE, TIMER, ACTION_NODE, RULESET, SPLIT, END,
+        //WORK_ITEM,
+        FOR_EACH, COMPOSITE, EVENT, WORK_ITEM
+    }
+
+    private String name;
+
+    private Type   type;
+
+    private long   id;
+
+    private int    x;
+
+    private int    y;
+
+    private int    width;
+
+    private int    height;
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setType(Type type) {
+        this.type = type;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setX(int x) {
+        this.x = x;
+    }
+
+    public int getX() {
+        return x;
+    }
+
+    public void setY(int y) {
+        this.y = y;
+    }
+
+    public int getY() {
+        return y;
+    }
+
+    public void setWidth(int width) {
+        this.width = width;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public void setHeight(int height) {
+        this.height = height;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferRuleFlowNodeFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferRuleFlowNodeFactory.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/TransferRuleFlowNodeFactory.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,154 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.drools.guvnor.client.rpc.RuleFlowContentModel;
+import org.drools.guvnor.client.rulefloweditor.TransferNode.Type;
+
+public class TransferRuleFlowNodeFactory {
+
+    public static TransferNode createNode(RuleFlowBaseNode node) {
+
+        TransferNode tn;
+
+        if ( node instanceof StartNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.START );
+
+        } else if ( node instanceof HumanTaskNode ) {
+
+            tn = createHumanTask( (HumanTaskNode) node );
+
+        } else if ( node instanceof JoinNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.JOIN );
+
+        } else if ( node instanceof SubProcessNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.SUB_PROCESS );
+
+        } else if ( node instanceof MileStoneNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.MILESTONE );
+
+        } else if ( node instanceof TimerNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.TIMER );
+
+        } else if ( node instanceof ActionNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.ACTION_NODE );
+
+        } else if ( node instanceof WorkItemNode ) {
+
+            tn = createWorkItemNode( (WorkItemNode) node );
+
+        } else if ( node instanceof RuleSetNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.RULESET );
+
+        } else if ( node instanceof SplitNode ) {
+
+            tn = createSplit( (SplitNode) node );
+
+        } else if ( node instanceof ForEachNode ) {
+
+            tn = createForEach( (ForEachNode) node );
+
+        } else if ( node instanceof EndNode ) {
+
+            tn = new TransferNode();
+            tn.setType( Type.END );
+
+        } else {
+
+            throw new IllegalArgumentException();
+
+        }
+
+        tn.setId( node.getId() );
+
+        return tn;
+    }
+
+    private static TransferNode createForEach(ForEachNode node) {
+
+        ForEachTransferNode fetn = new ForEachTransferNode();
+        Collection<TransferNode> baseNodes = new ArrayList<TransferNode>();
+
+        for ( RuleFlowBaseNode subNode : node.getNodes().values() ) {
+            baseNodes.add( createNode( subNode ) );
+        }
+
+        RuleFlowContentModel model = new RuleFlowContentModel();
+        model.setNodes( baseNodes );
+        fetn.setContentModel( model );
+
+        return fetn;
+    }
+
+    private static WorkItemTransferNode createWorkItemNode(WorkItemNode node) {
+
+        WorkItemTransferNode tn = null;
+
+        if ( node instanceof EmailNode ) {
+
+            tn = new WorkItemTransferNode();
+            tn.setWorkName( WorkItemNode.EMAIL );
+
+        } else if ( node instanceof LogNode ) {
+
+            tn = new WorkItemTransferNode();
+            tn.setWorkName( WorkItemNode.LOG );
+
+        }
+
+        tn.setParameters( node.attributes );
+
+        return tn;
+    }
+
+    private static SplitTransferNode createSplit(SplitNode node) {
+
+        SplitTransferNode splitNode = new SplitTransferNode();
+
+        splitNode.setSplitType( node.type );
+
+        splitNode.setConstraints( node.constraints );
+
+        return splitNode;
+    }
+
+    private static TransferNode createHumanTask(HumanTaskNode node) {
+        HumanTaskTransferNode n = new HumanTaskTransferNode();
+
+        n.setParameters( node.getParameters() );
+
+        return n;
+    }
+
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,92 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Map;
+
+import com.google.gwt.user.client.ui.FocusListener;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public abstract class WorkItemNode extends RuleFlowBaseNode
+    implements
+    AttributableNode {
+
+    public static final String LOG   = "Log";
+    public static final String EMAIL = "Email";
+
+    Map<String, String>        attributes;
+
+    @Override
+    public Corners getCorners() {
+        return Corners.ROUNDED;
+    }
+
+    @Override
+    public String getStyle() {
+        return YELLOW_RULE_FLOW_NODE_STYLE;
+    }
+
+    public void addAttribute(String key,
+                             String value) {
+        attributes.put( key,
+                        value );
+    }
+
+    public Map<String, String> getParameters() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, String> map) {
+        attributes = map;
+    }
+
+    /**
+     * Show parameters when clicked.
+     */
+    public void onClick(Widget arg0) {
+
+        if ( parametersForm != null ) {
+
+            parametersForm.clear();
+
+            for ( final String key : attributes.keySet() ) {
+
+                final String value = attributes.get( key );
+
+                final TextBox tb = new TextBox();
+                tb.setWidth( "300px" );
+                tb.setText( value );
+
+                tb.addFocusListener( new FocusListener() {
+                    public void onFocus(Widget arg1) {
+                        tb.selectAll();
+                    }
+
+                    public void onLostFocus(Widget arg1) {
+                        attributes.put( key,
+                                        tb.getText() );
+                    }
+                } );
+
+                parametersForm.addAttribute( key,
+                                             tb );
+            }
+
+        }
+    }
+}

Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemTransferNode.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemTransferNode.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulefloweditor/WorkItemTransferNode.java	2008-09-02 08:13:33 UTC (rev 22304)
@@ -0,0 +1,42 @@
+package org.drools.guvnor.client.rulefloweditor;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class WorkItemTransferNode extends TransferNode {
+
+    private Map<String, String> parameters = new HashMap<String, String>();
+    private String              workName;
+
+    public void setParameters(Map<String, String> parameters) {
+        this.parameters = parameters;
+    }
+
+    public Map<String, String> getParameters() {
+        return parameters;
+    }
+
+    public void setWorkName(String workName) {
+        this.workName = workName;
+    }
+
+    public String getWorkName() {
+        return workName;
+    }
+}




More information about the jboss-svn-commits mailing list