aminePlatform.guis.graphDrawing
Class VisualGraph

java.lang.Object
  extended byaminePlatform.guis.graphDrawing.VisualGraph

public class VisualGraph
extends java.lang.Object

Title : VisualGraph

Description : VisualGraph is a visual wrapper for Graph: a VisualGraph contains a reference to a Graph with visual attributes and methods. In this way, visualization (or drawing) of a Graph is separeted from the structure Graph.

Copyright : Copyright (c) Adil KABBAJ 2004-2009


Field Summary
static java.awt.Font fontTxtFld
           
 Graph graph
           
 boolean isBrowseView
           
 java.util.ArrayList vedges
           
 java.util.ArrayList vnodes
           
 
Constructor Summary
VisualGraph()
          Create a VisualGraph
VisualGraph(Graph graph)
          Create a VisualGraph for the specified graph
 
Method Summary
 void addEdge(Edge vedge, VisualNode Source, VisualNode Target)
          Add a VisualEdge to the current VisualGraph
 void addEdge(VisualEdge vedge)
          Add a VisualEdge to the current VisualGraph
 void addNode(VisualNode vnode)
          Add a VisualNode to the current VisualGraph
 void clear()
          Clear the content of the current VisualGraph
 void clear(GraphDrawPanel graphDrawPanel)
          Remove from the current VisualGraph all VisualNodes that are contained in the tracker of the specified graphDrawPanel
 void clearVGraphOnly()
           
static VisualGraph copy(Graph graph, java.util.ArrayList lstVNodes, java.util.ArrayList lstVEdges)
          Copy the part of the current Visual Graph that is determined by the list of Visual Nodes and the list of Visual Edges that are contained in the current Visual Graph
 VisualNode createAddVNode(Node node, Lexicon lexicon, java.awt.Graphics g, boolean ViewMode, int c)
           
static VisualGraph createSubVGraph(Graph graph, VisualNode SelectedVnode, VisualGraph lstExistingvNode, Lexicon lexicon, java.awt.Graphics g, boolean rearrange)
           
static VisualGraph createSubVGraph(Graph graph, VisualNode SelectedVnode, VisualGraph lstExistingvNode, Lexicon lexicon, java.awt.Graphics g, boolean rearrange, java.awt.Point verticalspacing)
          Create a SubVisualGraph for VisualGraph And used to reorganize the subgraph too when selectedVNode is Null.
static VisualGraph createSubVGraph(Graph graph, VisualNode SelectedVnode, VisualGraph lstExistingvNode, Lexicon lexicon, java.awt.Graphics g, boolean rearrange, java.awt.Point verticalspacing, boolean ViewMode)
           
static VisualGraph createVGraph(Graph graph, Lexicon lexicon, java.awt.Graphics g)
          Create a VisualGraph for the specified graph.
static VisualGraph createVGraph2(Graph graph, Lexicon lexicon, java.awt.Graphics g)
          Create a VisualGraph for the specified graph.
static VisualGraph createVGraph2(Graph graph, Lexicon lexicon, java.awt.Graphics g, boolean ViewMode)
           
 java.util.ArrayList getEdges()
          Get the VisualEdges that compose the current VisualGraph
 Graph getGraph()
          Get the graph associated to the current VisualGraph
 boolean getIsBrowseView()
           
 java.util.ArrayList getNodes()
          Get the VisualNodes that compose the current VisualGraph
 int getScale()
           
 int getSize()
          Get the size of the graph associated to the current VisualGraph
 java.awt.Point getSpacing()
           
 VisualEdge getVisualEdge(Edge edge)
          Get, from the current VisualGraph, the VisualEdge that is associated to the specified edge.
 VisualNode getVisualNode(Node node)
          Get, from the current VisualGraph, the VisualNode that is associated to the specified node.
 boolean isEmpty()
          Check if the current Visual Graph is empty
 void makeEmpty()
          Make the current VisualGraph empty.
 void moveVNodes(GraphDrawPanel cgDP, java.awt.Rectangle rct1, java.awt.Rectangle rct2, Lexicon lexicon)
          Move concepts that were already selected; that were contained in the tracker rectangle and update the related relations.
 void newVNode(java.lang.String contenu, java.awt.Rectangle rect, Lexicon lexicon)
          Add a new VisualNode to the current VisualGraph, with an associated node that is composed by the specified contenu and with the specified rectangle.
 void removeEdge(VisualEdge vedge)
          Remove the specified VisualEdge from the current VisualGraph
 void removeNode(VisualNode vnode)
          Remove the specified VisualNode from the current VisualGraph
 void removeVNode(VisualNode vnode)
          Operate on VNode and VisualGraph only; the correponding node in Graph is not touched
 void removeVNodes(java.awt.Rectangle tracker)
          Remove from the current VisualGraph the VisualNodes that are contained in the specified tracker.
 void setGraph(Graph graph)
          Set the specified graph to the current VisualGraph
 void setScale(int scale, java.awt.Graphics g, Lexicon lexicon)
           
 void setSpacing(java.awt.Point spacing)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

