|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jdrawing.AbstractDrawingModelCache
This abstract class provides default implementations for most of
the methods in the DrawingModelCache
interface. It takes
care of the management of listeners and provides some conveniences
for generating DrawingModelCacheEvents
and dispatching them
to the listeners. Also it provides some default handling of drawing
model events.
Constructor Summary | |
AbstractDrawingModelCache()
|
Method Summary | |
void |
addDrawingModelCacheListener(DrawingModelCacheListener listener)
Adds a listener which will be notified about changes in this model cache. |
protected void |
elementsAdded(DrawingModelEvent event)
Invoked after elements have been inserted into the model. |
protected void |
elementsChanged(DrawingModelEvent event)
Invoked after elements have been changed in some way. |
protected void |
elementsRemoved(DrawingModelEvent event)
Invoked after elements have been removed from the model. |
protected void |
fireAreaChanged(java.awt.Rectangle area)
Notifies all listeners that the area has changed in some way. |
protected void |
fireDrawingChanged()
Notifies all listeners that the drawing has changed in some way. |
DrawingModelCacheListener[] |
getDrawingModelCacheListeners()
Returns an array of all the drawing model cache listeners registered on this model cache. |
DrawingModel |
getModel()
Returns the DrawingModel that is cached by this cache.
|
java.awt.Rectangle |
getModelBounds()
Returns the bounding box of all elements of the model. |
DrawingRenderer |
getRenderer()
Returns the DrawingRenderer that is used by this cache.
|
protected void |
modelChanged(DrawingModelEvent event)
Invoked after the model has drastically changed in some way. |
void |
removeDrawingModelCacheListener(DrawingModelCacheListener listener)
Removes a listener from the list that is notified about changes in this model cache. |
void |
setModel(DrawingModel model)
Sets the DrawingModel that will be cached by this cache.
|
void |
setRenderer(DrawingRenderer renderer)
Sets the DrawingRenderer that will be used in this cache.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jdrawing.DrawingModelCache |
getElementsForPoint, getElementsForRectangle, getModelBounds2D |
Constructor Detail |
public AbstractDrawingModelCache()
Method Detail |
public void setModel(DrawingModel model)
DrawingModelCache
DrawingModel
that will be cached by this cache.
If model is null
, then set this DrawingModelCache
to do not cache any DrawingModel
.
setModel
in interface DrawingModelCache
model
- the DrawingModel
that is to be cached or
null
public DrawingModel getModel()
DrawingModel
that is cached by this cache.
If no DrawingModel
is cached by this cache, return
null
DrawingModel
that is cached by this cache, or
null
if no model is cachedpublic void setRenderer(DrawingRenderer renderer)
DrawingModelCache
DrawingRenderer
that will be used in this cache.
If renderer is null
, then set this DrawingModelCache
to do not use any DrawingRenderer
.
Renderer is used to obtain the bounds of an element of the model.
setRenderer
in interface DrawingModelCache
renderer
- the DrawingRenderer
that is to be usedpublic DrawingRenderer getRenderer()
DrawingRenderer
that is used by this cache.
If no DrawingRenderer
is used by this cache, return
null
DrawingRenderer
that is used by this cache, or
null
if not renderer is usedpublic java.awt.Rectangle getModelBounds()
DrawingModelCache
getModelBounds
in interface DrawingModelCache
public void addDrawingModelCacheListener(DrawingModelCacheListener listener)
DrawingModelCache
addDrawingModelCacheListener
in interface DrawingModelCache
listener
- the DrawingModelCacheListener
public void removeDrawingModelCacheListener(DrawingModelCacheListener listener)
DrawingModelCache
null
then this method does nothing.
removeDrawingModelCacheListener
in interface DrawingModelCache
listener
- the DrawingModelCacheListener
public DrawingModelCacheListener[] getDrawingModelCacheListeners()
DrawingModelCacheListener
s
or an empty array if no drawing model cache listeners are
currently registeredprotected void fireAreaChanged(java.awt.Rectangle area)
area
- rectangular bounds of the changed area
java.lang.IllegalArgumentException
- if area is null
protected void fireDrawingChanged()
protected void elementsAdded(DrawingModelEvent event)
event
- DrawingModelEvent object encapsulating event
informationprotected void elementsRemoved(DrawingModelEvent event)
event
- DrawingModelEvent object encapsulating event
informationprotected void elementsChanged(DrawingModelEvent event)
event
- DrawingModelEvent object encapsulating event
informationprotected void modelChanged(DrawingModelEvent event)
event
- DrawingModelEvent object encapsulating event
information
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |