org.ceryle.graph
Class GraphLayoutPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.ceryle.graph.GraphLayoutPanel
All Implemented Interfaces:
TGScrollPane, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
TMLayoutPanel

public class GraphLayoutPanel
extends JPanel
implements TGScrollPane

GraphLayoutPanel extends JPanel in providing support for a TouchGraph implementation, an analogue to TG's GLPanel (i.e., its demo panel). It also provides methods for navigating and manipulating nodes and edges and an improved tool bar over GLPanel.

NOTE: after calling its constructor, initialize() must be called to establish the graph engine and its GUI support.

Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
 class GraphLayoutPanel.ButtonListener
          The listener class to handle button events.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JRadioButton btn_hyper
           
protected  JButton btn_infinity
           
protected  JRadioButton btn_locality
           
protected  JRadioButton btn_rotate
           
protected  JRadioButton btn_sequence
           
protected  JRadioButton btn_zoom
           
static int DEFAULT_HYPERBOLIC
          An int value indicating the default setting (default=0) of the Hyperbolic distortion scroll bar.
static int DEFAULT_LOCALITY
          An int value indicating the default setting (default=4) of the Locality scroll bar.
static int DEFAULT_SEQUENCE
          An int value indicating the default setting (default=0) of the Sequence scroll bar.
protected static Color defaultColor
           
protected  GLEditUI editUI
           
protected  GraphPanel gp
           
protected  GraphPopupMenu gPopupMenu
           
protected  HVScroll hvScroll
           
static int HYPER_SCROLL
          An enumerated int value indicating the Hyperbolic scroll bar.
protected  JScrollBar hyperSB
           
protected  HyperScroll hyperScroll
           
static boolean includeEdit
          If true, include the "Edit" checkbox.
static int INFINITE_LOCALITY
          An int constant indicating infinite locality, derived from LocalityUtils.
protected  Point2D.Double lastClick
           
static int LOCALITY_SCROLL
          An enumerated int value indicating the Locality scroll bar.
protected  JScrollBar localitySB
           
protected  GraphLocalityScroll localityScroll
           
protected  Desktop m_desktop
           
protected  JComponent m_graphContainer
           
protected  JPanel m_legendPanel
           
protected  boolean m_localityEnabled
          Allows the locality scroll bar to be disabled.
protected  MouseWheelListener m_mouseWheelListener
           
protected  JScrollBar m_selectedSB
           
protected  boolean m_verbose
           
protected  View m_view
           
static int MAXIMUM_LOCALITY
          An int value indicating the maximum setting (default=20) of the Locality scroll bar.
protected  MessageHandler mh
           
protected  JCheckBox modeSelect
           
protected  GraphNavigateUI navigateUI
           
protected  PropertyManager pm
           
protected  JPanel popPanel
           
static int ROTATE_SCROLL
          An enumerated int value indicating the Rotate scroll bar.
protected  JScrollBar rotateSB
           
protected  RotateScroll rotateScroll
           
protected  JPanel scrollPanel
           
static int SEQUENCE_SCROLL
          An enumerated int value indicating the Sequence scroll bar.
protected  JScrollBar sequenceSB
           
protected  SequenceScroll sequenceScroll
           
protected  Services srvs
           
protected  TGLensSet tgLensSet
           
protected  TGUIManager tgUIManager
           
static int UI_EDIT
          An enumerated int value indicating the Edit UI manager.
static int UI_NAVIGATE
          An enumerated int value indicating the Navigate UI manager.
static int UI_ROTATEDRAG
          An enumerated int value indicating the RotateDrag UI manager.
static Point2D.Double zero
           
static int ZOOM_SCROLL
          An enumerated int value indicating the Zoom scroll bar.
protected  JScrollBar zoomSB
           
protected  ZoomScroll zoomScroll
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphLayoutPanel(View view)
          Constructor provided a reference to the parent view.
 
