public abstract class UpdateManager
extends java.lang.Object
The update manager receives requests to validate certain figures, and repaint certain areas of figures. An update manager could process every request synchronously, or it could batch these requests and process them asynchronously.
The update process occurs in two phases. The first phase is laying out invalid figures. This phase comes first because it usually introduces additional damage regions. In some cases, while validating figures, new invalid figures may be appended to the update manager. Of course, damage regions will be reported too as figures are layed out.
The second phase is to repaint all damaged areas. The update manager will typically batch, clip, and union, all rectangles and perform a single paint of the overall damaged area.
Constructor and Description |
---|
UpdateManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addDirtyRegion(IFigure figure,
int x,
int y,
int w,
int h)
Adds the dirty region defined by the coordinates on the IFigure
figure.
|
void |
addDirtyRegion(IFigure figure,
Rectangle rect) |
abstract void |
addInvalidFigure(IFigure figure)
The receiver should call validate() on the IFigure figure in a
timely fashion.
|
void |
addUpdateListener(UpdateListener listener)
Adds the given listener to the list of listeners to be notified of
painting and validation.
|
void |
dispose()
Called when the EditPartViewer is being disposed.
|
protected void |
firePainting(Rectangle damage,
java.util.Map dirtyRegions)
Notifies listeners that painting is about to occur, passing them the
damaged rectangle and the map of dirty regions.
|
protected void |
fireValidating()
Notifies listeners that validation is about to occur.
|
protected boolean |
isDisposed() |
protected void |
paint(GC gc)
Invoked by the
LightweightSystem (
LightweightSystem.paint(GC) ) to have the update manger paint its
contents. |
abstract void |
performUpdate()
Forces an update to occur.
|
abstract void |
performUpdate(Rectangle exposed)
Performs an update on the given exposed rectangle.
|
void |
performValidation()
Performs a partial update if supported (validation only).
|
void |
removeUpdateListener(UpdateListener listener)
Removes one occurrence of the given UpdateListener by identity.
|
void |
runWithUpdate(java.lang.Runnable run)
Causes an update to occur at some time, and the given runnable to be
executed following the update.
|
abstract void |
setGraphicsSource(GraphicsSource gs)
Sets the GraphicsSource for this update manager.
|
abstract void |
setRoot(IFigure figure)
Sets the root figure.
|
public abstract void addDirtyRegion(IFigure figure, int x, int y, int w, int h)
figure
- the dirty figurex
- the x coordinate of the dirty regiony
- the y coordinate of the dirty regionw
- the width of the dirty regionh
- the height of the dirty regionpublic void runWithUpdate(java.lang.Runnable run)
run
- the runnablepublic abstract void addInvalidFigure(IFigure figure)
figure
- the invalid figurepublic void addUpdateListener(UpdateListener listener)
listener
- the listener to addpublic void dispose()
protected void firePainting(Rectangle damage, java.util.Map dirtyRegions)
damage
- the damaged rectangledirtyRegions
- map of dirty regions to figuresprotected void fireValidating()
protected boolean isDisposed()
public abstract void performUpdate()
protected void paint(GC gc)
LightweightSystem
(
LightweightSystem.paint(GC)
) to have the update manger paint its
contents. Delegates to performUpdate(Rectangle)
with the passed
in gc's clipping region (GC.getClipping()
) by default. Subclasses
may override if they need to access the GC
for updating.gc
- The GC
to be used for updatingpublic abstract void performUpdate(Rectangle exposed)
exposed
- the exposed rectanglepublic void removeUpdateListener(UpdateListener listener)
listener
- the listener to removepublic abstract void setGraphicsSource(GraphicsSource gs)
gs
- the new GraphicsSourcepublic abstract void setRoot(IFigure figure)
figure
- the new root figurepublic void performValidation()
performUpdate()
. Subclasses should override
this method to support validation without repainting.Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.