Search this API

y.view
Class DefaultOrderRenderer

java.lang.Object
  extended by y.view.DefaultOrderRenderer
All Implemented Interfaces:
Graph2DRenderer, OrderRenderer

public class DefaultOrderRenderer
extends Object
implements OrderRenderer

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
 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, Rectangle2D region)
          Checks if the given region overlaps with the edge.
protected  boolean intersects(NodeRealizer nr, Rectangle2D region)
          Checks if the given region overlaps with the node.
protected  void paint(Graphics2D gfx, EdgeRealizer er)
          Paints the given edge realizer on the specified graphics context.
 void paint(Graphics2D gfx, Graph2D graph)
          Renders the given graph2D on the given Graphics2D context.
protected  void paint(Graphics2D gfx, NodeRealizer nr)
          Paints the given node realizer on the specified graphics context.
protected  void paintSloppy(Graphics2D gfx, EdgeRealizer er)
          Paints the given edge realizer sloppily on the specified graphics context.
 void paintSloppy(Graphics2D gfx, Graph2D graph)
          Renders the given graph2D on the given Graphics2D context.
protected  void paintSloppy(Graphics2D gfx, NodeRealizer nr)
          Paints the given node realizer sloppily on the specified graphics context.
 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

DefaultOrderRenderer

public DefaultOrderRenderer()
Constructs a new DefaultOrderRenderer which uses instances of DefaultGraph2DTraversal to determine painting and sloppy painting order.


DefaultOrderRenderer

public DefaultOrderRenderer(Graph2DTraversal paintOrder,
                            Graph2DTraversal sloppyPaintOrder)
Constructs a new DefaultOrderRenderer for the specified painting and sloppy painting orders.

Parameters:
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

getPaintOrder

public Graph2DTraversal getPaintOrder()
Returns the Graph2DTraversal instance that determines this DefaultOrderRenderer's painting order.

Specified by:
getPaintOrder in interface OrderRenderer
Returns:
the Graph2DTraversal instance that determines this DefaultOrderRenderer's painting order.

setPaintOrder

public void setPaintOrder(Graph2DTraversal paintOrder)
Specifies the Graph2DTraversal instance that determines this DefaultOrderRenderer's painting order.

Parameters:
paintOrder - the Graph2DTraversal whose firstToLast method determines the painting order.

getSloppyPaintOrder

public Graph2DTraversal getSloppyPaintOrder()
Returns the Graph2DTraversal instance that determines this DefaultOrderRenderer's sloppy painting order.

Specified by:
getSloppyPaintOrder in interface OrderRenderer
Returns:
the Graph2DTraversal instance that determines this DefaultOrderRenderer's sloppy painting order.

setSloppyPaintOrder

public void setSloppyPaintOrder(Graph2DTraversal sloppyPaintOrder)
Specifies the Graph2DTraversal instance that determines this DefaultOrderRenderer's sloppy painting order.

Parameters:
sloppyPaintOrder - the Graph2DTraversal whose firstToLast method determines the sloppy painting order.

paint

public void paint(Graphics2D gfx,
                  Graph2D graph)
Description copied from interface: Graph2DRenderer
Renders the given graph2D on the given Graphics2D context.

Specified by:
paint in interface Graph2DRenderer

paintSloppy

public void paintSloppy(Graphics2D gfx,
                        Graph2D graph)
Description copied from interface: Graph2DRenderer
Renders the given graph2D on the given Graphics2D context. the rendering process should be quick and can be sloppy.

Specified by:
paintSloppy in interface Graph2DRenderer

paint

protected void paint(Graphics2D gfx,
                     EdgeRealizer er)
Paints the given edge realizer on the specified graphics context.


paint

protected void paint(Graphics2D gfx,
                     NodeRealizer nr)
Paints the given node realizer on the specified graphics context.


paintSloppy

protected void paintSloppy(Graphics2D gfx,
                           EdgeRealizer er)
Paints the given edge realizer sloppily on the specified graphics context.


paintSloppy

protected void paintSloppy(Graphics2D gfx,
                           NodeRealizer nr)
Paints the given node realizer sloppily on the specified graphics context.


intersects

protected boolean intersects(NodeRealizer nr,
                             Rectangle2D region)
Checks if the given region overlaps with the node. This method may be overwritten to adjust the intersection detection.

By default it is tested if the node's bounding box including labels and node ports overlaps with the region.

Parameters:
nr - the realizer of the node
region - the rectangular region to be tested
Returns:
true if the node intersects with the region, false otherwise.

intersects

protected boolean intersects(EdgeRealizer er,
                             Rectangle2D region)
Checks if the given region overlaps with the edge. This method may be overwritten to adjust the intersection detection.

By default it is tested if the bends and end points of the edge lie within the region, labels are ignored.

Parameters:
er - the realizer of the edge
region - the rectangular region to be tested
Returns:
true if the edge crosses the region, false otherwise.

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