Method Summary
 void activateUI(int ui)
          Activates the indicated UI manager.
protected  GraphEdge addEdge(GraphNode node1, GraphNode node2, int length, int directed)
          Creates an edge between GraphNode node and node2 with a length of length, and edge direction of int directed (whose values may be GraphEdge.UNDIRECTED, GraphEdge.DIRECTED_TO, or GraphEdge.DIRECTED_FROM).
protected  void addGraphPanel(GraphPanel graphpanel)
          Adds the provided GraphPanel to this GraphLayoutPanel.
protected  void addUIs()
           
protected  void buildLens()
          Builds the set of lenses.
protected  void buildScrollBars()
          Builds the set of lenses.
protected  void buildScrollPanel()
          Adds the Zoom, Rotate and Locality scroll bars to the graph tool bar and creates the TouchGraph panel.
 void centerNode(GraphNode node)
          Quickly centers GraphNode node.
 void centerSelectedNode()
          Quickly centers the selected node.
 void centerSelectedNode(boolean fast)
          Centers the selected node, faster if the boolean is true.
 void clearGraph()
          Clears the graph area.
 void defloat(boolean shifted)
          Clusters all floating (unfixed), unattached GraphNodes around the selected node.
 boolean deleteNode(GraphNode node, boolean confirm)
          Deletes the GraphNode node, what happens depends on its type.
 boolean deleteSelected(boolean confirm)
          Deletes the selected nodes, depending on the number of type.
 Node findNode(String id)
          A convenience method that calls findNode(id,true) (searching the entire graph).
 Node findNode(String id, boolean searchAll)
          Returns the Node whose ID is the String id.
 Iterator getAllEdges()
          Returns all Edges in the graph as an Iterator, null if it is empty.
 GraphPanel getGraphPanel()
          Return a lazily-created GraphPanel used with this GraphLayoutPanel.
 GraphView getGraphView()
          Returns the parent GraphView of this GraphLayoutPanel.
 HVScroll getHVScroll()
          Return the HVScroll used with this GraphLayoutPanel.
 int getHyperbolicDistortion()
          Return the hyperbolic distortion of this GraphLayoutPanel.
 int getHyperRadius()
          Returns the radius of the circle at which points stay a constant distance away from the center despite the hyperbolic (fisheye) effect.
 HyperScroll getHyperScroll()
          Return the HyperScroll used with this GraphLayoutPanel.
 Point2D.Double getLastClickPoint()
          Returns the stored last-clicked point.
 double getLeftOf(GraphNode node)
          Returns a value corresponding to the X value of the left edge of GraphNode node.
 JPanel getLegend()
          Lazily-created east panel (uses a Y Box layout), used for legends.
 int getLocalityRadius()
          Return the locality radius of this GraphLayoutPanel.
 LocalityScroll getLocalityScroll()
          Return the LocalityScroll used with this GraphLayoutPanel.
 int getNodeCount()
          A convenience method; returns the number of nodes in the current graph.
 Font getNodeFont()
          Returns the font of the node text.
 Point getOffset()
          Return the viewport's horizontal and vertical offset position as a Point.
 JPanel getPopPanel()
          Returns the unused panel located to the left of the radio buttons.
 JPopupMenu getPopupMenu()
          Return the JPopupMenu used (actually, a GraphPopupMenu).
