Class Figure
- All Implemented Interfaces:
IFigure
- Direct Known Subclasses:
AbstractImageFigure
,Clickable
,Container
,FlowFigure
,GhostImageFigure
,Label
,LabeledContainer
,Layer
,LightweightSystem.RootFigure
,Panel
,ScrollBar
,ScrollPane
,Shape
,Thumbnail
,Viewport
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated.use ReverseFigureChildrenIterator insteadprotected static final class
A search which does not filter any figures. since 3.0static final class
Figure children iterator which implements the java iterator interface for more convenient figure iteration.Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
IFigure.NoInsets
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color
Deprecated.access usinggetLocalBackgroundColor()
.protected Border
Deprecated.access usinggetBorder()
protected Rectangle
The rectangular area that this Figure occupies.protected Color
Deprecated.access usinggetLocalForegroundColor()
.protected int
The flags for this Figure.protected Font
Deprecated.access usinggetLocalFont()
protected static int
The largest flag defined in this class.protected Dimension
This Figure's maximum size.protected Dimension
This Figure's minimum size.protected static final UpdateManager
An UpdateManager that does nothing.protected Dimension
This Figure's preferred size.protected IFigure
Deprecated.access usinggetToolTip()
Fields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Callsadd(IFigure, Object, int)
withnull
as the constraint and -1 as the index.final void
Callsadd(IFigure, Object, int)
withnull
as the constraint.final void
Callsadd(IFigure, Object, int)
with -1 as the index.void
Adds the child with the specified index and constraint.void
addAncestorListener
(AncestorListener ancestorListener) Registers the given listener as an AncestorListener of this figure.void
addCoordinateListener
(CoordinateListener listener) Registers the given listener as a CoordinateListener of this figure.void
addFigureListener
(FigureListener listener) Registers the given listener as a FigureListener of this figure.void
addFocusListener
(FocusListener listener) Registers the given listener as a FocusListener of this figure.void
addKeyListener
(KeyListener listener) Registers the given listener as a KeyListener of this figure.void
addLayoutListener
(LayoutListener listener) Appends the given layout listener to the list of layout listeners.protected <T> void
addListener
(Class<T> clazz, Object listener) Adds a listener of type clazz to this Figure's list of event listeners.void
addMouseListener
(MouseListener listener) Registers the given listener as a MouseListener of this IFigure.void
addMouseMotionListener
(MouseMotionListener listener) Registers the given listener as a MouseMotionListener of this IFigure.void
Called after the receiver's parent has been set and it has been added to its parent.void
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) Returnstrue
if the point(x, y)
is contained within this IFigure's bounds.final boolean
This method is final.void
erase()
Erases this IFigure.protected IFigure
findDescendantAtExcluding
(int x, int y, TreeSearch search) Returns a descendant of this Figure such that the Figure returned contains the point (x, y), and is accepted by the given TreeSearch.final IFigure
findFigureAt
(int x, int y) Returns the IFigure at the specified location.findFigureAt
(int x, int y, TreeSearch search) Returns the IFigure at the specified location based on the conditional TreeSearch.final IFigure
findFigureAt
(Point pt) Returns the IFigure at the specified location.final IFigure
findFigureAtExcluding
(int x, int y, Collection<IFigure> c) Returns the IFigure at the specified location, excluding any IFigures incollection
.findMouseEventTargetAt
(int x, int y) protected IFigure
findMouseEventTargetInDescendantsAt
(int x, int y) Searches this Figure's children for the deepest descendant for whichisMouseEventTarget()
returnstrue
and returns that descendant ornull
if none found.protected void
Notifies to allCoordinateListener
s that this figure's local coordinate system has changed in a way which affects the absolute bounds of figures contained within.protected void
Notifies to allFigureListener
s that this figure has moved.protected void
Deprecated.call fireFigureMoved() or fireCoordinateSystemChanged() as appropriateprotected void
firePropertyChange
(String property, boolean old, boolean current) Notifies anyPropertyChangeListeners
listening to this Figure that the boolean property with id property has changed.protected void
firePropertyChange
(String property, int old, int current) Notifies anyPropertyChangeListeners
listening to this figure that the integer property with idproperty
has changed.protected void
firePropertyChange
(String property, Object old, Object current) Notifies anyPropertyChangeListeners
listening to this figure that the Object property with id property has changed.Returns this Figure's background color.Returns the current border by reference.Returns the smallest rectangle completely enclosing the figure.Returns an unmodifiable list of children by reference.Provide an iterable that will iterate in reverse over all children of this figure.final Rectangle
Returns the rectangular area within this Figure's bounds in which children will be placed (viaLayoutManagers
) and the painting of children will be clipped.getClientArea
(Rectangle rect) Copies the client area into the specificied Recangle, and returns that rectangle for convenience.Returns the IClippingStrategy used by this figure to clip its childrenReturns the Cursor used when the mouse is over this IFigure.protected boolean
getFlag
(int flag) Returns the value of the given flag.getFont()
Returns the current Font by reference.Returns the foreground color.Returns the border's Insets if the border is set.Returns the current LayoutManager by reference.protected <T> Iterator<T>
getListeners
(Class<T> clazz) Returns an Iterator over the listeners of type clazz that are listening to this Figure.protected <T> Iterable<T>
getListenersIterable
(Class<T> listenerType) * Returns an Iterator over the listeners of type listenerType that are listening to this Figure.Returnsnull
or the local background Color of this Figure.protected Font
Returnsnull
or the local font setting for this figure.Returnsnull
or the local foreground Color of this Figure.final Point
Returns the top-left corner of this Figure's bounds.Returns a hint indicating the largest desireable size for the IFigure.final Dimension
Returns a hint indicating the smallest desireable size for the IFigure.getMinimumSize
(int wHint, int hHint) Returns a hint indicating the smallest desireable size for the IFigure.Returns the IFigure that is the current parent of this IFigure ornull
if there is no parent.final Dimension
Returns the preferred size for this IFigure.getPreferredSize
(int wHint, int hHint) Returns the preferred size for this IFigure using the provided width and height hints.final Dimension
getSize()
Returns the current size.Returns a IFigure that is the tooltip for this IFigure.Returns the UpdateManager for this IFigure by reference.void
handleFocusGained
(FocusEvent event) Called when this IFigure has gained focus.void
handleFocusLost
(FocusEvent event) Called when this IFigure has lost focus.void
handleKeyPressed
(KeyEvent event) Called when a key is pressed while this IFigure has focus.void
handleKeyReleased
(KeyEvent event) Called when a key is released while this IFigure has focus.void
Called when a mouse button has been double-clicked while within this IFigure's bounds.void
handleMouseDragged
(MouseEvent event) Called when the mouse has been dragged within this IFigure's bounds.void
handleMouseEntered
(MouseEvent event) Called when the mouse has entered this IFigure's bounds.void
handleMouseExited
(MouseEvent event) Called when the mouse has exited this IFigure's bounds.void
handleMouseHover
(MouseEvent event) Called when the mouse has hovered over this IFigure.void
handleMouseMoved
(MouseEvent event) Called when the mouse has moved within this IFigure's bounds.void
handleMousePressed
(MouseEvent event) Called when a mouse button has been pressed while within this IFigure's bounds.void
handleMouseReleased
(MouseEvent event) Called when a mouse button has been released while within this IFigure's bounds.boolean
hasFocus()
Returnstrue
if this IFigure has focus.This method is for internal purposes only and should not be called.boolean
intersects
(Rectangle rect) Returnstrue
if this IFigure's bounds intersect with the given Rectangle.void
Invalidates this IFigure.void
Invalidates this figure as well as all contained within.boolean
Returnstrue
if this figure is capable of applying a local coordinate system which affects its children.boolean
Returnstrue
if this IFigure is enabled.boolean
Returnstrue
if this IFigure can gain focus on aTraverseEvent
.boolean
protected boolean
Returnstrue
if this Figure can receiveMouseEvents
.boolean
isOpaque()
Returnstrue
if this IFigure is opaque.boolean
Returnstrue
if this IFigure can receive focus on a call toIFigure.requestFocus()
.boolean
Returnstrue
if this IFigure is showing.protected boolean
isValid()
Returnstrue
if this Figure is valid.protected boolean
Returnstrue
if revalidating this Figure does not require revalidating its parent.boolean
returnstrue
if this figure's visibility flag is set to true.protected void
layout()
Lays out this Figure using itsLayoutManager
.protected boolean
void
Paints this Figure and its children.protected void
paintBorder
(Graphics graphics) Paints the border associated with this Figure, if one exists.protected void
paintChildren
(Graphics graphics) Paints this Figure's children.protected void
paintClientArea
(Graphics graphics) Paints this Figure's client area.protected void
paintFigure
(Graphics graphics) Paints this Figure's primary representation, or background.protected void
primTranslate
(int dx, int dy) Translates this Figure's bounds, without firing a move.void
Removes the given child Figure from this Figure's hierarchy and revalidates this Figure.void
Removes all children from this Figure.void
removeAncestorListener
(AncestorListener listener) Unregisters the given listener, so that it will no longer receive notification of ancestor events.void
removeCoordinateListener
(CoordinateListener listener) Unregisters the given listener, so that it will no longer receive notification of coordinate changes.void
removeFigureListener
(FigureListener listener) Unregisters the given listener, so that it will no longer receive notification of IFigure events.void
removeFocusListener
(FocusListener listener) Unregisters the given listener, so that it will no longer receive notification of focus events.void
removeKeyListener
(KeyListener listener) Removes the first occurence of the given listener.void
removeLayoutListener
(LayoutListener listener) Removes the first occurence of the given listener.protected <T> void
removeListener
(Class<T> clazz, Object listener) Removes listener of type clazz from this Figure's list of listeners.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
Called prior to this figure's removal from its parentvoid
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 IFigure.void
repaint
(int x, int y, int w, int h) Repaints the rectangular area within this IFigure whose upper-left corner is located at the point(x,y)
and whose width and height arew
andh
, respectively.final void
Repaints the rectangular area within this IFigure represented byrect
.final void
Requests focus from theEventDispatcher
.void
Invalidates this figure and revalidates() its parent.void
Sets the background color.void
Sets the border.void
Sets the bounds of this Figure to the Rectangle rect.protected void
setChildrenDirection
(int direction) Sets the direction of anyOrientable
children.protected void
setChildrenEnabled
(boolean value) Sets all childrens' enabled property to value.protected void
setChildrenOrientation
(int orientation) Sets the orientation of anyOrientable
children.void
setClippingStrategy
(IClippingStrategy clippingStrategy) Registers a clipping strategy to specify how clipping is performed for child figures.void
setConstraint
(IFigure child, Object constraint) Convenience method to set the constraint of the specified child in the current LayoutManager.void
Sets the cursor.void
setEnabled
(boolean value) Sets this IFigure to be enabled.protected final void
setFlag
(int flag, boolean value) Sets the given flag to the given value.void
setFocusTraversable
(boolean focusTraversable) Sets the ability for this IFigure to gain focus on aTraverseEvent
.void
Sets the font.void
Sets the foreground color.void
setLayoutManager
(LayoutManager manager) Sets the LayoutManager.void
setLocation
(Point p) Sets the location of this IFigure.void
Sets the maximum size this IFigure can be.void
Sets the minimum size this IFigure can be.void
setOpaque
(boolean opaque) Sets this IFigure to be opaque if isOpaque istrue
and transparent if isOpaque isfalse
.void
Sets this IFigure's parent.final void
setPreferredSize
(int w, int h) Sets the preferred size of this figure.void
setPreferredSize
(Dimension size) Sets this IFigure's preferred size.void
setRequestFocusEnabled
(boolean requestFocusEnabled) Sets the ability for this Figure to gain focus on a call toIFigure.requestFocus()
.void
setSize
(int w, int h) Sets this IFigure's size.final void
Sets this IFigure's size.void
Sets a tooltip that is displayed when the mouse hovers over this IFigure.void
setValid
(boolean value) Sets this figure to be valid if value istrue
and invalid otherwise.void
setVisible
(boolean visible) Sets this IFigure's visibility.final void
translate
(int x, int y) Moves this IFigurex
pixels horizontally andy
pixels vertically.void
Translates a Translatable from this IFigure's parent's coordinates to this IFigure's local coordinates.final void
Translates a Translatable that is relative to this figure's bounds to absolute.void
Translates a Translatable from this IFigure's coordinates to its parent's coordinates.final void
Translates a Translatable in absolute coordinates to be relative to this figure's bounds.protected boolean
Returnstrue
if this Figure uses local coordinates.void
validate()
Indicates that this figure should make itself valid.
-
Field Details
-
MAX_FLAG
protected static int MAX_FLAGThe largest flag defined in this class. If subclasses define flags, they should declare them as larger than this value and redefine MAX_FLAG to be their largest flag value.This constant is evaluated at runtime and will not be inlined by the compiler.
-
bounds
The rectangular area that this Figure occupies. -
flags
protected int flagsThe flags for this Figure. -
prefSize
This Figure's preferred size. -
minSize
This Figure's minimum size. -
maxSize
This Figure's maximum size. -
font
Deprecated.access usinggetLocalFont()
-
bgColor
Deprecated.access usinggetLocalBackgroundColor()
. -
fgColor
Deprecated.access usinggetLocalForegroundColor()
. -
border
Deprecated.access usinggetBorder()
-
toolTip
Deprecated.access usinggetToolTip()
-
NO_MANAGER
An UpdateManager that does nothing.
-
-
Constructor Details
-
Figure
public Figure()
-
-
Method Details
-
add
Callsadd(IFigure, Object, int)
with -1 as the index. -
add
Description copied from interface:IFigure
Adds the child with the specified index and constraint. The child's parent is currently not null, it is removed from that parent. If this figure has a LayoutManager, thenLayoutManager.setConstraint(IFigure, Object)
shall be called on the layout. -
add
Callsadd(IFigure, Object, int)
withnull
as the constraint and -1 as the index. -
add
Callsadd(IFigure, Object, int)
withnull
as the constraint. -
addAncestorListener
Description copied from interface:IFigure
Registers the given listener as an AncestorListener of this figure.- Specified by:
addAncestorListener
in interfaceIFigure
- Parameters:
ancestorListener
- The listener to add- See Also:
-
addCoordinateListener
Description copied from interface:IFigure
Registers the given listener as a CoordinateListener of this figure.- Specified by:
addCoordinateListener
in interfaceIFigure
- Parameters:
listener
- the listener to add- See Also:
-
addFigureListener
Description copied from interface:IFigure
Registers the given listener as a FigureListener of this figure.- Specified by:
addFigureListener
in interfaceIFigure
- Parameters:
listener
- The listener to add- See Also:
-
addFocusListener
Description copied from interface:IFigure
Registers the given listener as a FocusListener of this figure.- Specified by:
addFocusListener
in interfaceIFigure
- Parameters:
listener
- The listener to add- See Also:
-
addKeyListener
Description copied from interface:IFigure
Registers the given listener as a KeyListener of this figure.- Specified by:
addKeyListener
in interfaceIFigure
- Parameters:
listener
- The listener to add- See Also:
-
addLayoutListener
Appends the given layout listener to the list of layout listeners.- Specified by:
addLayoutListener
in interfaceIFigure
- Parameters:
listener
- the listener being added- Since:
- 3.1
-
addListener
Adds a listener of type clazz to this Figure's list of event listeners.- Parameters:
clazz
- The listener typelistener
- The listener
-
addMouseListener
Description copied from interface:IFigure
Registers the given listener as a MouseListener of this IFigure.- Specified by:
addMouseListener
in interfaceIFigure
- Parameters:
listener
- The listener to add- See Also:
-
addMouseMotionListener
Description copied from interface:IFigure
Registers the given listener as a MouseMotionListener of this IFigure.- Specified by:
addMouseMotionListener
in interfaceIFigure
- Parameters:
listener
- The listener to add- See Also:
-
addNotify
public void addNotify()Called after the receiver's parent has been set and it has been added to its parent. -
addPropertyChangeListener
Description copied from interface:IFigure
Registers the given listener as a PropertyChangeListener of this IFigure, interested only in the given property.- Specified by:
addPropertyChangeListener
in interfaceIFigure
- Parameters:
property
- The property the listener is interested inlistener
- The listener to add- See Also:
-
addPropertyChangeListener
Description copied from interface:IFigure
Registers the given listener as a PropertyChangeListener of this IFigure.- Specified by:
addPropertyChangeListener
in interfaceIFigure
- Parameters:
listener
- The listener to add- See Also:
-
containsPoint
This method is final. OverridecontainsPoint(int, int)
if needed.- Specified by:
containsPoint
in interfaceIFigure
- Parameters:
p
- The point- Returns:
true
if the Point p is contained within this IFigure's bounds- Since:
- 2.0
- See Also:
-
containsPoint
public boolean containsPoint(int x, int y) Description copied from interface:IFigure
Returnstrue
if the point(x, y)
is contained within this IFigure's bounds.- Specified by:
containsPoint
in interfaceIFigure
- Parameters:
x
- The X coordinatey
- The Y coordinate- Returns:
true
if the point (x,y) is contained in this IFigure's bounds- See Also:
-
erase
public void erase()Description copied from interface:IFigure
Erases this IFigure. -
findDescendantAtExcluding
Returns a descendant of this Figure such that the Figure returned contains the point (x, y), and is accepted by the given TreeSearch. Returnsnull
if none found.- Parameters:
x
- The X coordinatey
- The Y coordinatesearch
- the TreeSearch- Returns:
- The descendant Figure at (x,y)
-
findFigureAt
Description copied from interface:IFigure
Returns the IFigure at the specified location. May returnthis
ornull
.- Specified by:
findFigureAt
in interfaceIFigure
- Parameters:
pt
- The point- Returns:
- The IFigure at the specified location
- See Also:
-
findFigureAt
Description copied from interface:IFigure
Returns the IFigure at the specified location. May returnthis
ornull
.- Specified by:
findFigureAt
in interfaceIFigure
- Parameters:
x
- The X coordinatey
- The Y coordinate- Returns:
- The IFigure at the specified location
- See Also:
-
findFigureAt
Description copied from interface:IFigure
Returns the IFigure at the specified location based on the conditional TreeSearch. May returnthis
ornull
- Specified by:
findFigureAt
in interfaceIFigure
- Parameters:
x
- the X coordinatey
- the Y coordinatesearch
- the conditional TreeSearch- Returns:
- the IFigure at the specified location
- See Also:
-
findFigureAtExcluding
Description copied from interface:IFigure
Returns the IFigure at the specified location, excluding any IFigures incollection
. May returnthis
ornull
.- Specified by:
findFigureAtExcluding
in interfaceIFigure
- Parameters:
x
- The X coordinatey
- The Y coordinatec
- A collection of IFigures to be excluded- Returns:
- The IFigure at the specified location, excluding any IFigures in collection
- See Also:
-
findMouseEventTargetAt
Returns the deepest descendant for whichisMouseEventTarget()
returnstrue
ornull
if none found. The Parameters x and y are absolute locations. Any Graphics transformations applied by this Figure to its children duringpaintChildren(Graphics)
(thus causing the children to appear transformed to the user) should be applied inversely to the points x and y when called on the children.- Specified by:
findMouseEventTargetAt
in interfaceIFigure
- Parameters:
x
- The X coordinatey
- The Y coordinate- Returns:
- The deepest descendant for which isMouseEventTarget() returns true
-
findMouseEventTargetInDescendantsAt
Searches this Figure's children for the deepest descendant for whichisMouseEventTarget()
returnstrue
and returns that descendant ornull
if none found.- Parameters:
x
- The X coordinatey
- The Y coordinate- Returns:
- The deepest descendant for which isMouseEventTarget() returns true
- See Also:
-
fireCoordinateSystemChanged
protected void fireCoordinateSystemChanged()Notifies to allCoordinateListener
s that this figure's local coordinate system has changed in a way which affects the absolute bounds of figures contained within.- Since:
- 3.1
-
fireFigureMoved
protected void fireFigureMoved()Notifies to allFigureListener
s that this figure has moved. Moved means that the bounds have changed in some way, location and/or size.- Since:
- 3.1
-
fireMoved
Deprecated.call fireFigureMoved() or fireCoordinateSystemChanged() as appropriateFires both figuremoved and coordinate system changed. This method exists for compatibility. Some listeners which used to listen for figureMoved now listen for coordinates changed. So to be sure that those new listeners are notified, any client code which used called this method will also result in notification of coordinate changes.- Since:
- 2.0
-
firePropertyChange
Notifies anyPropertyChangeListeners
listening to this Figure that the boolean property with id property has changed.- Parameters:
property
- The id of the property that changedold
- The old value of the changed propertycurrent
- The current value of the changed property- Since:
- 2.0
-
firePropertyChange
Notifies anyPropertyChangeListeners
listening to this figure that the Object property with id property has changed.- Parameters:
property
- The id of the property that changedold
- The old value of the changed propertycurrent
- The current value of the changed property- Since:
- 2.0
-
firePropertyChange
Notifies anyPropertyChangeListeners
listening to this figure that the integer property with idproperty
has changed.- Parameters:
property
- The id of the property that changedold
- The old value of the changed propertycurrent
- The current value of the changed property- Since:
- 2.0
-
getBackgroundColor
Returns this Figure's background color. If this Figure's background color isnull
and its parent is notnull
, the background color is inherited from the parent.- Specified by:
getBackgroundColor
in interfaceIFigure
- Returns:
- The background color
- See Also:
-
getBorder
Description copied from interface:IFigure
Returns the current border by reference. -
getBounds
Returns the smallest rectangle completely enclosing the figure. Implementors may return the Rectangle by reference. For this reason, callers of this method must not modify the returned Rectangle. -
getChildren
Description copied from interface:IFigure
Returns an unmodifiable list of children by reference.- Specified by:
getChildren
in interfaceIFigure
- Returns:
- An unmodifiable list of children by reference
- See Also:
-
getChildrenRevIterable
Provide an iterable that will iterate in reverse over all children of this figure.- Since:
- 3.13
-
getClientArea
Description copied from interface:IFigure
Copies the client area into the specificied Recangle, and returns that rectangle for convenience.- Specified by:
getClientArea
in interfaceIFigure
- Parameters:
rect
- The destination rectangle for the client area- Returns:
- The same instance that was passed in, modified to contain the client area
- See Also:
-
getClientArea
Description copied from interface:IFigure
Returns the rectangular area within this Figure's bounds in which children will be placed (viaLayoutManagers
) and the painting of children will be clipped.- Specified by:
getClientArea
in interfaceIFigure
- Returns:
- The client area
- See Also:
-
getClippingStrategy
Returns the IClippingStrategy used by this figure to clip its children- Specified by:
getClippingStrategy
in interfaceIFigure
- Returns:
- the IClipppingStrategy used to clip this figure's children.
- Since:
- 3.6
-
getCursor
Description copied from interface:IFigure
Returns the Cursor used when the mouse is over this IFigure. -
getFlag
protected boolean getFlag(int flag) Returns the value of the given flag.- Parameters:
flag
- The flag to get- Returns:
- The value of the given flag
-
getFont
Description copied from interface:IFigure
Returns the current Font by reference. -
getForegroundColor
Description copied from interface:IFigure
Returns the foreground color.- Specified by:
getForegroundColor
in interfaceIFigure
- Returns:
- The foreground color
- See Also:
-
getInsets
Returns the border's Insets if the border is set. Otherwise returns NO_INSETS, an instance of Insets with all 0s. Returns Insets by reference. DO NOT Modify returned value. Cannot return null. -
getLayoutManager
Description copied from interface:IFigure
Returns the current LayoutManager by reference.- Specified by:
getLayoutManager
in interfaceIFigure
- Returns:
- The current LayoutManager by reference
- See Also:
-
getListeners
Returns an Iterator over the listeners of type clazz that are listening to this Figure. If there are no listeners of type clazz, an empty iterator is returned.- Parameters:
clazz
- The type of listeners to get- Returns:
- An Iterator over the requested listeners
- Since:
- 2.0
-
getListenersIterable
* Returns an Iterator over the listeners of type listenerType that are listening to this Figure. If there are no listeners of type listenerType, an empty iterator is returned.- Parameters:
listenerType
- The type of listeners to get- Returns:
- an Iterable over the requested listeners c
- Since:
- 3.13
-
getLocalBackgroundColor
Returnsnull
or the local background Color of this Figure. Does not inherit this Color from the parent.- Specified by:
getLocalBackgroundColor
in interfaceIFigure
- Returns:
- bgColor
null
or the local background Color
-
getLocalFont
Returnsnull
or the local font setting for this figure. Does not return values inherited from the parent figure.- Returns:
null
or the local font- Since:
- 3.1
-
getLocalForegroundColor
Returnsnull
or the local foreground Color of this Figure. Does not inherit this Color from the parent.- Specified by:
getLocalForegroundColor
in interfaceIFigure
- Returns:
- fgColor
null
or the local foreground Color
-
getLocation
Returns the top-left corner of this Figure's bounds.- Specified by:
getLocation
in interfaceIFigure
- Returns:
- The top-left corner of this Figure's bounds
- Since:
- 2.0
-
getMaximumSize
Description copied from interface:IFigure
Returns a hint indicating the largest desireable size for the IFigure. Returned Dimension is by value.- Specified by:
getMaximumSize
in interfaceIFigure
- Returns:
- The maximum size
- See Also:
-
getMinimumSize
Description copied from interface:IFigure
Returns a hint indicating the smallest desireable size for the IFigure. The returned dimension may be by reference, and it must not be modified by the caller.- Specified by:
getMinimumSize
in interfaceIFigure
- Returns:
- The minimum size
- See Also:
-
getMinimumSize
Description copied from interface:IFigure
Returns a hint indicating the smallest desireable size for the IFigure. The returned dimension may be by reference, and it must not be modified by the caller.- Specified by:
getMinimumSize
in interfaceIFigure
- Parameters:
wHint
- the width hinthHint
- the height hint- Returns:
- The minimum size
- See Also:
-
getParent
Description copied from interface:IFigure
Returns the IFigure that is the current parent of this IFigure ornull
if there is no parent. -
getPreferredSize
Description copied from interface:IFigure
Returns the preferred size for this IFigure. The returned value must not be modified by the caller. If the figure has no preference, it returns its current size. The same as callinggetPreferredSize(-1, -1)
.- Specified by:
getPreferredSize
in interfaceIFigure
- Returns:
- The preferred size
- See Also:
-
getPreferredSize
Description copied from interface:IFigure
Returns the preferred size for this IFigure using the provided width and height hints. The returned dimension may be by reference, and it must not be modified by the caller. A value of-1
indicates that there is no constraint in that direction.- Specified by:
getPreferredSize
in interfaceIFigure
- Parameters:
wHint
- a width hinthHint
- a height hint- Returns:
- The preferred size
- See Also:
-
getSize
Description copied from interface:IFigure
Returns the current size. Returned Dimension is by value. -
getToolTip
Description copied from interface:IFigure
Returns a IFigure that is the tooltip for this IFigure.- Specified by:
getToolTip
in interfaceIFigure
- Returns:
- This IFigure's tooltip
- See Also:
-
getUpdateManager
Description copied from interface:IFigure
Returns the UpdateManager for this IFigure by reference.- Specified by:
getUpdateManager
in interfaceIFigure
- Returns:
- The update manager
- See Also:
-
handleFocusGained
Description copied from interface:IFigure
Called when this IFigure has gained focus.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
FocusListener
with this IFigure.- Specified by:
handleFocusGained
in interfaceIFigure
- Parameters:
event
- The focus event- See Also:
-
handleFocusLost
Description copied from interface:IFigure
Called when this IFigure has lost focus.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
FocusListener
with this IFigure.- Specified by:
handleFocusLost
in interfaceIFigure
- Parameters:
event
- The focus event- See Also:
-
handleKeyPressed
Description copied from interface:IFigure
Called when a key is pressed while this IFigure has focus.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
KeyListener
with this IFigure.- Specified by:
handleKeyPressed
in interfaceIFigure
- Parameters:
event
- The key event- See Also:
-
handleKeyReleased
Description copied from interface:IFigure
Called when a key is released while this IFigure has focus.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
KeyListener
with this IFigure.- Specified by:
handleKeyReleased
in interfaceIFigure
- Parameters:
event
- The key event- See Also:
-
handleMouseDoubleClicked
Description copied from interface:IFigure
Called when a mouse button has been double-clicked while within this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseListener
with this IFigure.- Specified by:
handleMouseDoubleClicked
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMouseDragged
Description copied from interface:IFigure
Called when the mouse has been dragged within this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseMotionListener
with this IFigure.- Specified by:
handleMouseDragged
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMouseEntered
Description copied from interface:IFigure
Called when the mouse has entered this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseMotionListener
with this IFigure.- Specified by:
handleMouseEntered
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMouseExited
Description copied from interface:IFigure
Called when the mouse has exited this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseMotionListener
with this IFigure.- Specified by:
handleMouseExited
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMouseHover
Description copied from interface:IFigure
Called when the mouse has hovered over this IFigure.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseMotionListener
with this IFigure.- Specified by:
handleMouseHover
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMouseMoved
Description copied from interface:IFigure
Called when the mouse has moved within this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseMotionListener
with this IFigure.- Specified by:
handleMouseMoved
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMousePressed
Description copied from interface:IFigure
Called when a mouse button has been pressed while within this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseListener
with this IFigure.- Specified by:
handleMousePressed
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
handleMouseReleased
Description copied from interface:IFigure
Called when a mouse button has been released while within this IFigure's bounds.NOTE: You should not override this method. If you are interested in receiving notification of this type of event, you should register a
MouseListener
with this IFigure.- Specified by:
handleMouseReleased
in interfaceIFigure
- Parameters:
event
- The mouse event- See Also:
-
hasFocus
public boolean hasFocus()Description copied from interface:IFigure
Returnstrue
if this IFigure has focus. -
internalGetEventDispatcher
Description copied from interface:IFigure
This method is for internal purposes only and should not be called.- Specified by:
internalGetEventDispatcher
in interfaceIFigure
- Returns:
- The event dispatcher
- See Also:
-
intersects
Description copied from interface:IFigure
Returnstrue
if this IFigure's bounds intersect with the given Rectangle. Figure is asked so that non-rectangular IFigures can reduce the frequency of paints.- Specified by:
intersects
in interfaceIFigure
- Parameters:
rect
- The rectangle to check for intersection- Returns:
true
if this IFigure's bounds intersect with the given Rectangle- See Also:
-
invalidate
public void invalidate()Description copied from interface:IFigure
Invalidates this IFigure. If this figure has a LayoutManager, thenLayoutManager.invalidate()
should be called on that layout.- Specified by:
invalidate
in interfaceIFigure
- See Also:
-
invalidateTree
public void invalidateTree()Description copied from interface:IFigure
Invalidates this figure as well as all contained within.- Specified by:
invalidateTree
in interfaceIFigure
- See Also:
-
isCoordinateSystem
public boolean isCoordinateSystem()Description copied from interface:IFigure
Returnstrue
if this figure is capable of applying a local coordinate system which affects its children.- Specified by:
isCoordinateSystem
in interfaceIFigure
- Returns:
true
if this figure provides local coordinates to children- See Also:
-
isEnabled
public boolean isEnabled()Description copied from interface:IFigure
Returnstrue
if this IFigure is enabled. -
isFocusTraversable
public boolean isFocusTraversable()Description copied from interface:IFigure
Returnstrue
if this IFigure can gain focus on aTraverseEvent
.- Specified by:
isFocusTraversable
in interfaceIFigure
- Returns:
true
if this IFigure can gain focus on a TraverseEvent- See Also:
-
isMouseEventTarget
protected boolean isMouseEventTarget()Returnstrue
if this Figure can receiveMouseEvents
.- Returns:
true
if this Figure can receiveMouseEvents
- Since:
- 2.0
-
isMirrored
public boolean isMirrored()- Specified by:
isMirrored
in interfaceIFigure
- Returns:
true
if this figure is hosted in a Control that is mirrored- See Also:
-
isOpaque
public boolean isOpaque()Description copied from interface:IFigure
Returnstrue
if this IFigure is opaque. -
isRequestFocusEnabled
public boolean isRequestFocusEnabled()Description copied from interface:IFigure
Returnstrue
if this IFigure can receive focus on a call toIFigure.requestFocus()
.- Specified by:
isRequestFocusEnabled
in interfaceIFigure
- Returns:
true
if this IFigure can receive focus on a call to requestFocus()- See Also:
-
isShowing
public boolean isShowing()Description copied from interface:IFigure
Returnstrue
if this IFigure is showing. This figure is only showing if it is visible and its parent is showing, or it has no parent. -
isValid
protected boolean isValid()Returnstrue
if this Figure is valid.- Returns:
true
if this Figure is valid- Since:
- 2.0
-
isValidationRoot
protected boolean isValidationRoot()Returnstrue
if revalidating this Figure does not require revalidating its parent.- Returns:
true
if revalidating this Figure doesn't require revalidating its parent.- Since:
- 2.0
-
isVisible
public boolean isVisible()Description copied from interface:IFigure
returnstrue
if this figure's visibility flag is set to true. Does not walk up the parent chain. -
layout
protected void layout()Lays out this Figure using itsLayoutManager
.- Since:
- 2.0
-
paint
Paints this Figure and its children. -
paintBorder
Paints the border associated with this Figure, if one exists.- Parameters:
graphics
- The Graphics used to paint- Since:
- 2.0
- See Also:
-
paintChildren
Paints this Figure's children. The caller must save the state of the graphics prior to calling this method, such thatgraphics.restoreState()
may be called safely, and doing so will return the graphics to its original state when the method was entered.This method must leave the Graphics in its original state upon return.
- Parameters:
graphics
- the graphics used to paint- Since:
- 2.0
-
paintClientArea
Paints this Figure's client area. The client area is typically defined as the anything inside the Figure'sBorder
orInsets
, and by default includes the children of this Figure. On return, this method must leave the given Graphics in its initial state.- Parameters:
graphics
- The Graphics used to paint- Since:
- 2.0
-
optimizeClip
protected boolean optimizeClip()- Since:
- 3.13
-
paintFigure
Paints this Figure's primary representation, or background. Changes made to the graphics to the graphics current state will not affect the subsequent calls topaintClientArea(Graphics)
andpaintBorder(Graphics)
. Furthermore, it is safe to callgraphics.restoreState()
within this method, and doing so will restore the graphics to its original state upon entry.- Parameters:
graphics
- The Graphics used to paint- Since:
- 2.0
-
primTranslate
protected void primTranslate(int dx, int dy) Translates this Figure's bounds, without firing a move.- Parameters:
dx
- The amount to translate horizontallydy
- The amount to translate vertically- Since:
- 2.0
- See Also:
-
remove
Removes the given child Figure from this Figure's hierarchy and revalidates this Figure. The child Figure'sremoveNotify()
method is also called. -
removeAll
public void removeAll()Removes all children from this Figure.- Since:
- 2.0
- See Also:
-
removeAncestorListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of ancestor events.- Specified by:
removeAncestorListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removeCoordinateListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of coordinate changes.- Specified by:
removeCoordinateListener
in interfaceIFigure
- Parameters:
listener
- the listener to remove- See Also:
-
removeFigureListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of IFigure events.- Specified by:
removeFigureListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removeFocusListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of focus events.- Specified by:
removeFocusListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removeKeyListener
Description copied from interface:IFigure
Removes the first occurence of the given listener.- Specified by:
removeKeyListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removeLayoutListener
Removes the first occurence of the given listener.- Specified by:
removeLayoutListener
in interfaceIFigure
- Parameters:
listener
- the listener being removed- Since:
- 3.1
-
removeListener
Removes listener of type clazz from this Figure's list of listeners.- Parameters:
clazz
- The type of listenerlistener
- The listener to remove- Since:
- 2.0
-
removeMouseListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of mouse events.- Specified by:
removeMouseListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removeMouseMotionListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of mouse motion events.- Specified by:
removeMouseMotionListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removeNotify
public void removeNotify()Called prior to this figure's removal from its parent- Specified by:
removeNotify
in interfaceIFigure
-
removePropertyChangeListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of any property changes.- Specified by:
removePropertyChangeListener
in interfaceIFigure
- Parameters:
listener
- The listener to remove- See Also:
-
removePropertyChangeListener
Description copied from interface:IFigure
Unregisters the given listener, so that it will no longer receive notification of changes in the given property. This will only unregister the listener for the given property. If the listener is registered to listen to other properties, this will not affect the notification of the listener regarding those properties.- Specified by:
removePropertyChangeListener
in interfaceIFigure
- Parameters:
property
- The property that the listener is no longer interested inlistener
- The listener no longer interested in the property- See Also:
-
repaint
Description copied from interface:IFigure
Repaints the rectangular area within this IFigure represented byrect
. -
repaint
public void repaint(int x, int y, int w, int h) Description copied from interface:IFigure
Repaints the rectangular area within this IFigure whose upper-left corner is located at the point(x,y)
and whose width and height arew
andh
, respectively. -
repaint
public void repaint()Description copied from interface:IFigure
Repaints this IFigure. -
requestFocus
public final void requestFocus()Description copied from interface:IFigure
Requests focus from theEventDispatcher
.- Specified by:
requestFocus
in interfaceIFigure
- See Also:
-
revalidate
public void revalidate()Description copied from interface:IFigure
Invalidates this figure and revalidates() its parent. If a figure does not have a parent, it will request a validation from it UpdateManager. Calling this method does not guarantee that a repaint will occur.- Specified by:
revalidate
in interfaceIFigure
- See Also:
-
setBackgroundColor
Description copied from interface:IFigure
Sets the background color.- Specified by:
setBackgroundColor
in interfaceIFigure
- Parameters:
bg
- The new background color- See Also:
-
setBorder
Description copied from interface:IFigure
Sets the border. -
setBounds
Sets the bounds of this Figure to the Rectangle rect. Note that rect is compared to the Figure's current bounds to determine what needs to be repainted and/or exposed and if validation is required. SincegetBounds()
may return the current bounds by reference, it is not safe to modify that Rectangle and then call setBounds() after making modifications. The figure would assume that the bounds are unchanged, and no layout or paint would occur. For proper behavior, always use a copy. -
setChildrenDirection
protected void setChildrenDirection(int direction) Sets the direction of anyOrientable
children. Allowable values fordir
are found inPositionConstants
.- Parameters:
direction
- The direction- Since:
- 2.0
- See Also:
-
setChildrenEnabled
protected void setChildrenEnabled(boolean value) Sets all childrens' enabled property to value.- Parameters:
value
- The enable value- Since:
- 2.0
- See Also:
-
setChildrenOrientation
protected void setChildrenOrientation(int orientation) Sets the orientation of anyOrientable
children. Allowable values for orientation are found inPositionConstants
.- Parameters:
orientation
- The Orientation- Since:
- 2.0
- See Also:
-
setConstraint
Description copied from interface:IFigure
Convenience method to set the constraint of the specified child in the current LayoutManager.- Specified by:
setConstraint
in interfaceIFigure
- Parameters:
child
- The figure whose constraint is being setconstraint
- the constraint- See Also:
-
setClippingStrategy
Registers a clipping strategy to specify how clipping is performed for child figures.- Specified by:
setClippingStrategy
in interfaceIFigure
- Parameters:
clippingStrategy
-- Since:
- 3.6
-
setCursor
Description copied from interface:IFigure
Sets the cursor. -
setEnabled
public void setEnabled(boolean value) Description copied from interface:IFigure
Sets this IFigure to be enabled.- Specified by:
setEnabled
in interfaceIFigure
- Parameters:
value
-true
if this IFigure should be enabled- See Also:
-
setFlag
protected final void setFlag(int flag, boolean value) Sets the given flag to the given value.- Parameters:
flag
- The flag to setvalue
- The value- Since:
- 2.0
-
setFocusTraversable
public void setFocusTraversable(boolean focusTraversable) Description copied from interface:IFigure
Sets the ability for this IFigure to gain focus on aTraverseEvent
.- Specified by:
setFocusTraversable
in interfaceIFigure
- Parameters:
focusTraversable
-true
if this IFigure should gain focus on a TraverseEvent- See Also:
-
setFont
Description copied from interface:IFigure
Sets the font. -
setForegroundColor
Description copied from interface:IFigure
Sets the foreground color.- Specified by:
setForegroundColor
in interfaceIFigure
- Parameters:
fg
- The new foreground color- See Also:
-
setLayoutManager
Description copied from interface:IFigure
Sets the LayoutManager.- Specified by:
setLayoutManager
in interfaceIFigure
- Parameters:
manager
- The new layout manager- See Also:
-
setLocation
Description copied from interface:IFigure
Sets the location of this IFigure.- Specified by:
setLocation
in interfaceIFigure
- Parameters:
p
- The new location- See Also:
-
setMaximumSize
Description copied from interface:IFigure
Sets the maximum size this IFigure can be.- Specified by:
setMaximumSize
in interfaceIFigure
- Parameters:
d
- The new maximum size- See Also:
-
setMinimumSize
Description copied from interface:IFigure
Sets the minimum size this IFigure can be.- Specified by:
setMinimumSize
in interfaceIFigure
- Parameters:
d
- The new minimum size- See Also:
-
setOpaque
public void setOpaque(boolean opaque) Description copied from interface:IFigure
Sets this IFigure to be opaque if isOpaque istrue
and transparent if isOpaque isfalse
. -
setParent
Description copied from interface:IFigure
Sets this IFigure's parent. -
setPreferredSize
Description copied from interface:IFigure
Sets this IFigure's preferred size.- Specified by:
setPreferredSize
in interfaceIFigure
- Parameters:
size
- The new preferred size- See Also:
-
setPreferredSize
public final void setPreferredSize(int w, int h) Sets the preferred size of this figure.- Parameters:
w
- The new preferred widthh
- The new preferred height- Since:
- 2.0
- See Also:
-
setRequestFocusEnabled
public void setRequestFocusEnabled(boolean requestFocusEnabled) Description copied from interface:IFigure
Sets the ability for this Figure to gain focus on a call toIFigure.requestFocus()
.- Specified by:
setRequestFocusEnabled
in interfaceIFigure
- Parameters:
requestFocusEnabled
-true
if this IFigure should gain focus on a call to requestFocus()- See Also:
-
setSize
Description copied from interface:IFigure
Sets this IFigure's size. -
setSize
public void setSize(int w, int h) Description copied from interface:IFigure
Sets this IFigure's size. -
setToolTip
Description copied from interface:IFigure
Sets a tooltip that is displayed when the mouse hovers over this IFigure.- Specified by:
setToolTip
in interfaceIFigure
- Parameters:
f
- The tooltip IFigure- See Also:
-
setValid
public void setValid(boolean value) Sets this figure to be valid if value istrue
and invalid otherwise.- Parameters:
value
- The valid value- Since:
- 2.0
-
setVisible
public void setVisible(boolean visible) Description copied from interface:IFigure
Sets this IFigure's visibility.- Specified by:
setVisible
in interfaceIFigure
- Parameters:
visible
-true
if this IFigure should be visible- See Also:
-
translate
public final void translate(int x, int y) Description copied from interface:IFigure
Moves this IFigurex
pixels horizontally andy
pixels vertically. -
translateFromParent
Description copied from interface:IFigure
Translates a Translatable from this IFigure's parent's coordinates to this IFigure's local coordinates.- Specified by:
translateFromParent
in interfaceIFigure
- Parameters:
t
- The object to translate- See Also:
-
translateToAbsolute
Description copied from interface:IFigure
Translates a Translatable that is relative to this figure's bounds to absolute.- Specified by:
translateToAbsolute
in interfaceIFigure
- Parameters:
t
- The object to translate- See Also:
-
translateToParent
Description copied from interface:IFigure
Translates a Translatable from this IFigure's coordinates to its parent's coordinates.- Specified by:
translateToParent
in interfaceIFigure
- Parameters:
t
- The object to translate- See Also:
-
translateToRelative
Description copied from interface:IFigure
Translates a Translatable in absolute coordinates to be relative to this figure's bounds.- Specified by:
translateToRelative
in interfaceIFigure
- Parameters:
t
- The object to translate- See Also:
-
useLocalCoordinates
protected boolean useLocalCoordinates()Returnstrue
if this Figure uses local coordinates. This means its children are placed relative to this Figure's top-left corner.- Returns:
true
if this Figure uses local coordinates- Since:
- 2.0
-
validate
public void validate()Description copied from interface:IFigure
Indicates that this figure should make itself valid. Validation includes invoking layout on a LayoutManager if present, and then validating all children figures. Default validation uses pre-order, depth-first ordering.
-