Draw2D v2.0

org.eclipse.draw2d
Interface IFigure

All Known Subinterfaces:
Connection, FreeformFigure, Orientable, RotatableDecoration
All Known Implementing Classes:
Figure

public interface IFigure

An interface for graphical figures.


Inner Class Summary
static class IFigure.NoInsets
           
 
Field Summary
static Dimension MAX_DIMENSION
           
static Dimension MIN_DIMENSION
           
static Insets NO_INSETS
           
 
Method Summary
 void add(IFigure figure)
          Adds the given IFigure as a child of this IFigure.
 void add(IFigure figure, int index)
          Adds the given IFigure as a child of this IFigure at the given index.
 void add(IFigure figure, Object constraint)
          Adds the given IFigure as a child of this IFigure with the given constraint.
 void add(IFigure figure, Object constraint, int index)
          Adds the given IFigure as a child of this IFigure at the given index with the given constraint.
 void addAncestorListener(AncestorListener ancestorListener)
          Registers the given listener as an AncestorListener of this IFigure.
 void addFigureListener(FigureListener fListener)
          Registers the given listener as a FigureListener of this IFigure.
 void addFocusListener(FocusListener fl)
          Registers the given listener as a FocusListener of this IFigure.
 void addKeyListener(KeyListener keyListner)
          Registers the given listener as a KeyListner of this IFigure.
 void addMouseListener(MouseListener mListener)
          Registers the given listener as a MouseListener of this IFigure.
 void addMouseMotionListener(MouseMotionListener mListener)
          Registers the given listener as a MouseMotionListener of this IFigure.
 void addNotify()
          Called after this figure is added to its parent.
 void addPropertyChangeListener(PropertyChangeListener pListener)
          Registers the given listener as a PropertyChangeListener of this IFigure.
 void addPropertyChangeListener(String property, PropertyChangeListener listener)
          Registers the given listener as a PropertyChangeListener of this IFigure, interested only in the given property.
 boolean containsPoint(int x, int y)
          Returns true if the point (x, y) is contained within this IFigures bounds.
 boolean containsPoint(Point p)
          Returns true if the Point p is contained within this IFigures bounds.
 void erase()
          Erases this IFigure.
 IFigure findFigureAt(int x, int y)
          Returns the figure at the specified location.
 IFigure findFigureAt(Point pt)
          Returns the figure at the specified location.
 IFigure findFigureAtExcluding(int x, int y, Collection collection)
          Returns the figure at the specified location, excluding any figures in collection.
 IFigure findMouseEventTargetAt(int x, int y)
          Returns the figure located at the given location which will accept mouse events.
 Color getBackgroundColor()
          Returns the background color.
 Border getBorder()
          Returns the current border by reference.
 Rectangle getBounds()
          Returns the smallest rectangle completely enclosing the figure.
 List getChildren()
          Returns an unmodifiable collection of children by reference.
 Rectangle getClientArea()
          Returns the rectangular area within this Figure's bounds in which children will be placed (via LayoutManagers) and the painting of children will be clipped.
 Cursor getCursor()
          Returns the cursor used when the mouse is over this figure.
 Font getFont()
          Returns the current font by reference.
 Color getForegroundColor()
          Returns the foreground color.
 Insets getInsets()
          Returns the current Insets.
 LayoutManager getLayoutManager()
          Returns the current LayoutManager by reference.
 Dimension getMaximumSize()
          Returns a hint indicating the largest desireable size for the figure.
 Dimension getMinimumSize()
          Returns a hint indicating the smallest desireable size for the figure.
 IFigure getParent()
          Returns the current Parent.
 Dimension getPreferredSize()
          Returns the desireable size for this figure.
 Dimension getPreferredSize(int wHint, int hHint)
          Returns the desireable size for this figure using the provided width and height hints.
 Dimension getSize()
          Returns the current size.
 IFigure getToolTip()
          Returns an IFigure that is the tooltip for this Figure.
 UpdateManager getUpdateManager()
          Returns the UpdateManager for this figure by reference.
 void handleFocusGained(FocusEvent fe)
          Called when this figure has gained focus.
 void handleFocusLost(FocusEvent fe)
          Called when this figure has lost focus.
 void handleKeyPressed(KeyEvent ke)
           
 void handleKeyReleased(KeyEvent ke)
           
 void handleMouseDoubleClicked(MouseEvent me)
          Called when a mouse button has been double-clicked while within this figure's bounds.
 void handleMouseDragged(MouseEvent me)
          Called when the mouse has been dragged within this figure's bounds.
 void handleMouseEntered(MouseEvent me)
          Called when the mouse has entered this figure's bounds.
 void handleMouseExited(MouseEvent me)
          Called when the mouse has exited this figure's bounds.
 void handleMouseHover(MouseEvent me)
          Called when called when the mouse has hovered over this figure.
 void handleMouseMoved(MouseEvent me)
          Called when the mouse has moved within this figure's bounds.
 void handleMousePressed(MouseEvent me)
          Called when a mouse button has been pressed while within this figure's bounds.
 void handleMouseReleased(MouseEvent me)
          Called when a mouse button has been released while within this figure's bounds.
 boolean hasFocus()
          Returns true if this figure has focus.
 EventDispatcher internalGetEventDispatcher()
          This method is for internal purposes only and should not be called.
 boolean intersects(Rectangle r)
          Returns true if this figure needs to paint anywhere inside r.
 void invalidate()
          Invalidates this figure.
 boolean isEnabled()
          Returns true if this figure is enabled.
 boolean isFocusTraversable()
          Returns true if this figure can gain focus on a TraverseEvent.
 boolean isOpaque()
          Returns true if this figure is opaque.
 boolean isRequestFocusEnabled()
          Returns true if this figure can receive focus on a call to requestFocus().
 boolean isVisible()
          Returns true if this figure is visible.
 void paint(Graphics graphics)
          Paints this figure and its children.
 void remove(IFigure figure)
          Removes the given figure from this figure's list of children.
 void removeAncestorListener(AncestorListener ancestorListener)
          Unregisters the given listener, so that it will no longer receive notification of ancestor events.
 void removeFigureListener(FigureListener listener)
          Unregisters the given listener, so that it will no longer receive notification of figure events.
 void removeFocusListener(FocusListener listener)
          Unregisters the given listener, so that it will no longer receive notification of focus events.
 void removeMouseListener(MouseListener listener)
          Unregisters the given listener, so that it will no longer receive notification of mouse events.
 void removeMouseMotionListener(MouseMotionListener listener)
          Unregisters the given listener, so that it will no longer receive notification of mouse motion events.
 void removeNotify()
          Called before this figure is removed from its parent.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Unregisters the given listener, so that it will no longer receive notification of any property changes.
 void removePropertyChangeListener(String property, PropertyChangeListener listener)
          Unregisters the given listener, so that it will no longer receive notification of changes in the given property.
 void repaint()
          Repaints this figure.
 void repaint(int x, int y, int w, int h)
          Repaints the rectangular area within this figure whose upper-left corner is located at the point (x,y) and whose width and height are w and h, respectively.
 void repaint(Rectangle rect)
          Repaints the rectangular area within this figure represented by rect.
 void requestFocus()
          Requests focus from the EventDispatcher.
 void revalidate()
          Revalidates this figure.
 void setBackgroundColor(Color c)
          Sets the background color.
 void setBorder(Border b)
          Sets the border.
 void setBounds(Rectangle r)
          Sets the bounds to the given rectangle.
 void setConstraint(IFigure child, Object constraint)
           
 void setCursor(Cursor cursor)
          Sets the cursor.
 void setEnabled(boolean value)
          Sets this figure to be enabled.
 void setFocusTraversable(boolean value)
          Sets the ability for this figure to gain focus on a TraverseEvent.
 void setFont(Font f)
          Sets the font.
 void setForegroundColor(Color c)
          Sets the foreground color.
 void setLayoutManager(LayoutManager lm)
          Sets the LayoutManager.
 void setLocation(Point p)
          Sets the location of this figure.
 void setMaximumSize(Dimension size)
          Sets the maximum size this figure can be.
 void setMinimumSize(Dimension size)
          Sets the minimum size this figure can be.
 void setOpaque(boolean isOpaque)
          Sets this figure to be opaque if isOpaque is true and transparent if isOpaque is false.
 void setParent(IFigure parent)
          Sets this figure's parent.
 void setPreferredSize(Dimension size)
          Sets this figure's preferred size.
 void setRequestFocusEnabled(boolean requestFocusEnabled)
          Sets the ability for this Figure to gain focus on a call to requestFocus().
 void setSize(Dimension d)
          Sets this figure's size.
 void setSize(int w, int h)
          Sets this figure's size.
 void setToolTip(IFigure figure)
          Sets a tooltip that is displayed when the mouse hovers over this figure.
 void setUpdateManager(UpdateManager updateManager)
          Sets the UpdateManager.
 void setVisible(boolean visible)
          Sets this figure's visibility.
 void translate(int x, int y)
          Moves this figure x pixels horizontally and y pixels vertically.
 void translateFromParent(Translatable t)
          Translates a Translatable from this figure's parent's coordinates to this figure's local coordinates.
 void translateToAbsolute(Translatable t)
          Translates a Translatable from this figure's coordinates to the top-most parent's coordinates.
 void translateToParent(Translatable t)
          Translates a Translatable from this figure's coordinates to its parent's coordinates.
 void translateToRelative(Translatable t)
          Translates a Translatable from the top-most parent's coordinates to local coordinates.
 void validate()
          Causes this figure to layout itself, as well as its children.
 