protected  Integer getPosition(boolean horiz, GraphNode node)
          Returns an Integer corresponding to the X (horiz==true) or Y position of GraphNode node.
 Point getPosition(GraphNode node)
          Return the GraphNode position as a Point, adjusted to take into account all active lenses.
 RotateScroll getRotateScroll()
          Return the RotateScroll used with this GraphLayoutPanel.
 int getRotationAngle()
          Return the rotation angle of this GraphLayoutPanel.
 JPanel getScrollPanel()
          Returns the graph's scroll panel.
 int getSelectedCount()
          Returns the number of selected GraphNodes.
 Point getSelectedLocation()
          Returns a Point containing the location of the selected Node, null if unavailable.
 GraphNode getSelectedNode()
          Returns the selected GraphNode, null if unavailable.
 int getSequenceDistortion()
          Return the sequence distortion of this GraphLayoutPanel.
 SequenceScroll getSequenceScroll()
          Return the SequenceScroll used with this GraphLayoutPanel.
 TGPanel getTGPanel()
          Return the TGPanel used with this GraphLayoutPanel.
 double getTopOf(GraphNode node)
          Returns a value corresponding to the Y value of the top edge of GraphNode node.
 View getView()
          Returns the parent View of this GraphLayoutPanel.
 ZoomScroll getZoomScroll()
          Return the ZoomScroll used with this GraphLayoutPanel.
 int getZoomValue()
          Return the zoom value of this GraphLayoutPanel.
 int[] graphStatus()
          Returns some status info as an int array.
 void hideNode(Node node)
          Hides the Node node, unless it is the first node.
 void initialize()
          Initializes the panel, tool bar and lens.
 void initialize(GraphPanel graphpanel)
          Initializes the panel, tool bar and lens, using the supplied GraphPanel.
 boolean isEditActive()
          Return true if the GLEditUI considers the graph active.
 boolean isEmpty()
          A convenience method that returns true if the graph is empty (i.e., it contains no nodes).
 boolean isLocalityEnabled()
          Returns true if the locality scrollbar is enabled.
 void keyPressed(KeyEvent ke)
          Responds to KeyEvents sent to the GraphPanel's GraphKeyListener.
 void nodeClicked(Node node, MouseEvent e)
          An action method that indicates that the Node node has been clicked.
 void nodeDoubleClicked(Node node, MouseEvent e)
          An action method that indicates that the Node node has been double-clicked.
 GraphPanel releaseGraphPanel()
          Releases use of the current GraphPanel, effectively disabling this GraphLayoutPanel.
 void repaintNode(GraphNode node)
          Repaints the GraphNode node by jubbling it.
 void reset()
          Resets the display damper, making the graph slowly move again.
 void selectAll(boolean unfiltered)
          Selects all of the graph nodes.
 void selectFirstNode()
          Selects the first node, triggering locality.
 void selectFirstNode(int r)
          Selects the first node, triggering locality at a radius of r.
 boolean selectNode(Node node)
          Selects the Node node.
 boolean selectNode(String id)
          Selects the Node whose ID is the String id.
 void selectSB(int scroll)
          Shows the indicated scroll bar.
protected  void setDefaultStylesheet()
          Sets the default colors for this GraphLayoutPanel.
 void setFixedSelectedNode(boolean fixed)
          Sets the fixed state of the selected Node or Nodes.
 void setGraphPriority(boolean hasPriority)
          Checks the priority of current Threads in this ThreadGroup.
 void setGraphPriority(int priority)
          Sets the priority of current Threads in this ThreadGroup to priority.
 void setHyperbolicDistortion(int value)
          Set the hyperbolic distortion of this TGScrollPane (allowable values between 0 to 108).
