org.jdrawing.graphics
Class GraphicsModel

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

public class GraphicsModel
extends AbstractDrawingModel

The implementation of DrawingModel interface that stores a sequence of graphics operations.


Constructor Summary
GraphicsModel()
           
 
Method Summary
 void addOperation(GraphicsOperation operation)
          Appends GraphicsOperation object to the end of painting sequence of the model.
 void addOperationAt(GraphicsOperation operation, int index)
          Inserts GraphicsOperation object to the painting sequence of the model model at specified position.
 void clear()
          Removes all elements from the model
 java.util.Enumeration elements()
          Returns an enumeration of the elements of this model.
 GraphicsOperation getOperationAt(int index)
          Returns GraphicsOperation located at specified position in the painting sequence of the model.
 void removeOperation(GraphicsOperation operation)
          Removes given GraphicsOperation from the painting sequence of the model.
 void removeOperationAt(int index)
          Removes the element at specified position from the painting sequence of the model.
 int size()
          Returns total count of elements in the model.
 void sortElements(java.lang.Object[] elements)
          Reorder elements to be in down, then right order.
 void updateOperation(GraphicsOperation operation)
          Notify listeners about element changes.
 
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

GraphicsModel

public GraphicsModel()
Method Detail

addOperation

public void addOperation(GraphicsOperation operation)
Appends GraphicsOperation object to the end of painting sequence of the model.

Parameters:
operation - GraphicsOperation to be appended

addOperationAt

public void addOperationAt(GraphicsOperation operation,
                           int index)
Inserts GraphicsOperation object to the painting sequence of the model model at specified position.

Parameters:
operation - GraphicsOperation to be inserted
index - position in the painting sequence

removeOperation

public void removeOperation(GraphicsOperation operation)
Removes given GraphicsOperation from the painting sequence of the model.

Parameters:
operation - GraphicsOperation to be removed

removeOperationAt

public void removeOperationAt(int index)
Removes the element at specified position from the painting sequence of the model.

Parameters:
index - position of the element

clear

public void clear()
Removes all elements from the model


size

public int size()
Returns total count of elements in the model.

Returns:
count of elements

getOperationAt

public GraphicsOperation getOperationAt(int index)
Returns GraphicsOperation located at specified position in the painting sequence of the model.

Parameters:
index - position in the painting sequence
Returns:
GraphicsOperation

updateOperation

public void updateOperation(GraphicsOperation operation)
Notify listeners about element changes.

Parameters:
operation - changed element

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.

Returns:
an enumeration of the elements of this model

sortElements

public void sortElements(java.lang.Object[] elements)
Reorder elements to be in down, then right order.

Parameters:
elements - the elements to reorder