public Graph graph

vnodes

public java.util.ArrayList vnodes

vedges

public java.util.ArrayList vedges

isBrowseView

public boolean isBrowseView

fontTxtFld

public static java.awt.Font fontTxtFld
Constructor Detail

VisualGraph

public VisualGraph()
Create a VisualGraph


VisualGraph

public VisualGraph(Graph graph)
Create a VisualGraph for the specified graph

Parameters:
graph - a Graph
Method Detail

setSpacing

public void setSpacing(java.awt.Point spacing)

getSpacing

public java.awt.Point getSpacing()

isEmpty

public boolean isEmpty()
Check if the current Visual Graph is empty

Returns:
true if the current Visual Graph is empty

getGraph

public Graph getGraph()
Get the graph associated to the current VisualGraph

Returns:

setGraph

public void setGraph(Graph graph)
Set the specified graph to the current VisualGraph

Parameters:
graph - A Graph

copy

public static VisualGraph copy(Graph graph,
                               java.util.ArrayList lstVNodes,
                               java.util.ArrayList lstVEdges)
Copy the part of the current Visual Graph that is determined by the list of Visual Nodes and the list of Visual Edges that are contained in the current Visual Graph

Parameters:
graph - A Graph for the new Visual Graph to create and return
lstVNodes - ArrayList of VisualNode
lstVEdges - ArrayList of VisualEdge
Returns:
a new VisualGraph

getSize

public int getSize()
Get the size of the graph associated to the current VisualGraph

Returns:
the size of the graph associated to the current VisualGraph

addEdge

public void addEdge(VisualEdge vedge)
Add a VisualEdge to the current VisualGraph

Parameters:
vedge - A VisualEdge

addEdge

public void addEdge(Edge vedge,
                    VisualNode Source,
                    VisualNode Target)
Add a VisualEdge to the current VisualGraph

Parameters:
vedge - A VisualEdge

addNode

public void addNode(VisualNode vnode)
Add a VisualNode to the current VisualGraph

Parameters:
vnode - A VisualNode

setScale

public void setScale(int scale,
                     java.awt.Graphics g,
                     Lexicon lexicon)

getScale

public int getScale()

getIsBrowseView

public boolean getIsBrowseView()

removeVNode

public void removeVNode(VisualNode vnode)
Operate on VNode and VisualGraph only; the correponding node in Graph is not touched


removeNode

public void removeNode(VisualNode vnode)
Remove the specified VisualNode from the current VisualGraph

Parameters:
vnode - A VisualNode

removeEdge

public void removeEdge(VisualEdge vedge)
Remove the specified VisualEdge from the current VisualGraph

Parameters:
vedge - A VisualEdge

getNodes

public java.util.ArrayList getNodes()
Get the VisualNodes that compose the current VisualGraph

Returns:
An ArrayList of the VisualNodes that compose the current VisualGraph

getEdges

public java.util.ArrayList getEdges()
Get the VisualEdges that compose the current VisualGraph

Returns:
An ArrayList of the VisualEdges that compose the current VisualGraph

getVisualNode

public VisualNode getVisualNode(Node node)
Get, from the current VisualGraph, the VisualNode that is associated to the specified node.

Parameters:
node - A Node
Returns:
the VisualNode that is associated to the specified node

getVisualEdge

public VisualEdge getVisualEdge(Edge edge)
Get, from the current VisualGraph, the VisualEdge that is associated to the specified edge.

