mascoptLib.gui
Class MascoptViewer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--mascoptLib.gui.MascoptViewer
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, ItemListener, MenuContainer, RootPaneContainer, Serializable, WindowConstants

public class MascoptViewer
extends JFrame
implements ActionListener, ItemListener

A Multi Layer and multi view viewer for Abstractgraphs.

MascoptViewer can display Oriented (DiGraph) or non oriented (Graph) graphs.
It can also display Chain or Path.

MascoptViewer allows to add and manage labels on Nodes or Edges (see setNodeLabels, setArcLabels). etc etc

Version:
Wed Feb 20 18:37:37 2002
Author:
bbongiov@bing.inria.fr
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MascoptViewer()
          Constructs a new MascoptViewer frame with a specified them and makes it visible.
MascoptViewer(String themeFile)
          Constructs a new MascoptViewer frame and makes it visible.
 
Method Summary
 void actionPerformed(ActionEvent e)
          overiden to listens the buttons; Not an user method.
 void addGraphInLayer(mascoptLib.abstractGraph.AbstractGraph g, mascoptLib.gui.GLayer l)
          Add a Graph in a Layer.
 void addGraphInLayer(mascoptLib.abstractGraph.AbstractGraph g, mascoptLib.gui.GLayer l, boolean visible)
          Add a Graph in a Layer.
 void addLayerInView(mascoptLib.gui.GLayer l, mascoptLib.gui.GView v)
          Adds a Layer in a View.
 void closeView(String name)
          Close a view.
 void destroyLayer(mascoptLib.gui.GLayer layer)
          Destroy a layer.
 String[] getArcLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph, mascoptLib.gui.GLayer l)
          Gets the label line for the arc for a specified graph in a specified layer in an array of String.
 String[] getNodeLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph, mascoptLib.gui.GLayer l)
          Gets the label line for the node for a specified graph in a specified layer in an array of String.
 void itemStateChanged(ItemEvent e)
          overiden to listens the combobox; Not an user method.
 void moveDownGraphInLayer(mascoptLib.abstractGraph.AbstractGraph ag, mascoptLib.gui.GLayer gl)
          Lower a Graph in a specified Layer.
 void moveDownLayerInView(mascoptLib.gui.GLayer gl, mascoptLib.gui.GView gv)
          Lower a Layer in a specified view.
 void moveUpGraphInLayer(mascoptLib.abstractGraph.AbstractGraph ag, mascoptLib.gui.GLayer gl)
          Raise a Graph in a specified Layer.
 void moveUpLayerInView(mascoptLib.gui.GLayer gl, mascoptLib.gui.GView gv)
          Raise a Layer in a specified view.
 void newGraph(mascoptLib.abstractGraph.AbstractGraph g)
          Adds a new Graph in the MascoptViewer ie adds it in the "Add Graph" combobox
 mascoptLib.gui.GLayer newLayer(String name)
          Creates a new Layer with a specified name.
 mascoptLib.gui.GView newView()
          Creates a new GView with a default name centered on (0,0) and displays it.
 mascoptLib.gui.GView newView(String name)
          Creates a new GView with a specified name centered on (0,0) and displays it.
 mascoptLib.gui.GView newView(String name, int centerX, int centerY)
          Creates a new GView with a specified name centered and displays it.
 mascoptLib.gui.GView newView(String name, int centerX, int centerY, double zoom, int width, int height, int locationX, int locationY)
          Creates a new GView with a specified name centered and displays it.
 mascoptLib.gui.GView newView(String name, int centerX, int centerY, double zoom, int width, int height, int locationX, int locationY, JPanel title)
          Creates a new GView centered with a specified name and displays it.
 mascoptLib.gui.GView newView(String name, int centerX, int centerY, double zoom, int width, int height, int locationX, int locationY, String title)
          Creates a new GView centered with a specified name and displays it.
 void purgeUnusedGraphs()
          Clean the memory of unused graphs.
 boolean removeGraph(mascoptLib.abstractGraph.AbstractGraph graph)
          Remove a graph from the list of available graphs.
 void removeGraphInLayer(mascoptLib.abstractGraph.AbstractGraph ag, mascoptLib.gui.GLayer gl)
          Remove a Graph in a specified Layer.
 void removeLayerInView(mascoptLib.gui.GLayer gl, mascoptLib.gui.GView gv)
          Remove a Layer in a specified view.
 void setArcLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph, mascoptLib.gui.GLayer l, String value)
          set the arc's label for a specified Graph in a specified Layer.The String value will be splitted in a String[] using the delimiter "\n".
 void setArcLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph, mascoptLib.gui.GLayer l, String[] value)
          set the arc's label for a specified Graph in a specified Layer.
 void setNodeLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph, mascoptLib.gui.GLayer l, String value)
          set the node's label for a specified Graph in a specified Layer.The String value will be splitted in a String[] using the delimiter "\n".
 void setNodeLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph, mascoptLib.gui.GLayer l, String[] value)
          set the node's label for a specified Graph in a specified Layer.
 void setVisibleGraphInLayer(mascoptLib.abstractGraph.AbstractGraph g, mascoptLib.gui.GLayer l, boolean visible)
          Shows or hides a Graph in a specified Layer depending on the value of parameter visible.
 void setVisibleLabels(mascoptLib.gui.GLayer gl, boolean visible)
          Shows or hides the labels in a specified Layer depending on the value of parameter visible.
 void setVisibleLayerInView(mascoptLib.gui.GLayer l, mascoptLib.gui.GView v, boolean visible)
          Shows or hides a Layer in a specified View depending on the value of parameter visible.
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

