org.jdrawing
Class AbstractDrawingModel

java.lang.Object
  extended byorg.jdrawing.AbstractDrawingModel
All Implemented Interfaces:
DrawingModel
Direct Known Subclasses:
DefaultDrawingModel, GraphicsModel, LayeredDrawingModel

public abstract class AbstractDrawingModel
extends java.lang.Object
implements DrawingModel

This abstract class provides default implementations for most of the methods in the DrawingModel interface. It takes care of the management of listeners and provides some conveniences for generating DrawingModelEvents and dispatching them to the listeners


Constructor Summary
AbstractDrawingModel()
           
 
Method Summary
 void addDrawingModelListener(DrawingModelListener listener)
          Adds a listener which will be notified about changes in this model.
protected  void fireElementsAdded(java.lang.Object[] elements)
          Notifies all listeners that elements have been inserted.
protected  void fireElementsChanged(java.lang.Object[] elements)
          Notifies all listeners that elements have been changed.
protected  void fireElementsRemoved(java.lang.Object[] elements)
          Notifies all listeners that elements have been removed.
protected  void fireModelChanged()
          Notifies all listeners that the model has changed.
 DrawingModelListener[] getDrawingModelListeners()
          Returns an array of all the drawing model listeners registered on this model.
 void removeDrawingModelListener(DrawingModelListener listener)
          Removes a listener from the list that is notified about changes in this model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jdrawing.DrawingModel
elements, sortElements
 

Constructor Detail

AbstractDrawingModel

public AbstractDrawingModel()
Method Detail

addDrawingModelListener

public void addDrawingModelListener(DrawingModelListener listener)
Description copied from interface: DrawingModel
Adds a listener which will be notified about changes in this model.

Specified by:
addDrawingModelListener in interface DrawingModel
Parameters:
listener - the DrawingModelListener

removeDrawingModelListener

public void removeDrawingModelListener(DrawingModelListener listener)
Description copied from interface: DrawingModel
Removes a listener from the list that is notified about changes in this model.

Specified by:
removeDrawingModelListener in interface DrawingModel
Parameters:
listener - the DrawingModelListener

getDrawingModelListeners

public DrawingModelListener[] getDrawingModelListeners()
Returns an array of all the drawing model listeners registered on this model.

Returns:
all of this model's DrawingModelListeners or an empty array if no drawing model listeners are currently registered

fireElementsAdded

protected void fireElementsAdded(java.lang.Object[] elements)
Notifies all listeners that elements have been inserted.

Parameters:
elements - an array of Object containing inserted elements

fireElementsRemoved

protected void fireElementsRemoved(java.lang.Object[] elements)
Notifies all listeners that elements have been removed.

Parameters:
elements - an array of Object containing removed elements

fireElementsChanged

protected void fireElementsChanged(java.lang.Object[] elements)
Notifies all listeners that elements have been changed.

Parameters:
elements - an array of Object containing changed elements

fireModelChanged

protected void fireModelChanged()
Notifies all listeners that the model has changed.