org.apache.batik.bridge
Class UpdateManager

java.lang.Object
  |
  +--org.apache.batik.bridge.UpdateManager
All Implemented Interfaces:
RunnableQueue.RunHandler

public class UpdateManager
extends java.lang.Object
implements RunnableQueue.RunHandler

This class provides features to manage the update of an SVG document.


Field Summary
protected  BridgeContext bridgeContext
          The bridge context.
protected  Document document
          The document to manage.
protected  GraphicsNode graphicsNode
          The GraphicsNode whose updates are to be tracked.
protected  java.util.List listeners
          The listeners.
protected  RepaintManager repaintManager
          The repaint manager.
protected  boolean running
          Whether the update manager is running.
protected  ScriptingEnvironment scriptingEnvironment
          The scripting environment.
protected  boolean started
          Whether the manager was started.
protected  boolean suspendCalled
          Whether the suspend() method was called.
protected  RunnableQueue updateRunnableQueue
          The update RunnableQueue.
protected  UpdateTracker updateTracker
          The update tracker.
 
Constructor Summary
UpdateManager(BridgeContext ctx, GraphicsNode gn, Document doc)
          Creates a new update manager.
 
Method Summary
 void addUpdateManagerListener(UpdateManagerListener l)
          Adds a UpdateManagerListener to this UpdateManager.
 void dispatchSVGLoadEvent()
          Dispatches an 'SVGLoad' event to the document.
 void dispatchSVGUnLoadEvent()
          Dispatches an 'SVGUnLoad' event to the document.
 void executionResumed(RunnableQueue rq)
          Called when the execution of the queue has been resumed.
 void executionSuspended(RunnableQueue rq)
          Called when the execution of the queue has been suspended.
protected  void fireCompletedEvent(java.awt.image.BufferedImage bi, java.util.List rects)
          Fires a UpdateManagerEvent when an update completed.
protected  void fireFailedEvent()
          Fires a UpdateManagerEvent when an update failed.
protected  void fireManagerResumedEvent()
          Fires a UpdateManagerEvent to notify that the manager was resumed.
protected  void fireManagerStartedEvent()
          Fires a UpdateManagerEvent to notify that the manager was started.
protected  void fireManagerStoppedEvent()
          Fires a UpdateManagerEvent to notify that the manager was stopped.
protected  void fireManagerSuspendedEvent()
          Fires a UpdateManagerEvent to notify that the manager was suspended.
protected  void fireStartedEvent(java.awt.image.BufferedImage bi)
          Fires a UpdateManagerEvent in the starting phase of an update.
 BridgeContext getBridgeContext()
          Returns the bridge context.
 Document getDocument()
          Returns the current Document.
 RepaintManager getRepaintManager()
          Returns the repaint manager.
 ScriptingEnvironment getScriptingEnvironment()
          Returns the scripting environment.
 RunnableQueue getUpdateRunnableQueue()
          Returns the update RunnableQueue.
 UpdateTracker getUpdateTracker()
          Returns the GVT update tracker.
 void interrupt()
          Interrupts the manager tasks.
static boolean isDynamicDocument(Document doc)
          Tells whether the given SVG document is dynamic.
 boolean isRunning()
          Tells whether the update manager is currently running.
 void manageUpdates(ImageRenderer r)
          Finishes the UpdateManager initialization.
 void removeUpdateManagerListener(UpdateManagerListener l)
          Removes a UpdateManagerListener from this UpdateManager.
 void repaint()
          Repaints the dirty areas, if needed.
 void resume()
          Resumes the update manager.
 void runnableInvoked(RunnableQueue rq, java.lang.Runnable r)
          Called when the given Runnable has just been invoked and has returned.
 void suspend()
          Suspends the update manager.
 void updateRendering(java.awt.geom.AffineTransform u2d, boolean dbr, java.awt.Shape aoi, int width, int height)
          Updates the rendering buffer.
 void updateRendering(java.util.List areas)
          Updates the rendering buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bridgeContext

protected BridgeContext bridgeContext
The bridge context.

document

protected Document document
The document to manage.

updateRunnableQueue

protected RunnableQueue updateRunnableQueue
The update RunnableQueue.

running

protected boolean running
Whether the update manager is running.

suspendCalled

protected boolean suspendCalled
Whether the suspend() method was called.

listeners

protected java.util.List listeners
The listeners.

scriptingEnvironment

protected ScriptingEnvironment scriptingEnvironment
The scripting environment.

repaintManager

protected RepaintManager repaintManager
The repaint manager.

