edu.uci.ics.jung.visualization.graphdraw
Class SettableRenderer

java.lang.Object
  extended by edu.uci.ics.jung.visualization.AbstractRenderer
      extended by edu.uci.ics.jung.visualization.graphdraw.SettableRenderer
All Implemented Interfaces:
Renderer

Deprecated. Replaced by PluggableRenderer.

public class SettableRenderer
extends AbstractRenderer

A renderer with all sorts of buttons to press and dials to turn. In general, if a function is available to get an answer to questions of color. Otherwise, the set fields are used.

The default is to paint vertices with Black foreground text and Red backgrounds. Picked vertices are orange. [Whether a vertex is Picked is resolved with v.getUserDatum(_VisualizationViewer.VIS_KEY);]

Note that setting a stroke width other than 1 is likely to slow down the visualization noticably, as is using transparency.

Author:
danyelf

Field Summary
protected  Color edgeColor
          Deprecated.  
protected  EdgeColorFunction edgeColorFunction
          Deprecated.  
protected  int edgeThickness
          Deprecated.  
protected  EdgeThicknessFunction edgeThicknessFunction
          Deprecated.  
protected  Arrow mArrow
          Deprecated.  
protected  boolean mDrawLightBoxes
          Deprecated.  
protected  EdgeStringer mEdgeLabelFunction
          Deprecated.  
protected  int mLineHeight
          Deprecated.  
protected  boolean mShouldDrawArrowsDirected
          Deprecated.  
protected  boolean mShouldDrawArrowsUndirected
          Deprecated.  
protected  boolean mShouldDrawSelfLoops
          Deprecated.  
protected  StringLabeller mStringLabeller
          Deprecated.  
protected static EdgePredicate self_loop
          Deprecated.  
protected  Color vertexBGColor
          Deprecated.  
protected  VertexColorFunction vertexColorFunction
          Deprecated.  
protected  Color vertexFGColor
          Deprecated.  
protected  Color vertexPickedColor
          Deprecated.  
 
Constructor Summary
SettableRenderer()
          Deprecated. This variant simply renders vertices as small empty boxes without labels.
SettableRenderer(StringLabeller sl)
          Deprecated. Creates a SettableRenderer that will be drawn in the "heavy" style: a box around the label
SettableRenderer(StringLabeller sl, EdgeStringer el)
          Deprecated. Creates a SettableRenderer that will label edges with the given EdgeStringer.
 
Method Summary
protected  void drawArrowhead(Graphics2D g2d, Edge e, int xsource, int ysource, int xdest, int ydest)
          Deprecated. Draws an arrowhead on this edge in the direction from xsource,ysource to xend, yend
protected  void drawEdge(float edgeWidth, Graphics g, Edge e, int x1, int y1, int x2, int y2)
          Deprecated. Draws the edge at the given width, then restores the previous stroke.
protected  void drawEdgeSimple(Graphics g, Edge e, int x1, int y1, int x2, int y2)
          Deprecated.  
protected  String getLabel(Vertex v)
          Deprecated. Simple label function returns the StringLabeller's notion of v's label.
 void labelEdge(Graphics2D g2d, Edge e, String label, int x1, int x2, int y1, int y2)
          Deprecated. Labels the edge at the half-way point (if undirected) or three-quarters if directed or 15 pixels above the vertex if self-loop.
 void paintEdge(Graphics g, Edge e, int x1, int y1, int x2, int y2)
          Deprecated. Paints the edge in the color specified by the EdgeColorFunction or the hard-set color, and at the thickness set with an EdgeThicknessFunction.