protected  void setHyperRadius(int radius)
          Sets the radius of the circle at which points stay a constant distance away from the center despite the hyperbolic (fisheye) effect.
 void setLastClickPoint(Point2D.Double p)
          Sets the stored last-clicked point to p.
 void setLocalityEnabled(boolean enabled)
          Sets the enabled status of the locality scrollbar.
 void setLocalityRadius(int radius)
          Set the locality radius of this TGScrollPane.
 void setNavigateVerbosity(boolean verbose)
          Set the verbosity of the GraphNavigateUI, which displays clicked locations when verbose.
 void setNodeFont(Font font)
          Sets the font of the node text to the Font font.
 void setOffset(Point p)
          Sets the horizontal offset of the viewport to p.x, the vertical offset to p.y, given Point p.
 void setPosition(int x, int y)
          Relocation the graph to the position x,y.
 void setRotationAngle(int angle)
          Set the rotation angle of this GraphLayoutPanel (allowable values between 0 to 359).
 void setScrollBarsEnabled(boolean enabled)
          Enables or disables the selector buttons for the scroll bars.
 void setScrollPanelVisibility(boolean visible)
          Sets the visibility of the graph's scroll panel to the boolean visible.
 void setSequenceDistortion(int value)
          Set the sequence distortion of this TGScrollPane (allowable values between 0 to 100).
 void setStylesheet(String filename)
          Sets the graph color "stylesheet" according to the properties found in file filename, which is an XML properties file in the same notation as the Ceryle property file (".ceryle.prop").
 void setToolVisibility(boolean visible)
          Sets the visibility of the graph tools according to the value of the boolean visible.
 void setZoomValue(int zoomValue)
          Set the zoom value of this GraphLayoutPanel (allowable values between -100 to 100).
 void update()
          Updates the display.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITE_LOCALITY

public static final int INFINITE_LOCALITY
An int constant indicating infinite locality, derived from LocalityUtils.

See Also:
Constant Field Values

ZOOM_SCROLL

public static final int ZOOM_SCROLL
An enumerated int value indicating the Zoom scroll bar.

See Also:
Constant Field Values

ROTATE_SCROLL

public static final int ROTATE_SCROLL
An enumerated int value indicating the Rotate scroll bar.

See Also:
Constant Field Values

LOCALITY_SCROLL

public static final int LOCALITY_SCROLL
An enumerated int value indicating the Locality scroll bar.

See Also:
Constant Field Values

HYPER_SCROLL

public static final int HYPER_SCROLL
An enumerated int value indicating the Hyperbolic scroll bar.

See Also:
Constant Field Values

SEQUENCE_SCROLL

public static final int SEQUENCE_SCROLL
An enumerated int value indicating the Sequence scroll bar.

See Also:
Constant Field Values

UI_EDIT

public static final int UI_EDIT
An enumerated int value indicating the Edit UI manager.

See Also:
Constant Field Values

UI_NAVIGATE

public static final int UI_NAVIGATE
An enumerated int value indicating the Navigate UI manager.

See Also:
Constant Field Values

UI_ROTATEDRAG

public static final int UI_ROTATEDRAG
An enumerated int value indicating the RotateDrag UI manager.

See Also:
Constant Field Values

DEFAULT_LOCALITY

public static int DEFAULT_LOCALITY
An int value indicating the default setting (default=4) of the Locality scroll bar.


MAXIMUM_LOCALITY

public static int MAXIMUM_LOCALITY
An int value indicating the maximum setting (default=20) of the Locality scroll bar.


DEFAULT_HYPERBOLIC

public static int DEFAULT_HYPERBOLIC
An int value indicating the default setting (default=0) of the Hyperbolic distortion scroll bar.


DEFAULT_SEQUENCE

public static int DEFAULT_SEQUENCE
An int value indicating the default setting (default=0) of the Sequence scroll bar.


includeEdit

public static boolean includeEdit
If true, include the "Edit" checkbox. Currently unused.


m_localityEnabled

protected boolean m_localityEnabled
Allows the locality scroll bar to be disabled.


gp

protected GraphPanel gp

m_view

protected View m_view

popPanel

protected JPanel popPanel

tgUIManager

protected TGUIManager tgUIManager

navigateUI

protected GraphNavigateUI navigateUI

gPopupMenu

protected GraphPopupMenu gPopupMenu

m_selectedSB

protected JScrollBar m_selectedSB

zoomSB

protected JScrollBar zoomSB

rotateSB

protected JScrollBar rotateSB

localitySB

protected JScrollBar localitySB

hyperSB

protected JScrollBar hyperSB

sequenceSB

protected JScrollBar sequenceSB

btn_infinity

protected JButton btn_infinity

m_mouseWheelListener