updateTracker

protected UpdateTracker updateTracker
The update tracker.

graphicsNode

protected GraphicsNode graphicsNode
The GraphicsNode whose updates are to be tracked.

started

protected boolean started
Whether the manager was started.
Constructor Detail

UpdateManager

public UpdateManager(BridgeContext ctx,
                     GraphicsNode gn,
                     Document doc)
Creates a new update manager.
Parameters:
ctx - The bridge context.
gn - GraphicsNode whose updates are to be tracked.
doc - The document to manage.
Method Detail

isDynamicDocument

public static boolean isDynamicDocument(Document doc)
Tells whether the given SVG document is dynamic.

dispatchSVGLoadEvent

public void dispatchSVGLoadEvent()
                          throws java.lang.InterruptedException
Dispatches an 'SVGLoad' event to the document.

manageUpdates

public void manageUpdates(ImageRenderer r)
Finishes the UpdateManager initialization.

getBridgeContext

public BridgeContext getBridgeContext()
Returns the bridge context.

getUpdateRunnableQueue

public RunnableQueue getUpdateRunnableQueue()
Returns the update RunnableQueue.

getRepaintManager

public RepaintManager getRepaintManager()
Returns the repaint manager.

getUpdateTracker

public UpdateTracker getUpdateTracker()
Returns the GVT update tracker.

getDocument

public Document getDocument()
Returns the current Document.

getScriptingEnvironment

public ScriptingEnvironment getScriptingEnvironment()
Returns the scripting environment.

isRunning

public boolean isRunning()
Tells whether the update manager is currently running.

suspend

public void suspend()
Suspends the update manager.

resume

public void resume()
Resumes the update manager.

interrupt

public void interrupt()
Interrupts the manager tasks.

dispatchSVGUnLoadEvent

public void dispatchSVGUnLoadEvent()
Dispatches an 'SVGUnLoad' event to the document. This method interrupts the update manager threads. NOTE: this method must be called outside the update thread.

updateRendering

public void updateRendering(java.awt.geom.AffineTransform u2d,
                            boolean dbr,
                            java.awt.Shape aoi,
                            int width,
                            int height)
Updates the rendering buffer.
Parameters:
u2d - The user to device transform.
dbr - Whether the double buffering should be used.
aoi - The area of interest in the renderer space units.
width height - The offscreen buffer size.

updateRendering

public void updateRendering(java.util.List areas)
Updates the rendering buffer.
Parameters:
aoi - The area of interest in the renderer space units.

repaint

public void repaint()
Repaints the dirty areas, if needed.

addUpdateManagerListener

public void addUpdateManagerListener(UpdateManagerListener l)
Adds a UpdateManagerListener to this UpdateManager.

removeUpdateManagerListener

public void removeUpdateManagerListener(UpdateManagerListener l)
Removes a UpdateManagerListener from this UpdateManager.

fireManagerStartedEvent

protected void fireManagerStartedEvent()
Fires a UpdateManagerEvent to notify that the manager was started.

fireManagerStoppedEvent

protected void fireManagerStoppedEvent()
Fires a UpdateManagerEvent to notify that the manager was stopped.

fireManagerSuspendedEvent

protected void fireManagerSuspendedEvent()
Fires a UpdateManagerEvent to notify that the manager was suspended.

fireManagerResumedEvent

protected void fireManagerResumedEvent()
Fires a UpdateManagerEvent to notify that the manager was resumed.

fireStartedEvent

protected void fireStartedEvent(java.awt.image.BufferedImage bi)
Fires a UpdateManagerEvent in the starting phase of an update.

fireCompletedEvent

protected void fireCompletedEvent(java.awt.image.BufferedImage bi,
                                  java.util.List rects)
Fires a UpdateManagerEvent when an update completed.

fireFailedEvent

protected void fireFailedEvent()
Fires a UpdateManagerEvent when an update failed.

runnableInvoked

public void runnableInvoked(RunnableQueue rq,
                            java.lang.Runnable r)
Called when the given Runnable has just been invoked and has returned.
Specified by:
runnableInvoked in interface RunnableQueue.RunHandler

executionSuspended

public void executionSuspended(RunnableQueue rq)
Called when the execution of the queue has been suspended.
Specified by:
executionSuspended in interface RunnableQueue.RunHandler

executionResumed

public void executionResumed(RunnableQueue rq)
Called when the execution of the queue has been resumed.
Specified by:
executionResumed in interface RunnableQueue.RunHandler


Copyright © 2002 Apache Software Foundation. All Rights Reserved.