Field Detail

NO_INSETS

public static final Insets NO_INSETS

MAX_DIMENSION

public static final Dimension MAX_DIMENSION

MIN_DIMENSION

public static final Dimension MIN_DIMENSION
Method Detail

add

public void add(IFigure figure)
Adds the given IFigure as a child of this IFigure.

add

public void add(IFigure figure,
                int index)
Adds the given IFigure as a child of this IFigure at the given index.

add

public void add(IFigure figure,
                Object constraint)
Adds the given IFigure as a child of this IFigure with the given constraint.

add

public void add(IFigure figure,
                Object constraint,
                int index)
Adds the given IFigure as a child of this IFigure at the given index with the given constraint.

addAncestorListener

public void addAncestorListener(AncestorListener ancestorListener)
Registers the given listener as an AncestorListener of this IFigure.

addFigureListener

public void addFigureListener(FigureListener fListener)
Registers the given listener as a FigureListener of this IFigure.

addFocusListener

public void addFocusListener(FocusListener fl)
Registers the given listener as a FocusListener of this IFigure.

addKeyListener

public void addKeyListener(KeyListener keyListner)
Registers the given listener as a KeyListner of this IFigure.

addMouseListener

public void addMouseListener(MouseListener mListener)
Registers the given listener as a MouseListener of this IFigure.

