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.8 $; $Date: 2006/11/25 10:41:08 $
Author:
Dirk Beyer

Field Summary
private  java.awt.Graphics area
           
private  java.lang.String browser
           
private  java.util.Vector<Cluster> clusters
           
private  ScreenDisplay display
           
private  boolean[] edgeAnnot
           
private  java.util.Set<java.lang.Integer>[][] edgeMap
           
private  int insetbottom
           
private  int insetleft
           
private  java.awt.Color write
           
private  java.util.Set<java.lang.String>[] xMap
           
private  int xSize
           
private  java.util.Set<java.lang.String>[] yMap
           
private  int ySize
           
 
Fields inherited from class ccvisu.WriterDataGraphics
backColor, blackCircle, fontSize, minVert, openURL, showEdges
 
Fields inherited from class ccvisu.WriterData
endl, graph
 
Constructor Summary
WriterDataGraphicsDISP(GraphData graph, float minVert, int fontSize, java.awt.Color backColor, boolean blackCircle, boolean showEdges, boolean openURL, boolean anim, java.lang.String inputName, java.lang.String browser)
          Constructor.
 
Method Summary
 void addCluster(Cluster clt)
          add a new cluster in the list
 boolean getBlackCircle()
          return true if black circles are drawn
 Cluster getCluster(int index)
          return the cluster at the specified index
 Cluster getCluster(java.lang.String name)
          return the cluster with the specified name
 ScreenDisplay getDisplay()
           
 GraphData getGraphData()
           
 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
 boolean getshowEdges()
          get showEdges
 java.awt.Color getWriteColor()
          the color of the text
private  boolean guessBrowser(java.lang.String URL)
           
 void hideAllLabels()
          Hide all labels (vertice names).
 boolean isshowEdgesPossible()
          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.
 void refreshCluster()
          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 vertice 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 setBackColor(java.awt.Color back)
          set backColor
 void setBlackCircle(boolean bc)
          set blackCircle
 void setColorToAll(java.awt.Color color)
          Set a color to all vertices Call-back method, invoked from within ScreenDisplay.
 void setGraphData(GraphData layout)
          Sets the local graph representation (layout) to a new value.
 void setshowEdges(boolean se)
          set showEdges
 void showAllLabels()
          Show all labels (vertices and edges names).
 void showLabel(GraphVertex vertex, boolean show)
          show/hide the name of a vertex
 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 area, int xCanvasSize, int yCanvasSize, int insetleft, int insetbottom, float minVert)
          Writes the layout on the screen device (DISP output format).
 void writeEdge(int index, 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 writeGraphicsLayout(int size)
          Write graphics layout.
 void writeVertex(GraphVertex curVertex, int xPos, int yPos, int zPos, int radius)
          Writes a vertex on screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

display

private ScreenDisplay display

xMap

private java.util.Set<java.lang.String>[] xMap

yMap

private java.util.Set<java.lang.String>[] yMap

edgeMap

private java.util.Set<java.lang.Integer>[][] edgeMap

edgeAnnot

private boolean[] edgeAnnot

clusters

private java.util.Vector<Cluster> clusters

write

private java.awt.Color write

browser

private java.lang.String browser

area

private java.awt.Graphics area

insetleft

private int insetleft

insetbottom

private int insetbottom

xSize

private int xSize

ySize

private int ySize
Constructor Detail

WriterDataGraphicsDISP

public WriterDataGraphicsDISP(GraphData graph,
                              float minVert,
                              int fontSize,
                              java.awt.Color backColor,
                              boolean blackCircle,
                              boolean showEdges,
                              boolean openURL,
                              boolean anim,
                              java.lang.String inputName,
                              java.lang.String browser)
Constructor.

Parameters:
graph - Graph representation, contains the positions of the vertices.
minVert - Diameter of the smallest vertex.
fontSize - Font size of vertex annotations.
backColor - Background color.
blackCircle - If true, draw black circle around each vertex.
showEdges - If true, draw the edges between the vertices (if possible).
anim - If true, the layout is already displayed while the minimizer is still improving it, and a simple mouse click on the canvas updates the current layout on the screen. If false, the layout is displayed only after minimization is completed.
inputName - the windows title
openURL - is Opening nodes as url allowed
browser - the browser cmd
Method Detail

write

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

Specified by:
write in class WriterDataGraphics

writeGraphicsLayout

public void writeGraphicsLayout(int size)
Write graphics layout.

Overrides:
writeGraphicsLayout in class WriterDataGraphics
Parameters:
size - Size of output area (e.g., number of pixel).

writeDISP

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

Parameters:
size - Size of the output drawing quare.
area - The drawing area of the canvas.
xCanvasSize - Width of the canvas.
yCanvasSize - Height of the canvas.
insetleft - Left 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(int index,
                      int xPos1,
                      int yPos1,
                      int zPos1,
                      int xPos2,
                      int yPos2,
                      int zPos2)
Writes an edge.

Specified by:
writeEdge in class WriterDataGraphics
Parameters:
index - index of the 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

showAllLabels

public void showAllLabels()
Show all labels (vertices and edges names). Call-back method, invoked from within ScreenDisplay.


setColorToAll

public void setColorToAll(java.awt.Color color)
Set a color to all vertices Call-back method, invoked from within ScreenDisplay.


hideAllLabels

public void hideAllLabels()
Hide all labels (vertice names). Call-back method, invoked from within ScreenDisplay.


showLabel

public void showLabel(GraphVertex vertex,
                      boolean show)
show/hide the name of a vertex

Parameters:
vertex - a vertex

getNames

public 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 vertice restriction that was set by restrictShowedVertices. Call-back method, invoked from within ScreenDisplay.


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.

getGraphData

public GraphData getGraphData()
Returns:
displayed graph

getDisplay

public ScreenDisplay getDisplay()
Returns:
return display.

setBlackCircle

public void setBlackCircle(boolean bc)
set blackCircle


getshowEdges

public boolean getshowEdges()
get showEdges


isshowEdgesPossible

public boolean isshowEdgesPossible()
get showEdges


setshowEdges

public void setshowEdges(boolean se)
set showEdges


getBlackCircle

public boolean getBlackCircle()
return true if black circles are drawn

Returns:
return blackCircle

setBackColor

public void setBackColor(java.awt.Color back)
set backColor


addCluster

public void addCluster(Cluster 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 Cluster getCluster(int index)
return the cluster at the specified index

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

getCluster

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

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

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 -

refreshCluster

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


getWriteColor

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

Returns:
the color of the text

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)