JHotDraw 7.0.9

org.jhotdraw.draw
Class AbstractDrawing

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractDrawing
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Drawing, DOMStorable
Direct Known Subclasses:
DefaultDrawing, QuadTreeDrawing

public abstract class AbstractDrawing
extends AbstractBean
implements Drawing

AbstractDrawing.

Version:
3.0 2007-05-18 Don't fire UndoableEdit events when Figures are added/removed from a Drawing. The
2.2 2006-12-26 Support for InputFormat's and OutputFormat's added.
2.1 2006-07-08 Extend AbstractBean.
2.0.1 2006-02-06 Did ugly dirty fix for IndexOutOfBoundsException when undoing removal of Figures.
2.0 2006-01-14 Changed to support double precision coordinates.
1.0 2003-12-01 Derived from JHotDraw 5.4b1.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
protected  javax.swing.event.EventListenerList listenerList
           
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
AbstractDrawing()
          Creates a new instance.
 
Method Summary
 void add(Figure figure)
          Calls basicAdd and then calls figure.addNotify and firesFigureAdded.
 void add(int index, Figure figure)
          Adds a figure to the drawing.
 void addAll(java.util.Collection<Figure> figures)
          Adds a collection of figures to the drawing.
 void addAll(int index, java.util.Collection<Figure> figures)
          Adds a collection of figures to the drawing.
 void addDrawingListener(DrawingListener listener)
          Adds a listener for this drawing.
 void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Adds a listener for undooable edit events.
 void basicAdd(Figure figure)
          Thi
 void basicAddAll(int index, java.util.Collection<Figure> figures)
          Reinserts the specified figures which were temporarily removed from the drawing.
 void basicRemoveAll(java.util.Collection<Figure> toBeOrphaned)
          Removes the specified figures temporarily from the drawing.
 void clear()
          Removes all figures.
protected  void fireAreaInvalidated(java.awt.geom.Rectangle2D.Double dirtyRegion)
          Notify all listenerList that have registered interest for notification on this event type.
protected  void fireFigureAdded(Figure f, int zIndex)
          Notify all listenerList that have registered interest for notification on this event type.
protected  void fireFigureRemoved(Figure f, int zIndex)
          Notify all listenerList that have registered interest for notification on this event type.
 void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
          Notify all listenerList that have registered interest for notification on this event type.
 int getFigureCount()
          Gets the number of figures.
 java.awt.font.FontRenderContext getFontRenderContext()
          Returns the font render context used to do text leyout and text drawing.
 java.util.List<InputFormat> getInputFormats()
          Gets input formats for the Drawing in order of preferred formats.
 java.lang.Object getLock()
          The drawing view synchronizes on the lock when drawing a drawing.
 java.util.List<OutputFormat> getOutputFormats()
          Gets output formats for the Drawing in order of preferred formats.
 void read(DOMInput in)
           
 void remove(Figure figure)
          Calls basicRemove and then calls figure.addNotify and firesFigureAdded.
 void removeAll(java.util.Collection<Figure> toBeRemoved)
          Removes the specified figures from the drawing.
 void removeDrawingListener(DrawingListener listener)
          Removes a listener from this drawing.
 void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Removes a listener for undoable edit events.
 void setFontRenderContext(java.awt.font.FontRenderContext frc)
          Sets the font render context used to do text leyout and text drawing.
 void setInputFormats(java.util.List<InputFormat> formats)
          Sets input formats for the Drawing in order of preferred formats.
 void setOutputFormats(java.util.List<OutputFormat> formats)
          Sets output formats for the Drawing in order of preferred formats.
 void write(DOMOutput out)
           
 
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
 
Methods inherited from interface org.jhotdraw.draw.Drawing
basicAdd, basicRemove, bringToFront, contains, draw, findFigure, findFigureBehind, findFigureBehind, findFigureExcept, findFigureExcept, findFigureInside, findFigures, findFiguresWithin, getCanvasSize, getFigures, getFiguresFrontToBack, indexOf, sendToBack, setCanvasSize, sort
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

AbstractDrawing

public AbstractDrawing()
Creates a new instance.

Method Detail

addDrawingListener

public void addDrawingListener(DrawingListener listener)
Description copied from interface: Drawing
Adds a listener for this drawing.

Specified by:
addDrawingListener in interface Drawing

removeDrawingListener

public void removeDrawingListener(DrawingListener listener)
Description copied from interface: Drawing
Removes a listener from this drawing.

Specified by:
removeDrawingListener in interface Drawing

addUndoableEditListener

public void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
Description copied from interface: Drawing
Adds a listener for undooable edit events.

Specified by:
addUndoableEditListener in interface Drawing

removeUndoableEditListener

public void removeUndoableEditListener(javax.swing.event.UndoableEditListener l)
Description copied from interface: Drawing
Removes a listener for undoable edit events.

Specified by:
removeUndoableEditListener in interface Drawing

addAll

public final void addAll(java.util.Collection<Figure> figures)
Description copied from interface: Drawing
Adds a collection of figures to the drawing. The drawing sends an addNotify message to each figure after it has been added.

Specified by:
addAll in interface Drawing
Parameters:
figures - to be added to the drawing
See Also:
Figure.addNotify(org.jhotdraw.draw.Drawing)

addAll

public final void addAll(int index,
                         java.util.Collection<Figure> figures)
