org.jdrawing
Class DefaultDrawingModel

java.lang.Object
  extended byorg.jdrawing.AbstractDrawingModel
      extended byorg.jdrawing.DefaultDrawingModel
All Implemented Interfaces:
DrawingModel

public class DefaultDrawingModel
extends AbstractDrawingModel

This is default implementation of DrawingModel interface. It stores all elements in LinkedList and does not support any ordering.


Constructor Summary
DefaultDrawingModel()
           
 
Method Summary
 void addElement(java.lang.Object element)
          Adds new element to the model.
 void addElements(java.lang.Object[] elements)
          Adds several elements to the model.
 java.util.Enumeration elements()
          Returns an enumeration of the elements of this model.
 void removeElement(java.lang.Object element)
          Removes element from the model.
 void removeElements(java.lang.Object[] elements)
          Removes several elements from the model.
 void sortElements(java.lang.Object[] elements)
          Reorder elements to be in order suitable for painting.
 void updateElement(java.lang.Object element)
          Notify all listeners that element has changed.
 void updateElements(java.lang.Object[] elements)
          Notify all listeners that several elements have changed.
 
Methods inherited from class org.jdrawing.AbstractDrawingModel
addDrawingModelListener, fireElementsAdded, fireElementsChanged, fireElementsRemoved, fireModelChanged, getDrawingModelListeners, removeDrawingModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDrawingModel

public DefaultDrawingModel()
Method Detail

elements

public java.util.Enumeration elements()
Returns an enumeration of the elements of this model. The returned Enumeration object will generate all elements in this model. The elements will be generated by this enumeration in order suitable for painting.

Returns:
an enumeration of the elements of this model

addElement

public void addElement(java.lang.Object element)
Adds new element to the model.

Parameters:
element - element to be added to the model

addElements

public void addElements(java.lang.Object[] elements)
Adds several elements to the model.

Parameters:
elements - an array of elements to be added to the model

removeElement

public void removeElement(java.lang.Object element)
Removes element from the model.

Parameters:
element - element to be removed from the model

removeElements

public void removeElements(java.lang.Object[] elements)
Removes several elements from the model.

Parameters:
elements - an array of elements to be removed from the model

updateElement

public void updateElement(java.lang.Object element)
Notify all listeners that element has changed.

Parameters:
element - changed element

updateElements

public void updateElements(java.lang.Object[] elements)
Notify all listeners that several elements have changed.

Parameters:
elements - an array of changed elements

sortElements

public void sortElements(java.lang.Object[] elements)
Reorder elements to be in order suitable for painting. This implementation does not do any reordering.

Parameters:
elements - the elements to reorder