protected MouseWheelListener m_mouseWheelListener

defaultColor

protected static Color defaultColor

m_desktop

protected Desktop m_desktop

srvs

protected Services srvs

mh

protected MessageHandler mh

pm

protected PropertyManager pm

m_verbose

protected boolean m_verbose

m_legendPanel

protected JPanel m_legendPanel

lastClick

protected Point2D.Double lastClick

tgLensSet

protected TGLensSet tgLensSet

modeSelect

protected JCheckBox modeSelect

scrollPanel

protected JPanel scrollPanel

m_graphContainer

protected JComponent m_graphContainer

zoomScroll

protected ZoomScroll zoomScroll

rotateScroll

protected RotateScroll rotateScroll

localityScroll

protected GraphLocalityScroll localityScroll

hyperScroll

protected HyperScroll hyperScroll

sequenceScroll

protected SequenceScroll sequenceScroll

hvScroll

protected HVScroll hvScroll

editUI

protected GLEditUI editUI

btn_zoom

protected JRadioButton btn_zoom

btn_rotate

protected JRadioButton btn_rotate

btn_locality

protected JRadioButton btn_locality

btn_hyper

protected JRadioButton btn_hyper

btn_sequence

protected JRadioButton btn_sequence

zero

public static final Point2D.Double zero
Constructor Detail

GraphLayoutPanel

public GraphLayoutPanel(View view)
Constructor provided a reference to the parent view.

Method Detail

initialize

public void initialize()
Initializes the panel, tool bar and lens.


initialize

public void initialize(GraphPanel graphpanel)
Initializes the panel, tool bar and lens, using the supplied GraphPanel. If graphpanel is null, a new one is created.


setGraphPriority

public void setGraphPriority(boolean hasPriority)
Checks the priority of current Threads in this ThreadGroup. If the priority already matches the method exits, otherwise sets each Thread to match the minimum or maximum, as per hasPriority.


setGraphPriority

public void setGraphPriority(int priority)
Sets the priority of current Threads in this ThreadGroup to priority.


setDefaultStylesheet

protected void setDefaultStylesheet()
Sets the default colors for this GraphLayoutPanel.


setStylesheet

public void setStylesheet(String filename)
Sets the graph color "stylesheet" according to the properties found in file filename, which is an XML properties file in the same notation as the Ceryle property file (".ceryle.prop").


releaseGraphPanel

public GraphPanel releaseGraphPanel()
Releases use of the current GraphPanel, effectively disabling this GraphLayoutPanel. This is used when two or more GraphLayoutPanels are using the same GraphPanel. Returns the GraphPanel, or null if it was already null.


getView

public View getView()
Returns the parent View of this GraphLayoutPanel. This is likely a GraphView, but it could be something else.


getGraphView

public GraphView getGraphView()
Returns the parent GraphView of this GraphLayoutPanel. The View itself may be something other than a GraphView; this returns the parent View of this GraphLayoutPanel.


getNodeCount

public int getNodeCount()
A convenience method; returns the number of nodes in the current graph.


centerSelectedNode

public void centerSelectedNode()
Quickly centers the selected node. Nothing happens if there is no selection.


centerSelectedNode

public void centerSelectedNode(boolean fast)
Centers the selected node, faster if the boolean is true. Nothing happens if there is no selection.


centerNode

public void centerNode(GraphNode node)
Quickly centers GraphNode node.


setLastClickPoint

public void setLastClickPoint(Point2D.Double p)
Sets the stored last-clicked point to p.


getLastClickPoint

public Point2D.Double getLastClickPoint()
Returns the stored last-clicked point. If this hasn't been set, this returns the point (0,0), adjusted for the current lens settings.


buildScrollBars

protected void buildScrollBars()
Builds the set of lenses.


getPopPanel

public JPanel getPopPanel()
Returns the unused panel located to the left of the radio buttons. This has a BorderLayout and can be used to add another component to the graph "tool bar."


