org.jgraph.pad
Class AbstractDefaultVertexnPortsCreator

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.jgraph.pad.actions.AbstractActionDefault
          extended byorg.jgraph.pad.AbstractDefaultVertexnPortsCreator
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable, TranslatorConstants, VertexnPortsCreatorInterface
Direct Known Subclasses:
ToolBoxDiamond, ToolBoxEllipse, ToolBoxIcon, ToolBoxRectangle, ToolBoxRoundRectangle, ToolBoxSwimlane, ToolBoxText

public abstract class AbstractDefaultVertexnPortsCreator
extends AbstractActionDefault
implements VertexnPortsCreatorInterface

This the upper class of various java beans containing their own data for the default cell creation of a given type once a button is pressed. This class contains generic methods to insert the cell and its ports in the graph model.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jgraph.pad.actions.AbstractActionDefault
graphpad
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface org.jgraph.pad.resources.TranslatorConstants
PREFIX_COMPONENT, PREFIX_MESSAGE_ERROR, PREFIX_MESSAGE_INFORMATION, PREFIX_MESSAGE_WARING, SUFFIX_ACCELERATOR, SUFFIX_ACTION, SUFFIX_ICON, SUFFIX_IMAGE, SUFFIX_LABEL, SUFFIX_MENU, SUFFIX_MNEMONIC, SUFFIX_TEXT, SUFFIX_TITLE, SUFFIX_TOOL_TIP_TEXT
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
AbstractDefaultVertexnPortsCreator()
           
AbstractDefaultVertexnPortsCreator(GPGraphpad graphpad)
           
 
Method Summary
 void actionForCell(DefaultGraphCell cell)
          This hook allow to take a special action just after creating the cell For instance editing the cell.
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addVertexnPorts(java.awt.geom.Rectangle2D bounds, GPGraphpad graphpad)
          This is a convenient hook to automatically add a cell, its ports and a custom user object.
 AttributeMap getAttributeMap(DefaultGraphCell cell, java.awt.geom.Rectangle2D bounds)
          You can override how the view attributes of the cell are created
 java.lang.String getCellLabel()
          Override if necessary
static java.lang.String getDEFAULT_PORT_NAME()
           
 java.lang.String getModelType()
          usefull to use as a key for a cell model factory
 java.lang.String getPortName(int i)
          Unless the cell is created with differenciated port names, ports are all called undifferenciated_port followed by the i indice.
 java.lang.String[] getPortNames()
           
 java.awt.Component getToolComponent(java.lang.String actionCommand)
          Returns a clean JButton which has a link to this action.
 java.util.Map getUserObjectProperties(DefaultGraphCell cell)
          We assume the user would like to freely override how the cell custom user object properties are created
 double[] getXPortsList()
          By default a cell don't have ports
 double[] getYPortsList()
          By default a cell don't have ports
 boolean hasFlottingPort()
          By default there aren't any floatting port.
protected  java.awt.geom.Rectangle2D reSize(java.awt.geom.Rectangle2D bounds)
          By default we resize the cell in a square but this may be be subclassed in order to cancel such automatic resizing...
static void setDEFAULT_PORT_NAME(java.lang.String default_port_name)
           
 void setGraphpad(GPGraphpad graphpad)
          Sets the graphpad.
 void update()
          empty implementation for this typ of action
 
Methods inherited from class org.jgraph.pad.actions.AbstractActionDefault
getCurrentDocument, getCurrentGraph, getCurrentGraphLayoutCache, getGraphpad, getMenuComponent, getMenuComponents, getName, getPresentationText, getToolComponents, setFontNameForSelection, setFontSizeForSelection, setFontStyleForSelection, setSelectionAttributes
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jgraph.pad.VertexnPortsCreatorInterface
getButton, getCellType
 

Constructor Detail

AbstractDefaultVertexnPortsCreator

public AbstractDefaultVertexnPortsCreator(GPGraphpad graphpad)

AbstractDefaultVertexnPortsCreator

public AbstractDefaultVertexnPortsCreator()
Method Detail

getXPortsList

public double[] getXPortsList()
By default a cell don't have ports

Specified by:
getXPortsList in interface VertexnPortsCreatorInterface
Returns:
double[]

getYPortsList

public double[] getYPortsList()
By default a cell don't have ports

Specified by:
getYPortsList in interface VertexnPortsCreatorInterface
Returns:
double[]

getPortName

public java.lang.String getPortName(int i)
Unless the cell is created with differenciated port names, ports are all called undifferenciated_port followed by the i indice.

Parameters:
i - int
Returns:
String

getPortNames

public java.lang.String[] getPortNames()
Specified by:
getPortNames in interface VertexnPortsCreatorInterface

hasFlottingPort

public boolean hasFlottingPort()
By default there aren't any floatting port. If you want some, then you will get a better graphical result by implementing the getPerimeterPoint method in the renderer of the cell view.

Specified by:
hasFlottingPort in interface VertexnPortsCreatorInterface
Returns:
boolean

setGraphpad

public void setGraphpad(GPGraphpad graphpad)
Description copied from class: AbstractActionDefault
Sets the graphpad.

Specified by:
setGraphpad in interface VertexnPortsCreatorInterface
Overrides:
setGraphpad in class AbstractActionDefault
Parameters:
graphpad - The graphpad to set

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

update

public void update()
Description copied from class: AbstractActionDefault
empty implementation for this typ of action

Overrides:
update in class AbstractActionDefault

getToolComponent

public java.awt.Component getToolComponent(java.lang.String actionCommand)
Description copied from class: AbstractActionDefault
Returns a clean JButton which has a link to this action.

Overrides:
getToolComponent in class AbstractActionDefault

addVertexnPorts

public void addVertexnPorts(java.awt.geom.Rectangle2D bounds,
                            GPGraphpad graphpad)
This is a convenient hook to automatically add a cell, its ports and a custom user object. Especially override in priority some of the other methods of this class in order to meet your needs.

Specified by:
addVertexnPorts in interface VertexnPortsCreatorInterface
Parameters:
bounds -
graphpad -

reSize

protected java.awt.geom.Rectangle2D reSize(java.awt.geom.Rectangle2D bounds)
By default we resize the cell in a square but this may be be subclassed in order to cancel such automatic resizing...

Parameters:
bounds -
Returns:

getUserObjectProperties

public java.util.Map getUserObjectProperties(DefaultGraphCell cell)
We assume the user would like to freely override how the cell custom user object properties are created

Parameters:
cell -
Returns:

getCellLabel

public java.lang.String getCellLabel()
Override if necessary

Returns:

getAttributeMap

public AttributeMap getAttributeMap(DefaultGraphCell cell,
                                    java.awt.geom.Rectangle2D bounds)
You can override how the view attributes of the cell are created

Parameters:
cell -
bounds -
Returns:

getModelType

public java.lang.String getModelType()
usefull to use as a key for a cell model factory

Specified by:
getModelType in interface VertexnPortsCreatorInterface

actionForCell

public void actionForCell(DefaultGraphCell cell)
This hook allow to take a special action just after creating the cell For instance editing the cell.

Parameters:
cell -

getDEFAULT_PORT_NAME

public static java.lang.String getDEFAULT_PORT_NAME()

setDEFAULT_PORT_NAME

public static void setDEFAULT_PORT_NAME(java.lang.String default_port_name)