codeblocks
Class BlockConnectorShape

java.lang.Object
  extended by codeblocks.BlockConnectorShape

public class BlockConnectorShape
extends java.lang.Object

BlockConnectionShape defines and draws the connectors between the blocks. This includes the different (command/data) (sockets/plugs). The standard sockets/plugs have varying styles. BlockConnectionShape doesn't care about the layout of the connectors on the blocks, that is the job of BlockShape. BlockConnectionShape is extendable to allow for 3rd party (command/data) (sockets/plugs) shapes.


Field Summary
static int CIRCLE_1
           
static int CIRCLE_2
           
static int CIRCLE_3
           
static int COMMAND
           
static float COMMAND_INPUT_BAR_HEIGHT
          height of command input bar
static float COMMAND_INPUT_BAR_WIDTH
          width of command input bar
static float CONTROL_PLUG_HEIGHT
          height of vertical control connection
static float CONTROL_PLUG_WIDTH
          width of vertical control connection
static float DATA_PLUG_HEIGHT
          height of horizontal-plug/socket
static boolean DEBUG_MODE
           
static float DEFAULT_COMMAND_INPUT_HEIGHT
          default height of command input
static float NORMAL_DATA_PLUG_WIDTH
          Width of most plug shapes
static int POLYMORPHIC_1
           
static int POLYMORPHIC_2
           
static int POLYMORPHIC_3
           
static float POLYMORPHIC_DATA_PLUG_WIDTH
          Width of polymorphic plug shape
static int PROC_PARAM
           
static int SQUARE_1
           
static int SQUARE_2
           
static int SQUARE_3
           
static int TRIANGLE_1
          Different styles of SocketShapes: 1 is the normal shape 2 is the double stacked shape 3 is the double inversion
static int TRIANGLE_2
           
static int TRIANGLE_3
           
 
Constructor Summary
BlockConnectorShape()
           
 
Method Summary
 java.awt.geom.Point2D addCommandSocket(java.awt.geom.GeneralPath blockPath, int commandSocketHeight)
           
static void addConnenctionShapeMapping(java.lang.String shapeName, int integer)
          Add a mapping of an application specific string of a connection shape to a shape identifying integer
 java.awt.geom.Point2D addControlConnectorShape(java.awt.geom.GeneralPath blockPath, boolean appendRight)
           
 java.awt.geom.Point2D addControlConnectorShape(java.awt.geom.GeneralPath blockPath, float distanceToCenter, boolean appendRight)
           
 java.awt.geom.Point2D addDataPlug(java.awt.geom.GeneralPath blockPath, java.lang.String connectionShape, boolean onRightSide)
          Appends a dataSocket to the blockPath given.
 java.awt.geom.Point2D addDataPlugUp(java.awt.geom.GeneralPath blockPath, java.lang.String connectionShape, boolean onRightSide)
           
 java.awt.geom.Point2D addDataSocket(java.awt.geom.GeneralPath blockPath, java.lang.String connectionShape, boolean onRightSide)
          Appends a dataPlug to the blockPath given.
 java.awt.geom.Point2D addDataSocketUp(java.awt.geom.GeneralPath blockPath, java.lang.String connectionShape, boolean onRightSide)
           
static java.lang.String getCommandShapeName()
           
static java.awt.Dimension getConnectorDimensions(BlockConnector blockConnector)
          Gets the dimension of a given BlockConnector.
static int getConnenctionShapeMapping(java.lang.String shapeName)
          Get a shape identifying integer mapped to an application specific string of a connection shape
static boolean isCommandConnector(BlockConnector connector)
           
static void loadBlockConnectorShapes(org.w3c.dom.Element root)
          Loads the all the initial BlockConnectorShapes of this language
static void resetConnectorShapeMappings()
          Resets all the connector shape names to connector shape mappings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_PLUG_HEIGHT

public static final float DATA_PLUG_HEIGHT
height of horizontal-plug/socket

See Also:
Constant Field Values

NORMAL_DATA_PLUG_WIDTH

public static final float NORMAL_DATA_PLUG_WIDTH
Width of most plug shapes

See Also:
Constant Field Values

POLYMORPHIC_DATA_PLUG_WIDTH

public static final float POLYMORPHIC_DATA_PLUG_WIDTH
Width of polymorphic plug shape

See Also:
Constant Field Values

CONTROL_PLUG_WIDTH

public static final float CONTROL_PLUG_WIDTH
width of vertical control connection

See Also:
Constant Field Values

CONTROL_PLUG_HEIGHT

public static final float CONTROL_PLUG_HEIGHT
height of vertical control connection

See Also:
Constant Field Values

COMMAND_INPUT_BAR_WIDTH

public static final float COMMAND_INPUT_BAR_WIDTH
width of command input bar

See Also:
Constant Field Values

COMMAND_INPUT_BAR_HEIGHT

public static final float COMMAND_INPUT_BAR_HEIGHT
height of command input bar

See Also:
Constant Field Values

DEFAULT_COMMAND_INPUT_HEIGHT

public static final float DEFAULT_COMMAND_INPUT_HEIGHT
default height of command input

See Also:
Constant Field Values

TRIANGLE_1

public static final int TRIANGLE_1
Different styles of SocketShapes: 1 is the normal shape 2 is the double stacked shape 3 is the double inversion

See Also:
Constant Field Values

TRIANGLE_2

public static final int TRIANGLE_2
See Also:
Constant Field Values

TRIANGLE_3

public static final int TRIANGLE_3
See Also:
Constant Field Values

CIRCLE_1

public static final int CIRCLE_1
See Also:
Constant Field Values

CIRCLE_2

public static final int CIRCLE_2
See Also:
Constant Field Values

CIRCLE_3

public static final int CIRCLE_3
See Also:
Constant Field Values

SQUARE_1

public static final int SQUARE_1
See Also:
Constant Field Values

SQUARE_2

public static final int SQUARE_2
See Also:
Constant Field Values

SQUARE_3

public static final int SQUARE_3
See Also:
Constant Field Values

POLYMORPHIC_1

public static final int POLYMORPHIC_1
See Also:
Constant Field Values

POLYMORPHIC_2

public static final int POLYMORPHIC_2
See Also:
Constant Field Values

POLYMORPHIC_3

public static final int POLYMORPHIC_3
See Also:
Constant Field Values

PROC_PARAM

public static final int PROC_PARAM
See Also:
Constant Field Values

COMMAND

public static final int COMMAND
See Also:
Constant Field Values

DEBUG_MODE

public static final boolean DEBUG_MODE
See Also:
Constant Field Values
Constructor Detail

BlockConnectorShape

public BlockConnectorShape()
Method Detail

addConnenctionShapeMapping

public static void addConnenctionShapeMapping(java.lang.String shapeName,
                                              int integer)
Add a mapping of an application specific string of a connection shape to a shape identifying integer


resetConnectorShapeMappings

public static void resetConnectorShapeMappings()
Resets all the connector shape names to connector shape mappings.


getConnenctionShapeMapping

public static int getConnenctionShapeMapping(java.lang.String shapeName)
Get a shape identifying integer mapped to an application specific string of a connection shape


getConnectorDimensions

public static java.awt.Dimension getConnectorDimensions(BlockConnector blockConnector)
Gets the dimension of a given BlockConnector. Mapping for the connector to a shape must already exist.


addControlConnectorShape

public java.awt.geom.Point2D addControlConnectorShape(java.awt.geom.GeneralPath blockPath,
                                                      boolean appendRight)

addControlConnectorShape

public java.awt.geom.Point2D addControlConnectorShape(java.awt.geom.GeneralPath blockPath,
                                                      float distanceToCenter,
                                                      boolean appendRight)

addCommandSocket

public java.awt.geom.Point2D addCommandSocket(java.awt.geom.GeneralPath blockPath,
                                              int commandSocketHeight)

addDataSocket

public java.awt.geom.Point2D addDataSocket(java.awt.geom.GeneralPath blockPath,
                                           java.lang.String connectionShape,
                                           boolean onRightSide)
Appends a dataPlug to the blockPath given. Starts drawing from the top.

Parameters:
blockPath - the current GeneralPath of the block being drawn
connectionShape - specifies the socket shape to be added
onRightSide - (note this method assumes startingFromTop)

addDataSocketUp

public java.awt.geom.Point2D addDataSocketUp(java.awt.geom.GeneralPath blockPath,
                                             java.lang.String connectionShape,
                                             boolean onRightSide)

addDataPlug

public java.awt.geom.Point2D addDataPlug(java.awt.geom.GeneralPath blockPath,
                                         java.lang.String connectionShape,
                                         boolean onRightSide)
Appends a dataSocket to the blockPath given. Starts drawing from the top.

Parameters:
blockPath - the current GeneralPath of the block being drawn
connectionShape - specifies the socket shape to be added
onRightSide - (note this method assumes startingFromTop)

addDataPlugUp

public java.awt.geom.Point2D addDataPlugUp(java.awt.geom.GeneralPath blockPath,
                                           java.lang.String connectionShape,
                                           boolean onRightSide)

loadBlockConnectorShapes

public static void loadBlockConnectorShapes(org.w3c.dom.Element root)
Loads the all the initial BlockConnectorShapes of this language

Parameters:
root - the Element carrying the specifications of the BlockConnectorShapes

isCommandConnector

public static boolean isCommandConnector(BlockConnector connector)

getCommandShapeName

public static java.lang.String getCommandShapeName()