Search this API

y.view
Class Graph2DViewRepaintManager

java.lang.Object
  extended by y.view.Graph2DViewRepaintManager
All Implemented Interfaces:
AnimationListener

public class Graph2DViewRepaintManager
extends java.lang.Object
implements AnimationListener

This class triggers repaints in a Graph2DView, that affect only the unified bounds of registered graph objects.

See Also:
add(Drawable), add(EdgeRealizer), add(NodeRealizer)
 

Constructor Summary
Graph2DViewRepaintManager(Graph2DView view)
          Constructs a new Graph2DViewRepaintManager for the specified Graph2DView.
 
Method Summary
 void add(Drawable drawable)
          Adds the specified Drawable to this manager's list of graph objects.
 void add(EdgeRealizer edge)
          Adds the specified EdgeRealizer to this manager's list of graph objects.
 void add(NodeRealizer node)
          Adds the specified NodeRealizer to this manager's list of graph objects.
 void animationPerformed(AnimationEvent e)
          Triggers update for the appropriate events.
protected  void calcUnionRect(Drawable drawable, java.awt.geom.Rectangle2D rectangle)
          Calculates the union of the bounding box of this drawable and the specified rectangle.
protected  void calcUnionRect(EdgeRealizer realizer, java.awt.geom.Rectangle2D rectangle)
          Calculates the union of the rectangle enclosed by this realizer and the specified rectangle.
protected  void calcUnionRect(NodeRealizer realizer, java.awt.geom.Rectangle2D rectangle)
          Calculates the union of rectangle enclosed by this realizer and the specified rectangle.
 boolean getForceGlobalUpdate()
          Returns true if this Graph2DViewRepaintManager forces its view to repaint completely.
 Graph2DView getView()
          Returns the Graph2DView, for which this Graph2DViewRepaintManager was created.
 void invalidate()
          Forces the manager to update all of its view's contents on the next call to update.
 void remove(Drawable drawable)
          Removes the specified Drawable from this manager's list of graph objects.
 void remove(EdgeRealizer edge)
          Removes the specified EdgeRealizer from this manager's list of graph objects.
 void remove(NodeRealizer node)
          Removes the specified NodeRealizer from this manager's list of graph objects.
 void removeAll()
          Removes all registered Drawables, NodeRealizers and EdgeRealizers from this manager's list of graph objects.
 void setForceGlobalUpdate(boolean forceGlobalUpdate)
          Specifies whether this Graph2DViewRepaintManager forces its view to repaint completely.
 void update()
          Forces this manager's view to repaint the union of bounds of the currently registered graph objects.
 void updateView()
          Forces this manager's view to repaint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph2DViewRepaintManager

public Graph2DViewRepaintManager(Graph2DView view)
Constructs a new Graph2DViewRepaintManager for the specified Graph2DView.

Parameters:
view - the Graph2DView
Method Detail

getView

public Graph2DView getView()
Returns the Graph2DView, for which this Graph2DViewRepaintManager was created.

Returns:
the Graph2DView, for which this Graph2DViewRepaintManager was created

add

public void add(Drawable drawable)
Adds the specified Drawable to this manager's list of graph objects.

Parameters:
drawable - the Drawable

remove

public void remove(Drawable drawable)
Removes the specified Drawable from this manager's list of graph objects.

Parameters:
drawable - the Drawable

add

public void add(EdgeRealizer edge)
Adds the specified EdgeRealizer to this manager's list of graph objects.

Parameters:
edge - the EdgeRealizer

remove

public void remove(EdgeRealizer edge)
Removes the specified EdgeRealizer from this manager's list of graph objects.

Parameters:
edge - the EdgeRealizer

add

public void add(NodeRealizer node)
Adds the specified NodeRealizer to this manager's list of graph objects.

Parameters:
node - the NodeRealizer

remove

public void remove(NodeRealizer node)
Removes the specified NodeRealizer from this manager's list of graph objects.

Parameters:
node - the NodeRealizer
See Also:
add(Drawable), add(NodeRealizer), add(EdgeRealizer)

removeAll

public void removeAll()
Removes all registered Drawables, NodeRealizers and EdgeRealizers from this manager's list of graph objects.


animationPerformed

public void animationPerformed(AnimationEvent e)
Triggers update for the appropriate events.

Specified by:
animationPerformed in interface AnimationListener
See Also:
update()

invalidate

public void invalidate()
Forces the manager to update all of its view's contents on the next call to update.

See Also:
update()

updateView

public void updateView()
Forces this manager's view to repaint.


update

public void update()
Forces this manager's view to repaint the union of bounds of the currently registered graph objects. If forceGlobalUpdate is set to true, calling this method has the same effect as calling updateView. If the repaint manager has no elements registered or update is called for the first time, the complete view is being updated.

See Also:
updateView(), setForceGlobalUpdate(boolean)

getForceGlobalUpdate

public boolean getForceGlobalUpdate()
Returns true if this Graph2DViewRepaintManager forces its view to repaint completely.

Returns:
true if this Graph2DViewRepaintManager forces its view to repaint completely.

setForceGlobalUpdate

public void setForceGlobalUpdate(boolean forceGlobalUpdate)
Specifies whether this Graph2DViewRepaintManager forces its view to repaint completely.

Parameters:
forceGlobalUpdate - if true, this Graph2DViewRepaintManager forces its view to repaint completely

calcUnionRect

protected void calcUnionRect(Drawable drawable,
                             java.awt.geom.Rectangle2D rectangle)
Calculates the union of the bounding box of this drawable and the specified rectangle. The union rectangle is returned by modifying the specified rectangle. If the specified rectangle has negative width or height, the rectangle's geometry should be ignored and the specified drawable's bounds should be adopted as result.

Parameters:
drawable - the drawable whose bounding box will be added.
rectangle - the rectangle that will be added and modified.

calcUnionRect

protected void calcUnionRect(EdgeRealizer realizer,
                             java.awt.geom.Rectangle2D rectangle)
Calculates the union of the rectangle enclosed by this realizer and the specified rectangle. The union rectangle is returned by modifying the specified rectangle. If the specified rectangle has negative width or height, the rectangle's geometry should be ignored and the specified edge's bounding box should be adopted as result.

The default implementation calls EdgeRealizer.calcUnionRect(java.awt.geom.Rectangle2D).

Parameters:
realizer - the realizer whose rectangle will be added.
rectangle - the rectangle that will be added and modified.

calcUnionRect

protected void calcUnionRect(NodeRealizer realizer,
                             java.awt.geom.Rectangle2D rectangle)
Calculates the union of rectangle enclosed by this realizer and the specified rectangle. The union rectangle is returned by modifying the specified rectangle. If the specified rectangle has negative width or height, the rectangle's geometry should be ignored and the specified node's bounding box should be adopted as result.

The default implementation calls NodeRealizer.calcUnionRect(java.awt.geom.Rectangle2D).

Parameters:
realizer - the realizer whose rectangle will be added.
rectangle - the rectangle that will be added and modified.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.