CH.ifa.draw.framework
Interface Drawing
-
- All Superinterfaces:
- java.util.EventListener, FigureChangeListener, java.io.Serializable, Storable
- All Known Implementing Classes:
- BouncingDrawing, NeuralNetDrawing, StandardDrawing
public interface Drawing extends Storable, FigureChangeListener, java.io.Serializable
Drawing is a container for figures.Drawing sends out DrawingChanged events to DrawingChangeListeners whenever a part of its area was invalidated.
Design Patterns
Observer
The Observer pattern is used to decouple the Drawing from its views and to enable multiple views.- See Also:
Figure,DrawingView,FigureChangeListener
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Figureadd(Figure figure)Adds a figure and sets its container to refer to this drawing.voidaddAll(java.util.Vector newFigures)Adds a vector of figures.voidaddDrawingChangeListener(DrawingChangeListener listener)Adds a listener for this drawing.voidbringToFront(Figure figure)Brings a figure to the front.voiddraw(java.awt.Graphics g)Draws all the figures back to front.java.util.EnumerationdrawingChangeListeners()Gets the listeners of a drawing.voidfigureInvalidated(FigureChangeEvent e)Invalidates a rectangle and merges it with the existing damaged area.voidfigureRequestRemove(FigureChangeEvent e)Handles a removeFrfigureRequestRemove request that is passed up the figure container hierarchy.voidfigureRequestUpdate(FigureChangeEvent e)Forces an update of the drawing change listeners.FigureEnumerationfigures()Returns an enumeration to iterate in Z-order back to front over the figures.FigureEnumerationfiguresReverse()Returns an enumeration to iterate in Z-order front to back over the figures.FigurefindFigure(int x, int y)Finds a top level Figure.FigurefindFigure(java.awt.Rectangle r)Finds a top level Figure that intersects the given rectangle.FigurefindFigure(java.awt.Rectangle r, Figure without)Finds a top level Figure that intersects the given rectangle.FigurefindFigureInside(int x, int y)Finds a figure but descends into a figure's children.FigurefindFigureInsideWithout(int x, int y, Figure without)Finds a figure but descends into a figure's children.FigurefindFigureWithout(int x, int y, Figure without)Finds a top level Figure, but supresses the passed in figure.voidlock()Acquires the drawing lock.Figureorphan(Figure figure)Removes a figure from the figure list, but doesn't release it.voidorphanAll(java.util.Vector newFigures)Removes a vector of figures from the figure's list without releasing the figures.voidrelease()Releases the drawing and its contained figures.Figureremove(Figure figure)Removes the figure from the drawing and releases it.voidremoveAll(java.util.Vector figures)Removes a vector of figures .voidremoveDrawingChangeListener(DrawingChangeListener listener)Removes a listener from this drawing.voidreplace(Figure figure, Figure replacement)Replaces a figure in the drawing without removing it from the drawing.voidsendToBack(Figure figure)Sends a figure to the back of the drawing.voidunlock()Releases the drawing lock.-
Methods inherited from interface CH.ifa.draw.framework.FigureChangeListener
figureChanged, figureRemoved
-
-
-
-
Method Detail
-
release
void release()
Releases the drawing and its contained figures.
-
figures
FigureEnumeration figures()
Returns an enumeration to iterate in Z-order back to front over the figures.
-
figuresReverse
FigureEnumeration figuresReverse()
Returns an enumeration to iterate in Z-order front to back over the figures.
-
findFigure
Figure findFigure(int x, int y)
Finds a top level Figure. Use this call for hit detection that should not descend into the figure's children.
-
findFigure
Figure findFigure(java.awt.Rectangle r)
Finds a top level Figure that intersects the given rectangle.
-
findFigureWithout
Figure findFigureWithout(int x, int y, Figure without)
Finds a top level Figure, but supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.- Parameters:
x- the x coordinatey- the y coordinatewithout- the figure to be ignored during the find.
-
findFigure
Figure findFigure(java.awt.Rectangle r, Figure without)
Finds a top level Figure that intersects the given rectangle. It supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.
-
findFigureInside
Figure findFigureInside(int x, int y)
Finds a figure but descends into a figure's children. Use this method to implement click-through hit detection, that is, you want to detect the inner most figure containing the given point.
-
findFigureInsideWithout
Figure findFigureInsideWithout(int x, int y, Figure without)
Finds a figure but descends into a figure's children. It supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.- Parameters:
x- the x coordinatey- the y coordinatewithout- the figure to be ignored during the find.
-
addDrawingChangeListener
void addDrawingChangeListener(DrawingChangeListener listener)
Adds a listener for this drawing.
-
removeDrawingChangeListener
void removeDrawingChangeListener(DrawingChangeListener listener)
Removes a listener from this drawing.
-
drawingChangeListeners
java.util.Enumeration drawingChangeListeners()
Gets the listeners of a drawing.
-
add
Figure add(Figure figure)
Adds a figure and sets its container to refer to this drawing.- Returns:
- the figure that was inserted.
-
addAll
void addAll(java.util.Vector newFigures)
Adds a vector of figures.
-
orphan
Figure orphan(Figure figure)
Removes a figure from the figure list, but doesn't release it. Use this method to temporarily manipulate a figure outside of the drawing.
-
orphanAll
void orphanAll(java.util.Vector newFigures)
Removes a vector of figures from the figure's list without releasing the figures.- See Also:
orphan(CH.ifa.draw.framework.Figure)
-
removeAll
void removeAll(java.util.Vector figures)
Removes a vector of figures .- See Also:
remove(CH.ifa.draw.framework.Figure)
-
replace
void replace(Figure figure, Figure replacement)
Replaces a figure in the drawing without removing it from the drawing.
-
sendToBack
void sendToBack(Figure figure)
Sends a figure to the back of the drawing.
-
bringToFront
void bringToFront(Figure figure)
Brings a figure to the front.
-
draw
void draw(java.awt.Graphics g)
Draws all the figures back to front.
-
figureInvalidated
void figureInvalidated(FigureChangeEvent e)
Invalidates a rectangle and merges it with the existing damaged area.- Specified by:
figureInvalidatedin interfaceFigureChangeListener
-
figureRequestUpdate
void figureRequestUpdate(FigureChangeEvent e)
Forces an update of the drawing change listeners.- Specified by:
figureRequestUpdatein interfaceFigureChangeListener
-
figureRequestRemove
void figureRequestRemove(FigureChangeEvent e)
Handles a removeFrfigureRequestRemove request that is passed up the figure container hierarchy.- Specified by:
figureRequestRemovein interfaceFigureChangeListener- See Also:
FigureChangeListener
-
lock
void lock()
Acquires the drawing lock.
-
unlock
void unlock()
Releases the drawing lock.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG