pedviz.view
Class GraphView

java.lang.Object
  extended by pedviz.view.GraphView
Direct Known Subclasses:
GraphView2D, GraphView3D

public class GraphView
extends java.lang.Object

This class is the super class for components that visualize a graph. A single Graph can be viewed in multiple ways whitout a lot of changes.

Version:
0.1
Author:
Lukas Forer

Constructor Summary
GraphView()
          Creates a new empty Graphview.
GraphView(LayoutedGraph graph)
          Creates a new Graphview for the given LayoutedGraph object.
 
Method Summary
 boolean addNodeListener(NodeListener nodeListener)
          Registers the NodeListener object.
 void addRule(Rule filter)
          Adds a new Rule.
 void centerGraph()
          Centers the graph and fits the size on.
 void deselect()
          Deselects all nodes that are currently selected.
 void deselect(Node node)
          Deselects the given node if it's selected.
 void exportJPEG(java.lang.String filename, float scale, boolean grayscale)
          Exports the GraphView as a jpeg-file.
 void fireNodeEvent(NodeEvent event)
          Fires a NodeEvent to all listeners.
 float getAlpha()
          Returns the alpha value of hidden nodes.
 java.awt.Color getBackgroundColor()
          Returns the background color of this component.
 java.awt.Component getComponent()
          Returns the SWING/AWT component used by this instance.
 Effect getEffect()
          Returns the Effect object used by this instance.
 LayoutedGraph getGraph()
          Returns the LayoutedGraph of which this is a view.
 java.util.Vector<Rule> getRules()
          Returns a vector of all rules.
 double getScale()
          Returns the current scale factor.
 java.util.ArrayList<Node> getSelection()
          Returns all nodes that are currently selected.
 int getSelectionCount()
          Returns the number of nodes that are currently selected.
 double getTranslateX()
          Returns the current x-translation.
 double getTranslateY()
          Returns the current y-translation.
 void hide(Node node)
          Hides the given node if it's shown.
 void hideAll()
          Hides all nodes that are currently shown.
 void highlight(java.util.Collection<Node> nodes)
          Highlights a collection of nodes.
 void highlight(Node node)
          Highlights the given node.
 boolean isEdgeVisible()
          Returns true if edges are visible.
 boolean isMovingEnabled()
          Returns true if moving is enabled.
 boolean isMultiselection()
          Returns true if multiselection is enabled.
 boolean isSelected(Node node)
          Returns true if the given node is selected.
 boolean isSelectionEnabled()
          Returns true if selection is enabled.
 boolean isZoomEnabled()
          Returns true if zooming is enabled.
 boolean removeNodeListener(NodeListener nodeListener)
          Removes the NodeListener object.
 void removeRule(Rule filter)
          Remove the given rule.
 void select(java.util.ArrayList<Node> Nodes)
          Selects a collection of nodes.
 void select(Node node)
          Selects a single node.
 void setAlpha(float alpha)
          To down grade nodes of less interest their alpha value can be lowered.
 void setBackgroundColor(java.awt.Color backgroundColor)
          Sets the background color of this component.
 void setCursor(int cursor)
          Sets the cursor of the component.
 void setEdgeVisible(boolean flag)
          Displays or hides the edges.
 void setEffect(Effect effect)
          Sets the given effect.
 void setGraph(LayoutedGraph graph)
          Sets the LayoutedGraph for this view..
 void setMovingEnabled(boolean movingEnabled)
          Enables or disables moving.
 void setMultiselection(boolean multiSelection)
          Enables or disables multiselection.
 void setRules(java.util.Vector<Rule> rules)
          Sets a collection of rules.
 void setScale(double scale)
          Sets the scale factor.
 void setSelectionEnabled(boolean enabled)
          Enables or disables selection.
 void setTranslate(double translateX, double translateY)
          Sets the x-translation and the y-translation.
 void setTranslateX(double translateX)
          Sets the x-translation.
 void setTranslateY(double translateY)
          Sets the y-translation.
 void setZoomEnabled(boolean zoomEnabled)
          Enables or disables zooming.
 void show(Node node)
          Shows the given node if it's hidden.
 void showAll()
          Shows all nodes that are currently hidden.
 void unHighlightAll()
          Clears accentuation for all nodes.
 void updateGraphModel()
          After you change the LayoutedGraph object manually run this method.
 void updateGraphView()
          Fires an update of the GraphView manually.
 void updateNodes(java.util.Set<Node> nodes)
          Redraws the given nodes.
 void updateRules()
          Reapplies all rules.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphView

public GraphView()
Creates a new empty Graphview.


GraphView

public GraphView(LayoutedGraph graph)
Creates a new Graphview for the given LayoutedGraph object.

Method Detail

setGraph

public void setGraph(LayoutedGraph graph)
Sets the LayoutedGraph for this view..

Parameters:
graph - Graph object

getGraph

public LayoutedGraph getGraph()
Returns the LayoutedGraph of which this is a view.

Returns:
the LayoutedGraph object

deselect

public void deselect(Node node)
Deselects the given node if it's selected.

Parameters:
node - node

select

public void select(Node node)
Selects a single node.

Parameters:
node - node

select

public void select(java.util.ArrayList<Node> Nodes)
Selects a collection of nodes.

Parameters:
Nodes -

isSelected

public boolean isSelected(Node node)
Returns true if the given node is selected.

Parameters:
node -
Returns:
true if the given node is selected

deselect

public void deselect()
Deselects all nodes that are currently selected.


getSelection

public java.util.ArrayList<Node> getSelection()
Returns all nodes that are currently selected.

Returns:
a list of all selected nodes

getSelectionCount

public int getSelectionCount()
Returns the number of nodes that are currently selected.

Returns:
nummer of selected nodes

setSelectionEnabled

public void setSelectionEnabled(boolean enabled)
Enables or disables selection.

Parameters:
enabled -

isMultiselection

public boolean isMultiselection()
Returns true if multiselection is enabled.

Returns:
true, if multiselection is enabled

setMultiselection

public void setMultiselection(boolean multiSelection)
Enables or disables multiselection.

Parameters:
multiSelection -

isSelectionEnabled

public boolean isSelectionEnabled()
Returns true if selection is enabled.

Returns:

show

public void show(Node node)
Shows the given node if it's hidden.

Parameters:
node - node

showAll

public void showAll()
Shows all nodes that are currently hidden.


hideAll

public void hideAll()
Hides all nodes that are currently shown.


hide

public void hide(Node node)
Hides the given node if it's shown.

Parameters:
node - node

unHighlightAll

public void unHighlightAll()
Clears accentuation for all nodes.


highlight

public void highlight(Node node)
Highlights the given node.

Parameters:
node - node

highlight

public void highlight(java.util.Collection<Node> nodes)
Highlights a collection of nodes.

Parameters:
nodes - list of nodes

centerGraph

public void centerGraph()
Centers the graph and fits the size on.


updateGraphView

public void updateGraphView()
Fires an update of the GraphView manually.


updateGraphModel

public void updateGraphModel()
After you change the LayoutedGraph object manually run this method.


isEdgeVisible

public boolean isEdgeVisible()
Returns true if edges are visible.

Returns:
true if edges are visible.

setEdgeVisible

public void setEdgeVisible(boolean flag)
Displays or hides the edges.

Parameters:
flag -

exportJPEG

public void exportJPEG(java.lang.String filename,
                       float scale,
                       boolean grayscale)
Exports the GraphView as a jpeg-file.

Parameters:
filename - filename
scale - scale factor

getComponent

public java.awt.Component getComponent()
Returns the SWING/AWT component used by this instance.

Returns:

addRule

public void addRule(Rule filter)
Adds a new Rule.

Parameters:
filter -

removeRule

public void removeRule(Rule filter)
Remove the given rule.

Parameters:
filter -

getRules

public java.util.Vector<Rule> getRules()
Returns a vector of all rules.

Returns:
vector of all rules

setBackgroundColor

public void setBackgroundColor(java.awt.Color backgroundColor)
Sets the background color of this component.

Parameters:
background - color of this component backgound color

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the background color of this component.

Returns:
background color of this component

setScale

public void setScale(double scale)
Sets the scale factor.

Parameters:
scale - scale factor

getScale

public double getScale()
Returns the current scale factor.

Returns:
the current scale factor.

setTranslateX

public void setTranslateX(double translateX)
Sets the x-translation.

Parameters:
translateX - x-translation

setTranslateY

public void setTranslateY(double translateY)
Sets the y-translation.

Parameters:
translateY - y-translation

setTranslate

public void setTranslate(double translateX,
                         double translateY)
Sets the x-translation and the y-translation.

Parameters:
translateX - x-translation
translateY - y-translation

getTranslateX

public double getTranslateX()
Returns the current x-translation.

Returns:
the current x-translation

getTranslateY

public double getTranslateY()
Returns the current y-translation.

Returns:
the current y-translation

getAlpha

public float getAlpha()
Returns the alpha value of hidden nodes.

Returns:
alpha value.

setAlpha

public void setAlpha(float alpha)
To down grade nodes of less interest their alpha value can be lowered.

Parameters:
alpha - alpha value.

getEffect

public Effect getEffect()
Returns the Effect object used by this instance.

Returns:
the current effect.

setEffect

public void setEffect(Effect effect)
Sets the given effect.

Parameters:
effect -

isMovingEnabled

public boolean isMovingEnabled()
Returns true if moving is enabled.

Returns:
true if moving is enabled.

setMovingEnabled

public void setMovingEnabled(boolean movingEnabled)
Enables or disables moving.

Parameters:
movingEnabled -

isZoomEnabled

public boolean isZoomEnabled()
Returns true if zooming is enabled.

Returns:
true if zooming is enabled.

setZoomEnabled

public void setZoomEnabled(boolean zoomEnabled)
Enables or disables zooming.

Parameters:
zoomEnabled -

setRules

public void setRules(java.util.Vector<Rule> rules)
Sets a collection of rules.

Parameters:
rules - a collection of rules.

updateRules

public void updateRules()
Reapplies all rules.


updateNodes

public void updateNodes(java.util.Set<Node> nodes)
Redraws the given nodes.

Parameters:
nodes - nodes that should be repainted.

setCursor

public void setCursor(int cursor)
Sets the cursor of the component.

Parameters:
cursor - the cursor of the component.

removeNodeListener

public boolean removeNodeListener(NodeListener nodeListener)
Removes the NodeListener object.

Returns:
the NodeListener object.

addNodeListener

public boolean addNodeListener(NodeListener nodeListener)
Registers the NodeListener object.

Parameters:
nodeListener - the NodeListener object.

fireNodeEvent

public void fireNodeEvent(NodeEvent event)
Fires a NodeEvent to all listeners.

Parameters:
event -