MascoptViewer

public MascoptViewer()
Constructs a new MascoptViewer frame with a specified them and makes it visible.


MascoptViewer

public MascoptViewer(String themeFile)
Constructs a new MascoptViewer frame and makes it visible.

Method Detail

newView

public mascoptLib.gui.GView newView()
Creates a new GView with a default name centered on (0,0) and displays it.

Returns:
the GView created

newView

public mascoptLib.gui.GView newView(String name)
Creates a new GView with a specified name centered on (0,0) and displays it.

Parameters:
name - the name of the view, if a view with this name already exists, than the name=name+'''
Returns:
the GView created

newView

public mascoptLib.gui.GView newView(String name,
                                    int centerX,
                                    int centerY)
Creates a new GView with a specified name centered and displays it.

Parameters:
name - the name of the view, if a view with this name already exists, then adds a ' at the end of the name.
centerX - the x coordiantes of the center of the view
centerY - the y coordiantes of the center of the view
Returns:
the GView created

newView

public mascoptLib.gui.GView newView(String name,
                                    int centerX,
                                    int centerY,
                                    double zoom,
                                    int width,
                                    int height,
                                    int locationX,
                                    int locationY)
Creates a new GView with a specified name centered and displays it.

Parameters:
name - the name of the view, if a view with this name already exists, then adds a ' at the end of the name.
centerX - the x coordiantes of the center of the view
centerY - the y coordiantes of the center of the view
zoom - the zoom factor for the view.
width - the width the view.
locationX - the x location for the frame containing the view.
locationY - the y location for the frame containing the view.
Returns:
the GView created

newView

public mascoptLib.gui.GView newView(String name,
                                    int centerX,
                                    int centerY,
                                    double zoom,
                                    int width,
                                    int height,
                                    int locationX,
                                    int locationY,
                                    String title)
Creates a new GView centered with a specified name and displays it. The title is represented by a JPanel added at the bottom of the scene with labels. "\n" goto line.

Parameters:
name - the name of the view, if a view with this name already exists, then adds a ' at the end of the name.
centerX - the x coordiantes of the center of the view
centerY - the y coordiantes of the center of the view
zoom - the zoom factor for the view.
width - the width of the view.
locationX - the x location for the frame containing the view.
locationY - the y location for the frame containing the view.
title - the title of the view represented by a string. y location for the frame containing the view.
Returns:
the GView created

newView

public mascoptLib.gui.GView newView(String name,
                                    int centerX,
                                    int centerY,
                                    double zoom,
                                    int width,
                                    int height,
                                    int locationX,
                                    int locationY,
                                    JPanel title)
Creates a new GView centered with a specified name and displays it. The title is represented by the JPanel title added at the bottom of the scene.

Parameters:
name - the name of the view, if a view with this name already exists, then adds a ' at the end of the name.
centerX - the x coordiantes of the center of the view
centerY - the y coordiantes of the center of the view
zoom - the zoom factor for the view.
width - the width of the the view.
locationX - the x location for the frame containing the view.
locationY - the y location for the frame containing the view.
title - the JPanel to be added at the bottom of the view.
Returns:
the GView created

closeView

public void closeView(String name)
Close a view.

Parameters:
name - the name of the view to be closed.

newLayer

public mascoptLib.gui.GLayer newLayer(String name)
Creates a new Layer with a specified name.

Parameters:
name - the name of the layer, if a layer with this name already exists, then adds a ' at the end of the name.
Returns:
the GLayer created

destroyLayer

public void destroyLayer(mascoptLib.gui.GLayer layer)
Destroy a layer. The layer is removed of all views. Then, it is droped in memory.

Parameters:
layer - the layer to destroy.

newGraph

public void newGraph(mascoptLib.abstractGraph.AbstractGraph g)
Adds a new Graph in the MascoptViewer ie adds it in the "Add Graph" combobox

Parameters:
g - the Graph to be added.

addLayerInView

public void addLayerInView(mascoptLib.gui.GLayer l,
                           mascoptLib.gui.GView v)
Adds a Layer in a View. If the layer is already in the view, then don't adds it twice.

Parameters:
l - the Layer to be added.
v - the View in wich the layer is added.

addGraphInLayer

public void addGraphInLayer(mascoptLib.abstractGraph.AbstractGraph g,
                            mascoptLib.gui.GLayer l)
Add a Graph in a Layer.

Parameters:
g - the graph to add.
l - the layer.

addGraphInLayer

public void addGraphInLayer(mascoptLib.abstractGraph.AbstractGraph g,
                            mascoptLib.gui.GLayer l,
                            boolean visible)
Add a Graph in a Layer. If the graph is already in the layer, then don't add it twice.

Parameters:
g - the Graph to be added.
l - the Layer in wich the graph is added.
visible - if true show the graph.

setVisibleGraphInLayer

public void setVisibleGraphInLayer(mascoptLib.abstractGraph.AbstractGraph g,
                                   mascoptLib.gui.GLayer l,
                                   boolean visible)
Shows or hides a Graph in a specified Layer depending on the value of parameter visible.

Parameters:
g - the Graph
l - the Layer
visible - if true, shows the graph in the layer; otherwise, hides it.

setVisibleLayerInView

public void setVisibleLayerInView(mascoptLib.gui.GLayer l,
                                  mascoptLib.gui.GView v,
                                  boolean visible)
Shows or hides a Layer in a specified View depending on the value of parameter visible.

Parameters:
l - the Layer.
v - the View.
visible - if true, shows the layer in the view; otherwise, hides it.

setVisibleLabels

public void setVisibleLabels(mascoptLib.gui.GLayer gl,
                             boolean visible)
Shows or hides the labels in a specified Layer depending on the value of parameter visible.

Parameters:
gl - the Layer.
visible - if true, shows labels in the layer; otherwise, hides it.

moveUpLayerInView

public void moveUpLayerInView(mascoptLib.gui.GLayer gl,
                              mascoptLib.gui.GView gv)
Raise a Layer in a specified view.

Parameters:
gl - the Layer to be raised.
gv - the view

moveDownLayerInView

public void moveDownLayerInView(mascoptLib.gui.GLayer gl,
                                mascoptLib.gui.GView gv)
Lower a Layer in a specified view.

Parameters:
gl - the Layer to be lowered
gv - the view

removeLayerInView

public void removeLayerInView(mascoptLib.gui.GLayer gl,
                              mascoptLib.gui.GView gv)
Remove a Layer in a specified view.

Parameters:
gl - the Layer to be removed.
gv - the view

moveUpGraphInLayer

public void moveUpGraphInLayer(mascoptLib.abstractGraph.AbstractGraph ag,
                               mascoptLib.gui.GLayer gl)
Raise a Graph in a specified Layer. Not implemented.

Parameters:
ag - the graph to be raised.
gl - the Layer

moveDownGraphInLayer

public void moveDownGraphInLayer(mascoptLib.abstractGraph.AbstractGraph ag,
                                 mascoptLib.gui.GLayer gl)
Lower a Graph in a specified Layer. Not implemented.

Parameters:
ag - the graph to be lowered.
gl - the Layer

removeGraphInLayer

public void removeGraphInLayer(mascoptLib.abstractGraph.AbstractGraph ag,
                               mascoptLib.gui.GLayer gl)
Remove a Graph in a specified Layer.

Parameters:
ag - the graph to be removed.
gl - the Layer

setNodeLabelGraphInLayer

public void setNodeLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph,
                                     mascoptLib.gui.GLayer l,
                                     String[] value)
set the node's label for a specified Graph in a specified Layer.

Each String of the array value is a line.
All expressions like "$(X)" will be replaced by node.getValue(X,graph).
for example: "id=$(id)" will be id=Id_Of_The_Node.

Parameters:
graph - the graph.
l - the layer.
value - the Strings for the labels.

setArcLabelGraphInLayer

public void setArcLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph,
                                    mascoptLib.gui.GLayer l,
                                    String[] value)
set the arc's label for a specified Graph in a specified Layer.

Each String of the array value is a line.
All expressions like "$(X)" will be replaced by arc.getValue(X,graph).
for example: "id=$(id)" will be id=Id_Of_The_Arc.

Parameters:
graph - the graph.
l - the layer.
value - the Strings for the labels.

setNodeLabelGraphInLayer

public void setNodeLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph,
                                     mascoptLib.gui.GLayer l,
                                     String value)
set the node's label for a specified Graph in a specified Layer.The String value will be splitted in a String[] using the delimiter "\n".

Parameters:
graph - the graph.
l - the layer.
value - the String to be used to create the String[].
See Also:
setNodeLabelGraphInLayer(AbstractGraph , GLayer ,String [])

setArcLabelGraphInLayer

public void setArcLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph,
                                    mascoptLib.gui.GLayer l,
                                    String value)
set the arc's label for a specified Graph in a specified Layer.The String value will be splitted in a String[] using the delimiter "\n".

Parameters:
graph - the graph.
l - the layer.
value - the String to be used to create the String[].
See Also:
setArcLabelGraphInLayer(AbstractGraph , GLayer ,String [])

getNodeLabelGraphInLayer

public String[] getNodeLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph,
                                         mascoptLib.gui.GLayer l)
Gets the label line for the node for a specified graph in a specified layer in an array of String.

Parameters:
graph - the Graph.
l - the Layer.
Returns:
an array representing the Labels of the node.

getArcLabelGraphInLayer

public String[] getArcLabelGraphInLayer(mascoptLib.abstractGraph.AbstractGraph graph,
                                        mascoptLib.gui.GLayer l)
Gets the label line for the arc for a specified graph in a specified layer in an array of String.

Parameters:
graph - the Graph.
l - the Layer.
Returns:
an array representing the Labels of the arc.

removeGraph

public boolean removeGraph(mascoptLib.abstractGraph.AbstractGraph graph)
Remove a graph from the list of available graphs.

Parameters:
graph - the graph to remove
Returns:
true if successfull

actionPerformed

public void actionPerformed(ActionEvent e)
overiden to listens the buttons; Not an user method.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - .

purgeUnusedGraphs

public void purgeUnusedGraphs()
Clean the memory of unused graphs. When some graphs have been used in the GUI and are not used anymore, they still are pointed in the memory and are not clean by the Garbage Collector. This method find them and and unpointe them.


itemStateChanged

public void itemStateChanged(ItemEvent e)
overiden to listens the combobox; Not an user method.

Specified by:
itemStateChanged in interface ItemListener
Parameters:
e - .