|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A lightweight graphical representation. Figures are rendered to a Graphics
object. Figures can be composed to create complex renderings.
Nested Class Summary | |
static class |
IFigure.NoInsets
Insets that are all 0. |
Field Summary | |
static Dimension |
MAX_DIMENSION
The maximum allowable dimension. |
static Dimension |
MIN_DIMENSION
The minimum allowable dimension. (5,5) |
static Insets |
NO_INSETS
Empty 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 child IFigure using the specified index and constraint. |
void |
addAncestorListener(AncestorListener listener)
Registers the given listener as an AncestorListener of this IFigure. |
void |
addFigureListener(FigureListener listener)
Registers the given listener as a FigureListener of this IFigure. |
void |
addFocusListener(FocusListener listener)
Registers the given listener as a FocusListener of this IFigure. |
void |
addKeyListener(KeyListener listener)
Registers the given listener as a KeyListner of this IFigure. |
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 |
addNotify()
Called after this IFigure is added to its parent. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
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
IFigure's bounds. |
boolean |
containsPoint(Point p)
Returns true if the Point p is contained within this IFigure's bounds. |
void |
erase()
Erases this IFigure. |
IFigure |
findFigureAt(int x,
int y)
Returns the IFigure at the specified location. |
IFigure |
findFigureAt(int x,
int y,
TreeSearch search)
Returns the IFigure at the specified location based on the conditional TreeSearch. |
IFigure |
findFigureAt(Point p)
Returns the IFigure at the specified location. |
IFigure |
findFigureAtExcluding(int x,
int y,
Collection collection)
Returns the IFigure at the specified location, excluding any IFigures in collection . |
IFigure |
findMouseEventTargetAt(int x,
int y)
Returns the IFigure 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 IFigure. |
List |
getChildren()
Returns an unmodifiable list 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. |
Rectangle |
getClientArea(Rectangle rect)
Copies the client area into the specificied Recangle, and returns that rectangle for convenience. |
Cursor |
getCursor()
Returns the Cursor used when the mouse is over this IFigure. |
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. |
Color |
getLocalBackgroundColor()
Returns the background Color of this Figure. |
Color |
getLocalForegroundColor()
Returns the local foreground Color of this Figure. |
Dimension |
getMaximumSize()
Returns a hint indicating the largest desireable size for the IFigure. |
Dimension |
getMinimumSize()
Returns a hint indicating the smallest desireable size for the IFigure. |
Dimension |
getMinimumSize(int wHint,
int hHint)
Returns a hint indicating the smallest desireable size for the IFigure. |
IFigure |
getParent()
Returns the IFigure that is the current parent of this IFigure or null if
there is no parent. |
Dimension |
getPreferredSize()
Returns the desireable size for this IFigure. |
Dimension |
getPreferredSize(int wHint,
int hHint)
Returns the desireable size for this IFigure using the provided width and height hints. |
Dimension |
getSize()
Returns the current size. |
IFigure |
getToolTip()
Returns a IFigure that is the tooltip for this IFigure. |
UpdateManager |
getUpdateManager()
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 |
handleMouseDoubleClicked(MouseEvent event)
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()
Returns true if this IFigure has focus. |
EventDispatcher |
internalGetEventDispatcher()
This method is for internal purposes only and should not be called. |
boolean |
intersects(Rectangle rect)
Returns true if this IFigure's bounds intersect with the given Rectangle.
|
void |
invalidate()
Invalidates this IFigure. |
void |
invalidateTree()
Invalidates this figure as well as all contained within. |
boolean |
isEnabled()
Returns true if this IFigure is enabled. |
boolean |
isFocusTraversable()
Returns true if this IFigure can gain focus on a
TraverseEvent . |
boolean |
isOpaque()
Returns true if this IFigure is opaque. |
boolean |
isRequestFocusEnabled()
Returns true if this IFigure can receive focus on a call to
requestFocus() . |
boolean |
isShowing()
Returns true if this IFigure is showing. |
boolean |
isVisible()
returns true if this figure's visibility flag is set to true. |
void |
paint(Graphics graphics)
Paints this IFigure and its children. |
void |
remove(IFigure figure)
Removes the given IFigure from this IFigure's list of children. |
void |
removeAncestorListener(AncestorListener listener)
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 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 |
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 IFigure 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 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 are w and
h , respectively. |
void |
repaint(Rectangle rect)
Repaints the rectangular area within this IFigure represented by rect . |
void |
requestFocus()
Requests focus from the EventDispatcher . |
void |
revalidate()
Revalidates this IFigure. |
void |
setBackgroundColor(Color c)
Sets the background color. |
void |
setBorder(Border b)
Sets the border. |
void |
setBounds(Rectangle rect)
Sets the bounds to the bounds of the specified Rectangle . |
void |
setConstraint(IFigure child,
Object constraint)
Convenience method to set the constraint of the specified child in the current LayoutManager. |
void |
setCursor(Cursor cursor)
Sets the cursor. |
void |
setEnabled(boolean value)
Sets this IFigure to be enabled. |
void |
setFocusTraversable(boolean value)
Sets the ability for this IFigure 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 IFigure. |
void |
setMaximumSize(Dimension size)
Sets the maximum size this IFigure can be. |
void |
setMinimumSize(Dimension size)
Sets the minimum size this IFigure can be. |
void |
setOpaque(boolean isOpaque)
Sets this IFigure to be opaque if isOpaque is true and transparent
if isOpaque is false . |
void |
setParent(IFigure parent)
Sets this IFigure's parent. |
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 to requestFocus() . |
void |
setSize(Dimension d)
Sets this IFigure's size. |
void |
setSize(int w,
int h)
Sets this IFigure's size. |
void |
setToolTip(IFigure figure)
Sets a tooltip that is displayed when the mouse hovers over this IFigure. |
void |
setVisible(boolean visible)
Sets this IFigure's visibility. |
void |
translate(int x,
int y)
Moves this IFigure x pixels horizontally and y pixels
vertically. |
void |
translateFromParent(Translatable t)
Translates a Translatable from this IFigure's parent's coordinates to this IFigure's local coordinates. |
void |
translateToAbsolute(Translatable t)
Translates a Translatable that is relative to this figure's bounds to absolute. |
void |
translateToParent(Translatable t)
Translates a Translatable from this IFigure's coordinates to its parent's coordinates. |
void |
translateToRelative(Translatable t)
Translates a Translatable in absolute coordinates to be relative to this figure's bounds. |
void |
validate()
Causes this IFigure to layout itself, as well as its children. |
Field Detail |
public static final Dimension MAX_DIMENSION
Integer.MAX_VALUE
,Integer.MAX_VALUE
)
public static final Dimension MIN_DIMENSION
public static final Insets NO_INSETS
Method Detail |
public void add(IFigure figure)
figure
- The IFigure to addpublic void add(IFigure figure, int index)
figure
- The IFigure to addindex
- The index where the IFigure should be addedpublic void add(IFigure figure, Object constraint)
figure
- The IFigure to addconstraint
- The newly added IFigure's constraintpublic void add(IFigure figure, Object constraint, int index)
figure
- The IFigure to addconstraint
- The newly added IFigure's constraintindex
- The index where the IFigure should be added
IndexOutOfBoundsException
- if the index is out of range
IllegalArgumentException
- if adding the child creates a cyclepublic void addAncestorListener(AncestorListener listener)
listener
- The listener to addpublic void addFigureListener(FigureListener listener)
listener
- The listener to addpublic void addFocusListener(FocusListener listener)
listener
- The listener to addpublic void addKeyListener(KeyListener listener)
listener
- The listener to addpublic void addMouseListener(MouseListener listener)
listener
- The listener to addpublic void addMouseMotionListener(MouseMotionListener listener)
listener
- The listener to addpublic void addNotify()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to addpublic void addPropertyChangeListener(String property, PropertyChangeListener listener)
property
- The property the listener is interested inlistener
- The listener to addpublic boolean containsPoint(int x, int y)
true
if the point (x, y)
is contained within this
IFigure's bounds.
x
- The X coordinatey
- The Y coordinate
true
if the point (x,y) is contained in this IFigure's boundspublic boolean containsPoint(Point p)
true
if the Point p is contained within this IFigure's bounds.
p
- The point
true
if the Point p is contained within this IFigure's boundspublic void erase()
public IFigure findFigureAt(int x, int y)
this
or
null
.
x
- The X coordinatey
- The Y coordinate
public IFigure findFigureAt(int x, int y, TreeSearch search)
this
or null
x
- the X coordinatey
- the Y coordinatesearch
- the conditional TreeSearch
public IFigure findFigureAt(Point p)
this
or
null
.
p
- The point
public IFigure findFigureAtExcluding(int x, int y, Collection collection)
collection
. May return this
or null
.
x
- The X coordinatey
- The Y coordinatecollection
- A collection of IFigures to be excluded
public IFigure findMouseEventTargetAt(int x, int y)
x
- The X coordinatey
- The Y coordinate
public Color getBackgroundColor()
public Border getBorder()
public Rectangle getBounds()
public List getChildren()
public Rectangle getClientArea()
LayoutManagers
) and the painting of children will be
clipped.
public Rectangle getClientArea(Rectangle rect)
rect
- The destination rectangle for the client area
public Cursor getCursor()
public Font getFont()
public Color getForegroundColor()
public Insets getInsets()
public LayoutManager getLayoutManager()
public Color getLocalBackgroundColor()
public Color getLocalForegroundColor()
public Dimension getMaximumSize()
public Dimension getMinimumSize()
public Dimension getMinimumSize(int wHint, int hHint)
wHint
- the width hinthHint
- the height hint
public IFigure getParent()
null
if
there is no parent.
public Dimension getPreferredSize()
public Dimension getPreferredSize(int wHint, int hHint)
wHint
- The width hinthHint
- The height hint
public Dimension getSize()
public IFigure getToolTip()
public UpdateManager getUpdateManager()
public void handleFocusGained(FocusEvent event)
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.
event
- The focus eventpublic void handleFocusLost(FocusEvent event)
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.
event
- The focus eventpublic void handleKeyPressed(KeyEvent event)
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.
event
- The key eventpublic void handleKeyReleased(KeyEvent event)
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.
event
- The key eventpublic void handleMouseDoubleClicked(MouseEvent event)
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.
event
- The mouse eventpublic void handleMouseDragged(MouseEvent event)
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.
event
- The mouse eventpublic void handleMouseEntered(MouseEvent event)
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.
event
- The mouse eventpublic void handleMouseExited(MouseEvent event)
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.
event
- The mouse eventpublic void handleMouseHover(MouseEvent event)
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.
event
- The mouse eventpublic void handleMouseMoved(MouseEvent event)
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.
event
- The mouse eventpublic void handleMousePressed(MouseEvent event)
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.
event
- The mouse eventpublic void handleMouseReleased(MouseEvent event)
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.
event
- The mouse eventpublic boolean hasFocus()
true
if this IFigure has focus.
true
if this IFigure has focuspublic EventDispatcher internalGetEventDispatcher()
public boolean intersects(Rectangle rect)
true
if this IFigure's bounds intersect with the given Rectangle.
Figure is asked so that non-rectangular IFigures can reduce the frequency of paints.
rect
- The rectangle to check for intersection
true
if this IFigure's bounds intersect with the given Rectanglepublic void invalidate()
public void invalidateTree()
public boolean isEnabled()
true
if this IFigure is enabled.
true
if this IFigure is enabledpublic boolean isFocusTraversable()
true
if this IFigure can gain focus on a
TraverseEvent
.
true
if this IFigure can gain focus on a TraverseEventpublic boolean isOpaque()
true
if this IFigure is opaque.
true
if this IFigure is opaquepublic boolean isRequestFocusEnabled()
true
if this IFigure can receive focus on a call to
requestFocus()
.
true
if this IFigure can receive focus on a call to requestFocus()public boolean isShowing()
true
if this IFigure is showing. This figure is only showing if
it is visible and its parent is showing, or it has no parent.
true
if this IFigure is showingpublic boolean isVisible()
true
if this figure's visibility flag is set to true. Does not
walk up the parent chain.
true
if the figure's visibility flag is setpublic void paint(Graphics graphics)
graphics
- The Graphics object used for paintingpublic void remove(IFigure figure)
figure
- The IFigure to removepublic void removeAncestorListener(AncestorListener listener)
listener
- The listener to removepublic void removeFigureListener(FigureListener listener)
listener
- The listener to removepublic void removeFocusListener(FocusListener listener)
listener
- The listener to removepublic void removeKeyListener(KeyListener listener)
listener
- The listener to removepublic void removeMouseListener(MouseListener listener)
listener
- The listener to removepublic void removeMouseMotionListener(MouseMotionListener listener)
listener
- The listener to removepublic void removeNotify()
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to removepublic void removePropertyChangeListener(String property, PropertyChangeListener listener)
property
- The property that the listener is no longer interested inlistener
- The listener no longer interested in the propertypublic void repaint()
public void repaint(int x, int y, int w, int h)
(x,y)
and whose width and height are w
and
h
, respectively.
x
- The X coordinate of the area to repainty
- The Y coordinate of the area to repaintw
- The width of the area to repainth
- The height of the area to repaintpublic void repaint(Rectangle rect)
rect
.
rect
- The rectangular area to be repaintedpublic void requestFocus()
EventDispatcher
.
public void revalidate()
public void setBackgroundColor(Color c)
c
- The new background colorpublic void setBorder(Border b)
b
- The new borderpublic void setBounds(Rectangle rect)
Rectangle
.
rect
- The new boundspublic void setConstraint(IFigure child, Object constraint)
child
- The figure whose constraint is being setconstraint
- the constraint
IllegalArgumentException
- if the child is not contained by this Figurepublic void setCursor(Cursor cursor)
cursor
- The new cursorpublic void setEnabled(boolean value)
value
- true
if this IFigure should be enabledpublic void setFocusTraversable(boolean value)
TraverseEvent
.
value
- true
if this IFigure should gain focus on a TraverseEventpublic void setFont(Font f)
f
- The new fontpublic void setForegroundColor(Color c)
c
- The new foreground colorpublic void setLayoutManager(LayoutManager lm)
lm
- The new layout managerpublic void setLocation(Point p)
p
- The new locationpublic void setMaximumSize(Dimension size)
size
- The new maximum sizepublic void setMinimumSize(Dimension size)
size
- The new minimum sizepublic void setOpaque(boolean isOpaque)
true
and transparent
if isOpaque is false
.
isOpaque
- true
is this IFigure should be opaquepublic void setParent(IFigure parent)
parent
- The new parent IFigurepublic void setPreferredSize(Dimension size)
size
- The new preferred sizepublic void setRequestFocusEnabled(boolean requestFocusEnabled)
requestFocus()
.
requestFocusEnabled
- true
if this IFigure should gain focus on a call
to requestFocus()public void setSize(Dimension d)
d
- The new sizepublic void setSize(int w, int h)
w
- The new widthh
- The new heightpublic void setToolTip(IFigure figure)
figure
- The tooltip IFigurepublic void setVisible(boolean visible)
visible
- true
if this IFigure should be visiblepublic void translate(int x, int y)
x
pixels horizontally and y
pixels
vertically.
x
- The amount to move this IFigure horizontallyy
- The amount to move this IFigure verticallypublic void translateFromParent(Translatable t)
t
- The object to translatepublic void translateToAbsolute(Translatable t)
t
- The object to translatepublic void translateToParent(Translatable t)
t
- The object to translatepublic void translateToRelative(Translatable t)
t
- The object to translatepublic void validate()
|
Eclipse Draw2d 2.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |