edu.iastate.metnet.graphmodel
Class AbstractGraphMetaphor

java.lang.Object
  extended by edu.iastate.metnet.graphmodel.AbstractGraphMetaphor
All Implemented Interfaces:
IGraphMetaphor
Direct Known Subclasses:
AbstractVersionGraphMetaphor, AlignmentMetaphor, CategoryMetaphor, ChemicalReactionMetaphor, ComparativeMetaphor, CompositionRelationMetaphor, DefaultGraphMetaphor, EditingMetaphor, FCMetaphor, IsomorphismMetaphor, PathwayElementMetaphor, SearchInteractionTypeMetaphor, SearchNameMetaphor, ValidityMetaphor

public class AbstractGraphMetaphor
extends java.lang.Object
implements IGraphMetaphor

abstract graph metaphor containing common utility functions and default behaviors.

Since:
6/25/04
Author:
Jie Li

Field Summary
protected static java.awt.Color DEFAULT_BACKGROUND
          default background color
protected static java.awt.Color DEFAULT_FOREGROUND
          default foreground color
protected static int DEFAULT_LINE_WIDTH
          default line width for recovery
(package private) static org.apache.log4j.Logger logger
          log4j facility
 
Constructor Summary
AbstractGraphMetaphor()
          defualt constrcutor
 
Method Summary
protected  void autoSizeBox(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view)
          change the vertex size according to the content
protected  void changeEdgeColor(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, java.awt.Color color)
          change the line color
protected  void changeEdgeDualColor(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, java.awt.Color leftColor, java.awt.Color rightColor)
          change the line color to two parallel foreground color to indicate the different interaction type
protected  void changeEdgePattern(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, float[] pattern)
          change the edge or border's line pattern
protected  void changeEdgeWidth(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, float width)
          change the edge width
protected  void changeVertexBackgroundColor(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, java.awt.Color color)
          set the normal background
protected  void changeVertexBorderColor(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, java.awt.Color color)
          change the vertext border color
protected  void changeVertexBorderWidth(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, float width)
          change the edge width
protected  void changeVertexDualColor(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, java.awt.Color leftColor, java.awt.Color rightColor)
          things are complicated if we want two or more background color
protected  void changeVertexForegroundColor(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view, java.awt.Color color)
          change the font color in the vertex
static MetaphorTypeInformation getEdgeType(Blockunit source, Blockunit target)
           searching rule: node A, and node B, edge (A, B) A and B both are entitywithcontext get the intersection of the interactions? require the entity join the interaction A is interaction and B is entitywithcontext type of A A is entitywithcontext and B is interaction see if catalysis A and B both are interaction, never occurred
protected  java.util.List getIncomingEdges(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view)
          get the incoming edges use CellView[] views = graph.getGraphLayoutCache().getMapping(cells); to get views
protected  java.util.List getIncomingNodes(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view)
          get the predecessor nodes
protected  java.awt.Color getInteractionColorForEdge(java.lang.String interactionType)
          get the color for interaction type
protected  int getInteractionWidthForEdge(java.lang.String interactionType)
          get the line width for interaction type
protected static java.util.Set getIntersectionNodes(Blockunit source, Blockunit target)
          if the intermedia dummy node is removed already, guess the interaction from the two enity nodes
protected  java.awt.Color getLocationColorForVertex(java.lang.String location)
          return the vertext background color
protected  java.util.List getOutgoingEdges(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view)
          get outgoing edges from one node
protected  java.util.List getOutgoingNodes(org.jgraph.JGraph graph, java.lang.Object cell, org.jgraph.graph.CellView view)
          get the successor nodes
 void run(org.jgraph.JGraph graph, java.lang.Object[] cells)
          make the graph black and white
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
log4j facility


DEFAULT_LINE_WIDTH

protected static final int DEFAULT_LINE_WIDTH
default line width for recovery

See Also:
Constant Field Values

DEFAULT_FOREGROUND

protected static final java.awt.Color DEFAULT_FOREGROUND
default foreground color


DEFAULT_BACKGROUND

protected static final java.awt.Color DEFAULT_BACKGROUND
default background color

Constructor Detail

AbstractGraphMetaphor

public AbstractGraphMetaphor()
defualt constrcutor

Method Detail

run

public void run(org.jgraph.JGraph graph,
                java.lang.Object[] cells)
make the graph black and white

Specified by:
run in interface IGraphMetaphor
Parameters:
graph - the jgraph instance
cells - the selected cells or all cells

changeVertexForegroundColor

protected void changeVertexForegroundColor(org.jgraph.JGraph graph,
                                           java.lang.Object cell,
                                           org.jgraph.graph.CellView view,
                                           java.awt.Color color)
change the font color in the vertex

Parameters:
graph - the graph
cell - the node
view - the node view
color - the font color

changeVertexDualColor

protected void changeVertexDualColor(org.jgraph.JGraph graph,
                                     java.lang.Object cell,
                                     org.jgraph.graph.CellView view,
                                     java.awt.Color leftColor,
                                     java.awt.Color rightColor)
things are complicated if we want two or more background color