getPopupMenu

public JPopupMenu getPopupMenu()
Return the JPopupMenu used (actually, a GraphPopupMenu).

Specified by:
getPopupMenu in interface TGScrollPane

setHyperRadius

protected void setHyperRadius(int radius)
Sets the radius of the circle at which points stay a constant distance away from the center despite the hyperbolic (fisheye) effect. If the provided value is -1, its value is calculated based on the current panel height. The minimum value is 100.


getHyperRadius

public int getHyperRadius()
Returns the radius of the circle at which points stay a constant distance away from the center despite the hyperbolic (fisheye) effect.


buildScrollPanel

protected void buildScrollPanel()
Adds the Zoom, Rotate and Locality scroll bars to the graph tool bar and creates the TouchGraph panel.


addGraphPanel

protected void addGraphPanel(GraphPanel graphpanel)
Adds the provided GraphPanel to this GraphLayoutPanel. (This is called by buildScrollPanel().)


getLegend

public JPanel getLegend()
Lazily-created east panel (uses a Y Box layout), used for legends. Delivered hidden upon creation.


setToolVisibility

public void setToolVisibility(boolean visible)
Sets the visibility of the graph tools according to the value of the boolean visible.


buildLens

protected void buildLens()
Builds the set of lenses.


addEdge

protected GraphEdge addEdge(GraphNode node1,
                            GraphNode node2,
                            int length,
                            int directed)
Creates an edge between GraphNode node and node2 with a length of length, and edge direction of int directed (whose values may be GraphEdge.UNDIRECTED, GraphEdge.DIRECTED_TO, or GraphEdge.DIRECTED_FROM).

Edge length is usually some fraction or multiple of Edge.DEFAULT_LENGTH.


keyPressed

public void keyPressed(KeyEvent ke)
Responds to KeyEvents sent to the GraphPanel's GraphKeyListener.

Specified by:
keyPressed in interface TGScrollPane

nodeClicked

public void nodeClicked(Node node,
                        MouseEvent e)
An action method that indicates that the Node node has been clicked. This selects the node and sets the locale around it to the current radius. The MouseEvent e is ignored in this class.

Specified by:
nodeClicked in interface TGScrollPane

nodeDoubleClicked

public void nodeDoubleClicked(Node node,
                              MouseEvent e)
An action method that indicates that the Node node has been double-clicked.

Specified by:
nodeDoubleClicked in interface TGScrollPane

deleteSelected

public boolean deleteSelected(boolean confirm)
Deletes the selected nodes, depending on the number of type.

Currently unsupported in this class.

Returns:
true if the node was deleted

deleteNode

public boolean deleteNode(GraphNode node,
                          boolean confirm)
Deletes the GraphNode node, what happens depends on its type.

Currently unsupported in this class.

Returns:
true if the node was deleted

getNodeFont

public Font getNodeFont()
Returns the font of the node text.


setNodeFont

public void setNodeFont(Font font)
Sets the font of the node text to the Font font.


setScrollPanelVisibility

public void setScrollPanelVisibility(boolean visible)
Sets the visibility of the graph's scroll panel to the boolean visible.


getScrollPanel

public JPanel getScrollPanel()
Returns the graph's scroll panel.


update

public void update()
Updates the display.


isEmpty

public boolean isEmpty()
A convenience method that returns true if the graph is empty (i.e., it contains no nodes).


reset

public void reset()
Resets the display damper, making the graph slowly move again.


setScrollBarsEnabled

public void setScrollBarsEnabled(boolean enabled)
Enables or disables the selector buttons for the scroll bars.


activateUI

public void activateUI(int ui)
Activates the indicated UI manager.

See Also:
UI_EDIT, UI_NAVIGATE, UI_ROTATEDRAG

selectSB

public void selectSB(int scroll)
Shows the indicated scroll bar.

See Also:
ZOOM_SCROLL, ROTATE_SCROLL, LOCALITY_SCROLL, HYPER_SCROLL, SEQUENCE_SCROLL

