org.jhotdraw.draw
Class AbstractDrawing

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

public abstract class AbstractDrawing
extends AbstractAttributedCompositeFigure
implements Drawing

AbstractDrawing.

Version:
4.1 2007-12-16 Drawing hold attributes on its own.
4.0 2007-07-17 Adapted to changes in Drawing interface.
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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jhotdraw.draw.AbstractCompositeFigure
AbstractCompositeFigure.EventHandler
 
Field Summary
private static boolean DEBUG
           
private  java.awt.font.FontRenderContext fontRenderContext
           
private  java.util.LinkedList<InputFormat> inputFormats
           
private static java.lang.Object lock
           
private  java.util.LinkedList<OutputFormat> outputFormats
           
 
Fields inherited from class org.jhotdraw.draw.AbstractCompositeFigure
cachedBounds, cachedDrawingArea, children, eventHandler, layouter
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Fields inherited from interface org.jhotdraw.draw.Drawing
CANVAS_SIZE_PROPERTY
 
Fields inherited from interface org.jhotdraw.draw.CompositeFigure
LAYOUT_INSETS
 
Constructor Summary
AbstractDrawing()
          Creates a new instance.
 
Method Summary
 void addInputFormat(InputFormat format)
          Adds an input format to the drawing.
 void addOutputFormat(OutputFormat format)
          Adds an output format to the drawing.
 void addUndoableEditListener(javax.swing.event.UndoableEditListener l)
          Adds a listener for undooable edit events.
 void fireUndoableEditHappened(javax.swing.undo.UndoableEdit edit)
          Notify all listenerList that have registered interest for notification on this event type.
 Drawing getDrawing()
           
 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 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.draw.AbstractAttributedCompositeFigure
applyAttributesTo, clone, drawChildren, drawFigure, drawFill, drawStroke, drawText, getAttribute, getAttributeKey, getAttributes, getAttributesRestoreData, getFigureDrawBounds, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, setAttribute, setAttributeEnabled, setAttributeOnChildren, setAttributes, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractCompositeFigure
add, add, addAll, addAll, addCompositeFigureListener, addNotify, basicAdd, basicAdd, basicAddAll, basicRemove, basicRemoveAll, basicRemoveAllChildren, basicRemoveChild, bringToFront, contains, contains, createEventHandler, createHandles, draw, findChild, findChildIndex, findFigureInside, fireFigureAdded, fireFigureRemoved, getBounds, getChild, getChildCount, getChildren, getChildrenFrontToBack, getDecomposition, getDrawingArea, getLayouter, getPreferredSize, getTransformRestoreData, indexOf, invalidate, layout, remove, removeAll, removeAllChildren, removeChild, removeCompositeFigureListener, removeNotify, restoreTransformTo, sendToBack, setBounds, setLayouter, transform, validate
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, basicClone, canConnect, changed, findCompatibleConnector, findConnector, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, getActions, getChangingDepth, getConnectors, getCursor, getEndPoint, getLayer, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isChanging, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, requestRemove, setBounds, setRemovable, setSelectable, setTransformable, setVisible, toString, willChange
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.draw.Drawing
add, add, addAll, addAll, basicAdd, basicAdd, basicAddAll, basicRemove, basicRemoveAll, bringToFront, draw, findFigure, findFigureBehind, findFigureBehind, findFigureExcept, findFigureExcept, findFigureInside, findFigures, findFiguresWithin, getChildCount, getChildren, getFiguresFrontToBack, indexOf, remove, removeAll, sendToBack, sort
 
Methods inherited from interface org.jhotdraw.draw.CompositeFigure
addCompositeFigureListener, basicRemoveAllChildren, basicRemoveChild, contains, getChild, getLayouter, layout, removeAllChildren, removeChild, removeCompositeFigureListener, setLayouter
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, canConnect, changed, clone, contains, createHandles, findCompatibleConnector, findConnector, getActions, getAttribute, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getDrawingArea, getEndPoint, getLayer, getPreferredSize, getStartPoint, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, requestRemove, restoreAttributesTo, restoreTransformTo, setAttribute, setBounds, transform, willChange
 

Field Detail

lock

private static final java.lang.Object lock

fontRenderContext

private transient java.awt.font.FontRenderContext fontRenderContext

inputFormats

private java.util.LinkedList<InputFormat> inputFormats

outputFormats

private java.util.LinkedList<OutputFormat> outputFormats

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

AbstractDrawing

public AbstractDrawing()
Creates a new instance.

Method Detail

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

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
Overrides:
fireUndoableEditHappened in class AbstractFigure

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
Overrides:
getFontRenderContext in class AbstractFigure

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
Overrides:
read in class AbstractAttributedCompositeFigure
Throws:
java.io.IOException

write

public void write(DOMOutput out)
           throws java.io.IOException
Specified by:
write in interface DOMStorable
Overrides:
write in class AbstractAttributedCompositeFigure
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
Overrides:
getLock in class AbstractFigure

addInputFormat

public void addInputFormat(InputFormat format)
Description copied from interface: Drawing
Adds an input format to the drawing.

Specified by:
addInputFormat in interface Drawing

addOutputFormat

public void addOutputFormat(OutputFormat format)
Description copied from interface: Drawing
Adds an output format to the drawing.

Specified by:
addOutputFormat 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

getDrawing

public Drawing getDrawing()
Overrides:
getDrawing in class AbstractFigure