Runtime

org.eclipse.gmf.runtime.diagram.ui.figures
Class BorderedNodeFigure

java.lang.Object
  extended byorg.eclipse.draw2d.Figure
      extended byorg.eclipse.gmf.runtime.gef.ui.figures.NodeFigure
          extended byorg.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure
All Implemented Interfaces:
HandleBounds, IAnchorableFigure, org.eclipse.gmf.runtime.diagram.ui.internal.figures.IExpandableFigure, IFigure

public class BorderedNodeFigure
extends NodeFigure
implements org.eclipse.gmf.runtime.diagram.ui.internal.figures.IExpandableFigure

Wrapper figure that contains the main figure and the border item figures. This is required to allow the main figure's layout manager to ignore the border items. The border item container applies a delegating layout manager to allow border item children to lay themselves out.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.draw2d.Figure
Figure.FigureIterator, Figure.IdentitySearch
 
Nested classes inherited from class org.eclipse.draw2d.IFigure
IFigure.NoInsets
 
Field Summary
 
Fields inherited from class org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure
szAnchor
 
Fields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
 
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
 
Constructor Summary
BorderedNodeFigure(IFigure mainFigure)
          Creates a new BorderedNodeFigure figure.
 
Method Summary
 boolean containsPoint(int x, int y)
          We need to override this for smooth painting of border items.
 void erase()
           
 IFigure findFigureAt(int x, int y, TreeSearch search)
           
 IFigure findMouseEventTargetAt(int x, int y)
           
 IFigure getBorderItemContainer()
          Gets the border item container figure to which border item figures can be added with a IBorderItemLocator as the constraint and then later removed.
 Rectangle getClientArea(Rectangle rect)
           
 ConnectionAnchor getConnectionAnchor(java.lang.String terminal)
          Given a string identifier, return the associated anchor for that identifier
 java.lang.String getConnectionAnchorTerminal(ConnectionAnchor c)
          Dynamically allocates a new anchor if needed.
 Rectangle getExtendedBounds()
           
 Rectangle getHandleBounds()
          gets the handle bounds of the main figure
 IFigure getMainFigure()
          Gets the main figure of this bordered figure.
 Dimension getMinimumSize(int wHint, int hHint)
           
static IFigure getParentFigure(IFigure target)
          This method provides a generic way to get a target figure's parent's main figure where if the target figure is a border item figure, then its parent is considered the figure on which it borders.It is not possible to get a target figure's parent using IFigure#getParent() if the target figure is a border item figure, since this would return the border item container figure.
 Dimension getPreferredSize(int wHint, int hHint)
           
 ConnectionAnchor getSourceConnectionAnchorAt(Point p)
          Gets the source connection anchor at a given point on the figure.
 ConnectionAnchor getTargetConnectionAnchorAt(Point p)
          Gets the target connection anchor at a given point on the figure.
 IFigure getToolTip()
           
 boolean intersects(Rectangle rect)
           
protected  void layout()
          Give the main figure the entire bounds of the wrapper.
protected  void primTranslate(int dx, int dy)
           
 void repaint()
          Refresh adornments
 void setToolTip(IFigure f)
           
 
Methods inherited from class org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure
createAnchor, createConnectionAnchor, createDefaultAnchor, getConnectionAnchors, getDefaultAnchorID, getSlidableAnchorArea, isDefaultAnchorArea, paintFigure
 
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, containsPoint, findFigureAt, findFigureAt, findFigureAtExcluding, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getParent, getPreferredSize, getSize, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
 

Constructor Detail

BorderedNodeFigure

public BorderedNodeFigure(IFigure mainFigure)
Creates a new BorderedNodeFigure figure.

Parameters:
mainFigure - the figure to use with this figure
Method Detail

getBorderItemContainer

public IFigure getBorderItemContainer()
Gets the border item container figure to which border item figures can be added with a IBorderItemLocator as the constraint and then later removed.

Returns:
The border item container figure

getMainFigure