Description copied from interface: Drawing
Adds a collection of figures to the drawing. The drawing sends an addNotify message to each figure after it has been added.

Specified by:
addAll in interface Drawing
Parameters:
index - The z-index of the figure.
figures - to be added to the drawing
See Also:
Figure.addNotify(org.jhotdraw.draw.Drawing)

clear

public void clear()
Removes all figures.

Specified by:
clear in interface Drawing

getFigureCount

public int getFigureCount()
Gets the number of figures.

Specified by:
getFigureCount in interface Drawing

removeAll

public void removeAll(java.util.Collection<Figure> toBeRemoved)
Description copied from interface: Drawing
Removes the specified figures from the drawing. The drawing sends a removeNotify message to each figure before it is removed.

Specified by:
removeAll in interface Drawing
Parameters:
toBeRemoved - A collection of figures which are part of the drawing and should be removed
See Also:
Figure.removeNotify(org.jhotdraw.draw.Drawing)

basicAddAll

public void basicAddAll(int index,
                        java.util.Collection<Figure> figures)
Description copied from interface: Drawing
Reinserts the specified figures which were temporarily removed from the drawing.

Specified by:
basicAddAll in interface Drawing
Parameters:
index - The insertion index.
figures - A collection of figures which are part of the drawing and should be reinserted.
See Also:
Drawing.basicRemoveAll(Collection)

basicRemoveAll

public void basicRemoveAll(java.util.Collection<Figure> toBeOrphaned)
Description copied from interface: Drawing
Removes the specified figures temporarily from the drawing.

Specified by:
basicRemoveAll in interface Drawing
Parameters:
toBeOrphaned - A collection of figures which are part of the drawing and should be removed
See Also:
Drawing.basicAddAll(int, Collection)

add

public final void add(Figure figure)
Calls basicAdd and then calls figure.addNotify and firesFigureAdded.

Specified by:
add in interface Drawing
Parameters:
figure - to be added to the drawing
See Also:
Figure.addNotify(org.jhotdraw.draw.Drawing)

add

public final void add(int index,
                      Figure figure)
Description copied from interface: Drawing
Adds a figure to the drawing. The drawing sends an addNotify message to the figure after it has been added.

Specified by:
add in interface Drawing
Parameters:
index - The z-index of the figure.
figure - to be added to the drawing
See Also:
Figure.addNotify(org.jhotdraw.draw.Drawing)

basicAdd

public void basicAdd(Figure figure)
Thi

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

remove

public final void remove(Figure figure)
Calls basicRemove and then calls figure.addNotify and firesFigureAdded.

Specified by:
remove in interface Drawing
Parameters:
figure - that is part of the drawing and should be removed
See Also:
Figure.removeNotify(org.jhotdraw.draw.Drawing)

fireAreaInvalidated

protected void fireAreaInvalidated(java.awt.geom.Rectangle2D.Double dirtyRegion)
Notify all listenerList that have registered interest for notification on this event type.


fireUndoableEditHappened

public void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
Notify all listenerList that have registered interest for notification on this event type.

Specified by:
fireUndoableEditHappened in interface Drawing

fireFigureAdded

protected void fireFigureAdded(Figure f,
                               int zIndex)
Notify all listenerList that have registered interest for notification on this event type.


fireFigureRemoved

protected void fireFigureRemoved(Figure f,
                                 int zIndex)
Notify all listenerList that have registered interest for notification on this event type.


getFontRenderContext

public java.awt.font.FontRenderContext getFontRenderContext()
Description copied from interface: Drawing
Returns the font render context used to do text leyout and text drawing.

Specified by:
getFontRenderContext in interface Drawing

setFontRenderContext

public void setFontRenderContext(java.awt.font.FontRenderContext frc)
Description copied from interface: Drawing
Sets the font render context used to do text leyout and text drawing.

Specified by:
setFontRenderContext in interface Drawing

read

public void read(DOMInput in)
          throws java.io.IOException
Specified by:
read in interface DOMStorable
Throws:
java.io.IOException

write

public void write(DOMOutput out)
           throws java.io.IOException
Specified by:
write in interface DOMStorable
Throws:
java.io.IOException

getLock

public java.lang.Object getLock()
The drawing view synchronizes on the lock when drawing a drawing.

Specified by:
getLock in interface Drawing

setOutputFormats

public void setOutputFormats(java.util.List<OutputFormat> formats)
Description copied from interface: Drawing
Sets output formats for the Drawing in order of preferred formats.

The output formats are used for saving the Drawing into a file and for cutting and copying Figures from the Drawing into the clipboard.

Specified by:
setOutputFormats in interface Drawing

setInputFormats

public void setInputFormats(java.util.List<InputFormat> formats)
Description copied from interface: Drawing
Sets input formats for the Drawing in order of preferred formats.

The input formats are used for loading the Drawing from a file and for pasting Figures from the clipboard into the Drawing.

Specified by:
setInputFormats in interface Drawing

getInputFormats

public java.util.List<InputFormat> getInputFormats()
Description copied from interface: Drawing
Gets input formats for the Drawing in order of preferred formats.

Specified by:
getInputFormats in interface Drawing

getOutputFormats

public java.util.List<OutputFormat> getOutputFormats()
Description copied from interface: Drawing
Gets output formats for the Drawing in order of preferred formats.

Specified by:
getOutputFormats in interface Drawing

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.