addMouseMotionListener

public void addMouseMotionListener(MouseMotionListener mListener)
Registers the given listener as a MouseMotionListener of this IFigure.

addNotify

public void addNotify()
Called after this figure is added to its parent.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pListener)
Registers the given listener as a PropertyChangeListener of this IFigure.

addPropertyChangeListener

public void addPropertyChangeListener(String property,
                                      PropertyChangeListener listener)
Registers the given listener as a PropertyChangeListener of this IFigure, interested only in the given property.

containsPoint

public boolean containsPoint(int x,
                             int y)
Returns true if the point (x, y) is contained within this IFigures bounds.

containsPoint

public boolean containsPoint(Point p)
Returns true if the Point p is contained within this IFigures bounds.

erase

public void erase()
Erases this IFigure.

findFigureAt

public IFigure findFigureAt(int x,
                            int y)
Returns the figure at the specified location. May return this or null.

findFigureAt

public IFigure findFigureAt(Point pt)
Returns the figure at the specified location. May return this or null.

findFigureAtExcluding

public IFigure findFigureAtExcluding(int x,
                                     int y,
                                     Collection collection)
Returns the figure at the specified location, excluding any figures in collection. May return this or null.

findMouseEventTargetAt

public IFigure findMouseEventTargetAt(int x,
                                      int y)
Returns the figure located at the given location which will accept mouse events.

getBackgroundColor

public Color getBackgroundColor()
Returns the background color.

getBorder

public Border getBorder()
Returns the current border by reference.

getBounds

public Rectangle getBounds()
Returns the smallest rectangle completely enclosing the figure. Implementation may return the Rectangle by reference. For this reason, callers of this method must not modify the returned Rectangle.