public IFigure getMainFigure()
Gets the main figure of this bordered figure.

Returns:
The "main" figure

getClientArea

public Rectangle getClientArea(Rectangle rect)
Specified by:
getClientArea in interface IFigure

getHandleBounds

public Rectangle getHandleBounds()
gets the handle bounds of the main figure

Specified by:
getHandleBounds in interface HandleBounds
Overrides:
getHandleBounds in class NodeFigure
Returns:
the hnalde bounds

layout

protected void layout()
Give the main figure the entire bounds of the wrapper.


containsPoint

public boolean containsPoint(int x,
                             int y)
We need to override this for smooth painting of border items.

Specified by:
containsPoint in interface IFigure

primTranslate

protected void primTranslate(int dx,
                             int dy)

erase

public void erase()
Specified by:
erase in interface IFigure

repaint

public void repaint()
Refresh adornments

Specified by:
repaint in interface IFigure

findFigureAt

public IFigure findFigureAt(int x,
                            int y,
                            TreeSearch search)
Specified by:
findFigureAt in interface IFigure

findMouseEventTargetAt

public IFigure findMouseEventTargetAt(int x,
                                      int y)
Specified by:
findMouseEventTargetAt in interface IFigure

intersects

public boolean intersects(Rectangle rect)
Specified by:
intersects in interface IFigure

getMinimumSize

public Dimension getMinimumSize(int wHint,
                                int hHint)
Specified by:
getMinimumSize in interface IFigure

getPreferredSize

public Dimension getPreferredSize(int wHint,
                                  int hHint)
Specified by:
getPreferredSize in interface IFigure

getToolTip

public IFigure getToolTip()
Specified by:
getToolTip in interface IFigure

setToolTip

public void setToolTip(IFigure f)
Specified by:
setToolTip in interface IFigure

getSourceConnectionAnchorAt

public ConnectionAnchor getSourceConnectionAnchorAt(Point p)
Description copied from interface: IAnchorableFigure
Gets the source connection anchor at a given point on the figure.

Specified by:
getSourceConnectionAnchorAt in interface IAnchorableFigure
Overrides:
getSourceConnectionAnchorAt in class NodeFigure

getTargetConnectionAnchorAt

public ConnectionAnchor getTargetConnectionAnchorAt(Point p)
Description copied from interface: IAnchorableFigure
Gets the target connection anchor at a given point on the figure.

Specified by:
getTargetConnectionAnchorAt in interface IAnchorableFigure
Overrides:
getTargetConnectionAnchorAt in class NodeFigure

getConnectionAnchor

public ConnectionAnchor getConnectionAnchor(java.lang.String terminal)
Description copied from interface: IAnchorableFigure
Given a string identifier, return the associated anchor for that identifier

Specified by:
getConnectionAnchor in interface IAnchorableFigure
Overrides:
getConnectionAnchor in class NodeFigure

getConnectionAnchorTerminal

public java.lang.String getConnectionAnchorTerminal(ConnectionAnchor c)
Description copied from interface: IAnchorableFigure
Dynamically allocates a new anchor if needed. Otherwise, recycles old anchors no longer in use.

Specified by:
getConnectionAnchorTerminal in interface IAnchorableFigure
Overrides:
getConnectionAnchorTerminal in class NodeFigure

getParentFigure

public static IFigure getParentFigure(IFigure target)
This method provides a generic way to get a target figure's parent's main figure where if the target figure is a border item figure, then its parent is considered the figure on which it borders.It is not possible to get a target figure's parent using IFigure#getParent() if the target figure is a border item figure, since this would return the border item container figure.

Parameters:
target - the target figure, may or may not be acting as a border item figure
Returns:
the parent figure or if the target figure was on a border item container figure, then the main figure that it borders.

getExtendedBounds

public Rectangle getExtendedBounds()
Specified by:
getExtendedBounds in interface org.eclipse.gmf.runtime.diagram.ui.internal.figures.IExpandableFigure

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.