addUIs

protected void addUIs()

setNavigateVerbosity

public void setNavigateVerbosity(boolean verbose)
Set the verbosity of the GraphNavigateUI, which displays clicked locations when verbose.


isEditActive

public boolean isEditActive()
Return true if the GLEditUI considers the graph active.


getGraphPanel

public GraphPanel getGraphPanel()
Return a lazily-created GraphPanel used with this GraphLayoutPanel. This is analogous to getTGPanel().


getTGPanel

public TGPanel getTGPanel()
Return the TGPanel used with this GraphLayoutPanel. The returned object is actually a GraphPanel.

Specified by:
getTGPanel in interface TGScrollPane

setOffset

public void setOffset(Point p)
Sets the horizontal offset of the viewport to p.x, the vertical offset to p.y, given Point p.

Specified by:
setOffset in interface TGScrollPane

getOffset

public Point getOffset()
Return the viewport's horizontal and vertical offset position as a Point.

Specified by:
getOffset in interface TGScrollPane

getHVScroll

public HVScroll getHVScroll()
Return the HVScroll used with this GraphLayoutPanel.

Specified by:
getHVScroll in interface TGScrollPane

setPosition

public void setPosition(int x,
                        int y)
Relocation the graph to the position x,y. If such a repositioning would move the graph out of bounds, the method call will be ignored.


getPosition

public Point getPosition(GraphNode node)
Return the GraphNode position as a Point, adjusted to take into account all active lenses.


getPosition

protected Integer getPosition(boolean horiz,
                              GraphNode node)
Returns an Integer corresponding to the X (horiz==true) or Y position of GraphNode node. This is adjusted to take into account all active lenses.


getLeftOf

public double getLeftOf(GraphNode node)
Returns a value corresponding to the X value of the left edge of GraphNode node. This is adjusted to take into account all active lenses.


getTopOf

public double getTopOf(GraphNode node)
Returns a value corresponding to the Y value of the top edge of GraphNode node. This is adjusted to take into account all active lenses.


getZoomScroll

public ZoomScroll getZoomScroll()
Return the ZoomScroll used with this GraphLayoutPanel.

Specified by:
getZoomScroll in interface TGScrollPane

setZoomValue

public void setZoomValue(int zoomValue)
Set the zoom value of this GraphLayoutPanel (allowable values between -100 to 100).

Specified by:
setZoomValue in interface TGScrollPane

getZoomValue

public int getZoomValue()
Return the zoom value of this GraphLayoutPanel.

Specified by:
getZoomValue in interface TGScrollPane

setRotationAngle

public void setRotationAngle(int angle)
Set the rotation angle of this GraphLayoutPanel (allowable values between 0 to 359).

Specified by:
setRotationAngle in interface TGScrollPane

getRotationAngle

public int getRotationAngle()
Return the rotation angle of this GraphLayoutPanel.

Specified by:
getRotationAngle in interface TGScrollPane

getRotateScroll

public RotateScroll getRotateScroll()
Return the RotateScroll used with this GraphLayoutPanel.

Specified by:
getRotateScroll in interface TGScrollPane

setLocalityEnabled

public void setLocalityEnabled(boolean enabled)
Sets the enabled status of the locality scrollbar.


isLocalityEnabled

public boolean isLocalityEnabled()
Returns true if the locality scrollbar is enabled.


getLocalityScroll

public LocalityScroll getLocalityScroll()
Return the LocalityScroll used with this GraphLayoutPanel.

Specified by:
getLocalityScroll in interface TGScrollPane

setLocalityRadius

public void setLocalityRadius(int radius)
Set the locality radius of this TGScrollPane. Allowable values are between 0 to 7, or INFINITE_LOCALITY.

Specified by:
setLocalityRadius in interface TGScrollPane

getLocalityRadius