getClientArea

public Rectangle getClientArea()
Returns the rectangular area within this Figure's bounds in which children will be placed (via LayoutManagers) and the painting of children will be clipped.

getChildren

public List getChildren()
Returns an unmodifiable collection of children by reference.

getCursor

public Cursor getCursor()
Returns the cursor used when the mouse is over this figure.

getFont

public Font getFont()
Returns the current font by reference.

getForegroundColor

public Color getForegroundColor()
Returns the foreground color.

getInsets

public Insets getInsets()
Returns the current Insets. May be returned by reference.

getLayoutManager

public LayoutManager getLayoutManager()
Returns the current LayoutManager by reference.

getMaximumSize

public Dimension getMaximumSize()
Returns a hint indicating the largest desireable size for the figure. Returned Dimension is by value.

getMinimumSize

public Dimension getMinimumSize()
Returns a hint indicating the smallest desireable size for the figure. Returned Dimension is by value.

getParent

public IFigure getParent()
Returns the current Parent.

getPreferredSize

public Dimension getPreferredSize()
Returns the desireable size for this figure. The returned value should not be modified.

getPreferredSize

public Dimension getPreferredSize(int wHint,
                                  int hHint)
Returns the desireable size for this figure using the provided width and height hints. Returned Dimension is by value.

getSize

public Dimension getSize()
Returns the current size. Returned Dimension is by value.

getToolTip

public IFigure getToolTip()
Returns an IFigure that is the tooltip for this Figure.

getUpdateManager

public UpdateManager getUpdateManager()
Returns the UpdateManager for this figure by reference.

handleFocusGained

public void handleFocusGained(FocusEvent fe)
Called when this figure has gained focus.

handleFocusLost

public void handleFocusLost(FocusEvent fe)
Called when this figure has lost focus.

handleKeyPressed

public void handleKeyPressed(KeyEvent ke)

handleKeyReleased

public void handleKeyReleased(KeyEvent ke)

handleMouseDoubleClicked

public void handleMouseDoubleClicked(MouseEvent me)
Called when a mouse button has been double-clicked while within this figure's bounds.

handleMouseDragged

public void handleMouseDragged(MouseEvent me)
Called when the mouse has been dragged within this figure's bounds.

handleMouseEntered

public void handleMouseEntered(MouseEvent me)
Called when the mouse has entered this figure's bounds.

handleMouseExited

public void handleMouseExited(MouseEvent me)
Called when the mouse has exited this figure's bounds.

handleMouseHover

public void handleMouseHover(MouseEvent me)
Called when called when the mouse has hovered over this figure.

handleMouseMoved

public void handleMouseMoved(MouseEvent me)
Called when the mouse has moved within this figure's bounds.

handleMousePressed

public void handleMousePressed(MouseEvent me)
Called when a mouse button has been pressed while within this figure's bounds.

handleMouseReleased

public void handleMouseReleased(MouseEvent me)
Called when a mouse button has been released while within this figure's bounds.

hasFocus

public boolean hasFocus()
Returns true if this figure has focus.

internalGetEventDispatcher

public EventDispatcher internalGetEventDispatcher()
This method is for internal purposes only and should not be called.

intersects

public boolean intersects(Rectangle r)
Returns true if this figure needs to paint anywhere inside r. Figure is asked so that non-rectangular figures can reduce the frequency of paints.

invalidate

public void invalidate()
Invalidates this figure.

isEnabled

public boolean isEnabled()
Returns true if this figure is enabled.

isFocusTraversable

public boolean isFocusTraversable()
Returns true if this figure can gain focus on a TraverseEvent.

isOpaque

public boolean isOpaque()
Returns true if this figure is opaque.

isRequestFocusEnabled

public boolean isRequestFocusEnabled()
Returns true if this figure can receive focus on a call to requestFocus().

isVisible

public boolean isVisible()
Returns true if this figure is visible.

paint

public void paint(Graphics graphics)
Paints this figure and its children.

remove

public void remove(IFigure figure)
Removes the given figure from this figure's list of children.

removeAncestorListener

public void removeAncestorListener(AncestorListener ancestorListener)
Unregisters the given listener, so that it will no longer receive notification of ancestor events.

