gdl.base
Class GraphExplorerCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by edu.umd.cs.piccolo.PCanvas
                  extended by gdl.base.GraphExplorerCanvas
All Implemented Interfaces:
edu.umd.cs.piccolo.PComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GraphExplorerCanvas
extends edu.umd.cs.piccolo.PCanvas

A full-features PCanvas that is able to display a graph and calculate the current position of the nodes on the canvas

Author:
Martin Suntinger
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class edu.umd.cs.piccolo.PCanvas
CURRENT_ZCANVAS, INTERATING_CHANGED_NOTIFICATION
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
GraphExplorerCanvas(ParsingManager p, GraphExplorerGui gui, java.lang.Object curColorConfigSet, java.lang.Object curSizeConfigSet)
           
 
Method Summary
 int[] calcPositionFromPolar(float r, float phi)
           
 java.lang.String getNodeContent(java.lang.String id)
           
 int getRingOffset()
          get the current ring offset value
 void hideInfoBox()
          hides the infobox panel
 void initialize()
          initialise all layers and functions of the canvas as well as several event handlers
 void initNodeMover()
          initialise the nodemover with several class intern parameters like the layers and the node IDs
 void move()
          invokes the node Mover that moves each node from its current position on the canvas to the position that is stored in its nextPosition member variable
 void paint(int _ringOffSet, boolean justRingOffsetChanged)
          redraws the graph on the GraphCanvas, including to reallocate the node positions.
 void refresh()
           
 void sendClosingMessageToGui(boolean isHidden)
          invokes the updateInfoBoxMenuItem functions of the GraphExplorerCanvas the gui is in in oder to enable or disable the gui main menu item "show/Hide Infobox"
 void setAnimationSpeed(int animationSpeed)
           
 void setCanvasColor(java.awt.Color newColor)
           
 void setCurColorConfigSet(SwitchConfigSet curSet)
           
 void setCurSizeConfigSet(java.lang.Object curSet)
           
 void setFishEyeFactor(int fishEyeFactor)
          The fisheye factor has influence on whether to decrease the ring offset from the inner to the outer, or not. 0 means no fisheye effect, 100 causes a strong fisheye effect. this function can be used by a slider in the gui.
 void setGuiSettingsScaleIcons(boolean guiSettingsScaleIcons)
           
 void setGuiSettingUseIcons(boolean guiSettingUseIcons)
           
 void setNodeSizeFactor(int nodeSizeFactor)
          The node size factor is a multiplier for the node size. the original node sizes are multiplied by this factor.
 void setNodeToFocus()
          reset the current focus node.
 void setNodeToFocus(java.lang.String id)
          sets a node to the focus of the graph, including to invoke the nodeMover
 void setRingColor(java.awt.Color newColor)
           
 void showInfoBox()
          shows the infobox panel
 void updateCrossRefBooleanFlag(boolean value)
           
 void updateCrossRefTransparancy(float newValue)
          set the transparance of cross references
 
Methods inherited from class edu.umd.cs.piccolo.PCanvas
addInputEventListener, createTimer, getAnimating, getCamera, getInteracting, getLayer, getPanEventHandler, getRoot, getZoomEventHandler, paintComponent, paintImmediately, popCursor, pushCursor, removeInputEventListener, repaint, setAnimatingRenderQuality, setBounds, setCamera, setDefaultRenderQuality, setEnabled, setInteracting, setInteractingRenderQuality, setPanEventHandler, setZoomEventHandler
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphExplorerCanvas

public GraphExplorerCanvas(ParsingManager p,
                           GraphExplorerGui gui,
                           java.lang.Object curColorConfigSet,
                           java.lang.Object curSizeConfigSet)
Parameters:
p - the ParsingManager holding several information retreived during the loading of the input source
gui - the gui the canvas is in
curColorConfigSet - the color config set to use on initialisation
curSizeConfigSet - the size config set to use on initialisation
Method Detail

setCanvasColor