public int getLocalityRadius()
Return the locality radius of this GraphLayoutPanel.

Specified by:
getLocalityRadius in interface TGScrollPane

getHyperScroll

public HyperScroll getHyperScroll()
Return the HyperScroll used with this GraphLayoutPanel.

Specified by:
getHyperScroll in interface TGScrollPane

setHyperbolicDistortion

public void setHyperbolicDistortion(int value)
Set the hyperbolic distortion of this TGScrollPane (allowable values between 0 to 108).

Specified by:
setHyperbolicDistortion in interface TGScrollPane

getHyperbolicDistortion

public int getHyperbolicDistortion()
Return the hyperbolic distortion of this GraphLayoutPanel.

Specified by:
getHyperbolicDistortion in interface TGScrollPane

getSequenceScroll

public SequenceScroll getSequenceScroll()
Return the SequenceScroll used with this GraphLayoutPanel.


setSequenceDistortion

public void setSequenceDistortion(int value)
Set the sequence distortion of this TGScrollPane (allowable values between 0 to 100).


getSequenceDistortion

public int getSequenceDistortion()
Return the sequence distortion of this GraphLayoutPanel.


clearGraph

public void clearGraph()
Clears the graph area.


getSelectedCount

public int getSelectedCount()
Returns the number of selected GraphNodes. This is a convenience method.

See Also:
SelectionManager

selectFirstNode

public void selectFirstNode()
Selects the first node, triggering locality.


selectFirstNode

public void selectFirstNode(int r)
Selects the first node, triggering locality at a radius of r.


setFixedSelectedNode

public void setFixedSelectedNode(boolean fixed)
Sets the fixed state of the selected Node or Nodes.


selectAll

public void selectAll(boolean unfiltered)
Selects all of the graph nodes. The boolean unfiltered is not used in this class.


defloat

public void defloat(boolean shifted)
Clusters all floating (unfixed), unattached GraphNodes around the selected node.

If there is no selected node or the selected node is offscreen, the center of the screen is used. This also sets the locality radius to infinity, as unattached nodes are only all displayed in that locality. The boolean shifted does not affect anything in this method's implementation, and is provided to optionally alter the behaviour in any subclasses.


getSelectedLocation

public Point getSelectedLocation()
Returns a Point containing the location of the selected Node, null if unavailable.


getSelectedNode

public GraphNode getSelectedNode()
                          throws GraphException
Returns the selected GraphNode, null if unavailable.

NOTE:
Various incarnations of this method have either returned null or thrown a GraphException if there is no selected node, there is more than one selected node, or if the selected node is not an instance of a GraphNode (or one of its subclasses). The current incarnation only throws an exception when the selected node is not a GraphNode (or one of its subclasses), as there ended being too much exception handling for this common situation.

Throws:
org.ceryle.util.GraphException
GraphException

repaintNode

public void repaintNode(GraphNode node)
Repaints the GraphNode node by jubbling it.


graphStatus

public int[] graphStatus()
Returns some status info as an int array. The returned values are the total node count and total edge count. This can be modified by subclasses as necessary, returning richer information.


selectNode

public boolean selectNode(String id)
Selects the Node whose ID is the String id. If the node is not currently visible, it is selected and displayed. Returns true if able to select the node, false if unable.


selectNode

public boolean selectNode(Node node)
Selects the Node node. If the node is not currently visible, it is selected and displayed. Returns true if able to select the node, false if unable.


findNode

public Node findNode(String id)
A convenience method that calls findNode(id,true) (searching the entire graph).


findNode

public Node findNode(String id,
                     boolean searchAll)
Returns the Node whose ID is the String id. If searchAll is true, the entire graph (visible and hidden) is searched, otherwise only the visible locality. Returns null if not found.


hideNode

public void hideNode(Node node)
Hides the Node node, unless it is the first node.


getAllEdges

public Iterator getAllEdges()
Returns all Edges in the graph as an Iterator, null if it is empty.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.