JHotDraw 7.0.6

org.jhotdraw.draw
Class DefaultDrawing

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractDrawing
          extended by org.jhotdraw.draw.DefaultDrawing
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.event.UndoableEditListener, Drawing, FigureListener, DOMStorable
Direct Known Subclasses:
SVGDrawing

public class DefaultDrawing
extends AbstractDrawing
implements FigureListener, javax.swing.event.UndoableEditListener

DefaultDrawing.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.AbstractDrawing
listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
DefaultDrawing()
          Creates a new instance.
 
Method Summary
 void basicAdd(int index, Figure figure)
          Reinserts a figure which was temporarily removed using basicRemove.
 void basicRemove(Figure figure)
          Removes a figure temporarily from the drawing.
 void bringToFront(Figure figure)
          Brings a figure to the front.
 boolean contains(Figure f)
          Returns true if this drawing contains the specified figure.
 void draw(java.awt.Graphics2D g)
          Draws all the figures from back to front.
 void draw(java.awt.Graphics2D g, java.util.Collection<Figure> figures)
           
 void figureAdded(FigureEvent e)
          Sent when a figure was added to a drawing.
 void figureAreaInvalidated(FigureEvent e)
          Sent when an area used by the figure needs to be repainted.
 void figureAttributeChanged(FigureEvent e)
          Sent when an attribute of the figure has changed.
 void figureChanged(FigureEvent e)
          Sent when the geometry (e.g.
 void figureRemoved(FigureEvent e)
          Sent when a figure was removed from a drawing.
 void figureRequestRemove(FigureEvent e)
          Sent when the figure requests to be removed from a drawing.
 Figure findFigure(java.awt.geom.Point2D.Double p)
          Finds a top level Figure.
 Figure findFigureExcept(java.awt.geom.Point2D.Double p, java.util.Collection<Figure> ignore)
          Finds a top level Figure.
 Figure findFigureExcept(java.awt.geom.Point2D.Double p, Figure ignore)
          Finds a top level Figure.
 Figure findFigureInside(java.awt.geom.Point2D.Double p)
          Finds a figure but descends into a figure's children.
 java.util.Collection<Figure> findFigures(java.awt.geom.Rectangle2D.Double bounds)
          Returns all figures that lie within or intersect the specified bounds.
 java.util.Collection<Figure> findFiguresWithin(java.awt.geom.Rectangle2D.Double bounds)
          Returns all figures that lie within the specified bounds.
 java.util.Collection<Figure> getFigures()
          Returns the figures of the drawing.
 java.util.List<Figure> getFiguresFrontToBack()
          Returns an iterator to iterate in Z-order front to back over the figures.
protected  int indexOf(Figure figure)
           
 void sendToBack(Figure figure)
          Sends a figure to the back of the drawing.
 java.util.Collection<Figure> sort(java.util.Collection<Figure> c)
          Returns a copy of the provided collection which is sorted in z order from back to front.
 void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
          We propagate all edit events from our figures to undoable edit listeners, which have registered with us.
 
Methods inherited from class org.jhotdraw.draw.AbstractDrawing
add, addAll, addDrawingListener, addUndoableEditListener, basicAdd, basicAddAll, basicRemoveAll, clear, fireAreaInvalidated, fireFigureAdded, fireFigureRemoved, fireUndoableEditHappened, getFigureCount, getFontRenderContext, getLock, read, remove, removeAll, removeDrawingListener, removeUndoableEditListener, setFontRenderContext, write
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDrawing

public DefaultDrawing()
Creates a new instance.

Method Detail

indexOf

protected int indexOf(Figure figure)
Specified by:
indexOf in class AbstractDrawing

basicAdd

public void basicAdd(int index,
                     Figure figure)
Description copied from interface: Drawing
Reinserts a figure which was temporarily removed using basicRemove. The drawing sends no addNotify message to the figure.

Specified by:
basicAdd in interface Drawing
figure - that is part of the drawing and should be removed
See Also:
Drawing.basicRemove(Figure)

basicRemove

public void basicRemove(Figure figure)
Description copied from interface: Drawing
Removes a figure temporarily from the drawing. The drawing sends no removeNotify message to the figure.

Specified by:
basicRemove in interface Drawing
Parameters:
figure - that is part of the drawing and should be removed
See Also:
Drawing.basicAdd(Figure)

draw

public void draw(java.awt.Graphics2D g)
Description copied from interface: Drawing
Draws all the figures from back to front.

Specified by:
draw in interface Drawing

draw

public void draw(java.awt.Graphics2D g,
                 java.util.Collection<Figure> figures)

sort

public java.util.Collection<Figure> sort(java.util.Collection<Figure> c)
Description copied from interface: Drawing
Returns a copy of the provided collection which is sorted in z order from back to front.

Specified by:
sort in interface Drawing

figureAreaInvalidated

public void figureAreaInvalidated(FigureEvent e)
Description copied from interface: FigureListener
Sent when an area used by the figure needs to be repainted.

Specified by:
figureAreaInvalidated in interface FigureListener

figureChanged

public void figureChanged(FigureEvent e)
Description copied from interface: FigureListener
Sent when the geometry (e.g. the bounds) of the figure has changed.

Specified by:
figureChanged in interface FigureListener

figureAdded

public void figureAdded(FigureEvent e)
Description copied from interface: FigureListener
Sent when a figure was added to a drawing.

Specified by:
figureAdded in interface FigureListener

figureRemoved

public void figureRemoved(FigureEvent e)
Description copied from interface: FigureListener
Sent when a figure was removed from a drawing.

Specified by:
figureRemoved in interface FigureListener

figureRequestRemove

public void figureRequestRemove(FigureEvent e)
Description copied from interface: FigureListener
Sent when the figure requests to be removed from a drawing.

Specified by:
figureRequestRemove in interface FigureListener

findFigure

public Figure findFigure(java.awt.geom.Point2D.Double p)
Description copied from interface: Drawing
Finds a top level Figure. Use this call for hit detection that should not descend into the figure's children.

Specified by:
findFigure in interface Drawing

findFigureExcept

public Figure findFigureExcept(java.awt.geom.Point2D.Double p,
                               Figure ignore)
Description copied from interface: Drawing
Finds a top level Figure. Use this call for hit detection that should not descend into the figure's children.

Specified by:
findFigureExcept in interface Drawing

findFigureExcept

public Figure findFigureExcept(java.awt.geom.Point2D.Double p,
                               java.util.Collection<Figure> ignore)
Description copied from interface: Drawing
Finds a top level Figure. Use this call for hit detection that should not descend into the figure's children.

Specified by:
findFigureExcept in interface Drawing

findFigures

public java.util.Collection<Figure> findFigures(java.awt.geom.Rectangle2D.Double bounds)
Description copied from interface: Drawing
Returns all figures that lie within or intersect the specified bounds. The figures are returned in Z-order from back to front.

Specified by:
findFigures in interface Drawing

findFiguresWithin

public java.util.Collection<Figure> findFiguresWithin(java.awt.geom.Rectangle2D.Double bounds)
Description copied from interface: Drawing
Returns all figures that lie within the specified bounds. The figures are returned in Z-order from back to front.

Specified by:
findFiguresWithin in interface Drawing

getFigures

public java.util.Collection<Figure> getFigures()
Description copied from interface: Drawing
Returns the figures of the drawing.

Specified by:
getFigures in interface Drawing
Returns:
A Collection of Figure's.

findFigureInside

public Figure findFigureInside(java.awt.geom.Point2D.Double p)
Description copied from interface: Drawing
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.

Specified by:
findFigureInside in interface Drawing

getFiguresFrontToBack

public java.util.List<Figure> getFiguresFrontToBack()
Returns an iterator to iterate in Z-order front to back over the figures.

Specified by:
getFiguresFrontToBack in interface Drawing

bringToFront

public void bringToFront(Figure figure)
Description copied from interface: Drawing
Brings a figure to the front.

Specified by:
bringToFront in interface Drawing
Parameters:
figure - that is part of the drawing

sendToBack

public void sendToBack(Figure figure)
Description copied from interface: Drawing
Sends a figure to the back of the drawing.

Specified by:
sendToBack in interface Drawing
Parameters:
figure - that is part of the drawing

undoableEditHappened

public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
We propagate all edit events from our figures to undoable edit listeners, which have registered with us.

Specified by:
undoableEditHappened in interface javax.swing.event.UndoableEditListener

figureAttributeChanged

public void figureAttributeChanged(FigureEvent e)
Description copied from interface: FigureListener
Sent when an attribute of the figure has changed.

Specified by:
figureAttributeChanged in interface FigureListener

contains

public boolean contains(Figure f)
Description copied from interface: Drawing
Returns true if this drawing contains the specified figure.

Specified by:
contains in interface Drawing

Copyright 1996-2006 © JHotDraw.org