Parameters:
graph - the graph
cell - the cell, vertex only
view - the view
leftColor - the left background color
rightColor - the right background color

changeEdgeDualColor

protected void changeEdgeDualColor(org.jgraph.JGraph graph,
                                   java.lang.Object cell,
                                   org.jgraph.graph.CellView view,
                                   java.awt.Color leftColor,
                                   java.awt.Color rightColor)
change the line color to two parallel foreground color to indicate the different interaction type

Parameters:
graph - the graph
cell - the edge
view - the edge view
leftColor - the left color
rightColor - the right color

changeVertexBackgroundColor

protected void changeVertexBackgroundColor(org.jgraph.JGraph graph,
                                           java.lang.Object cell,
                                           org.jgraph.graph.CellView view,
                                           java.awt.Color color)
set the normal background

Parameters:
graph - the graph
cell - the normal vertex
view - the view
color - the background color

autoSizeBox

protected void autoSizeBox(org.jgraph.JGraph graph,
                           java.lang.Object cell,
                           org.jgraph.graph.CellView view)
change the vertex size according to the content

Parameters:
graph - the graph
cell - the graph cell
view - the cell view

changeVertexBorderColor

protected void changeVertexBorderColor(org.jgraph.JGraph graph,
                                       java.lang.Object cell,
                                       org.jgraph.graph.CellView view,
                                       java.awt.Color color)
change the vertext border color

Parameters:
graph - the graph
cell - the graph cell
view - the cell view
color - the border color

changeEdgeColor

protected void changeEdgeColor(org.jgraph.JGraph graph,
                               java.lang.Object cell,
                               org.jgraph.graph.CellView view,
                               java.awt.Color color)
change the line color

Parameters:
graph - the graph
cell - the edge cell
view - the edge view
color - the line color

changeEdgeWidth

protected void changeEdgeWidth(org.jgraph.JGraph graph,
                               java.lang.Object cell,
                               org.jgraph.graph.CellView view,
                               float width)
change the edge width

Parameters:
graph - the graph
cell - the edge
view - the edge view
width - the width of the edge

changeVertexBorderWidth

protected void changeVertexBorderWidth(org.jgraph.JGraph graph,
                                       java.lang.Object cell,
                                       org.jgraph.graph.CellView view,
                                       float width)
change the edge width

Parameters:
graph - the graph
cell - the edge
view - the edge view
width - the width of the edge

changeEdgePattern

protected void changeEdgePattern(org.jgraph.JGraph graph,
                                 java.lang.Object cell,
                                 org.jgraph.graph.CellView view,
                                 float[] pattern)
change the edge or border's line pattern

Parameters:
graph - the graph
cell - the node or edge
view - the node or edge
pattern - the pattern for node border or edge line

getIncomingEdges

protected java.util.List getIncomingEdges(org.jgraph.JGraph graph,
                                          java.lang.Object cell,
                                          org.jgraph.graph.CellView view)
get the incoming edges use CellView[] views = graph.getGraphLayoutCache().getMapping(cells); to get views

Parameters:
graph - the graph
cell - the node
view - the node
Returns:
the incoming edge set

getIncomingNodes

protected java.util.List getIncomingNodes(org.jgraph.JGraph graph,
                                          java.lang.Object cell,
                                          org.jgraph.graph.CellView view)
get the predecessor nodes

Parameters:
graph - the graph
cell - the current node
view - the node view
Returns:
the predecessor nodes

getOutgoingEdges

protected java.util.List getOutgoingEdges(org.jgraph.JGraph graph,
                                          java.lang.Object cell,
                                          org.jgraph.graph.CellView view)
get outgoing edges from one node

Parameters:
graph - the graph
cell - start node
view - start node
Returns:
edge list

getOutgoingNodes

protected java.util.List getOutgoingNodes(org.jgraph.JGraph graph,
                                          java.lang.Object cell,
                                          org.jgraph.graph.CellView view)
get the successor nodes

Parameters:
graph - the graph
cell - the current nodes
view - the current node view
Returns:
the successor nodes

getLocationColorForVertex

protected java.awt.Color getLocationColorForVertex(java.lang.String location)
return the vertext background color

Parameters:
location -
Returns:
the color

getInteractionColorForEdge

protected java.awt.Color getInteractionColorForEdge(java.lang.String interactionType)
get the color for interaction type

Parameters:
interactionType - the interaction type
Returns:
the color

getInteractionWidthForEdge

protected int getInteractionWidthForEdge(java.lang.String interactionType)
get the line width for interaction type

Parameters:
width - for interaction type
Returns:
the width

getEdgeType

public static MetaphorTypeInformation getEdgeType(Blockunit source,
                                                  Blockunit target)

Parameters:
source - the source blockunit
target - the target blockunit
Returns:
the interaction type of the connection edge

getIntersectionNodes

protected static java.util.Set getIntersectionNodes(Blockunit source,
                                                    Blockunit target)
if the intermedia dummy node is removed already, guess the interaction from the two enity nodes

Parameters:
source - the source entitywithlocaion node
target - the target entitywithlocation nodes
Returns:
the intersection interaction node set