removeFigureListener

public void removeFigureListener(FigureListener listener)
Unregisters the given listener, so that it will no longer receive notification of figure events.

removeFocusListener

public void removeFocusListener(FocusListener listener)
Unregisters the given listener, so that it will no longer receive notification of focus events.

removeMouseListener

public void removeMouseListener(MouseListener listener)
Unregisters the given listener, so that it will no longer receive notification of mouse events.

removeMouseMotionListener

public void removeMouseMotionListener(MouseMotionListener listener)
Unregisters the given listener, so that it will no longer receive notification of mouse motion events.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Unregisters the given listener, so that it will no longer receive notification of any property changes.

removePropertyChangeListener

public void removePropertyChangeListener(String property,
                                         PropertyChangeListener listener)
Unregisters the given listener, so that it will no longer receive notification of changes in the given property.

removeNotify

public void removeNotify()
Called before this figure is removed from its parent.

repaint

public void repaint()
Repaints this figure.

repaint

public void repaint(int x,
                    int y,
                    int w,
                    int h)
Repaints the rectangular area within this figure whose upper-left corner is located at the point (x,y) and whose width and height are w and h, respectively.

repaint

public void repaint(Rectangle rect)
Repaints the rectangular area within this figure represented by rect.

requestFocus

public void requestFocus()
Requests focus from the EventDispatcher.

revalidate

public void revalidate()
Revalidates this figure.

setBackgroundColor

public void setBackgroundColor(Color c)
Sets the background color.

setBorder

public void setBorder(Border b)
Sets the border.

setBounds

public void setBounds(Rectangle r)
Sets the bounds to the given rectangle.

setConstraint

public void setConstraint(IFigure child,
                          Object constraint)

setCursor

public void setCursor(Cursor cursor)
Sets the cursor.

setEnabled

public void setEnabled(boolean value)
Sets this figure to be enabled.

setFocusTraversable

public void setFocusTraversable(boolean value)
Sets the ability for this figure to gain focus on a TraverseEvent.

setFont

public void setFont(Font f)
Sets the font.

setForegroundColor

public void setForegroundColor(Color c)
Sets the foreground color.

setLayoutManager

public void setLayoutManager(LayoutManager lm)
Sets the LayoutManager.

setLocation

public void setLocation(Point p)
Sets the location of this figure.

setMaximumSize

public void setMaximumSize(Dimension size)
Sets the maximum size this figure can be.

setMinimumSize

public void setMinimumSize(Dimension size)
Sets the minimum size this figure can be.

setOpaque

public void setOpaque(boolean isOpaque)
Sets this figure to be opaque if isOpaque is true and transparent if isOpaque is false.

setParent

public void setParent(IFigure parent)
Sets this figure's parent.

setPreferredSize

public void setPreferredSize(Dimension size)
Sets this figure's preferred size.

setRequestFocusEnabled

public void setRequestFocusEnabled(boolean requestFocusEnabled)
Sets the ability for this Figure to gain focus on a call to requestFocus().

setSize

public void setSize(Dimension d)
Sets this figure's size.

setSize

public void setSize(int w,
                    int h)
Sets this figure's size.

setToolTip

public void setToolTip(IFigure figure)
Sets a tooltip that is displayed when the mouse hovers over this figure.

setUpdateManager

public void setUpdateManager(UpdateManager updateManager)
Sets the UpdateManager.

setVisible

public void setVisible(boolean visible)
Sets this figure's visibility.

translate

public void translate(int x,
                      int y)
Moves this figure x pixels horizontally and y pixels vertically.

translateFromParent

public void translateFromParent(Translatable t)
Translates a Translatable from this figure's parent's coordinates to this figure's local coordinates.

translateToAbsolute

public void translateToAbsolute(Translatable t)
Translates a Translatable from this figure's coordinates to the top-most parent's coordinates.

translateToParent

public void translateToParent(Translatable t)
Translates a Translatable from this figure's coordinates to its parent's coordinates.

translateToRelative

public void translateToRelative(Translatable t)
Translates a Translatable from the top-most parent's coordinates to local coordinates.

validate

public void validate()
Causes this figure to layout itself, as well as its children.

Draw2D v2.0