protected  void paintLightVertex(Graphics g, Vertex v, int x, int y, String label)
          Deprecated.  
 void paintVertex(Graphics g, Vertex v, int x, int y)
          Deprecated. Paints the vertex, using the settings above (VertexColors, etc).
 void setEdgeColor(Color c)
          Deprecated.  
 void setEdgeColorFunction(EdgeColorFunction ecf)
          Deprecated. Edges are drawn by calling EdgeColorFunction with the edge, to decide how it is to be drawn.
 void setEdgeThickness(int i)
          Deprecated. Forces all edges to draw with this thickness.
 void setEdgeThicknessFunction(EdgeThicknessFunction etf)
          Deprecated. This version takes a function that dynamically chooses an edge thickness.
 void setLightDrawing(boolean b)
          Deprecated. Creates a SettableRenderer that will be drawn in the "light" style: a colored box next to text, instead of text overlaying the box.
 void setShouldDrawDirectedArrows(boolean b)
          Deprecated. Sets whether the system should draw arrows on directed edges.
 void setShouldDrawSelfLoops(boolean b)
          Deprecated. Sets whether the system should draw self-loops.
 void setShouldDrawUndirectedArrows(boolean b)
          Deprecated. Sets whether the system should draw arrows on directed edges.
 void setStringLabeller(StringLabeller sl)
          Deprecated.  
 void setVertexBGColor(Color vertexColor)
          Deprecated. Manually sets the color of an unpicked Vertex's background (i.e. its field).
 void setVertexColorFunction(VertexColorFunction vcf)
          Deprecated. Finds the color of a vertex with a VertexColorFunction.
 void setVertexForegroundColor(Color vertexColor)
          Deprecated. Manually sets the color of a Vertex's foreground (i.e. its text).
 void setVertexPickedColor(Color vertexColor)
          Deprecated. Manually sets the color of a picked Vertex's background (i.e. its field).
 
Methods inherited from class edu.uci.ics.jung.visualization.AbstractRenderer
getPickedKey, isPicked, isPicked, setPickedKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vertexFGColor

protected Color vertexFGColor
Deprecated. 

vertexPickedColor

protected Color vertexPickedColor
Deprecated. 

vertexBGColor

protected Color vertexBGColor
Deprecated. 

vertexColorFunction

protected VertexColorFunction vertexColorFunction
Deprecated. 

edgeThicknessFunction

protected EdgeThicknessFunction edgeThicknessFunction
Deprecated. 

edgeThickness

protected int edgeThickness
Deprecated. 

edgeColor

protected Color edgeColor
Deprecated. 

edgeColorFunction

protected EdgeColorFunction edgeColorFunction
Deprecated. 

mStringLabeller

protected StringLabeller mStringLabeller
Deprecated. 

mShouldDrawSelfLoops

protected boolean mShouldDrawSelfLoops
Deprecated. 

mDrawLightBoxes

protected boolean mDrawLightBoxes
Deprecated. 

mShouldDrawArrowsUndirected

protected boolean mShouldDrawArrowsUndirected
Deprecated. 

mShouldDrawArrowsDirected

protected boolean mShouldDrawArrowsDirected
Deprecated. 

mArrow

protected Arrow mArrow
Deprecated. 

mEdgeLabelFunction

protected EdgeStringer mEdgeLabelFunction
Deprecated. 

mLineHeight

protected int mLineHeight
Deprecated. 

self_loop

protected static EdgePredicate self_loop
Deprecated. 
Constructor Detail

SettableRenderer

public SettableRenderer()
Deprecated. 
This variant simply renders vertices as small empty boxes without labels.


SettableRenderer

public SettableRenderer(StringLabeller sl)
Deprecated. 
Creates a SettableRenderer that will be drawn in the "heavy" style: a box around the label

Parameters:
sl -

SettableRenderer

public SettableRenderer(StringLabeller sl,
                        EdgeStringer el)
Deprecated. 
Creates a SettableRenderer that will label edges with the given EdgeStringer. (You may want EdgeWeightLabellerStringer, which uses an EdgeWeightLabeller to label the weights.)

Parameters:
sl -
el -
Method Detail

setLightDrawing

public void setLightDrawing(boolean b)
Deprecated. 
Creates a SettableRenderer that will be drawn in the "light" style: a colored box next to text, instead of text overlaying the box.


setStringLabeller

public void setStringLabeller(StringLabeller sl)
Deprecated. 

setEdgeColor

public void setEdgeColor(Color c)
Deprecated. 

setEdgeColorFunction

public void setEdgeColorFunction(EdgeColorFunction ecf)
Deprecated. 
Edges are drawn by calling EdgeColorFunction with the edge, to decide how it is to be drawn.

Parameters:
ecf -

setEdgeThickness

public void setEdgeThickness(int i)
Deprecated. 
Forces all edges to draw with this thickness. Sets the edge thickness function to null.

Parameters:
i -

setEdgeThicknessFunction

public void setEdgeThicknessFunction(EdgeThicknessFunction etf)
Deprecated. 
This version takes a function that dynamically chooses an edge thickness.

Parameters:
etf -

