JHotDraw 6.0b1

org.jhotdraw.standard
Class StandardDrawing

java.lang.Object
  extended by org.jhotdraw.standard.AbstractFigure
      extended by org.jhotdraw.standard.CompositeFigure
          extended by org.jhotdraw.standard.StandardDrawing
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, Drawing, Figure, FigureChangeListener, Storable
Direct Known Subclasses:
BouncingDrawing

public class StandardDrawing
extends CompositeFigure
implements Drawing

The standard implementation of the Drawing interface.

See Also:
Drawing, Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.standard.CompositeFigure
_nHighestZ, _nLowestZ, fFigures
 
Constructor Summary
StandardDrawing()
          Constructs the Drawing.
 
Method Summary
 Figure add(Figure figure)
          Adds a figure to the list of figures.
 void addDrawingChangeListener(DrawingChangeListener listener)
          Adds a listener for this drawing.
 void basicDisplayBox(java.awt.Point p1, java.awt.Point p2)
          Sets the display box of a figure.
 java.awt.Rectangle displayBox()
          Gets the display box.
 java.util.Iterator drawingChangeListeners()
          Gets an enumeration with all listener for this drawing.
 void figureInvalidated(FigureChangeEvent e)
          Invalidates a rectangle and merges it with the existing damaged area.
 void figureRequestUpdate(FigureChangeEvent e)
          Forces an update of the drawing change listeners.
 void fireDrawingTitleChanged()
          Forces an update of the drawing change listeners.
 java.lang.String getTitle()
           
 HandleEnumeration handles()
          Return's the figure's handles.
 void lock()
          Acquires the drawing lock.
 Figure orphan(Figure figure)
          Removes a figure from the figure list, but doesn't release it.
 void removeDrawingChangeListener(DrawingChangeListener listener)
          Removes a listener from this drawing.
 void setTitle(java.lang.String newTitle)
           
 void unlock()
          Releases the drawing lock.
 
Methods inherited from class org.jhotdraw.standard.CompositeFigure
addAll, addAll, basicMoveBy, bringToFront, containsFigure, draw, draw, figureAt, figureChanged, figureCount, figureRemoved, figureRequestRemove, figures, figures, figuresReverse, findFigure, findFigure, findFigure, findFigureInside, findFigureInsideWithout, findFigureWithout, getFigureFromLayer, getLayer, includes, init, orphanAll, orphanAll, read, release, remove, removeAll, removeAll, removeAll, replace, sendToBack, sendToLayer, write
 
Methods inherited from class org.jhotdraw.standard.AbstractFigure
addDependendFigure, addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, getAttribute, getAttribute, getDecoratedFigure, getDependendFigures, getTextHolder, getZValue, invalidate, invalidateRectangle, isEmpty, listener, moveBy, removeDependendFigure, removeFigureChangeListener, removeFromContainer, setAttribute, setAttribute, setZValue, size, visit, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.framework.Drawing
addAll, addAll, bringToFront, containsFigure, draw, draw, figures, figures, figuresReverse, findFigure, findFigure, findFigure, findFigureInside, findFigureInsideWithout, findFigureWithout, getFigureFromLayer, getLayer, includes, init, orphanAll, orphanAll, release, remove, removeAll, removeAll, replace, sendToBack, sendToLayer
 
Methods inherited from interface org.jhotdraw.util.Storable
read, write
 
Methods inherited from interface org.jhotdraw.framework.FigureChangeListener
figureChanged, figureRemoved, figureRequestRemove
 

Constructor Detail

StandardDrawing

public StandardDrawing()
Constructs the Drawing.

Method Detail

addDrawingChangeListener

public void addDrawingChangeListener(DrawingChangeListener listener)
Adds a listener for this drawing.

Specified by:
addDrawingChangeListener in interface Drawing

removeDrawingChangeListener

public void removeDrawingChangeListener(DrawingChangeListener listener)
Removes a listener from this drawing.

Specified by:
removeDrawingChangeListener in interface Drawing

drawingChangeListeners

public java.util.Iterator drawingChangeListeners()
Gets an enumeration with all listener for this drawing.

Specified by:
drawingChangeListeners in interface Drawing
Returns:
new iterator of all registered change listener

orphan

public 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.

Specified by:
orphan in interface Drawing
Overrides:
orphan in class CompositeFigure
Parameters:
figure - that is part of the drawing and should be added

add

public Figure add(Figure figure)
Description copied from class: CompositeFigure
Adds a figure to the list of figures. Initializes the the figure's container.

Specified by:
add in interface Drawing
Overrides:
add in class CompositeFigure
Parameters:
figure - to be added to the drawing
Returns:
the figure that was inserted (might be different from the figure specified).

figureInvalidated

public void figureInvalidated(FigureChangeEvent e)
Invalidates a rectangle and merges it with the existing damaged area.

Specified by:
figureInvalidated in interface FigureChangeListener
Overrides:
figureInvalidated in class CompositeFigure
See Also:
FigureChangeListener

fireDrawingTitleChanged

public void fireDrawingTitleChanged()
Forces an update of the drawing change listeners.


figureRequestUpdate

public void figureRequestUpdate(FigureChangeEvent e)
Forces an update of the drawing change listeners.

Specified by:
figureRequestUpdate in interface FigureChangeListener
Overrides:
figureRequestUpdate in class CompositeFigure
See Also:
FigureChangeListener

handles

public HandleEnumeration handles()
Return's the figure's handles. This is only used when a drawing is nested inside another drawing.

Specified by:
handles in interface Figure
Specified by:
handles in class AbstractFigure
Returns:
a type-safe iterator of handles
See Also:
Handle

displayBox

public java.awt.Rectangle displayBox()
Gets the display box. This is the union of all figures.

Specified by:
displayBox in interface Figure
Specified by:
displayBox in class AbstractFigure
See Also:
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)

basicDisplayBox

public void basicDisplayBox(java.awt.Point p1,
                            java.awt.Point p2)
Description copied from class: AbstractFigure
Sets the display box of a figure. This is the method that subclassers override. Clients usually call displayBox.

Specified by:
basicDisplayBox in interface Figure
Specified by:
basicDisplayBox in class AbstractFigure
Parameters:
p1 - the new origin
p2 - the new corner
See Also:
AbstractFigure.displayBox(java.awt.Point, java.awt.Point)

lock

public void lock()
Acquires the drawing lock.

Specified by:
lock in interface Drawing

unlock

public void unlock()
Releases the drawing lock.

Specified by:
unlock in interface Drawing

getTitle

public java.lang.String getTitle()
Specified by:
getTitle in interface Drawing

setTitle

public void setTitle(java.lang.String newTitle)
Specified by:
setTitle in interface Drawing

JHotDraw 6.0b1