[jboss-svn-commits] JBL Code SVN: r13173 - in labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow: editor and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Jul 6 13:52:01 EDT 2007
Author: KrisVerlaenen
Date: 2007-07-06 13:52:01 -0400 (Fri, 06 Jul 2007)
New Revision: 13173
Added:
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/MilestoneWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/MilestoneEditPart.java
Modified:
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
Log:
JBRULES-979: Ruleflow should terminate all running node instances when ruleflow process is completed
JBRULES-981: Milestone
- initial start of milestone node
Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/MilestoneWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/MilestoneWrapper.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/MilestoneWrapper.java 2007-07-06 17:52:01 UTC (rev 13173)
@@ -0,0 +1,87 @@
+package org.drools.eclipse.flow.ruleflow.core;
+/*
+ * 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.eclipse.flow.common.editor.core.DefaultElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.ruleflow.core.MilestoneNode;
+import org.drools.ruleflow.core.impl.MilestoneNodeImpl;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+/**
+ * Wrapper for a milestone node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class MilestoneWrapper extends NodeWrapper {
+
+ private static final long serialVersionUID = -5976489437109982927L;
+ private static IPropertyDescriptor[] descriptors;
+
+ public static final String CONSTRAINT = "Constraint";
+ static {
+ descriptors = new IPropertyDescriptor[DefaultElementWrapper.descriptors.length + 1];
+ System.arraycopy(DefaultElementWrapper.descriptors, 0, descriptors, 0, DefaultElementWrapper.descriptors.length);
+ descriptors[descriptors.length - 1] =
+ new TextPropertyDescriptor(CONSTRAINT, "Constraint");
+ }
+
+ public MilestoneWrapper() {
+ setNode(new MilestoneNodeImpl());
+ getMilestoneNode().setName("Milestone");
+ }
+
+ public MilestoneNode getMilestoneNode() {
+ return (MilestoneNode) getNode();
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return descriptors;
+ }
+
+ public boolean acceptsIncomingConnection(ElementConnection connection) {
+ return getIncomingConnections().isEmpty();
+ }
+
+ public boolean acceptsOutgoingConnection(ElementConnection connection) {
+ return getOutgoingConnections().isEmpty();
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (CONSTRAINT.equals(id)) {
+ String constraint = getMilestoneNode().getConstraint();
+ return constraint == null ? "" : constraint;
+ }
+ return super.getPropertyValue(id);
+ }
+
+ public void resetPropertyValue(Object id) {
+ if (CONSTRAINT.equals(id)) {
+ getMilestoneNode().setConstraint("");
+ } else {
+ super.resetPropertyValue(id);
+ }
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (CONSTRAINT.equals(id)) {
+ getMilestoneNode().setConstraint((String) value);
+ } else {
+ super.setPropertyValue(id, value);
+ }
+ }
+}
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java 2007-07-06 17:49:45 UTC (rev 13172)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java 2007-07-06 17:52:01 UTC (rev 13173)
@@ -24,6 +24,7 @@
import org.drools.eclipse.flow.ruleflow.core.ConnectionWrapperFactory;
import org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper;
import org.drools.eclipse.flow.ruleflow.core.JoinWrapper;
+import org.drools.eclipse.flow.ruleflow.core.MilestoneWrapper;
import org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper;
import org.drools.eclipse.flow.ruleflow.core.SplitWrapper;
import org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper;
@@ -117,6 +118,16 @@
);
entries.add(combined);
+// combined = new CombinedTemplateCreationEntry(
+// "Milestone",
+// "Create a new Milestone",
+// MilestoneWrapper.class,
+// new SimpleFactory(MilestoneWrapper.class),
+// ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/activity.gif")),
+// ImageDescriptor.createFromURL(DroolsEclipsePlugin.getDefault().getBundle().getEntry("icons/activity.gif"))
+// );
+// entries.add(combined);
+
drawer.addAll(entries);
return drawer;
}
Added: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/MilestoneEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/MilestoneEditPart.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/MilestoneEditPart.java 2007-07-06 17:52:01 UTC (rev 13173)
@@ -0,0 +1,64 @@
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
+/*
+ * 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.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * EditPart for a RuleSet node.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class MilestoneEditPart extends ElementEditPart {
+
+ private static final Color color = new Color(Display.getCurrent(), 255, 250, 205);
+
+ protected IFigure createFigure() {
+ return new RuleSetNodeFigure();
+ }
+
+ public class RuleSetNodeFigure extends ElementFigure {
+
+ private RoundedRectangle rectangle;
+
+ protected void customizeFigure() {
+ rectangle = new RoundedRectangle();
+ rectangle.setCornerDimensions(new Dimension(25, 25));
+ add(rectangle, 0);
+ rectangle.setBackgroundColor(color);
+ rectangle.setBounds(getBounds());
+ setSelected(false);
+ }
+
+ public void setBounds(Rectangle rectangle) {
+ super.setBounds(rectangle);
+ this.rectangle.setBounds(rectangle);
+ }
+
+ public void setSelected(boolean b) {
+ super.setSelected(b);
+ rectangle.setLineWidth(b ? 3 : 1);
+ repaint();
+ }
+ }
+}
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java 2007-07-06 17:49:45 UTC (rev 13172)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java 2007-07-06 17:52:01 UTC (rev 13173)
@@ -19,6 +19,7 @@
import org.drools.eclipse.flow.common.editor.editpart.ProcessEditPart;
import org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper;
import org.drools.eclipse.flow.ruleflow.core.JoinWrapper;
+import org.drools.eclipse.flow.ruleflow.core.MilestoneWrapper;
import org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper;
import org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper;
import org.drools.eclipse.flow.ruleflow.core.SplitWrapper;
@@ -49,6 +50,8 @@
result = new SplitEditPart();
} else if (model instanceof JoinWrapper) {
result = new JoinEditPart();
+ } else if (model instanceof MilestoneWrapper) {
+ result = new MilestoneEditPart();
} else {
throw new IllegalArgumentException(
"Unknown model object " + model);
More information about the jboss-svn-commits
mailing list