vocleditor.figures
Class ClassifierFigure

java.lang.Object
  extended by org.eclipse.draw2d.Figure
      extended by org.eclipse.draw2d.Shape
          extended by org.eclipse.draw2d.RectangleFigure
              extended by vocleditor.figures.ClassifierFigure
All Implemented Interfaces:
org.eclipse.draw2d.IFigure

public class ClassifierFigure
extends org.eclipse.draw2d.RectangleFigure

Figure that represents a Classifier Role. It has a label for the Classifier's name and type and a compartment for the Classifier's attributes.


Nested Class Summary
static class ClassifierFigure.CompartmentFigure
          a figure used to hold a classifiers attribute figures
 
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator
 
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsets
 
Field Summary
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
ClassifierFigure(VOCLClassifierRoleEditPart theEdPart)
          Create a new ClassifierFigure.
 
Method Summary
 void add(org.eclipse.draw2d.IFigure figure, java.lang.Object constraint, int index)
          Adds AttributeFigures to the attribute compartment or behaves like its super method otherwise.
static int getClosestConnectionAnchorAt(org.eclipse.draw2d.geometry.Point p, java.util.List connectionAnchors)
          returns the index of the anchor point closest to a given point.
 org.eclipse.draw2d.geometry.Dimension getMinimumSize(int wHint, int hHint)
          returns the minimum size of this figure
 org.eclipse.draw2d.geometry.Dimension getPreferredSize(int wHint, int hHint)
          Returns the preferred size of this figure.
 VOCLConnectionAnchor getSourceConnectionAnchorAt(int index)
          returns the source VOCLConnectionAnchor at the given index.
 int getSourceConnectionAnchorAt(org.eclipse.draw2d.geometry.Point p)
          returns the index of the source connection closest to a given point.
 java.util.List getSourceConnectionAnchors()
          returns a list of source connections
 VOCLConnectionAnchor getTargetConnectionAnchorAt(int index)
          returns the target VOCLConnectionAnchor at the given index.
 int getTargetConnectionAnchorAt(org.eclipse.draw2d.geometry.Point p)
          returns the index of the target connection closest to a given point.
 java.util.List getTargetConnectionAnchors()
          returns a list of target connections
 void remove(org.eclipse.draw2d.IFigure figure)
          Removes AttributeFigures from the attribute compartment or behaves like its super method otherwise.
 void setConstraint(org.eclipse.draw2d.IFigure child, java.lang.Object constraint)
          Redirects call to the attribute compartment for AttributeFigures or behaves like its super method otherwise.
 void setName(java.lang.String name)
          set the classifier name to be displayed.
 void validate()
          Adjusts the size of this figure and refreshes anchor points.
 
Methods inherited from class org.eclipse.draw2d.Shape
getLineStyle, getLineWidth, isOpaque, paintFigure, setFill, setFillXOR, setLineStyle, setLineWidth, setOutline, setOutlineXOR, setXOR
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, addAncestorListener, addFigureListener, addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isEnabled, isFocusTraversable, isRequestFocusEnabled, isShowing, isVisible, paint, removeAll, removeAncestorListener, removeFigureListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassifierFigure

public ClassifierFigure(VOCLClassifierRoleEditPart theEdPart)
Create a new ClassifierFigure.

Parameters:
theEdPart - the editpart that creates this figure
Method Detail

add

public void add(org.eclipse.draw2d.IFigure figure,
                java.lang.Object constraint,
                int index)
Adds AttributeFigures to the attribute compartment or behaves like its super method otherwise.

Specified by:
add in interface org.eclipse.draw2d.IFigure
Overrides:
add in class org.eclipse.draw2d.Figure
See Also:
IFigure.add(org.eclipse.draw2d.IFigure, java.lang.Object, int)

remove

public void remove(org.eclipse.draw2d.IFigure figure)
Removes AttributeFigures from the attribute compartment or behaves like its super method otherwise.

Specified by:
remove in interface org.eclipse.draw2d.IFigure
Overrides:
remove in class org.eclipse.draw2d.Figure
See Also:
IFigure.remove(org.eclipse.draw2d.IFigure)

setConstraint

public void setConstraint(org.eclipse.draw2d.IFigure child,
                          java.lang.Object constraint)
Redirects call to the attribute compartment for AttributeFigures or behaves like its super method otherwise.

Specified by:
setConstraint in interface org.eclipse.draw2d.IFigure
Overrides:
setConstraint in class org.eclipse.draw2d.Figure
See Also:
IFigure.setConstraint(org.eclipse.draw2d.IFigure, java.lang.Object)

setName

public void setName(java.lang.String name)
set the classifier name to be displayed.

Parameters:
name - the classifier name to be displayed

validate

public void validate()
Adjusts the size of this figure and refreshes anchor points.

Specified by:
validate in interface org.eclipse.draw2d.IFigure
Overrides:
validate in class org.eclipse.draw2d.Figure
See Also:
IFigure.validate()

getSourceConnectionAnchors

public java.util.List getSourceConnectionAnchors()
returns a list of source connections

Returns:
a list of source connections

getTargetConnectionAnchors

public java.util.List getTargetConnectionAnchors()
returns a list of target connections

Returns:
a list of target connections

getSourceConnectionAnchorAt

public int getSourceConnectionAnchorAt(org.eclipse.draw2d.geometry.Point p)
returns the index of the source connection closest to a given point.

Parameters:
p - a point
Returns:
the index of the source connection closest to p

getTargetConnectionAnchorAt

public int getTargetConnectionAnchorAt(org.eclipse.draw2d.geometry.Point p)
returns the index of the target connection closest to a given point.

Parameters:
p - a point
Returns:
the index of the target connection closest to p

getSourceConnectionAnchorAt

public VOCLConnectionAnchor getSourceConnectionAnchorAt(int index)
returns the source VOCLConnectionAnchor at the given index.

Parameters:
index - index of the connection source anchor point
Returns:
the source VOCLConnectionAnchor at the given index.

getTargetConnectionAnchorAt

public VOCLConnectionAnchor getTargetConnectionAnchorAt(int index)
returns the target VOCLConnectionAnchor at the given index.

Parameters:
index - index of the connection target anchor point
Returns:
the target VOCLConnectionAnchor at the given index.

getClosestConnectionAnchorAt

public static int getClosestConnectionAnchorAt(org.eclipse.draw2d.geometry.Point p,
                                               java.util.List connectionAnchors)
returns the index of the anchor point closest to a given point.

Parameters:
p - the point
connectionAnchors - the connection anchors to choose one from
Returns:
the index of the anchor closest to p

getMinimumSize

public org.eclipse.draw2d.geometry.Dimension getMinimumSize(int wHint,
                                                            int hHint)
returns the minimum size of this figure

Specified by:
getMinimumSize in interface org.eclipse.draw2d.IFigure
Overrides:
getMinimumSize in class org.eclipse.draw2d.Figure
See Also:
IFigure.getMinimumSize(int, int)

getPreferredSize

public org.eclipse.draw2d.geometry.Dimension getPreferredSize(int wHint,
                                                              int hHint)
Returns the preferred size of this figure. The preferred size is based on the size of the label and the attribute compartment.

Specified by:
getPreferredSize in interface org.eclipse.draw2d.IFigure
Overrides:
getPreferredSize in class org.eclipse.draw2d.Figure
Returns:
a Dimension object holding the preferred size
See Also:
IFigure.getPreferredSize(int, int)