Parameters:
edge - An Edge
Returns:
The VisualEdge that is associated to the specified edge.

createAddVNode

public VisualNode createAddVNode(Node node,
                                 Lexicon lexicon,
                                 java.awt.Graphics g,
                                 boolean ViewMode,
                                 int c)

createVGraph2

public static VisualGraph createVGraph2(Graph graph,
                                        Lexicon lexicon,
                                        java.awt.Graphics g)
Create a VisualGraph for the specified graph. The graph contains no graphic information, so we use an automatic graph drawing method (relaxGraph or relaxOntology) to create the graphic information for the specified graph. Then we create the VisualGraph.

Parameters:
graph - A Graph
lexicon - The Lexison
g - Graphics
Returns:
A VisualGraph for the specified graph

createVGraph2

public static VisualGraph createVGraph2(Graph graph,
                                        Lexicon lexicon,
                                        java.awt.Graphics g,
                                        boolean ViewMode)

createVGraph

public static VisualGraph createVGraph(Graph graph,
                                       Lexicon lexicon,
                                       java.awt.Graphics g)
Create a VisualGraph for the specified graph. The graph contains already graphic information. So we create directly the VisualGraph.

Parameters:
graph - A Graph
lexicon - A Lexicon
g - Graphics
Returns:
a VisualGraph for the specified graph

makeEmpty

public void makeEmpty()
Make the current VisualGraph empty.


clearVGraphOnly

public void clearVGraphOnly()

clear

public void clear()
Clear the content of the current VisualGraph


clear

public void clear(GraphDrawPanel graphDrawPanel)
Remove from the current VisualGraph all VisualNodes that are contained in the tracker of the specified graphDrawPanel

Parameters:
graphDrawPanel - A GraphDrawPanel

newVNode

public void newVNode(java.lang.String contenu,
                     java.awt.Rectangle rect,
                     Lexicon lexicon)
              throws java.lang.Exception
Add a new VisualNode to the current VisualGraph, with an associated node that is composed by the specified contenu and with the specified rectangle.

Parameters:
contenu - A String that represents the content of the node
rect - A Rectangle that will enclose the VisualNode
lexicon - A Lexicon
Throws:
java.lang.Exception - if a problem occurs during the operation

moveVNodes

public void moveVNodes(GraphDrawPanel cgDP,
                       java.awt.Rectangle rct1,
                       java.awt.Rectangle rct2,
                       Lexicon lexicon)
Move concepts that were already selected; that were contained in the tracker rectangle and update the related relations.

Parameters:
cgDP - A GraphDrawPanel
rct1 - A Rectangle
rct2 - A Rectangle
lexicon - A Lexicon

removeVNodes

public void removeVNodes(java.awt.Rectangle tracker)
Remove from the current VisualGraph the VisualNodes that are contained in the specified tracker.

Parameters:
tracker - A Rectangle

createSubVGraph

public static VisualGraph createSubVGraph(Graph graph,
                                          VisualNode SelectedVnode,
                                          VisualGraph lstExistingvNode,
                                          Lexicon lexicon,
                                          java.awt.Graphics g,
                                          boolean rearrange,
                                          java.awt.Point verticalspacing)
Create a SubVisualGraph for VisualGraph And used to reorganize the subgraph too when selectedVNode is Null. It's used only in Case of Ontology to allow Graph Browser View

Parameters:
graph - A Graph
SelectedVnode - The VisualNode we want to explore (or to expand)
lstExistingvNode - if it's null we don't keep existing VisualNodes in th Browser else we keep them and we add the newest one's.
lexicon - The Lexison
g - Graphics
Returns:
A VisualGraph for the specified graph

createSubVGraph

public static VisualGraph createSubVGraph(Graph graph,
                                          VisualNode SelectedVnode,
                                          VisualGraph lstExistingvNode,
                                          Lexicon lexicon,
                                          java.awt.Graphics g,
                                          boolean rearrange,
                                          java.awt.Point verticalspacing,
                                          boolean ViewMode)

createSubVGraph

public static VisualGraph createSubVGraph(Graph graph,
                                          VisualNode SelectedVnode,
                                          VisualGraph lstExistingvNode,
                                          Lexicon lexicon,
                                          java.awt.Graphics g,
                                          boolean rearrange)