Package org.eclipse.draw2d
Class DeferredUpdateManager
java.lang.Object
org.eclipse.draw2d.UpdateManager
org.eclipse.draw2d.DeferredUpdateManager
An UpdateManager that asynchronously updates the affected figures.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.Constructs a new DererredUpdateManager with the given GraphicsSource. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDirtyRegion
(IFigure figure, int x, int y, int w, int h) Adds a dirty region (defined by the rectangle x, y, w, h) to the update queue.void
Adds the given figure to the update queue.protected Graphics
getGraphics
(Rectangle region) Returns a Graphics object for the given region.protected void
Invoked by theLightweightSystem
(LightweightSystem.paint(GC)
) to have the update manger paint its contents.void
Performs the update.void
performUpdate
(Rectangle exposed) Adds the given exposed region to the update queue and then performs the update.void
Performs a partial update if supported (validation only).protected void
Posts anDeferredUpdateManager.UpdateRequest
usingDisplay.asyncExec(Runnable)
.protected void
releaseGraphics
(Graphics graphics) Releases the graphics object, which causes the GraphicsSource to flush.protected void
Repaints the dirty regions on the update queue and callsUpdateManager.firePainting(Rectangle, Map)
, unless there are no dirty regions.void
runWithUpdate
(Runnable runnable) Adds the given runnable and queues an update if an update is not under progress.protected void
Fires theUpdateRequest
to the current display asynchronously.void
Sets the graphics source.void
Sets the root figure.protected void
Validates all invalid figures on the update queue and callsUpdateManager.fireValidating()
unless there are no invalid figures.Methods inherited from class org.eclipse.draw2d.UpdateManager
addDirtyRegion, addUpdateListener, dispose, firePainting, fireValidating, isDisposed, removeUpdateListener
-
Constructor Details
-
DeferredUpdateManager
public DeferredUpdateManager()Empty constructor. -
DeferredUpdateManager
Constructs a new DererredUpdateManager with the given GraphicsSource.- Parameters:
gs
- the graphics source
-
-
Method Details
-
addDirtyRegion
Adds a dirty region (defined by the rectangle x, y, w, h) to the update queue. If the figure isn't visible or either the width or height are 0, the method returns without queueing the dirty region.- Specified by:
addDirtyRegion
in classUpdateManager
- Parameters:
figure
- the figure that contains the dirty regionx
- 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 region
-
addInvalidFigure
Adds the given figure to the update queue. Invalid figures will be validated before the damaged regions are repainted.- Specified by:
addInvalidFigure
in classUpdateManager
- Parameters:
f
- the invalid figure
-
getGraphics
Returns a Graphics object for the given region.- Parameters:
region
- the region to be repainted- Returns:
- the Graphics object
-
paint
Description copied from class:UpdateManager
Invoked by theLightweightSystem
(LightweightSystem.paint(GC)
) to have the update manger paint its contents. Delegates toUpdateManager.performUpdate(Rectangle)
with the passed in gc's clipping region (GC.getClipping()
) by default. Subclasses may override if they need to access theGC
for updating.- Overrides:
paint
in classUpdateManager
- Parameters:
gc
- TheGC
to be used for updating- Since:
- 3.10
-
performUpdate
public void performUpdate()Performs the update. Validates the invalid figures and then repaints the dirty regions.- Specified by:
performUpdate
in classUpdateManager
- See Also:
-
performValidation
public void performValidation()Description copied from class:UpdateManager
Performs a partial update if supported (validation only). Fires notification to listeners that validation has been performed. By default this method callsUpdateManager.performUpdate()
. Subclasses should override this method to support validation without repainting.- Overrides:
performValidation
in classUpdateManager
- See Also:
-
performUpdate
Adds the given exposed region to the update queue and then performs the update.- Specified by:
performUpdate
in classUpdateManager
- Parameters:
exposed
- the exposed region
-
queueWork
protected void queueWork()Posts anDeferredUpdateManager.UpdateRequest
usingDisplay.asyncExec(Runnable)
. If work has already been queued, a new request is not needed. -
sendUpdateRequest
protected void sendUpdateRequest()Fires theUpdateRequest
to the current display asynchronously.- Since:
- 3.2
-
releaseGraphics
Releases the graphics object, which causes the GraphicsSource to flush.- Parameters:
graphics
- the graphics object
-
repairDamage
protected void repairDamage()Repaints the dirty regions on the update queue and callsUpdateManager.firePainting(Rectangle, Map)
, unless there are no dirty regions. -
runWithUpdate
Adds the given runnable and queues an update if an update is not under progress.- Overrides:
runWithUpdate
in classUpdateManager
- Parameters:
runnable
- the runnable
-
setGraphicsSource
Sets the graphics source.- Specified by:
setGraphicsSource
in classUpdateManager
- Parameters:
gs
- the graphics source
-
setRoot
Sets the root figure.- Specified by:
setRoot
in classUpdateManager
- Parameters:
figure
- the root figure
-
validateFigures
protected void validateFigures()Validates all invalid figures on the update queue and callsUpdateManager.fireValidating()
unless there are no invalid figures.
-