org.primordion.xholon.io
Class TreeViewerJung

java.lang.Object
  extended byorg.primordion.xholon.io.TreeViewerJung
All Implemented Interfaces:
IGraphicalTreeViewer, IViewer

public class TreeViewerJung
extends java.lang.Object
implements IGraphicalTreeViewer

Graphical tree viewer constructed using the JUNG software.

This requires the Java classes that implement JUNG. Download these from the JUNG web site, download the additional third-party Java classes specified at that site, and install the various downloaded jar files.

Since:
0.2 (Created on November 29, 2005)
Author:
Ken Webb
See Also:
jung.sourceforge.net

Constructor Summary
TreeViewerJung()
          Constructor.
 
Method Summary
 void createGraph(IXholon xhRoot, java.lang.String title, boolean showNodeLabels)
          Create a graph using a tree layout.
 void remove()
          Remove the graph from the screen.
 void setDistances(int distX, int distY)
          Set the default x and y distances between vertices.
 void setGraphSize(int sizeX, int sizeY)
          Set the size of the graph.
 void setLabelFontSize(int fontSize)
          Set the font size for displaying labels on vertices.
 void writeImage(java.io.File file, java.lang.String formatName)
          Write a graph to a file using PNG, JPG or some other graphic format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeViewerJung

public TreeViewerJung()
Constructor.

Method Detail

setDistances

public void setDistances(int distX,
                         int distY)
Description copied from interface: IGraphicalTreeViewer
Set the default x and y distances between vertices.

Specified by:
setDistances in interface IGraphicalTreeViewer
Parameters:
distX - Distance in the x direction (system default is 50).
distY - Distance in the y direction (system default is 50).

setGraphSize

public void setGraphSize(int sizeX,
                         int sizeY)
Description copied from interface: IGraphicalTreeViewer
Set the size of the graph.

Specified by:
setGraphSize in interface IGraphicalTreeViewer
Parameters:
sizeX - Size in the x direction.
sizeY - Size in the y direction.

setLabelFontSize

public void setLabelFontSize(int fontSize)
Description copied from interface: IGraphicalTreeViewer
Set the font size for displaying labels on vertices.

Specified by:
setLabelFontSize in interface IGraphicalTreeViewer
Parameters:
fontSize - The font size (default is 9).

createGraph

public void createGraph(IXholon xhRoot,
                        java.lang.String title,
                        boolean showNodeLabels)
Description copied from interface: IGraphicalTreeViewer
Create a graph using a tree layout.

Specified by:
createGraph in interface IGraphicalTreeViewer
Parameters:
xhRoot - The root of the IXholon tree.
title - The title to appear in the viewer window,
showNodeLabels - Whether vertices (nodes) should initially appear labelled.

writeImage

public void writeImage(java.io.File file,
                       java.lang.String formatName)
Write a graph to a file using PNG, JPG or some other graphic format.

Parameters:
file - The file to be written to.
formatName - Name of the graphic format to use.

remove

public void remove()
Description copied from interface: IGraphicalTreeViewer
Remove the graph from the screen.

Specified by:
remove in interface IGraphicalTreeViewer