setShouldDrawDirectedArrows

public void setShouldDrawDirectedArrows(boolean b)
Deprecated. 
Sets whether the system should draw arrows on directed edges. By default, yes.

Parameters:
b -

setShouldDrawUndirectedArrows

public void setShouldDrawUndirectedArrows(boolean b)
Deprecated. 
Sets whether the system should draw arrows on directed edges. By default, yes.

Parameters:
b -

setShouldDrawSelfLoops

public void setShouldDrawSelfLoops(boolean b)
Deprecated. 
Sets whether the system should draw self-loops. By default, no.

Parameters:
b -

paintEdge

public void paintEdge(Graphics g,
                      Edge e,
                      int x1,
                      int y1,
                      int x2,
                      int y2)
Deprecated. 
Paints the edge in the color specified by the EdgeColorFunction or the hard-set color, and at the thickness set with an EdgeThicknessFunction. Draws a self-loop if shouldDrawSelfLoops() has been set (by default, no); draws an arrow on directed edges if shouldDrawDirectedArrows() has been set (by default, yes) and on both ends of undirected edges if shouldDrawUndirectedArrows() has been set (by default, false). Calls either drawEdge or drawEdgeSimple. Draws one arrow for self-loops if needed. Note that x1, y1 always correspond to e.getEndpoints.getFirst() and x2, y2 always correspond to e.getEndpoints.getSecond()

Specified by:
paintEdge in interface Renderer
Specified by:
paintEdge in class AbstractRenderer
See Also:
EdgeThicknessFunction, EdgeColorFunction

labelEdge

public void labelEdge(Graphics2D g2d,
                      Edge e,
                      String label,
                      int x1,
                      int x2,
                      int y1,
                      int y2)
Deprecated. 
Labels the edge at the half-way point (if undirected) or three-quarters if directed or 15 pixels above the vertex if self-loop.

Parameters:
g2d -
e -
label -
x1 -
x2 -
y1 -
y2 -

drawArrowhead

protected void drawArrowhead(Graphics2D g2d,
                             Edge e,
                             int xsource,
                             int ysource,
                             int xdest,
                             int ydest)
Deprecated. 
Draws an arrowhead on this edge in the direction from xsource,ysource to xend, yend


drawEdge

protected void drawEdge(float edgeWidth,
                        Graphics g,
                        Edge e,
                        int x1,
                        int y1,
                        int x2,
                        int y2)
Deprecated. 
Draws the edge at the given width, then restores the previous stroke. Calls drawEdgeSimple to accomplish this task.

Parameters:
edgeWidth - the width of the stroke.

drawEdgeSimple

protected void drawEdgeSimple(Graphics g,
                              Edge e,
                              int x1,
                              int y1,
                              int x2,
                              int y2)
Deprecated. 

setVertexForegroundColor

public void setVertexForegroundColor(Color vertexColor)
Deprecated. 
Manually sets the color of a Vertex's foreground (i.e. its text).

Parameters:
vertexColor -

setVertexPickedColor

public void setVertexPickedColor(Color vertexColor)
Deprecated. 
Manually sets the color of a picked Vertex's background (i.e. its field).

Parameters:
vertexColor -

setVertexBGColor

public void setVertexBGColor(Color vertexColor)
Deprecated. 
Manually sets the color of an unpicked Vertex's background (i.e. its field).

Parameters:
vertexColor -

setVertexColorFunction

public void setVertexColorFunction(VertexColorFunction vcf)
Deprecated. 
Finds the color of a vertex with a VertexColorFunction.

Parameters:
vcf -

getLabel

protected String getLabel(Vertex v)
Deprecated. 
Simple label function returns the StringLabeller's notion of v's label. It may be sometimes useful to override this.

Parameters:
v - a vertex
Returns:
the label on the vertex.

paintVertex

public void paintVertex(Graphics g,
                        Vertex v,
                        int x,
                        int y)
Deprecated. 
Paints the vertex, using the settings above (VertexColors, etc). In this implmenetation, vertices are painted as filled squares with textual labels over the filled square.

Specified by:
paintVertex in interface Renderer
Specified by:
paintVertex in class AbstractRenderer

paintLightVertex

protected void paintLightVertex(Graphics g,
                                Vertex v,
                                int x,
                                int y,
                                String label)
Deprecated. 
Parameters:
g -
v -
x -
y -