|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Drawing is a container for figures.
Drawing sends out DrawingChanged events to DrawingChangeListeners whenever a part of its area was invalidated.
Observer
The Observer pattern is used to decouple the Drawing from its views and
to enable multiple views.
Figure
,
DrawingView
,
FigureChangeListener
Method Summary | |
Figure |
add(Figure figure)
Adds a figure and sets its container to refer to this drawing. |
void |
addAll(FigureEnumeration fe)
Adds a FigureEnumeration of figures. |
void |
addAll(java.util.List newFigures)
Deprecated. use addAll(FigureEnumeration) instead |
void |
addDrawingChangeListener(DrawingChangeListener listener)
Adds a listener for this drawing. |
void |
bringToFront(Figure figure)
Brings a figure to the front. |
boolean |
containsFigure(Figure figure)
Check whether a given figure is a (direct) child figure of this CompositeFigure. |
void |
draw(java.awt.Graphics g)
Draws all the figures back to front. |
void |
draw(java.awt.Graphics g,
FigureEnumeration fe)
Draws only the given figures. |
java.util.Iterator |
drawingChangeListeners()
Gets the listeners of a drawing. |
FigureEnumeration |
figures()
Returns an enumeration to iterate in Z-order back to front over the figures. |
FigureEnumeration |
figures(java.awt.Rectangle viewRectangle)
Returns an enumeration to iterate in Z-order back to front over the figures that lie within the absolute bounds. |
FigureEnumeration |
figuresReverse()
Returns an enumeration to iterate in Z-order front to back over the figures. |
Figure |
findFigure(int x,
int y)
Finds a top level Figure. |
Figure |
findFigure(java.awt.Rectangle r)
Finds a top level Figure that intersects the given rectangle. |
Figure |
findFigure(java.awt.Rectangle r,
Figure without)
Finds a top level Figure that intersects the given rectangle. |
Figure |
findFigureInside(int x,
int y)
Finds a figure but descends into a figure's children. |
Figure |
findFigureInsideWithout(int x,
int y,
Figure without)
Finds a figure but descends into a figure's children. |
Figure |
findFigureWithout(int x,
int y,
Figure without)
Finds a top level Figure, but supresses the passed in figure. |
Figure |
getFigureFromLayer(int layerNr)
Gets the figure from a certain layer. |
int |
getLayer(Figure figure)
Gets the layer for a certain figure (first occurrence). |
java.lang.String |
getTitle()
|
boolean |
includes(Figure figure)
Checks if the composite figure has the argument as one of its children. |
void |
init(java.awt.Rectangle viewRectangle)
Used to optimize rendering. |
void |
lock()
Acquires the drawing lock. |
Figure |
orphan(Figure figure)
Removes a figure from the figure list, but doesn't release it. |
void |
orphanAll(FigureEnumeration fe)
Removes a FigureEnumeration of figures from the figure's list without releasing the figures. |
void |
orphanAll(java.util.List orphanFigures)
Deprecated. use orphanAll(FigureEnumeration) instead |
void |
release()
Releases the drawing and its contained figures. |
Figure |
remove(Figure figure)
Removes the figure from the drawing and releases it. |
void |
removeAll(FigureEnumeration fe)
Removes a FigureEnumeration of figures. |
void |
removeAll(java.util.List figures)
Deprecated. use removeAll(FigureEnumeration) instead |
void |
removeDrawingChangeListener(DrawingChangeListener listener)
Removes a listener from this drawing. |
Figure |
replace(Figure figure,
Figure replacement)
Replaces a figure in the drawing without removing it from the drawing. |
void |
sendToBack(Figure figure)
Sends a figure to the back of the drawing. |
void |
sendToLayer(Figure figure,
int layerNr)
Sends a figure to a certain layer within a drawing. |
void |
setTitle(java.lang.String name)
|
void |
unlock()
Releases the drawing lock. |
Methods inherited from interface org.jhotdraw.util.Storable |
read, write |
Methods inherited from interface org.jhotdraw.framework.FigureChangeListener |
figureChanged, figureInvalidated, figureRemoved, figureRequestRemove, figureRequestUpdate |
Method Detail |
public void release()
public FigureEnumeration figures()
public FigureEnumeration figures(java.awt.Rectangle viewRectangle)
public FigureEnumeration figuresReverse()
public Figure findFigure(int x, int y)
public Figure findFigure(java.awt.Rectangle r)
public Figure findFigureWithout(int x, int y, Figure without)
x
- the x coordinatey
- the y coordinatewithout
- the figure to be ignored during
the find.public Figure findFigure(java.awt.Rectangle r, Figure without)
public Figure findFigureInside(int x, int y)
public Figure findFigureInsideWithout(int x, int y, Figure without)
x
- the x coordinatey
- the y coordinatewithout
- the figure to be ignored during
the find.public boolean includes(Figure figure)
figure
- figure to be searched in all descendants
public boolean containsFigure(Figure figure)
figure
- figure to be searched in all direct descendents
public void addDrawingChangeListener(DrawingChangeListener listener)
public void removeDrawingChangeListener(DrawingChangeListener listener)
public java.util.Iterator drawingChangeListeners()
public Figure add(Figure figure)
figure
- to be added to the drawing
public void addAll(java.util.List newFigures)
public void addAll(FigureEnumeration fe)
fe
- (unused) enumeration containing all figures to be addedadd(org.jhotdraw.framework.Figure)
public Figure remove(Figure figure)
figure
- that is part of the drawing and should be removed
public Figure orphan(Figure figure)
figure
- that is part of the drawing and should be addedpublic void orphanAll(java.util.List orphanFigures)
orphan(org.jhotdraw.framework.Figure)
public void orphanAll(FigureEnumeration fe)
orphan(org.jhotdraw.framework.Figure)
public void removeAll(java.util.List figures)
remove(org.jhotdraw.framework.Figure)
public void removeAll(FigureEnumeration fe)
remove(org.jhotdraw.framework.Figure)
public Figure replace(Figure figure, Figure replacement)
figure
- figure to be replacedreplacement
- figure that should replace the specified figure
public void sendToBack(Figure figure)
figure
- that is part of the drawingpublic void bringToFront(Figure figure)
figure
- that is part of the drawingpublic void sendToLayer(Figure figure, int layerNr)
figure
- figure to be sent to a certain layerlayerNr
- target layer of the figurepublic int getLayer(Figure figure)
figure
- figure to be queried for its layering place
sendToLayer(org.jhotdraw.framework.Figure, int)
public Figure getFigureFromLayer(int layerNr)
layerNr
- number of the layer which figure should be returned
sendToLayer(org.jhotdraw.framework.Figure, int)
public void draw(java.awt.Graphics g)
public void draw(java.awt.Graphics g, FigureEnumeration fe)
public void lock()
public void unlock()
public void init(java.awt.Rectangle viewRectangle)
public java.lang.String getTitle()
public void setTitle(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |