[jboss-svn-commits] JBL Code SVN: r7091 - in labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools: ide/editors/rete ide/editors/rete/model ide/editors/rete/part reteoo

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 24 13:20:56 EDT 2006


Author: ahtik
Date: 2006-10-24 13:20:33 -0400 (Tue, 24 Oct 2006)
New Revision: 7091

Modified:
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/ReteViewer.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/GraphicalVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ModelElement.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ReteGraph.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/VertexPropertySource.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/part/VertexEditPartFactory.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/AlphaNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/BaseVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/JoinNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/NotNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteooVisitor.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/RightInputAdapterNodeVertex.java
   labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/TerminalNodeVertex.java
Log:
JBRULES-517: Cleaned up code - organized imports, formatted unformatted code, extracted strings, removed redundant Serializable from ModelElement

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/ReteViewer.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/ReteViewer.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/ReteViewer.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -38,8 +38,6 @@
 import org.drools.rule.Package;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.DebugException;
 import org.eclipse.draw2d.ColorConstants;
 import org.eclipse.draw2d.IFigure;
 import org.eclipse.draw2d.geometry.Point;
@@ -67,6 +65,8 @@
  */
 public class ReteViewer extends GraphicalEditor {
 
+    private static final String  JAVA_NATURE  = "org.eclipse.jdt.core.javanature";
+
     ScalableFreeformRootEditPart rootEditPart = new ScalableFreeformRootEditPart();
 
     private IDocumentProvider    documentProvider;
@@ -116,7 +116,7 @@
                 ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
                 ClassLoader newLoader = DroolsBuilder.class.getClassLoader();
                 IFile file = ((IFileEditorInput) getEditorInput()).getFile();
-                if ( file.getProject().getNature( "org.eclipse.jdt.core.javanature" ) != null ) {
+                if ( file.getProject().getNature( JAVA_NATURE ) != null ) {
                     IJavaProject project = JavaCore.create( file.getProject() );
                     newLoader = ProjectClassLoader.getProjectClassLoader( project );
                 }

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/GraphicalVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/GraphicalVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/GraphicalVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -23,31 +23,37 @@
  */
 abstract public class GraphicalVertex extends ModelElement {
 
+    private static final String          VERTEX_NAME             = "BaseVertex ";
+
+    private static final String          WIDTH                   = "Width";
+
+    private static final String          HEIGHT                  = "Height";
+
     private static IPropertyDescriptor[] descriptors;
 
     /** ID for the Height property value (used for by the corresponding property descriptor). */
-    private static final String          HEIGHT_PROP             = "BaseVertex.Height";
+    private static final String          HEIGHT_PROP             = VERTEX_NAME + "." + HEIGHT;
 
+    /** ID for the Width property value (used for by the corresponding property descriptor). */
+    private static final String          WIDTH_PROP              = VERTEX_NAME + "." + WIDTH;
+
     /** Property ID to use when the location of this shape is modified. */
-    public static final String           LOCATION_PROP           = "BaseVertex.Location";
+    public static final String           LOCATION_PROP           = VERTEX_NAME + ".Location";
 
     /** Property ID to use then the size of this shape is modified. */
-    public static final String           SIZE_PROP               = "BaseVertex.Size";
+    public static final String           SIZE_PROP               = VERTEX_NAME + ".Size";
 
     /** Property ID to use when the list of outgoing connections is modified. */
-    public static final String           SOURCE_CONNECTIONS_PROP = "BaseVertex.SourceConn";
+    public static final String           SOURCE_CONNECTIONS_PROP = VERTEX_NAME + ".SourceConn";
 
     /** Property ID to use when the list of incoming connections is modified. */
-    public static final String           TARGET_CONNECTIONS_PROP = "BaseVertex.TargetConn";
+    public static final String           TARGET_CONNECTIONS_PROP = VERTEX_NAME + ".TargetConn";
 
-    /** ID for the Width property value (used for by the corresponding property descriptor). */
-    private static final String          WIDTH_PROP              = "BaseVertex.Width";
-
     /** ID for the X property value (used for by the corresponding property descriptor).  */
-    private static final String          XPOS_PROP               = "BaseVertex.xPos";
+    private static final String          XPOS_PROP               = VERTEX_NAME + ".xPos";
 
     /** ID for the Y property value (used for by the corresponding property descriptor).  */
-    private static final String          YPOS_PROP               = "BaseVertex.yPos";
+    private static final String          YPOS_PROP               = VERTEX_NAME + ".yPos";
 
     /*
      * Initializes the property descriptors array.
@@ -60,8 +66,8 @@
                                                                             "X" ), // id and description pair
             new TextPropertyDescriptor( YPOS_PROP,
                                         "Y" ), new TextPropertyDescriptor( WIDTH_PROP,
-                                                                           "Width" ), new TextPropertyDescriptor( HEIGHT_PROP,
-                                                                                                                  "Height" ),};
+                                                                           WIDTH ), new TextPropertyDescriptor( HEIGHT_PROP,
+                                                                                                                HEIGHT ),};
     } // static
 
     /** Location of this vertex. */
@@ -249,7 +255,7 @@
      * @see java.lang.Object#toString()
      */
     public String toString() {
-        return "BaseVertex " + hashCode();
+        return VERTEX_NAME + hashCode();
     }
 
     /**

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ModelElement.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ModelElement.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ModelElement.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -2,14 +2,11 @@
 
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
-import java.io.Serializable;
 
 /**
  * Abstract prototype of a model element.
  */
-public abstract class ModelElement
-    implements
-    Serializable {
+public abstract class ModelElement {
 
     /** Delegate used to implemenent property-change-support. */
     private transient PropertyChangeSupport pcsDelegate = new PropertyChangeSupport( this );
@@ -44,13 +41,6 @@
         }
     }
 
-    /**
-     * Children should override this. The default implementation returns false.
-     */
-    public boolean isPropertySet(Object id) {
-        return false;
-    }
-
     /** 
      * Remove a PropertyChangeListener from this component.
      * 

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ReteGraph.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ReteGraph.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/ReteGraph.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -4,7 +4,6 @@
 import java.util.List;
 
 import org.drools.reteoo.BaseVertex;
-import org.eclipse.jface.util.PropertyChangeEvent;
 
 /**
  * Rete graph containing a set of vertices that form the graph itself.
@@ -68,13 +67,4 @@
         }
     }
 
-    /**
-     * Not implemented. Not required if graph editing functionality is not required.
-     * 
-     * @param event property change event
-     */
-    public void propertyChange(PropertyChangeEvent event) {
-        // Not relevant
-    }
-
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/VertexPropertySource.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/VertexPropertySource.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/model/VertexPropertySource.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -5,7 +5,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.drools.ide.DroolsIDEPlugin;
 import org.drools.reteoo.AlphaNodeVertex;
 import org.drools.reteoo.BaseVertex;
 import org.drools.reteoo.EvalConditionNodeVertex;
@@ -30,39 +29,61 @@
     implements
     IPropertySource {
 
-    public String                     ID_ROOT               = "vertex";                               //$NON-NLS-1$
+    private static final String       VERTEX_TERMINAL            = "Terminal BaseVertex";
 
-    public String                     ID_ID                 = "id";                                   //$NON-NLS-1$
-    public String                     ID_HTML               = "html";                                 //$NON-NLS-1$
+    private static final String       VERTEX_EVAL_CONDITION      = "Eval Condition BaseVertex";
 
+    private static final String       VERTEX_NOT                 = "Not BaseVertex";
+
+    private static final String       VERTEX_JOIN                = "Join BaseVertex";
+
+    private static final String       VERTEX_RIGHT_INPUT_ADAPTER = "Right Input Adapter BaseVertex";
+
+    private static final String       VERTEX_LEFT_INPUT_ADAPTER  = "Left Input Adapter BaseVertex";
+
+    private static final String       VERTEX_ALPHA               = "Alpha BaseVertex";
+
+    private static final String       VERTEX_OBJECT_TYPE         = "Object Type BaseVertex";
+
+    private static final String       VERTEX_RETE                = "Rete BaseVertex";
+
+    private static final String       CONSTRAINT_CAP             = "Constraint";
+
+    private static final String       CONSTRAINT                 = "constraint";
+
+    public String                     ID_ROOT                    = "vertex";                               //$NON-NLS-1$
+
+    public String                     ID_ID                      = "id";                                   //$NON-NLS-1$
+    public String                     ID_HTML                    = "html";                                 //$NON-NLS-1$
+
     private IPropertyDescriptor[]     descriptors;
 
-    private final IPropertyDescriptor PROP_NAME             = new PropertyDescriptor( "name",
-                                                                                      "Name" );
-    private final IPropertyDescriptor PROP_ID               = new PropertyDescriptor( "id",
-                                                                                      "ID" );
-    private final IPropertyDescriptor PROP_RULE             = new PropertyDescriptor( "rule",
-                                                                                      "Rule" );
+    private final IPropertyDescriptor PROP_NAME                  = new PropertyDescriptor( "name",
+                                                                                           "Name" );
+    private final IPropertyDescriptor PROP_ID                    = new PropertyDescriptor( "id",
+                                                                                           "ID" );
+    private final IPropertyDescriptor PROP_RULE                  = new PropertyDescriptor( "rule",
+                                                                                           "Rule" );
 
     // Alpha-specific
-    private final IPropertyDescriptor PROP_ALPHA_FIELD_NAME = new PropertyDescriptor( "fieldName",
-                                                                                      "Field Name" );
-    private final IPropertyDescriptor PROP_ALPHA_EVALUATOR  = new PropertyDescriptor( "evaluator",
-                                                                                      "Evaluator" );
-    private final IPropertyDescriptor PROP_ALPHA_VALUE      = new PropertyDescriptor( "value",
-                                                                                      "Value" );
+    private final IPropertyDescriptor PROP_ALPHA_FIELD_NAME      = new PropertyDescriptor( "fieldName",
+                                                                                           "Field Name" );
+    private final IPropertyDescriptor PROP_ALPHA_EVALUATOR       = new PropertyDescriptor( "evaluator",
+                                                                                           "Evaluator" );
+    private final IPropertyDescriptor PROP_ALPHA_VALUE           = new PropertyDescriptor( "value",
+                                                                                           "Value" );
 
     // ObjectType specific
-    private final IPropertyDescriptor PROP_OBJ_TYPE         = new PropertyDescriptor( "objectType",
-                                                                                      "Object Type" );
+    private final IPropertyDescriptor PROP_OBJ_TYPE              = new PropertyDescriptor( "objectType",
+                                                                                           "Object Type" );
 
-    private final static String       CAT_GENERAL           = "General";
-    private final static String       CAT_OTHER             = "Other";
+    private final static String       CAT_GENERAL                = "General";
+    private final static String       CAT_OTHER                  = "Other";
 
-    protected BaseVertex              vertex                = null;
+    protected BaseVertex              vertex                     = null;
 
     // Map<String,NodeValue>
-    private Map                       values                = new HashMap();
+    private Map                       values                     = new HashMap();
 
     /**
      * Constructor initializing properties from <code>vertex</code>
@@ -96,8 +117,7 @@
                                     descriptorList,
                                     values );
         } else if ( vertex instanceof RightInputAdapterNodeVertex ) {
-            initRightInputAdapterNodeProperties( (RightInputAdapterNodeVertex) vertex,
-                                                 descriptorList,
+            initRightInputAdapterNodeProperties( descriptorList,
                                                  values );
         } else if ( vertex instanceof LeftInputAdapterNodeVertex ) {
             initLeftInputAdapterNodeProperties( (LeftInputAdapterNodeVertex) vertex,
@@ -124,7 +144,7 @@
                                         List descriptorList,
                                         Map valueMap) {
         addProperty( PROP_NAME,
-                     "Rete BaseVertex",
+                     VERTEX_RETE,
                      descriptorList,
                      valueMap );
         addProperty( PROP_ID,
@@ -137,7 +157,7 @@
                                               List descriptorList,
                                               Map valueMap) {
         addProperty( PROP_NAME,
-                     "Object Type BaseVertex",
+                     VERTEX_OBJECT_TYPE,
                      descriptorList,
                      valueMap );
         addProperty( PROP_OBJ_TYPE,
@@ -151,7 +171,7 @@
                                          List descriptorList,
                                          Map valueMap) {
         addProperty( PROP_NAME,
-                     "Alpha BaseVertex",
+                     VERTEX_ALPHA,
                      descriptorList,
                      valueMap );
         addProperty( PROP_ALPHA_FIELD_NAME,
@@ -171,8 +191,8 @@
         if ( constraint == null ) {
             return;
         }
-        IPropertyDescriptor prop = new PropertyDescriptor( "constraint",
-                                                           "Constraint" );
+        IPropertyDescriptor prop = new PropertyDescriptor( CONSTRAINT,
+                                                           CONSTRAINT_CAP );
         addProperty( prop,
                      constraint.toString(),
                      descriptorList,
@@ -184,7 +204,7 @@
                                                     List descriptorList,
                                                     Map valueMap) {
         addProperty( PROP_NAME,
-                     "Left Input Adapter BaseVertex",
+                     VERTEX_LEFT_INPUT_ADAPTER,
                      descriptorList,
                      valueMap );
 
@@ -193,8 +213,8 @@
             return;
         }
         for ( int i = 0, length = constraints.length; i < length; i++ ) {
-            PropertyDescriptor prop = new PropertyDescriptor( "constraint" + (i + 1),
-                                                              "Constraint " + (i + 1) );
+            PropertyDescriptor prop = new PropertyDescriptor( CONSTRAINT + (i + 1),
+                                                              CONSTRAINT_CAP + " " + (i + 1) );
             addOther( prop,
                       constraints[i].toString(),
                       descriptorList,
@@ -203,11 +223,10 @@
 
     }
 
-    private void initRightInputAdapterNodeProperties(RightInputAdapterNodeVertex vertex,
-                                                     List descriptorList,
+    private void initRightInputAdapterNodeProperties(List descriptorList,
                                                      Map valueMap) {
         addProperty( PROP_NAME,
-                     "Right Input Adapter BaseVertex",
+                     VERTEX_RIGHT_INPUT_ADAPTER,
                      descriptorList,
                      valueMap );
     }
@@ -217,7 +236,7 @@
                                         Map valueMap) {
 
         addProperty( PROP_NAME,
-                     "Join BaseVertex",
+                     VERTEX_JOIN,
                      descriptorList,
                      valueMap );
         addProperty( PROP_ID,
@@ -232,8 +251,8 @@
         }
 
         for ( int i = 0, length = constraints.length; i < length; i++ ) {
-            PropertyDescriptor prop = new PropertyDescriptor( "constraint" + (i + 1),
-                                                              "Constraint " + (i + 1) );
+            PropertyDescriptor prop = new PropertyDescriptor( CONSTRAINT + (i + 1),
+                                                              CONSTRAINT_CAP + " " + (i + 1) );
             addOther( prop,
                       constraints[i].toString(),
                       descriptorList,
@@ -246,7 +265,7 @@
                                        List descriptorList,
                                        Map valueMap) {
         addProperty( PROP_NAME,
-                     "Not BaseVertex",
+                     VERTEX_NOT,
                      descriptorList,
                      valueMap );
         addProperty( PROP_ID,
@@ -259,7 +278,7 @@
                                                  List descriptorList,
                                                  Map valueMap) {
         addProperty( PROP_NAME,
-                     "Eval Condition BaseVertex",
+                     VERTEX_EVAL_CONDITION,
                      descriptorList,
                      valueMap );
         addProperty( PROP_ID,
@@ -273,7 +292,7 @@
                                             Map valueMap) {
 
         addProperty( PROP_NAME,
-                     "Terminal BaseVertex",
+                     VERTEX_TERMINAL,
                      descriptorList,
                      valueMap );
         addProperty( PROP_ID,
@@ -347,21 +366,10 @@
      */
     public void setPropertyValue(Object propName,
                                  Object value) {
-        setPropertyValue( (String) propName,
+        setPropertyValue( propName,
                           value );
     }
 
-    /**
-     * Doing nothing as changing properties from property sheet is not possible.
-     * 
-     * @param propName
-     * @param value
-     */
-    public void setPropertyValue(String propName,
-                                 Object value) {
-        // Can't be changed
-    }
-
     /* (non-Javadoc)
      * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
      */

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/part/VertexEditPartFactory.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/part/VertexEditPartFactory.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/ide/editors/rete/part/VertexEditPartFactory.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -1,5 +1,6 @@
 package org.drools.ide.editors.rete.part;
 
+import org.drools.ide.DroolsIDEPlugin;
 import org.drools.ide.editors.rete.model.Connection;
 import org.drools.ide.editors.rete.model.ReteGraph;
 import org.drools.reteoo.BaseVertex;
@@ -41,8 +42,9 @@
         if ( modelElement instanceof Connection ) {
             return new ConnectionEditPart();
         }
-        //TODO Add logging and consider "return null"
-        throw new RuntimeException( "Can't create part for model element: " + ((modelElement != null) ? modelElement.getClass().getName() : "null") );
+        DroolsIDEPlugin.log( new Exception( "Can't create part for model element: " + ((modelElement != null) ? modelElement.getClass().getName() : "null") ) );
+        return null;
+        
     }
 
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/AlphaNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/AlphaNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/AlphaNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -17,6 +17,8 @@
 
     private final AlphaNode node;
 
+    private final String    NODE_NAME = "AlphaNode";
+
     /**
      * Constructor
      * 
@@ -33,7 +35,7 @@
     public String getHtml() {
         final LiteralConstraint constraint = (LiteralConstraint) this.node.getConstraint();
         final ClassFieldExtractor extractor = (ClassFieldExtractor) constraint.getFieldExtractor();
-        return "AlphaNode<br>field : " + extractor.getFieldName() + "<br>evaluator : " + constraint.getEvaluator() + "<br>value :  " + constraint.getField();
+        return NODE_NAME + "<BR/>field : " + extractor.getFieldName() + "<BR/>evaluator : " + constraint.getEvaluator() + "<BR/>value :  " + constraint.getField();
     }
 
     /* (non-Javadoc)

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/BaseVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/BaseVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/BaseVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -17,8 +17,6 @@
 
 import org.drools.ide.editors.rete.model.GraphicalVertex;
 
-
-
 /**
  * Intermediate class to have a workaround for *Node default visibility  
  * and ReteooVisitor.
@@ -31,5 +29,5 @@
  */
 abstract public class BaseVertex extends GraphicalVertex {
 
-   
+
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -11,6 +11,8 @@
  *
  */
 public class EvalConditionNodeVertex extends BaseVertex {
+    
+    private static final String     NODE_NAME = "EvalConditionNode";
     private final EvalConditionNode node;
 
     /**
@@ -27,14 +29,14 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "EvalConditionNode : " + this.node.getId();
+        return NODE_NAME + " : " + this.node.getId();
     }
 
     /* (non-Javadoc)
      * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
      */
     public String toString() {
-        return "EvalConditionNode";
+        return NODE_NAME;
     }
 
     /**

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/JoinNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/JoinNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/JoinNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -12,8 +12,11 @@
  *
  */
 public class JoinNodeVertex extends BaseVertex {
-    private final JoinNode node;
 
+    private static final String NODE_NAME = "JoinNode";
+
+    private final JoinNode      node;
+
     /**
      * Constructor
      * 
@@ -28,14 +31,14 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "JoinNode<br> " + dumpConstraints( this.node.getConstraints() );
+        return NODE_NAME + "<BR/>" + dumpConstraints( this.node.getConstraints() );
     }
 
     /* (non-Javadoc)
      * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
      */
     public String toString() {
-        return "JoinNode";
+        return NODE_NAME;
     }
 
     /* (non-Javadoc)

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -12,6 +12,9 @@
  *
  */
 public class LeftInputAdapterNodeVertex extends BaseVertex {
+
+    private static final String        NODE_NAME = "LeftInputAdapterNode";
+
     private final LeftInputAdapterNode node;
 
     /**
@@ -28,7 +31,7 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "LeftInputAdapterNode<br>" + dumpConstraints( this.node.getConstraints() );
+        return NODE_NAME + "<BR/>" + dumpConstraints( this.node.getConstraints() );
     }
 
     /* (non-Javadoc)

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/NotNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/NotNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/NotNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -11,6 +11,9 @@
  *
  */
 public class NotNodeVertex extends BaseVertex {
+    
+    private static final String NODE_NAME = "NotNode";
+    
     private final NotNode node;
 
     /**
@@ -27,14 +30,14 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "NotNode : " + this.node.getId();
+        return NODE_NAME+" : " + this.node.getId();
     }
 
     /* (non-Javadoc)
      * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
      */
     public String toString() {
-        return "NotNode";
+        return NODE_NAME;
     }
 
     /* (non-Javadoc)

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -12,6 +12,9 @@
  *
  */
 public class ObjectTypeNodeVertex extends BaseVertex {
+
+    private static final String  NODE_NAME = "ObjectTypeNode";
+
     private final ObjectTypeNode node;
 
     /**
@@ -28,14 +31,14 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "ObjectTypeNode : " + this.node.getObjectType();
+        return NODE_NAME + " : " + this.node.getObjectType();
     }
 
     /* (non-Javadoc)
      * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
      */
     public String toString() {
-        return "ObjectTypeNode";
+        return NODE_NAME;
     }
 
     /* (non-Javadoc)

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -11,6 +11,9 @@
  *
  */
 public class ReteVertex extends BaseVertex {
+    
+    private static final String NODE_NAME = "Rete";
+    
     private final Rete node;
 
     /**
@@ -27,14 +30,14 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "Rete : " + this.node.getId();
+        return NODE_NAME+" : " + this.node.getId();
     }
 
     /* (non-Javadoc)
      * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
      */
     public String toString() {
-        return "Rete";
+        return NODE_NAME;
     }
 
     /**

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteooVisitor.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteooVisitor.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/ReteooVisitor.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -19,6 +19,8 @@
  */
 public class ReteooVisitor extends ReflectiveVisitor {
 
+    private static final String PACKAGE_NAME = "org.drools.reteoo.";
+
     /**
      * Keeps track of visited JoinNode DOT IDs. This mapping allows the visitor
      * to recognize JoinNodes it has already visited and as a consequence link
@@ -27,11 +29,11 @@
      */
     private final Map           visitedNodes = new HashMap();
 
-    private ReteGraph               graph;
+    private ReteGraph           graph;
 
-    private BaseVertex              rootVertex;
+    private BaseVertex          rootVertex;
 
-    private BaseVertex              parentVertex;
+    private BaseVertex          parentVertex;
 
     /**
      * Constructor.
@@ -80,7 +82,7 @@
             try {
                 String name = node.getClass().getName();
                 name = name.substring( name.lastIndexOf( '.' ) + 1 ) + "Vertex";
-                final Class clazz = Class.forName( "org.drools.reteoo." + name );
+                final Class clazz = Class.forName( PACKAGE_NAME + name );
                 vertex = (BaseVertex) clazz.getConstructor( new Class[]{node.getClass()} ).newInstance( new Object[]{node} );
             } catch ( final Exception e ) {
                 throw new RuntimeException( "problem visiting vertex " + node.getClass().getName(),
@@ -89,9 +91,10 @@
             this.graph.addChild( vertex );
             this.visitedNodes.put( dotId( node ),
                                    vertex );
-            
-            new Connection(this.parentVertex,vertex);
-            
+
+            new Connection( this.parentVertex,
+                            vertex );
+
             final BaseVertex oldParentVertex = this.parentVertex;
             this.parentVertex = vertex;
 
@@ -110,7 +113,8 @@
             }
             this.parentVertex = oldParentVertex;
         } else {
-            new Connection(this.parentVertex, vertex );
+            new Connection( this.parentVertex,
+                            vertex );
         }
     }
 

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/RightInputAdapterNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/RightInputAdapterNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/RightInputAdapterNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -11,9 +11,9 @@
  *
  */
 public class RightInputAdapterNodeVertex extends BaseVertex {
-    
-    private final RightInputAdapterNode node;
 
+    private static final String NODE_NAME = "RightInputAdapterNode";
+
     /**
      * Constructor
      * 
@@ -21,15 +21,14 @@
      */
     public RightInputAdapterNodeVertex(final RightInputAdapterNode node) {
         super();
-        this.node = node;
     }
 
     public String getHtml() {
-        return "RightInputAdapterNode";
+        return NODE_NAME;
     }
 
     public String toString() {
-        return "RightInputAdapterNode";
+        return NODE_NAME;
     }
 
     public Color getFillColor() {

Modified: labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/TerminalNodeVertex.java
===================================================================
--- labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/TerminalNodeVertex.java	2006-10-24 16:56:21 UTC (rev 7090)
+++ labs/jbossrules/branches/3.0.x/drools-ide/src/main/java/org/drools/reteoo/TerminalNodeVertex.java	2006-10-24 17:20:33 UTC (rev 7091)
@@ -11,6 +11,9 @@
  *
  */
 public class TerminalNodeVertex extends BaseVertex {
+    
+    private static final String NODE_NAME = "TerminalNode";
+    
     private final TerminalNode node;
 
     /**
@@ -27,14 +30,14 @@
      * @see org.drools.reteoo.BaseNodeVertex#getHtml()
      */
     public String getHtml() {
-        return "TerminalNode : " + this.node.getId() + " : " + this.node.getRule();
+        return NODE_NAME+" : " + this.node.getId() + " : " + this.node.getRule();
     }
 
     /* (non-Javadoc)
      * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
      */
     public String toString() {
-        return "TerminalNode";
+        return NODE_NAME;
     }
 
     /* (non-Javadoc)




More information about the jboss-svn-commits mailing list