public void setCanvasColor(java.awt.Color newColor)
Parameters:
newColor - the new java.awt.Color as the bg color of the canvas

setRingColor

public void setRingColor(java.awt.Color newColor)
Parameters:
newColor - the ring color used for the graph rings

initialize

public void initialize()
initialise all layers and functions of the canvas as well as several event handlers


sendClosingMessageToGui

public void sendClosingMessageToGui(boolean isHidden)
invokes the updateInfoBoxMenuItem functions of the GraphExplorerCanvas the gui is in in oder to enable or disable the gui main menu item "show/Hide Infobox"

Parameters:
isHidden -

hideInfoBox

public void hideInfoBox()
hides the infobox panel


showInfoBox

public void showInfoBox()
shows the infobox panel


paint

public void paint(int _ringOffSet,
                  boolean justRingOffsetChanged)
redraws the graph on the GraphCanvas, including to reallocate the node positions.

Parameters:
_ringOffSet - the current offset between the rings of the node
justRingOffsetChanged - true if no movement is necessary, false, if the nodes should afterward be moved to their new position by the NodeMover

calcPositionFromPolar

public int[] calcPositionFromPolar(float r,
                                   float phi)
Parameters:
r - a poloar coordinate radius value
phi - a poloar coordinate degree value
Returns:
and int[] array of pixel positions of these poloar coordinates

move

public void move()
invokes the node Mover that moves each node from its current position on the canvas to the position that is stored in its nextPosition member variable


setNodeToFocus

public void setNodeToFocus(java.lang.String id)
sets a node to the focus of the graph, including to invoke the nodeMover

Parameters:
id - the id of the node that should be set to the focus

setNodeToFocus

public void setNodeToFocus()
reset the current focus node. Necessary for example if the node sizes are updated, and an animated changing to newly calculated node positions is necessary, but the focus node remains the same.


getNodeContent

public java.lang.String getNodeContent(java.lang.String id)
Parameters:
id - the id of the node to obtain the content
Returns:
the content as string of the node

getRingOffset

public int getRingOffset()
get the current ring offset value

Returns:
the currently set ring offset value (ignoring a possible fisheye effect)

initNodeMover

public void initNodeMover()
initialise the nodemover with several class intern parameters like the layers and the node IDs


setCurColorConfigSet

public void setCurColorConfigSet(SwitchConfigSet curSet)
Parameters:
curSet - a SwitchConfigSet that determines the current node size evaluation

setCurSizeConfigSet

public void setCurSizeConfigSet(java.lang.Object curSet)
Parameters:
curSet - either a RangeConfigSet or a SwitchConfigSet that determines the evaluation and calcuation of node sizes

updateCrossRefTransparancy

public void updateCrossRefTransparancy(float newValue)
set the transparance of cross references

Parameters:
newValue - the parameter of the cross references

updateCrossRefBooleanFlag

public void updateCrossRefBooleanFlag(boolean value)
Parameters:
value - true if cross references should be drawn, false if not

setAnimationSpeed

public void setAnimationSpeed(int animationSpeed)
Parameters:
animationSpeed - the new animation speed

setFishEyeFactor

public void setFishEyeFactor(int fishEyeFactor)
The fisheye factor has influence on whether to decrease the ring offset from the inner to the outer, or not. 0 means no fisheye effect, 100 causes a strong fisheye effect. this function can be used by a slider in the gui.

Parameters:
fishEyeFactor -

setNodeSizeFactor

public void setNodeSizeFactor(int nodeSizeFactor)
The node size factor is a multiplier for the node size. the original node sizes are multiplied by this factor.

Parameters:
nodeSizeFactor - the new node size factor as an interger between 0 and 100;

setGuiSettingsScaleIcons

public void setGuiSettingsScaleIcons(boolean guiSettingsScaleIcons)

setGuiSettingUseIcons

public void setGuiSettingUseIcons(boolean guiSettingUseIcons)

refresh

public void refresh()