You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/07/25 04:55:59 UTC

svn commit: r1365415 - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui: graph/ graph/amazon/ graph/system/ utils/

Author: samindaw
Date: Wed Jul 25 02:55:58 2012
New Revision: 1365415

URL: http://svn.apache.org/viewvc?rev=1365415&view=rev
Log:
xbata workflow editor UI changes

Added:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/DrawUtils.java
Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/GraphPieceGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/PortGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/InstanceNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/TerminateInstanceNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ConfigurableNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/DoWhileNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndBlockNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/GraphPieceGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/GraphPieceGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/GraphPieceGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/GraphPieceGUI.java Wed Jul 25 02:55:58 2012
@@ -32,4 +32,5 @@ public interface GraphPieceGUI {
      * @param engine
      */
     public void mouseClicked(MouseEvent event, XBayaEngine engine);
+
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/NodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,14 +21,21 @@
 
 package org.apache.airavata.xbaya.ui.graph;
 
+import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Dimension;
+import java.awt.Font;
 import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Shape;
 import java.awt.event.MouseEvent;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -38,6 +45,7 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public abstract class NodeGUI implements GraphPieceGUI {
 
@@ -66,7 +74,7 @@ public abstract class NodeGUI implements
 
     protected static final int PORT_INITIAL_GAP = 10;
 
-    protected static final Color EDGE_COLOR = Color.black;
+    protected static final Color EDGE_COLOR = Color.GRAY;
 
     protected static final Color DEFAULT_HEAD_COLOR = Color.white;
 
@@ -75,7 +83,7 @@ public abstract class NodeGUI implements
     /**
      * The default body color.
      */
-    public static final Color DEFAULT_BODY_COLOR = new Color(250, 220, 100);
+    public static final Color DEFAULT_BODY_COLOR = new Color(229, 229, 248);
 
     protected static final Color DRAGGED_BODY_COLOR = Color.lightGray;
 
@@ -96,7 +104,7 @@ public abstract class NodeGUI implements
     protected Color bodyColor;
 
     protected List<Paintable> paintables;
-
+    
     /**
      * @param node
      */
@@ -183,7 +191,7 @@ public abstract class NodeGUI implements
      * @return the position of the node
      */
     protected Point getPosition() {
-        return this.node.getPosition();
+        return getNode().getPosition();
     }
 
     /**
@@ -192,7 +200,7 @@ public abstract class NodeGUI implements
      * @return A rectangle indicating this component's bounds
      */
     protected Rectangle getBounds() {
-        return new Rectangle(this.node.getPosition(), this.dimension);
+        return new Rectangle(getNode().getPosition(), this.dimension);
     }
 
     /**
@@ -228,9 +236,9 @@ public abstract class NodeGUI implements
         FontMetrics fm = g.getFontMetrics();
         this.headHeight = fm.getHeight() + TEXT_GAP_Y * 2;
 
-        int maxNumPort = Math.max(this.node.getOutputPorts().size(), this.node.getInputPorts().size());
+        int maxNumPort = Math.max(getNode().getOutputPorts().size(), getNode().getInputPorts().size());
         this.dimension.height = Math.max(this.headHeight + PORT_INITIAL_GAP + PORT_GAP * maxNumPort, MINIMUM_HEIGHT);
-        this.dimension.width = Math.max(MINIMUM_WIDTH, fm.stringWidth(this.node.getID()) + TEXT_GAP_X * 2);
+        this.dimension.width = Math.max(MINIMUM_WIDTH, fm.stringWidth(getNode().getID()) + TEXT_GAP_X * 2);
 
         /* Calculates the position of ports */
         setPortPositions();
@@ -240,58 +248,173 @@ public abstract class NodeGUI implements
      * @param g
      */
     protected void paint(Graphics2D g) {
+        Shape componentShape = getComponentShape();
+        
+        // Draws the body.
+        drawBody(g, componentShape, getComponentBodyColor());
+        
+        // Draws the head.
+		drawHeader(g, getComponentHeaderShape(), getComponentHeaderText(), getComponentHeaderColor());
+        
+        // Draw a small circle to indicate the break
+        drawBreaks(g, getNode().getPosition());
 
-        Point position = this.node.getPosition();
+        // Edge
+		drawEdge(g, componentShape, getComponentEdgeColor());
 
-        // Draws the body.
+        // Paint all ports
+        drawPorts(g, getAllPorts());
+
+        // Paint extras
+        drawExtras(g);
+    }
+    
+    /** Following functions need to be overridden for if the component shape/text/color is different **/
+	
+	protected final Collection<? extends Port> getAllPorts() {
+		return getNode().getAllPorts();
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
+
+	protected final Color getComponentEdgeColor() {
+		return EDGE_COLOR;
+	}
+
+	protected Color getComponentHeaderColor() {
+		return this.headColor;
+	}
+
+	protected Shape getComponentHeaderShape() {
+		Point position = getNode().getPosition();
+		RoundRectangle2D headerBoundaryRect = new RoundRectangle2D.Double(position.x, position.y, this.dimension.width, this.headHeight,DrawUtils.ARC_SIZE, DrawUtils.ARC_SIZE);
+		return headerBoundaryRect;
+	}
+
+	protected final Color getComponentBodyColor() {
+		Color paintBodyColor;
         if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
+        	paintBodyColor=DRAGGED_BODY_COLOR;
         } else {
-            g.setColor(this.bodyColor);
+        	paintBodyColor=this.bodyColor;
         }
-        g.fillRect(position.x, position.y, this.dimension.width, this.dimension.height);
+		return paintBodyColor;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        g.fillRect(position.x, position.y, this.dimension.width, this.headHeight);
-        // Draw a small circle to indicate the break
-        if (node.isBreak()) {
+	protected Shape getComponentShape() {
+		Point position = getNode().getPosition();
+        RoundRectangle2D completeComponentBoundaryRect = new RoundRectangle2D.Float(position.x, position.y, this.dimension.width, this.dimension.height, DrawUtils.ARC_SIZE, DrawUtils.ARC_SIZE);
+		return completeComponentBoundaryRect;
+	}
+
+	protected String getComponentHeaderText() {
+		// XXX it's debatable if we should show the ID or the name.
+        // String headerText = this.node.getName();
+        String headerText = getNode().getID();
+		return headerText;
+	}
+
+	/**---------------------------------------------------------------------------------**/
+	
+	protected void drawBody(Graphics2D g,
+			Shape shape, Color paintBodyColor) {
+		DrawUtils.initializeGraphics2D(g);
+		AffineTransform affineTransform = new AffineTransform();
+		affineTransform.translate(5,5);
+		Shape shadow = affineTransform.createTransformedShape(shape);
+		g.setColor(Color.GRAY);
+		g.fill(shadow);
+		DrawUtils.gradientFillShape(g, getEndColor(paintBodyColor), paintBodyColor, shape);
+	}
+
+	protected void drawBreaks(Graphics2D g, Point position) {
+		if (getNode().isBreak()) {
+			DrawUtils.initializeGraphics2D(g);
             g.setColor(BREAK_POINT_COLOR);
             int r = this.headHeight / 4;
             g.fillOval(position.x + this.dimension.width - 3 * r, position.y + r, 2 * r, 2 * r);
             g.setColor(BREAK_POINT_BORDER_COLOR);
             g.drawOval(position.x + this.dimension.width - 3 * r, position.y + r, 2 * r, 2 * r);
         }
+	}
 
-        // Text
-        g.setColor(TEXT_COLOR);
-
-        // XXX it's debatable if we should show the ID or the name.
-        // String name = this.node.getName();
-        String name = this.node.getID();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawRect(position.x, position.y, this.dimension.width, this.dimension.height);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
+	protected void drawExtras(Graphics2D g) {
+		DrawUtils.initializeGraphics2D(g);
+		for (Paintable paintable : this.paintables) {
+            paintable.paint(g, getNode().getPosition());
+        }
+	}
+
+	protected void drawPorts(Graphics2D g, Collection<? extends Port> ports) {
+		DrawUtils.initializeGraphics2D(g);
+		for (Port port : ports) {
             NodeController.getGUI(port).paint(g);
         }
+	}
+	
+	protected void drawPorts(Graphics2D g, Node node) {
+		drawPorts(g, node.getAllPorts());
+	}
+
+	protected void drawEdge(Graphics2D g,
+			Shape completeComponentBoundaryShape, Color edgeColor) {
+		DrawUtils.initializeGraphics2D(g);
+		g.setColor(edgeColor);
+		//uncomment the commented lines to enable a double line edge
+//		g.setStroke(new BasicStroke(4.0f));
+        g.draw(completeComponentBoundaryShape);
+//        g.setColor(Color.white);
+//        g.setStroke(new BasicStroke(3.0f));
+//        g.draw(completeComponentBoundaryShape);
+	}
+	protected void drawHeader(Graphics2D g, Shape shape,
+			String headerText, Color headColor, boolean lowerBorderflat) {
+		drawHeader(g, shape, headerText, headColor, shape, lowerBorderflat);
+	}
+	
+	protected void drawHeader(Graphics2D g, Shape shape,
+			String headerText, Color headColor) {
+		drawHeader(g, shape, headerText, headColor, true);
+	}
+	
+	protected void drawHeader(Graphics2D g, Shape shape,
+			String headerText, Color headColor,
+			Shape headerDrawBoundaryShape) {
+		drawHeader(g, shape, headerText, headColor, headerDrawBoundaryShape, true);
+	}
+	
+	protected void drawHeader(Graphics2D g, Shape shape,
+			String headerText, Color headColor,
+			Shape headerDrawBoundaryShape, boolean lowerBorderflat) {
+		DrawUtils.initializeGraphics2D(g);
+        if (lowerBorderflat) {
+    		g.setColor(getEndColor(headColor));
+    		Rectangle rect=new Rectangle((int) shape.getBounds().getX()+1, (int) (shape.getBounds()
+					.getY() + shape.getBounds().getHeight() - DrawUtils.ARC_SIZE),
+					(int) shape.getBounds().getWidth(), DrawUtils.ARC_SIZE);
+			DrawUtils.gradientFillShape(g, getEndColor(headColor), headColor, rect);
+		}
+        DrawUtils.gradientFillShape(g, getEndColor(headColor), headColor, headerDrawBoundaryShape);
+        
+        // Text
+        g.setColor(TEXT_COLOR);
 
-        // Paint extras
-        for (Paintable paintable : this.paintables) {
-            paintable.paint(g, this.node.getPosition());
-        }
-    }
+        Font oldFont = g.getFont();
+		g.setFont(new Font(oldFont.getFontName(),Font.BOLD,oldFont.getSize()));
+        Rectangle2D bounds = g.getFontMetrics().getStringBounds(headerText, g);
+        g.drawString(headerText, (int)(shape.getBounds().getX() + (shape.getBounds().getWidth()-bounds.getWidth())/2), 
+		(int)(shape.getBounds().getY() + (shape.getBounds().getHeight()+bounds.getHeight())/2));
+        g.setFont(oldFont);
+	}
 
     /**
      * Sets up the position of ports
      */
     protected void setPortPositions() {
         // inputs
-        List<? extends Port> inputPorts = this.node.getInputPorts();
+        List<? extends Port> inputPorts = getNode().getInputPorts();
         for (int i = 0; i < inputPorts.size(); i++) {
             Port port = inputPorts.get(i);
             Point offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
@@ -299,7 +422,7 @@ public abstract class NodeGUI implements
         }
 
         // outputs
-        List<? extends Port> outputPorts = this.node.getOutputPorts();
+        List<? extends Port> outputPorts = getNode().getOutputPorts();
         for (int i = 0; i < outputPorts.size(); i++) {
             Port port = outputPorts.get(i);
             // Use getBounds() instead of this.dimension because subclass might
@@ -310,13 +433,13 @@ public abstract class NodeGUI implements
         }
 
         // control-in
-        Port controlInPort = this.node.getControlInPort();
+        Port controlInPort = getNode().getControlInPort();
         if (controlInPort != null) {
         	NodeController.getGUI(controlInPort).setOffset(new Point(0, 0));
         }
 
         // control-outs
-        for (Port controlOutPort : this.node.getControlOutPorts()) {
+        for (Port controlOutPort : getNode().getControlOutPorts()) {
             // By default, all ports will be drawn at the same place. Subclass
             // should rearrange them if there are more than one control-out
             // ports.
@@ -329,7 +452,7 @@ public abstract class NodeGUI implements
      * @param failed
      */
     public void setToken(String workflowName, NodeState state) {
-        List<DataPort> inputPorts = this.node.getInputPorts();
+        List<DataPort> inputPorts = getNode().getInputPorts();
         switch (state) {
         case EXECUTING:
 
@@ -343,7 +466,7 @@ public abstract class NodeGUI implements
             	NodeController.getGUI(dataPort).removeToken(workflowName);
             }
 
-            List<DataPort> outputPorts = this.node.getOutputPorts();
+            List<DataPort> outputPorts = getNode().getOutputPorts();
             for (DataPort dataPort : outputPorts) {
             	NodeController.getGUI(dataPort).addToken(workflowName);
             }
@@ -361,13 +484,18 @@ public abstract class NodeGUI implements
 	 */
     public void resetTokens() {
 
-        List<DataPort> inputPorts = this.node.getInputPorts();
+        List<DataPort> inputPorts = getNode().getInputPorts();
         for (DataPort dataPort : inputPorts) {
             NodeController.getGUI(dataPort).reset();
         }
-        List<DataPort> outputPorts = this.node.getOutputPorts();
+        List<DataPort> outputPorts = getNode().getOutputPorts();
         for (DataPort dataPort : outputPorts) {
             NodeController.getGUI(dataPort).reset();
         }
     }
+    
+    protected Color getEndColor(Color bodyColor){
+    	return Color.white;
+    }
+    
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/PortGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/PortGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/PortGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/PortGUI.java Wed Jul 25 02:55:58 2012
@@ -34,6 +34,7 @@ import java.util.List;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.Port.Kind;
 import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class PortGUI implements GraphPieceGUI {
 
@@ -162,8 +163,9 @@ public class PortGUI implements GraphPie
                     CONTROL_PORT_SIZE, CONTROL_PORT_SIZE);
             break;
         }
-        g.setColor(color);
-        g.fill(shape);
+//        g.setColor(color);
+//        g.fill(shape);
+        DrawUtils.gradientFillShape(g, color.brighter().brighter().brighter().brighter(), color.darker(), shape);
     }
 
     /**
@@ -176,6 +178,7 @@ public class PortGUI implements GraphPie
         triangle.addPoint(point.x - DATA_PORT_SIZE / 2, point.y - DATA_PORT_SIZE / 2);
         triangle.addPoint(point.x + DATA_PORT_SIZE / 2, point.y);
         triangle.addPoint(point.x - DATA_PORT_SIZE / 2, point.y + DATA_PORT_SIZE / 2);
+//        shape = DrawUtils.getRoundedShape(triangle);
         shape = triangle;
         return shape;
     }
@@ -192,7 +195,13 @@ public class PortGUI implements GraphPie
      */
     public Point getPosition() {
         Point nodePosition = this.port.getNode().getPosition();
-        return new Point(nodePosition.x + this.offset.x, nodePosition.y + this.offset.y);
+        int offsetX=this.offset.x;
+//        if ((PortGUI.DATA_PORT_SIZE / 2) + 1 < this.offset.x){
+//        	offsetX=this.offset.x+(PortGUI.DATA_PORT_SIZE / 2);
+//        }else{
+//        	offsetX=0;
+//        }
+        return new Point(nodePosition.x + offsetX, nodePosition.y + this.offset.y);
     }
 
     /**

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/InstanceNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/InstanceNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/InstanceNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/InstanceNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,13 +21,16 @@
 
 package org.apache.airavata.xbaya.ui.graph.amazon;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.RoundRectangle2D;
 import java.util.List;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
@@ -35,12 +38,15 @@ import org.apache.airavata.xbaya.ui.XBay
 import org.apache.airavata.xbaya.ui.dialogs.graph.amazon.InstanceConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
 import org.apache.airavata.xbaya.ui.graph.system.ConfigurableNodeGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class InstanceNodeGUI extends ConfigurableNodeGUI {
 
     private InstanceNode node;
 
     private Polygon polygon;
+    
+    private GeneralPath generalPath;
 
     private InstanceConfigurationDialog configDialog;
 
@@ -53,6 +59,7 @@ public class InstanceNodeGUI extends Con
         super(node);
         this.node = node;
         this.polygon = new Polygon();
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -81,7 +88,7 @@ public class InstanceNodeGUI extends Con
      */
     @Override
     protected Rectangle getBounds() {
-        return this.polygon.getBounds();
+        return this.getComponentShape().getBounds();
     }
 
     /**
@@ -92,40 +99,26 @@ public class InstanceNodeGUI extends Con
         return this.polygon.contains(point);
     }
 
-    /**
-     * @see org.apache.airavata.xbaya.ui.graph.system.ConfigurableNodeGUI#paint(java.awt.Graphics2D)
-     */
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
-
-        // Draws the head.
-        g.setColor(this.headColor);
-        g.fillRect(position.x, position.y, this.dimension.width, this.headHeight);
-
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+	protected Color getComponentHeaderColor() {
+		return this.headColor;
+	}
+
+	protected String getComponentHeaderText() {
+		return this.node.getName();
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected RoundRectangle2D getComponentHeaderShape() {
+		RoundRectangle2D componentHeaderBoundaryRect = new RoundRectangle2D.Double(getPosition().x, getPosition().y, this.dimension.width, this.headHeight, DrawUtils.ARC_SIZE,DrawUtils.ARC_SIZE);
+		return componentHeaderBoundaryRect;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
     /**
      * Sets up the position of ports
@@ -157,7 +150,7 @@ public class InstanceNodeGUI extends Con
         Point offset = new Point(getBounds().width / 2, getBounds().height);
         NodeController.getGUI(controlOutPort1).setOffset(offset);
     }
-
+    
     private void calculatePositions() {
         // Avoid instantiating a new polygon each time.
         this.polygon.reset();
@@ -168,5 +161,6 @@ public class InstanceNodeGUI extends Con
                 + this.headHeight);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/TerminateInstanceNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/TerminateInstanceNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/TerminateInstanceNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/amazon/TerminateInstanceNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -26,6 +26,7 @@ import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 import java.util.List;
 
 import org.apache.airavata.workflow.model.graph.Port;
@@ -33,6 +34,7 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.graph.NodeGUI;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class TerminateInstanceNodeGUI extends NodeGUI {
 
@@ -40,6 +42,8 @@ public class TerminateInstanceNodeGUI ex
 
     private Polygon polygon;
 
+    private GeneralPath generalPath;
+
     /**
      * Constructs a InstanceNodeGUI.
      * 
@@ -49,6 +53,7 @@ public class TerminateInstanceNodeGUI ex
         super(node);
         this.node = node;
         this.polygon = new Polygon();
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -90,31 +95,28 @@ public class TerminateInstanceNodeGUI ex
         } else {
             g.setColor(this.bodyColor);
         }
-        g.fillPolygon(this.polygon);
+        drawBody(g, generalPath, g.getColor());
 
         // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
-        head.addPoint(position.x, position.y);
-        head.addPoint(position.x, position.y + this.headHeight);
-        head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
-        head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
-        g.fill(head);
-
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
+        Polygon head = createHeader(position);
+        drawHeader(g, DrawUtils.getRoundedShape(head), node.getName(), headColor);
 
         // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
+        drawEdge(g, generalPath, EDGE_COLOR);
 
         // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
+        drawPorts(g, node);
     }
 
+	private Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
+        head.addPoint(position.x, position.y);
+        head.addPoint(position.x, position.y + this.headHeight);
+        head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
+        head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+		return head;
+	}
+
     /**
      * Sets up the position of ports
      */
@@ -153,5 +155,6 @@ public class TerminateInstanceNodeGUI ex
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height + this.headHeight
                 / 2);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+        DrawUtils.setupRoundedGeneralPath(polygon, generalPath);
     }
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ConfigurableNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ConfigurableNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ConfigurableNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ConfigurableNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -26,107 +26,115 @@ import java.awt.FontMetrics;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Point;
-import java.awt.Rectangle;
 import java.awt.event.MouseEvent;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
 
 import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public abstract class ConfigurableNodeGUI extends NodeGUI {
 
-    protected static final Color CONFIG_AREA_COLOR = new Color(220, 220, 220);
+	protected static final Color CONFIG_AREA_COLOR = new Color(220, 220, 220);
 
-    protected static final String DEFAULT_CONFIG_AREA_TEXT = "Config";
+	protected static final String DEFAULT_CONFIG_AREA_TEXT = "Config";
 
-    protected static final int CONFIG_AREA_GAP_X = 20;
+	protected static final int CONFIG_AREA_GAP_X = 20;
 
-    protected String configurationText;
+	protected String configurationText;
 
-    protected Rectangle configurationArea;
-
-    /**
-     * @param node
-     */
-    public ConfigurableNodeGUI(NodeImpl node) {
-        super(node);
-        this.configurationText = DEFAULT_CONFIG_AREA_TEXT;
-        this.configurationArea = new Rectangle();
-
-    }
-
-    /**
-     * Sets the text shown on the configuration area.
-     * 
-     * @param text
-     *            The text to set
-     */
-    public void setConfigurationText(String text) {
-        this.configurationText = text;
-    }
-
-    /**
-     * @see org.apache.airavata.xbaya.ui.graph.GraphPieceGUI#mouseClicked(java.awt.event.MouseEvent,
-     *      org.apache.airavata.xbaya.XBayaEngine)
-     */
-    @Override
-    public void mouseClicked(MouseEvent event, XBayaEngine engine) {
-        if (isInConfig(event.getPoint())) {
-            showConfigurationDialog(engine.getGUI());
-        }
-    }
-
-    /**
-     * @param engine
-     */
-    protected abstract void showConfigurationDialog(XBayaGUI xbayaGUI);
-
-    /**
-     * Checks if a user's click is to select the configuration
-     * 
-     * @param point
-     * @return true if the user's click is to select the node, false otherwise
-     */
-    @Override
-    protected boolean isInConfig(Point point) {
-        return this.configurationArea.contains(point);
-    }
-
-    @Override
-    protected void calculatePositions(Graphics g) {
-        super.calculatePositions(g);
-
-        Point position = this.node.getPosition();
-        FontMetrics fm = g.getFontMetrics();
-
-        this.configurationArea.height = fm.getHeight() + TEXT_GAP_Y * 2;
-        this.configurationArea.width = this.dimension.width - CONFIG_AREA_GAP_X * 2;
-        this.configurationArea.x = position.x + CONFIG_AREA_GAP_X;
-        this.configurationArea.y = position.y + this.headHeight
-                + (this.dimension.height - this.headHeight - this.configurationArea.height) / 2;
-
-    }
-
-    /**
-     * Paints the config area
-     * 
-     * @param g
-     */
-    @Override
-    protected void paint(Graphics2D g) {
-        super.paint(g);
-        paintConfiguration(g);
-    }
-
-    /**
-     * @param g
-     */
-    protected void paintConfiguration(Graphics2D g) {
-        g.setColor(CONFIG_AREA_COLOR);
-        g.fill(this.configurationArea);
-        g.setColor(TEXT_COLOR);
-        g.drawString(this.configurationText, this.configurationArea.x + TEXT_GAP_X, this.configurationArea.y
-                + this.configurationArea.height - TEXT_GAP_Y);
-    }
+	protected RoundRectangle2D configurationArea;
+
+	/**
+	 * @param node
+	 */
+	public ConfigurableNodeGUI(NodeImpl node) {
+		super(node);
+		this.configurationText = DEFAULT_CONFIG_AREA_TEXT;
+//		this.configurationArea = new RoundRectangle2D();
+
+	}
+
+	/**
+	 * Sets the text shown on the configuration area.
+	 * 
+	 * @param text
+	 *            The text to set
+	 */
+	public void setConfigurationText(String text) {
+		this.configurationText = text;
+	}
+
+	/**
+	 * @see org.apache.airavata.xbaya.ui.graph.GraphPieceGUI#mouseClicked(java.awt.event.MouseEvent,
+	 *      org.apache.airavata.xbaya.XBayaEngine)
+	 */
+	@Override
+	public void mouseClicked(MouseEvent event, XBayaEngine engine) {
+		if (isInConfig(event.getPoint())) {
+			showConfigurationDialog(engine.getGUI());
+		}
+	}
+
+	/**
+	 * @param engine
+	 */
+	protected abstract void showConfigurationDialog(XBayaGUI xbayaGUI);
+
+	/**
+	 * Checks if a user's click is to select the configuration
+	 * 
+	 * @param point
+	 * @return true if the user's click is to select the node, false otherwise
+	 */
+	@Override
+	protected boolean isInConfig(Point point) {
+		return this.configurationArea.contains(point);
+	}
+
+	@Override
+	protected void calculatePositions(Graphics g) {
+		super.calculatePositions(g);
+
+		Point position = this.node.getPosition();
+		FontMetrics fm = g.getFontMetrics();
+		
+		int h = fm.getHeight() + TEXT_GAP_Y * 2+1;
+		int w = this.dimension.width - CONFIG_AREA_GAP_X * 2;
+		int x = position.x + CONFIG_AREA_GAP_X;
+		int y = position.y
+				+ this.headHeight
+				+ (this.dimension.height - this.headHeight - h)
+				/ 2;
+		this.configurationArea=new RoundRectangle2D.Float(x,y,w,h,DrawUtils.ARC_SIZE, DrawUtils.ARC_SIZE);
+	}
+
+	/**
+	 * Paints the config area
+	 * 
+	 * @param g
+	 */
+	@Override
+	protected final void paint(Graphics2D g) {
+		super.paint(g);
+		drawComponentConfiguration(g);
+	}
+
+	/**
+	 * @param g
+	 */
+	protected void drawComponentConfiguration(Graphics2D g) {
+		String s = this.configurationText;
+		g.setColor(CONFIG_AREA_COLOR);
+		g.fill(this.configurationArea);
+		g.setColor(TEXT_COLOR);
+		Rectangle2D bounds = g.getFontMetrics().getStringBounds(s, g);
+		
+		g.drawString(s, 
+				(int)(this.configurationArea.getX() + (this.configurationArea.getWidth()-bounds.getWidth())/2), 
+				(int)(this.configurationArea.getY() + (this.configurationArea.getHeight()+bounds.getHeight()/2)/2));
+	}
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/DoWhileNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/DoWhileNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/DoWhileNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/DoWhileNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,22 +21,23 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 import java.util.List;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.impl.PortImpl;
 import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
-import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.DoWhileConfigrationDialog;
-import org.apache.airavata.xbaya.ui.dialogs.graph.system.ForEachConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class DoWhileNodeGUI extends ConfigurableNodeGUI {
 
@@ -47,6 +48,8 @@ public class DoWhileNodeGUI extends Conf
 	private DoWhileConfigrationDialog configurationWindow;
 
 	private Polygon polygon;
+	
+    private GeneralPath generalPath;
 
 	/**
 	 * Constructs a DoWhileNodeGUI.
@@ -58,6 +61,7 @@ public class DoWhileNodeGUI extends Conf
 		this.node = node;
 		setConfigurationText(CONFIG_AREA_STRING);
 		this.polygon = new Polygon();
+        generalPath = new GeneralPath();
 	}
 
 	/**
@@ -100,47 +104,34 @@ public class DoWhileNodeGUI extends Conf
 		return this.polygon.contains(point);
 	}
 
-	/**
-	 * @see edu.indiana.extreme.xbaya.graph.system.gui.ConfigurableNodeGUI#paint(java.awt.Graphics2D)
-	 */
-	@Override
-	protected void paint(Graphics2D g) {
-		Point position = getPosition();
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
 
-		// Draws the body.
-		if (this.dragged) {
-			g.setColor(DRAGGED_BODY_COLOR);
-		} else {
-			g.setColor(this.bodyColor);
-		}
-		g.fillPolygon(this.polygon);
+	protected String getComponentHeaderText() {
+		return node.getName();
+	}
+
+	protected Color getComponentHeaderColor() {
+		return headColor;
+	}
 
-		// Draws the head.
-		g.setColor(this.headColor);
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
+
+	private Polygon createHeader(Point position) {
 		Polygon head = new Polygon();
 		head.addPoint(position.x, position.y + this.headHeight / 2);
 		head.addPoint(position.x, position.y + this.headHeight);
 		head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
 		head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
 		head.addPoint(position.x + this.dimension.width / 2, position.y);
-		g.fill(head);
-
-		g.setColor(TEXT_COLOR);
-		g.setColor(TEXT_COLOR);
-		String name = this.node.getName();
-		g.drawString(name, position.x + this.dimension.width / 3 + TEXT_GAP_X, position.y + this.headHeight
-				- TEXT_GAP_Y);
-
-		// Edge
-		g.setColor(EDGE_COLOR);
-		g.drawPolygon(this.polygon);
-
-		// Paint all ports
-		for (Port port : this.node.getAllPorts()) {
-			NodeController.getGUI(port).paint(g);
-		}
-
-		paintConfiguration(g);
+		return head;
 	}
 
 	/**
@@ -182,7 +173,6 @@ public class DoWhileNodeGUI extends Conf
 		Port controlOutPort2 = controlOutPorts.get(1);
 		offset = new Point(this.getBounds().width, getBounds().height - this.headHeight / 2);
 		NodeController.getGUI(controlOutPort2).setOffset(offset);
-
 	}
 
 	private void calculatePositions() {
@@ -196,5 +186,6 @@ public class DoWhileNodeGUI extends Conf
 		this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
 		this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
 		this.polygon.addPoint(position.x + this.dimension.width / 2, position.y);
+		DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
 	}
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndBlockNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndBlockNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndBlockNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndBlockNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,19 +21,22 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 import java.util.List;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.system.EndBlockNode;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndBlockConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class EndBlockNodeGUI extends ConfigurableNodeGUI {
 
@@ -43,6 +46,8 @@ public class EndBlockNodeGUI extends Con
 
     private Polygon polygon;
 
+    private GeneralPath generalPath;
+
     /**
      * @param node
      */
@@ -50,6 +55,7 @@ public class EndBlockNodeGUI extends Con
         super(node);
         this.node = node;
         this.polygon = new Polygon();
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -88,43 +94,34 @@ public class EndBlockNodeGUI extends Con
         return this.polygon.contains(point);
     }
 
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
+
+	protected String getComponentHeaderText() {
+		return node.getName();
+	}
+
+	protected Color getComponentHeaderColor() {
+		return headColor;
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	protected Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
-        g.fill(head);
-
-        // Text
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     /**
      * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#setPortPositions()
@@ -174,5 +171,6 @@ public class EndBlockNodeGUI extends Con
         this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,20 +21,22 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 import java.util.List;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
-import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndDoWhileConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 
 public class EndDoWhileNodeGUI extends ConfigurableNodeGUI {
@@ -45,6 +47,8 @@ public class EndDoWhileNodeGUI extends C
 
     private Polygon polygon;
 
+    private GeneralPath generalPath;
+
     /**
      * @param node
      */
@@ -52,6 +56,7 @@ public class EndDoWhileNodeGUI extends C
         super(node);
         this.node = node;
         this.polygon = new Polygon();
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -91,46 +96,36 @@ public class EndDoWhileNodeGUI extends C
         return this.polygon.contains(point);
     }
 
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected String getComponentHeaderText() {
+		return node.getName();
+	}
+
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
+
+	protected Color getComponentHeaderColor() {
+		return headColor;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	private Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y
                 + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y
                 + this.headHeight / 2);
-        g.fill(head);
-
-        // Text
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y
-                + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-        	NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     /**
      * @see edu.indiana.extreme.xbaya.graph.gui.NodeGUI#setPortPositions()
@@ -177,6 +172,7 @@ public class EndDoWhileNodeGUI extends C
                 + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y
                 + this.headHeight / 2);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 
 }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,17 +21,20 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndForEachConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class EndForEachNodeGUI extends ConfigurableNodeGUI {
 
@@ -40,6 +43,7 @@ public class EndForEachNodeGUI extends C
     private Polygon polygon;
 
     private EndForEachConfigurationDialog configurationWindow;
+    private GeneralPath generalPath;
 
     /**
      * Shows a configuration window when a user click the configuration area.
@@ -61,6 +65,7 @@ public class EndForEachNodeGUI extends C
         super(node);
         this.node = node;
         this.polygon = new Polygon(); // To avoid null check.
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -86,43 +91,34 @@ public class EndForEachNodeGUI extends C
         return this.polygon.contains(point);
     }
 
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
+	protected Color getCompnentHeaderColor() {
+		return headColor;
+	}
+
+	protected String getComponentHeaderText() {
+		return node.getName();
+	}
+
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	private Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
-        g.fill(head);
-
-        // Text
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     private void calculatePositions() {
         this.polygon = new Polygon();
@@ -131,6 +127,7 @@ public class EndForEachNodeGUI extends C
         this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 
     /**

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,19 +21,22 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 import java.util.List;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.system.EndifNode;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndifConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class EndifNodeGUI extends ConfigurableNodeGUI {
 
@@ -42,6 +45,8 @@ public class EndifNodeGUI extends Config
     private EndifNode node;
 
     private Polygon polygon;
+    
+    private GeneralPath generalPath;
 
     /**
      * @param node
@@ -50,6 +55,7 @@ public class EndifNodeGUI extends Config
         super(node);
         this.node = node;
         this.polygon = new Polygon();
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -88,43 +94,34 @@ public class EndifNodeGUI extends Config
         return this.polygon.contains(point);
     }
 
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
+	protected Color getComponentHeaderColor() {
+		return headColor;
+	}
+
+	protected String getComponentHeaderText() {
+		return this.node.getName();
+	}
+
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	private Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
-        g.fill(head);
-
-        // Text
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     /**
      * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#setPortPositions()
@@ -174,5 +171,6 @@ public class EndifNodeGUI extends Config
         this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -26,6 +26,7 @@ import java.awt.Color;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.Point;
+import java.awt.geom.Ellipse2D;
 
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.system.ExitNode;
@@ -63,28 +64,30 @@ public class ExitNodeGUI extends NodeGUI
         } else {
             g.setColor(this.bodyColor);
         }
-
-        g.setPaint(gp);
-        g.fillOval(position.x + 2, position.y, this.dimension.height, this.dimension.height);
-        g.setColor(Color.black);
-        g.setStroke(new BasicStroke(1.2f));
-        g.drawOval(position.x + 2, position.y, this.dimension.height, this.dimension.height);
+        Ellipse2D.Double bodyShape = new Ellipse2D.Double(position.x + 2, position.y, this.dimension.height, this.dimension.height);
+        drawHeader(g, bodyShape, node.getName(), c_DARKER, false);
+//        g.setPaint(gp);
+//        g.fillOval(position.x + 2, position.y, this.dimension.height, this.dimension.height);
+//        g.setColor(Color.black);
+////        g.setStroke(new BasicStroke(1.2f));
+//        g.drawOval(position.x + 2, position.y, this.dimension.height, this.dimension.height);
         // Text
-        g.setColor(TEXT_COLOR);
+//        g.setColor(TEXT_COLOR);
 
         // XXX it's debatable if we should show the ID or the name.
-        String name = this.node.getName(); // + this.node.getID();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y + 2);
+//        String name = this.node.getName(); // + this.node.getID();
+//        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y + 2);
 
         // Edge
-        g.setColor(EDGE_COLOR);
-        // Comment of dont want circle in rectangle
-        g.drawRect(position.x, position.y, this.dimension.height + 2, this.dimension.height);
+        drawEdge(g, bodyShape.getBounds2D(),EDGE_COLOR.brighter());
+        drawEdge(g, bodyShape, EDGE_COLOR);
+        
+//        g.setColor(EDGE_COLOR);
+//        // Comment of dont want circle in rectangle
+//        g.drawRect(position.x, position.y, this.dimension.height + 2, this.dimension.height);
 
         // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
+        drawPorts(g, node);
 
         // Paint extras
         for (Paintable paintable : this.paintables) {

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,18 +21,20 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 
-import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.impl.PortImpl;
 import org.apache.airavata.workflow.model.graph.system.ForEachNode;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.ForEachConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class ForEachNodeGUI extends ConfigurableNodeGUI {
 
@@ -44,6 +46,8 @@ public class ForEachNodeGUI extends Conf
 
     private Polygon polygon;
 
+    private GeneralPath generalPath;
+
     /**
      * @param node
      */
@@ -52,6 +56,7 @@ public class ForEachNodeGUI extends Conf
         this.node = node;
         setConfigurationText(CONFIG_AREA_STRING);
         this.polygon = new Polygon(); // To avoid null check.
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -93,47 +98,34 @@ public class ForEachNodeGUI extends Conf
         return this.polygon.contains(point);
     }
 
-    /**
-     * @see org.apache.airavata.xbaya.ui.graph.system.ConfigurableNodeGUI#paint(java.awt.Graphics2D)
-     */
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
+	protected Color getComponentHeaderColor() {
+		return headColor;
+	}
+
+	protected String getComponentHeaderText() {
+		return node.getName();
+	}
+
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
-
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	private Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y + this.headHeight / 2);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y);
-        g.fill(head);
-
-        g.setColor(TEXT_COLOR);
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + this.dimension.width / 3 + TEXT_GAP_X, position.y + this.headHeight
-                - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     private void calculatePositions() {
         // XXX Avoid instantiating a new polygon each time.
@@ -144,6 +136,7 @@ public class ForEachNodeGUI extends Conf
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height + this.headHeight
                 - this.headHeight / 2);
         this.polygon.addPoint(position.x + this.dimension.width, position.y);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 
     /**

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,13 +21,15 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 import java.util.List;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.impl.PortImpl;
 import org.apache.airavata.workflow.model.graph.system.IfNode;
@@ -35,6 +37,7 @@ import org.apache.airavata.xbaya.graph.c
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.IfConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class IfNodeGUI extends ConfigurableNodeGUI {
 
@@ -45,6 +48,8 @@ public class IfNodeGUI extends Configura
     private IfConfigurationDialog configurationWindow;
 
     private Polygon polygon;
+    
+    private GeneralPath generalPath;
 
     /**
      * @param node
@@ -54,6 +59,7 @@ public class IfNodeGUI extends Configura
         this.node = node;
         setConfigurationText(CONFIG_AREA_STRING);
         this.polygon = new Polygon();
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -84,7 +90,7 @@ public class IfNodeGUI extends Configura
      */
     @Override
     protected Rectangle getBounds() {
-        return this.polygon.getBounds();
+        return this.getComponentShape().getBounds();
     }
 
     /**
@@ -95,48 +101,35 @@ public class IfNodeGUI extends Configura
         return this.polygon.contains(point);
     }
 
-    /**
-     * @see org.apache.airavata.xbaya.ui.graph.system.ConfigurableNodeGUI#paint(java.awt.Graphics2D)
-     */
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
+	protected Color getComponentHeaderColor() {
+		return this.headColor;
+	}
+
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeadNode(getPosition()));
+	}
+
+	protected String getComponentHeaderText() {
+		return this.node.getName();
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	private Polygon createHeadNode(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y + this.headHeight / 2);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
         head.addPoint(position.x + this.dimension.width / 2, position.y);
-        g.fill(head);
-
-        g.setColor(TEXT_COLOR);
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + this.dimension.width / 3 + TEXT_GAP_X, position.y + this.headHeight
-                - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     /**
      * Sets up the position of ports
@@ -180,6 +173,7 @@ public class IfNodeGUI extends Configura
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
         this.polygon.addPoint(position.x + this.dimension.width / 2, position.y);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -35,6 +35,7 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.MemoConfigurationDialog;
 import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class MemoNodeGUI extends NodeGUI {
 
@@ -87,7 +88,8 @@ public class MemoNodeGUI extends NodeGUI
         Point position = this.node.getPosition();
         this.textArea.setText(this.node.getMemo());
         Dimension preferredSize = this.textArea.getPreferredSize();
-        this.textArea.setBounds(position.x, position.y, preferredSize.width, preferredSize.height);
+        Rectangle bounds = new Rectangle(position.x, position.y, preferredSize.width, preferredSize.height);
+        this.textArea.setBounds(bounds);
         Graphics graphics = g.create(position.x, position.y, preferredSize.width, preferredSize.height);
         this.textArea.paint(graphics);
     }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java?rev=1365415&r1=1365414&r2=1365415&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java Wed Jul 25 02:55:58 2012
@@ -21,17 +21,20 @@
 
 package org.apache.airavata.xbaya.ui.graph.system;
 
+import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Graphics2D;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
 
+import org.apache.airavata.workflow.model.graph.Node;
 import org.apache.airavata.workflow.model.graph.Port;
 import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
 import org.apache.airavata.xbaya.graph.controller.NodeController;
 import org.apache.airavata.xbaya.ui.XBayaGUI;
 import org.apache.airavata.xbaya.ui.dialogs.graph.system.ReceiveConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
 
 public class ReceiveNodeGUI extends ConfigurableNodeGUI {
 
@@ -40,6 +43,8 @@ public class ReceiveNodeGUI extends Conf
     private Polygon polygon;
 
     private ReceiveConfigurationDialog configurationDialog;
+    
+    private GeneralPath generalPath;
 
     /**
      * @param node
@@ -48,6 +53,7 @@ public class ReceiveNodeGUI extends Conf
         super(node);
         this.node = node;
         this.polygon = new Polygon(); // To avoid null check.
+        generalPath = new GeneralPath();
     }
 
     /**
@@ -86,43 +92,34 @@ public class ReceiveNodeGUI extends Conf
         return this.polygon.contains(point);
     }
 
-    @Override
-    protected void paint(Graphics2D g) {
-        Point position = getPosition();
-
-        // Draws the body.
-        if (this.dragged) {
-            g.setColor(DRAGGED_BODY_COLOR);
-        } else {
-            g.setColor(this.bodyColor);
-        }
-        g.fillPolygon(this.polygon);
+	protected Color getComponentHeaderColor() {
+		return headColor;
+	}
+
+	protected String getComponentHeaderText() {
+		return node.getName();
+	}
+
+	protected GeneralPath getComponentHeaderShape() {
+		return DrawUtils.getRoundedShape(createHeader(getPosition()));
+	}
+
+	protected GeneralPath getComponentShape() {
+		return generalPath;
+	}
+
+	protected Node getNode() {
+		return this.node;
+	}
 
-        // Draws the head.
-        g.setColor(this.headColor);
-        Polygon head = new Polygon();
+	private Polygon createHeader(Point position) {
+		Polygon head = new Polygon();
         head.addPoint(position.x, position.y);
         head.addPoint(position.x, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
         head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
-        g.fill(head);
-
-        // Text
-        g.setColor(TEXT_COLOR);
-        String name = this.node.getName();
-        g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y);
-
-        // Edge
-        g.setColor(EDGE_COLOR);
-        g.drawPolygon(this.polygon);
-
-        // Paint all ports
-        for (Port port : this.node.getAllPorts()) {
-            NodeController.getGUI(port).paint(g);
-        }
-
-        paintConfiguration(g);
-    }
+		return head;
+	}
 
     private void calculatePositions() {
         this.polygon = new Polygon();
@@ -131,6 +128,7 @@ public class ReceiveNodeGUI extends Conf
         this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
         this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+        DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
     }
 
     /**

Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/DrawUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/DrawUtils.java?rev=1365415&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/DrawUtils.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/utils/DrawUtils.java Wed Jul 25 02:55:58 2012
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.airavata.xbaya.ui.utils;
+
+import java.awt.Color;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.RoundRectangle2D;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.python.modules.math;
+
+public class DrawUtils {
+	public static final int ARC_SIZE=10;
+	
+	public static void gradientFillShape(Graphics2D g,Color startColor, Color endColor, Shape shape) {
+		initializeGraphics2D(g);
+		GradientPaint gp = getGradientPaint(startColor, endColor, shape);
+        g.setPaint(gp);
+        g.fill(shape);
+	}
+
+
+	public static GradientPaint getGradientPaint(Color startColor,
+			Color endColor, Shape shape) {
+		GradientPaint gp = new GradientPaint((int)shape.getBounds().getX(), (int)shape.getBounds().getY(),
+				startColor, (int)(shape.getBounds().getX()+shape.getBounds().getWidth()), (int)(shape.getBounds().getY()+shape.getBounds().getHeight()),
+				endColor,false);
+		return gp;
+	}
+	
+
+	public static void initializeGraphics2D(Graphics2D g) {
+		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                RenderingHints.VALUE_ANTIALIAS_ON);
+	}
+	
+	public static Shape getRoundedShape(Rectangle shape) {
+		return new RoundRectangle2D.Double(shape.getX(),shape.getY(),shape.getWidth(),shape.getHeight(),DrawUtils.ARC_SIZE,DrawUtils.ARC_SIZE);
+    }
+	
+	public static GeneralPath getRoundedShape(Polygon polygon) {
+    	GeneralPath generalPath=new GeneralPath();
+    	DrawUtils.setupRoundedGeneralPath(polygon, generalPath);
+    	return generalPath;
+    }
+
+	public static void setupRoundedGeneralPath(Polygon polygon, GeneralPath generalPath) {
+		generalPath.reset();
+		List<int[]> l = new ArrayList<int[]>();
+		for(int i=0; i < polygon.npoints; i++){
+			l.add(new int[]{polygon.xpoints[i],polygon.ypoints[i]});
+		}
+		l.add(l.get(0));
+		l.add(l.get(1));
+		int[][] a=l.toArray(new int[][]{});
+		generalPath.moveTo(a[0][0],a[0][1]);
+		for(int pointIndex=1; pointIndex<a.length-1;pointIndex++){
+			int[] p1=a[pointIndex-1];
+			int[] p2=a[pointIndex];
+			int[] p3=a[pointIndex+1];
+			int[] mPoint = calculatePoint(p1, p2);
+			generalPath.lineTo(mPoint[0], mPoint[1]);
+			mPoint = calculatePoint(p3, p2);
+			generalPath.curveTo(p2[0], p2[1], p2[0], p2[1], mPoint[0], mPoint[1]);
+		}
+	}
+	
+
+    private static int[] calculatePoint(int[] p1, int[] p2) {
+		double d1=math.sqrt(math.pow(p1[0]-p2[0], 2)+math.pow(p1[1]-p2[1], 2));
+		double per=ARC_SIZE/d1;
+		
+		double d_x=(p1[0]-p2[0])*per;
+		double d_y=(p1[1]-p2[1])*per;
+		
+		int xx=(int)(p2[0]+d_x);
+		int yy=(int)(p2[1]+d_y);
+		
+		int[] mPoint={xx,yy};
+		return mPoint;
+	}
+}