|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.DefaultOrderRenderer
public class DefaultOrderRenderer
Default OrderRenderer
implementation. The rendering order
is specified using Graph2DTraversal
instances.
Constructor Summary | |
---|---|
DefaultOrderRenderer()
Constructs a new DefaultOrderRenderer which uses
instances of DefaultGraph2DTraversal to determine
painting and sloppy painting order. |
|
DefaultOrderRenderer(Graph2DTraversal paintOrder,
Graph2DTraversal sloppyPaintOrder)
Constructs a new DefaultOrderRenderer for the specified
painting and sloppy painting orders. |
Method Summary | |
---|---|
protected java.lang.Object |
getEdgeLock(Edge edge)
Returns the lock to synchronize intersects and
paint calls on for the given edge. |
java.lang.Object |
getGlobalLock()
Returns the global synchronization lock that should be used to synchronize all intersects and paint calls on. |
protected java.lang.Object |
getNodeLock(Node node)
Returns the lock to synchronize intersects and
paint calls on for the given node. |
Graph2DTraversal |
getPaintOrder()
Returns the Graph2DTraversal instance that determines
this DefaultOrderRenderer 's painting order. |
Graph2DTraversal |
getSloppyPaintOrder()
Returns the Graph2DTraversal instance that determines
this DefaultOrderRenderer 's sloppy painting order. |
protected boolean |
intersects(EdgeRealizer er,
java.awt.geom.Rectangle2D region)
Checks if the given region overlaps with the edge. |
protected boolean |
intersects(NodeRealizer nr,
java.awt.geom.Rectangle2D region)
Checks if the given region overlaps with the node. |
protected boolean |
isSynchronizationEnabled()
Determines whether or not intersects and paint
calls should be synchronized. |
protected void |
paint(java.awt.Graphics2D gfx,
EdgeRealizer er)
Paints the given edge realizer on the specified graphics context. |
void |
paint(java.awt.Graphics2D gfx,
Graph2D graph)
Renders the given graph2D on the given Graphics2D context. |
protected void |
paint(java.awt.Graphics2D gfx,
NodeRealizer nr)
Paints the given node realizer on the specified graphics context. |
protected void |
paintSloppy(java.awt.Graphics2D gfx,
EdgeRealizer er)
Paints the given edge realizer sloppily on the specified graphics context. |
void |
paintSloppy(java.awt.Graphics2D gfx,
Graph2D graph)
Renders the given graph2D on the given Graphics2D context. |
protected void |
paintSloppy(java.awt.Graphics2D gfx,
NodeRealizer nr)
Paints the given node realizer sloppily on the specified graphics context. |
void |
setGlobalLock(java.lang.Object lock)
Specifies the global synchronization lock that should be used to synchronize all intersects and paint calls on. |
void |
setPaintOrder(Graph2DTraversal paintOrder)
Specifies the Graph2DTraversal instance that determines
this DefaultOrderRenderer 's painting order. |
void |
setSloppyPaintOrder(Graph2DTraversal sloppyPaintOrder)
Specifies the Graph2DTraversal instance that determines
this DefaultOrderRenderer 's sloppy painting order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultOrderRenderer()
DefaultOrderRenderer
which uses
instances of DefaultGraph2DTraversal
to determine
painting and sloppy painting order.
public DefaultOrderRenderer(Graph2DTraversal paintOrder, Graph2DTraversal sloppyPaintOrder)
DefaultOrderRenderer
for the specified
painting and sloppy painting orders.
paintOrder
- a Graph2DTraversal
whose
firstToLast
method determines this DefaultOrderRenderer
painting order.sloppyPaintOrder
- a Graph2DTraversal
whose
firstToLast
method determines this DefaultOrderRenderer
sloppy painting
order.Method Detail |
---|
public Graph2DTraversal getPaintOrder()
Graph2DTraversal
instance that determines
this DefaultOrderRenderer
's painting order.
getPaintOrder
in interface OrderRenderer
Graph2DTraversal
instance that determines
this DefaultOrderRenderer
's painting order.public void setPaintOrder(Graph2DTraversal paintOrder)
Graph2DTraversal
instance that determines
this DefaultOrderRenderer
's painting order.
paintOrder
- the Graph2DTraversal
whose
firstToLast
method determines the painting order.public Graph2DTraversal getSloppyPaintOrder()
Graph2DTraversal
instance that determines
this DefaultOrderRenderer
's sloppy painting order.
getSloppyPaintOrder
in interface OrderRenderer
Graph2DTraversal
instance that determines
this DefaultOrderRenderer
's sloppy painting order.public void setSloppyPaintOrder(Graph2DTraversal sloppyPaintOrder)
Graph2DTraversal
instance that determines
this DefaultOrderRenderer
's sloppy painting order.
sloppyPaintOrder
- the Graph2DTraversal
whose
firstToLast
method determines the sloppy painting order.public void paint(java.awt.Graphics2D gfx, Graph2D graph)
Graph2DRenderer
paint
in interface Graph2DRenderer
public void paintSloppy(java.awt.Graphics2D gfx, Graph2D graph)
Graph2DRenderer
paintSloppy
in interface Graph2DRenderer
protected void paint(java.awt.Graphics2D gfx, EdgeRealizer er)
protected void paint(java.awt.Graphics2D gfx, NodeRealizer nr)
protected void paintSloppy(java.awt.Graphics2D gfx, EdgeRealizer er)
protected void paintSloppy(java.awt.Graphics2D gfx, NodeRealizer nr)
protected boolean intersects(NodeRealizer nr, java.awt.geom.Rectangle2D region)
nr
- the realizer of the noderegion
- the rectangular region to be tested
true
if the node intersects with the region, false
otherwise.protected boolean intersects(EdgeRealizer er, java.awt.geom.Rectangle2D region)
er
- the realizer of the edgeregion
- the rectangular region to be tested
true
if the edge crosses the region, false
otherwise.public java.lang.Object getGlobalLock()
intersects
and paint
calls on.
By default, this lock will be null
and intersection
calculation and painting will not be synchronized.
setGlobalLock(Object)
,
isSynchronizationEnabled()
,
getNodeLock(y.base.Node)
,
getEdgeLock(y.base.Edge)
public void setGlobalLock(java.lang.Object lock)
intersects
and paint
calls on.
By default, this lock will be null
and intersection
calculation and painting will not be synchronized.
lock
- the object instance to synchronize all intersects
and paint
calls on.setGlobalLock(Object)
,
isSynchronizationEnabled()
,
getNodeLock(y.base.Node)
,
getEdgeLock(y.base.Edge)
protected boolean isSynchronizationEnabled()
intersects
and paint
calls should be synchronized. Intersection calculation and painting should
be synchronized if multiple threads paint one graph instance e.g. during
printing.
By default, this method returns true
if
getGlobalLock()
returns a non-null
global lock and
false
otherwise.
true
if intersects
and paint
calls should be synchronized; false
otherwise.getGlobalLock()
,
setGlobalLock(Object)
,
getNodeLock(y.base.Node)
,
getEdgeLock(y.base.Edge)
protected java.lang.Object getEdgeLock(Edge edge)
intersects
and
paint
calls on for the given edge.
By default, this method will return the given edge if this class' global
lock is null
; otherwise the global lock is returned.
Client code may overwrite this method for fine-grained control over synchronization locks.
This method may not return null
.
edge
- the edge that is about to be painted.
getGlobalLock()
,
isSynchronizationEnabled()
protected java.lang.Object getNodeLock(Node node)
intersects
and
paint
calls on for the given node.
By default, this method will return the given node if this class' global
lock is null
; otherwise the global lock is returned.
Client code may overwrite this method for fine-grained control over synchronization locks.
This method may not return null
.
node
- the node that is about to be painted.
getGlobalLock()
,
isSynchronizationEnabled()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |