ccvisu
Class WriterDataGraphicsDISP

java.lang.Object
  extended by ccvisu.WriterData
      extended by ccvisu.WriterDataGraphics
          extended by ccvisu.WriterDataGraphicsDISP

public class WriterDataGraphicsDISP
extends WriterDataGraphics

Writer for displaying the layout on the screen device.

Version:
$Revision: 1.70 $; $Date: 2009-01-20 22:30:37 $
Author:
Dirk Beyer

Field Summary
private  javax.swing.DefaultListModel clusters
           
private  DisplayCriteria dispFilter
           
private  FrameDisplay display
           
private  java.util.Vector<java.util.Vector<java.util.Set<GraphEdge>>> edgeMap
           
private  java.awt.Color frontColor
           
private  int insetbottom
           
private  int insetleft
           
private  java.awt.Graphics mGraphics
           
private  java.util.Vector<java.util.Set<java.lang.String>> xMap
           
private  int xSize
           
private  java.util.Vector<java.util.Set<java.lang.String>> yMap
           
private  int ySize
           
 
Fields inherited from class ccvisu.WriterDataGraphics
options
 
Fields inherited from class ccvisu.WriterData
endl, graph, out
 
Constructor Summary
WriterDataGraphicsDISP(java.io.PrintWriter out, GraphData graph, Options opt)
          Constructor.
 
Method Summary
 void addCluster(Group clt)
          add a new cluster in the list
 void adjustFrontColor()
          adjust frontColor
 void filterEdges(int filterType)
           
 void filterOff()
           
 void filterVertices(int filterType)
           
 Group getCluster(int index)
          return the cluster at the specified index
 Group getCluster(java.lang.String name)
          return the cluster with the specified name
 javax.swing.DefaultListModel getClusters()
           
 FrameDisplay getDisplay()
           
 GraphData getGraphData()
          Gets the local graph representation (layout).
 java.util.Set<java.lang.String> getNames(java.awt.Point p)
          Compute list of names of the vertices and edges at the given position.
 int getNbOfCluster()
          get the number of cluster
 java.awt.Color getWriteColor()
          the color of the text
private  boolean guessBrowser(java.lang.String URL)
           
 boolean isEdgesAvailable()
          get showEdges
 void markVertices(java.lang.String regEx)
          Marks all vertices whose node names match the given regular expression.
 void moveClusterDown(int index)
          move the cluster at index one place lower in the list => drawn later (more on top)
 void moveClusterUp(int index)
          move the cluster at index one place higher in the list => cluster drawn sooner
 void openURL(java.awt.Point p)
          Open the name of what is under the cursor as if it is an URL.
private  void paintArrow(java.awt.Graphics g, int x0, int y0, int x1, int y1)
           
 void refreshClusters()
          tells the cluster that the graph has changed => recompute some data
 void removeCluster(int index)
          remove the cluster at the specified index
 void resetRestriction()
          Reset vertex restriction that was set by restrictShowedVertices.
 void restrictShowedVertices(java.awt.Point pTopLeft, java.awt.Point pBottomRight)
          Restrict the set of vertices displayed on the screen to the vertices within the given rectangular (i.e., zoom).
 void setGraphData(GraphData layout)
          Sets the local graph representation (layout) to a new value.
 int toggleNames(java.awt.Point p)
          Toggle the showName flag of the vertices and edges at the given position.
 void write()
          Nothing to do here.
 void writeDISP(int size, java.awt.Graphics pGraphics, int xCanvasSize, int yCanvasSize, int insetleft, int insetbottom)
          Writes the layout on the screen device (DISP output format).
 void writeEdge(GraphEdge edge, int xPos1, int yPos1, int zPos1, int xPos2, int yPos2, int zPos2)
          Writes an edge.
 void writeFileLayout(java.lang.String fileName)
          Writes layout to file using an implementation of class WriterData.
 void writeVertex(GraphVertex curVertex, int xPos, int yPos, int zPos, int radius)
          Writes a vertex on screen.
 
Methods inherited from class ccvisu.WriterDataGraphics
paintArrow, writeGraphicsLayout
 
Methods inherited from class ccvisu.WriterData
mkQuoted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

display

private final FrameDisplay display

xMap

private java.util.Vector<java.util.Set<java.lang.String>> xMap

yMap

private java.util.Vector<java.util.Set<java.lang.String>> yMap

edgeMap

private java.util.Vector<java.util.Vector<java.util.Set<GraphEdge>>> edgeMap

clusters

private final javax.swing.DefaultListModel clusters

frontColor

private java.awt.Color frontColor

mGraphics

private java.awt.Graphics mGraphics

insetleft

private int insetleft

insetbottom

private int insetbottom

xSize

private int xSize

ySize

private int ySize

dispFilter

private DisplayCriteria dispFilter
Constructor Detail

WriterDataGraphicsDISP

public WriterDataGraphicsDISP(java.io.PrintWriter out,
                              GraphData graph,
                              Options opt)
Constructor.

Parameters:
graph - Graph representation, contains the positions of the vertices.
Method Detail

write

public void write()
Nothing to do here. The constructor initializes the ScreenDisplay (frame and canvas), and that calls back to the methods below (writeDISP, writeLAY, toggleVertexNames, getVertexNames).

Specified by:
write in class WriterDataGraphics

writeDISP

public void writeDISP(int size,
                      java.awt.Graphics pGraphics,
                      int xCanvasSize,
                      int yCanvasSize,
                      int insetleft,
                      int insetbottom)
Writes the layout on the screen device (DISP output format). Call-back method, invoked from ScreenDisplay.

Parameters:
size - Size of the output drawing square.
pGraphics - The drawing area of the canvas.
xCanvasSize - Width of the canvas.
yCanvasSize - Height of the canvas.
insetleft - Left inset of the drawing frame.
insetbottom - Bottom inset of the drawing frame.

writeVertex

public void writeVertex(GraphVertex curVertex,
                        int xPos,
                        int yPos,
                        int zPos,
                        int radius)
Writes a vertex on screen.

Specified by:
writeVertex in class WriterDataGraphics
Parameters:
curVertex - The vertex object, to access vertex attributes.
xPos - x coordinate of the vertex.
yPos - y coordinate of the vertex.
zPos - z coordinate of the vertex.
radius - Radius of the vertex.

writeEdge

public void writeEdge(GraphEdge edge,
                      int xPos1,
                      int yPos1,
                      int zPos1,
                      int xPos2,
                      int yPos2,
                      int zPos2)
Writes an edge.

Specified by:
writeEdge in class WriterDataGraphics
Parameters:
edge - an edge in graph.edges
xPos1 - x coordinate of the first point.
yPos1 - y coordinate of the first point.
zPos1 - z coordinate of the first point.
xPos2 - x coordinate of the second point.
yPos2 - y coordinate of the second point.
zPos2 - z coordinate of the second point.

writeFileLayout

public void writeFileLayout(java.lang.String fileName)
Writes layout to file using an implementation of class WriterData. Call-back method, invoked from within ScreenDisplay.

Parameters:
fileName - Name of the output file to write the layout to.

markVertices

public void markVertices(java.lang.String regEx)
Marks all vertices whose node names match the given regular expression. Call-back method, invoked from within ScreenDisplay.

Parameters:
regEx - Regular expression.

toggleNames

public int toggleNames(java.awt.Point p)
Toggle the showName flag of the vertices and edges at the given position. Call-back method, invoked from within ScreenDisplay.

Parameters:
p - coordinates of the vertex.
Returns:
number of names toggled

getNames

public java.util.Set<java.lang.String> getNames(java.awt.Point p)
Compute list of names of the vertices and edges at the given position. Call-back method, invoked from within ScreenDisplay.

Parameters:
p - coordinates.

restrictShowedVertices

public void restrictShowedVertices(java.awt.Point pTopLeft,
                                   java.awt.Point pBottomRight)
Restrict the set of vertices displayed on the screen to the vertices within the given rectangular (i.e., zoom). Call-back method, invoked from within ScreenDisplay.

Parameters:
pTopLeft - coordinates of the top left corner of the rectangular.
pBottomRight - coordinates of the bottom right corner of the rectangular.

resetRestriction

public void resetRestriction()
Reset vertex restriction that was set by restrictShowedVertices. Call-back method, invoked from within ScreenDisplay.


getGraphData

public GraphData getGraphData()
Gets the local graph representation (layout). Call-back method, invoked from within ScreenDisplay.

Returns:
Graph/layout representation to switch to.

setGraphData

public void setGraphData(GraphData layout)
Sets the local graph representation (layout) to a new value. Call-back method, invoked from within ScreenDisplay.

Parameters:
layout - Graph/layout representation to switch to.

isEdgesAvailable

public boolean isEdgesAvailable()
get showEdges


adjustFrontColor

public void adjustFrontColor()
adjust frontColor


getWriteColor

public java.awt.Color getWriteColor()
the color of the text

Returns:
the color of the text

addCluster

public void addCluster(Group clt)
add a new cluster in the list

Parameters:
clt -

removeCluster

public void removeCluster(int index)
remove the cluster at the specified index

Parameters:
index -

getCluster

public Group getCluster(int index)
return the cluster at the specified index

Parameters:
index -
Returns:
the cluster at the specified index

getCluster

public Group getCluster(java.lang.String name)
return the cluster with the specified name

Parameters:
name -
Returns:
the cluster with the specified name

getClusters

public javax.swing.DefaultListModel getClusters()

getNbOfCluster

public int getNbOfCluster()
get the number of cluster

Returns:
return the number of cluster

moveClusterUp

public void moveClusterUp(int index)
move the cluster at index one place higher in the list => cluster drawn sooner

Parameters:
index -

moveClusterDown

public void moveClusterDown(int index)
move the cluster at index one place lower in the list => drawn later (more on top)

Parameters:
index -

refreshClusters

public void refreshClusters()
tells the cluster that the graph has changed => recompute some data


openURL

public void openURL(java.awt.Point p)
Open the name of what is under the cursor as if it is an URL.

Parameters:
p - Coordinates

guessBrowser

private boolean guessBrowser(java.lang.String URL)

paintArrow

private void paintArrow(java.awt.Graphics g,
                        int x0,
                        int y0,
                        int x1,
                        int y1)

getDisplay

public FrameDisplay getDisplay()
Returns:
the display

filterVertices

public void filterVertices(int filterType)
Parameters:
filterType -
0: Display unchanged vertices
1: Display removed vertices
2: Display added vertices

filterEdges

public void filterEdges(int filterType)
Parameters:
filterType -
0: Display unchanged edges
1: Display removed edges
2: Display added edges

filterOff

public void filterOff()