ch.ethz.graphbench.toolbox
Class Toolbox

java.lang.Object
  |
  +--ch.ethz.graphbench.toolbox.Toolbox

public class Toolbox
extends java.lang.Object

This class provides some methods for generating Algorithm outputs. It provides methods to draw arbitrary Shapes within the graph and also methods for displaying text output.


Field Summary
static int HORIZONTAL
          Specifies that a horizontal line should be drawn.
static int VERTICAL
          Specifies that a vertical line should be drawn.
 
Method Summary
 void addLine(int position, int direction, java.awt.Color color)
          Adds a line to the list of graphical components.
 void addShape(java.awt.Shape shape, java.awt.Color color, boolean filled)
          Adds shape to the list of graphical components.
 void clearAllGraphicComponents()
          Removes all graphical components from the list.
 void clearOutputText()
          Clears all text in the text ouput window.
static Toolbox getToolbox()
          Returns an instance of Toolbox.
 void printText(java.lang.String text)
          Ouputs a string to a special frame.
 void removeLine(int position, int direction)
          Removes a line from the list of graphical components.
 void removeShape(java.awt.Shape shape)
          Removes shape from list of graphical components.
 void setDirected(boolean directed)
          Sets the directed attribute of the Toolbox object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Specifies that a horizontal line should be drawn.

VERTICAL

public static final int VERTICAL
Specifies that a vertical line should be drawn.
Method Detail

setDirected

public void setDirected(boolean directed)
Sets the directed attribute of the Toolbox object
Parameters:
directed - The new directed value

printText

public void printText(java.lang.String text)
Ouputs a string to a special frame.
Parameters:
text - String to be added to text output frame.

addShape

public void addShape(java.awt.Shape shape,
                     java.awt.Color color,
                     boolean filled)
Adds shape to the list of graphical components. The passed will be draw within the graph view until it's removed.
Parameters:
shape - Shape to be drawn in the future.
color - Color to use to draw shape with.
filled - Boolean indicating if shape should be drawn filled or outlined.

removeShape

public void removeShape(java.awt.Shape shape)
Removes shape from list of graphical components.
Parameters:
shape - Shape to be removed

addLine

public void addLine(int position,
                    int direction,
                    java.awt.Color color)
Adds a line to the list of graphical components.
Parameters:
position - Position of the line, either x- or y-coordinate depending on the type of the line.
direction - Type of the line, can either be Toolbox.HORIZONTAL or Toolbox.VERTICAL.
color - The color to draw the line with.

removeLine

public void removeLine(int position,
                       int direction)
Removes a line from the list of graphical components.
Parameters:
position - Position of the line to be removed, either x- or y-coordinate depending on the type of the line.
direction - Type of the line to be removed, can either be Toolbox.HORIZONTAL or Toolbox.VERTICAL.

clearAllGraphicComponents

public void clearAllGraphicComponents()
Removes all graphical components from the list.

clearOutputText

public void clearOutputText()
Clears all text in the text ouput window.

getToolbox

public static Toolbox getToolbox()
Returns an instance of Toolbox.
Returns:
Toolbox instance.