treebolic.view
Class View

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 treebolic.view.View
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class View
extends javax.swing.JPanel

View

Author:
Bernard Bou
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static int ANIMATIONSTARTDELAY
          Animation start delay
private static int ANIMATIONTIMESLICE
          Animation time slice
private  boolean focusOnHover
          Whether hovering on nodes triggers gaining focus
private  boolean hasTooltip
          Whether it has tooltip
private static int HOTNODETIMESLICE
          Hot node time slice
private  boolean invalidatePainterGraphics
          Full redraw flag
private static long serialVersionUID
           
private  Animator theAnimator
          Animator
private  java.awt.Image theCache
          Drawing cache
private  INode theFocusNode
          Focus node
private  INode theHotNode
          Hot node
private  AbstractLayerOut theLayerOut
          LayerOut
private  Model theModel
          Data model
private  MouseAdapter theMouseAdapter
          Mouse adapter
private  AbstractPainter thePainter
          Painter
private  java.awt.Dimension theSize
          View size
private  javax.swing.Timer theTimer
          Timer
private static int theTooltipLineSpan
          Tooltip break
private  Transformer theTransformer
          Transformer
 boolean tooltipDisplaysContent
          Whether tooltips display contents
 
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
View()
          Constructor
 
Method Summary
private  void animate(Complex thisFrom, Complex thisTo, boolean now)
          Animate tree.
 void animateTo(INode thisNode, Complex thisDestination, boolean now)
          Animate node to destination location
 void animateToCenter(INode thisNode, boolean now)
          Animate to unit circle center
 void apply(Settings theseSettings)
          Set view behaviour
 void applyComposedTransform(HyperTransform thisTransform)
          Compose this transform with current and apply
 void applyInitialTransform()
          Apply initial transform
 void applyNullTransform()
          Apply null transform
 void applyTransform(HyperTransform thisTransform)
          Apply transform
 void composeRotate(Complex thisStart, Complex thisEnd)
          Compose delta rotation
 void composeTranslate(Complex thisStart, Complex thisEnd)
          Compose delta translation
 void connect(AbstractLayerOut thisLayerOut)
          Connect layout agent
 void connect(Controller thisController)
          Connect controller
 void connect(Model thisModel)
          Set model
 void enterDrag()
          Drag notification hook
 INode findNode(int vx, int vy)
          Find node given view location
 INode getFocusNode()
          Get focused node
private  void invalidateAndRepaint()
          Invalidate graphics and repaint
 void leaveDrag()
          Leave drag notification hook
 void mount(INode thisMountedRoot)
          Mount notification hook
 void moveTo(INode thisNode, Complex thisDestination)
          Translate node to point
 void moveToCenter(INode thisNode)
          Translate node to unit circle center
 void paint(java.awt.Graphics thisScreenGraphics)
           
 void repaint()
           
 void resetTransform()
           
 void setFocusOnHover(java.lang.Boolean thisFlag)
          Control whether hovering on node triggers gaining focus
 void setHasTooltip(java.lang.Boolean thisFlag)
          Enable/disable tooltips
 void setHoverCursor(boolean linkCursor)
          Set default cursor
 void setHyperbolicEdges(java.lang.Boolean thisFlag)
          Set linear/hyperbolic rendering of edges
 void setImages(java.awt.Image thisBackgroundImage, java.awt.Image thisDefaultNodeImage, java.awt.Image thisDefaultTreeEdgeImage, java.awt.Image thisDefaultEdgeImage)
          Set images
 void setPopUpMenu(java.lang.Boolean thisFlag)
          Control whether view has popup menu
 void setPreserveOrientation(java.lang.Boolean thisFlag)
          Preserve orientation
 void setShift(double cx, double cy, boolean xinc, boolean yinc)
          Set shift
 void setToolTip(INode thisNode)
          Set tooltip to contain information about this node
 void setTooltipDisplaysContent(java.lang.Boolean thisFlag)
          Enable/disable displaying content in tooltips
 void setZoomFactor(double f)
          Set zoom factor
private  void translate(Complex thisStart, Complex thisEnd)
          Translate tree according to vector
 void umount(INode thisMountingRoot)
          Unmount notification hook
 Complex viewToUnitCircle(int vx, int vy)
          Convert from view coordinates to unit circle euclidian coordinates
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, 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

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

theModel

private Model theModel
Data model


thePainter

private final AbstractPainter thePainter
Painter


theTransformer

private final Transformer theTransformer
Transformer


theAnimator

private final Animator theAnimator
Animator


theLayerOut

private AbstractLayerOut theLayerOut
LayerOut


theMouseAdapter

private MouseAdapter theMouseAdapter
Mouse adapter


theTimer

private javax.swing.Timer theTimer
Timer


invalidatePainterGraphics

private boolean invalidatePainterGraphics
Full redraw flag


theSize

private java.awt.Dimension theSize
View size


theCache

private java.awt.Image theCache
Drawing cache


theHotNode

private INode theHotNode
Hot node


theFocusNode

private INode theFocusNode
Focus node


focusOnHover

private boolean focusOnHover
Whether hovering on nodes triggers gaining focus


hasTooltip

private boolean hasTooltip
Whether it has tooltip


tooltipDisplaysContent

public boolean tooltipDisplaysContent
Whether tooltips display contents


theTooltipLineSpan

private static int theTooltipLineSpan
Tooltip break


ANIMATIONTIMESLICE

private static final int ANIMATIONTIMESLICE
Animation time slice

See Also:
Constant Field Values

ANIMATIONSTARTDELAY

private static final int ANIMATIONSTARTDELAY
Animation start delay

See Also:
Constant Field Values

HOTNODETIMESLICE

private static final int HOTNODETIMESLICE
Hot node time slice

See Also:
Constant Field Values
Constructor Detail

View

public View()
Constructor

Method Detail

connect

public void connect(Controller thisController)
Connect controller

Parameters:
thisController - controller

connect

public void connect(Model thisModel)
Set model

Parameters:
thisModel - data model

connect

public void connect(AbstractLayerOut thisLayerOut)
Connect layout agent

Parameters:
thisLayerOut - layout agent

repaint

public void repaint()
Overrides:
repaint in class java.awt.Component

paint

public void paint(java.awt.Graphics thisScreenGraphics)
Overrides:
paint in class javax.swing.JComponent

invalidateAndRepaint

private void invalidateAndRepaint()
Invalidate graphics and repaint


setHoverCursor

public void setHoverCursor(boolean linkCursor)
Set default cursor

Parameters:
linkCursor - whether to use 'link' cursor

enterDrag

public void enterDrag()
Drag notification hook


leaveDrag

public void leaveDrag()
Leave drag notification hook


mount

public void mount(INode thisMountedRoot)
Mount notification hook

Parameters:
thisMountedRoot - mounted node

umount

public void umount(INode thisMountingRoot)
Unmount notification hook


setFocusOnHover

public void setFocusOnHover(java.lang.Boolean thisFlag)
Control whether hovering on node triggers gaining focus

Parameters:
thisFlag - whether hovering on node triggers gaining focus (null toggles value)

setPreserveOrientation

public void setPreserveOrientation(java.lang.Boolean thisFlag)
Preserve orientation

Parameters:
thisFlag - whether transformations preserve orientation (null toggles value)

setShift

public void setShift(double cx,
                     double cy,
                     boolean xinc,
                     boolean yinc)
Set shift

Parameters:
cx - x shift
cy - y shift
xinc - whether to add to current x shift
yinc - whether to add to current y shift

setZoomFactor

public void setZoomFactor(double f)
Set zoom factor

Parameters:
f - zoom factor

setHyperbolicEdges

public void setHyperbolicEdges(java.lang.Boolean thisFlag)
Set linear/hyperbolic rendering of edges

Parameters:
thisFlag - whether edges are rendered in hyperbolic way (null toggles value)

setHasTooltip

public void setHasTooltip(java.lang.Boolean thisFlag)
Enable/disable tooltips

Parameters:
thisFlag - whether to display tooltip (null toggles value)

setTooltipDisplaysContent

public void setTooltipDisplaysContent(java.lang.Boolean thisFlag)
Enable/disable displaying content in tooltips

Parameters:
thisFlag - whether tooltip displays content (null toggles value)

setToolTip

public void setToolTip(INode thisNode)
Set tooltip to contain information about this node

Parameters:
thisNode - node

setPopUpMenu

public void setPopUpMenu(java.lang.Boolean thisFlag)
Control whether view has popup menu

Parameters:
thisFlag - whether view has popup menu (null toggles value)

apply

public void apply(Settings theseSettings)
Set view behaviour

Parameters:
theseSettings - settings

setImages

public void setImages(java.awt.Image thisBackgroundImage,
                      java.awt.Image thisDefaultNodeImage,
                      java.awt.Image thisDefaultTreeEdgeImage,
                      java.awt.Image thisDefaultEdgeImage)
Set images

Parameters:
thisBackgroundImage - background image
thisDefaultNodeImage - default node image
thisDefaultTreeEdgeImage - default tree edge image
thisDefaultEdgeImage - default edge image

resetTransform

public void resetTransform()

applyComposedTransform

public void applyComposedTransform(HyperTransform thisTransform)
Compose this transform with current and apply

Parameters:
thisTransform - transform to compose with current transform

applyTransform

public void applyTransform(HyperTransform thisTransform)
Apply transform

Parameters:
thisTransform - transform

applyNullTransform

public void applyNullTransform()
Apply null transform


applyInitialTransform

public void applyInitialTransform()
Apply initial transform


composeTranslate

public void composeTranslate(Complex thisStart,
                             Complex thisEnd)
Compose delta translation

Parameters:
thisStart - unit circle delta vector start
thisEnd - unit circle delta vector start

composeRotate

public void composeRotate(Complex thisStart,
                          Complex thisEnd)
Compose delta rotation

Parameters:
thisStart - unit circle delta vector start
thisEnd - unit circle delta vector end

translate

private void translate(Complex thisStart,
                       Complex thisEnd)
Translate tree according to vector

Parameters:
thisStart - unit circle vector start
thisEnd - unit circle vector end

moveTo

public void moveTo(INode thisNode,
                   Complex thisDestination)
Translate node to point

Parameters:
thisNode - node
thisDestination - unit circle destination location

moveToCenter

public void moveToCenter(INode thisNode)
Translate node to unit circle center

Parameters:
thisNode - node

animateToCenter

public void animateToCenter(INode thisNode,
                            boolean now)
Animate to unit circle center

Parameters:
thisNode - node
now - whether to start now

animateTo

public void animateTo(INode thisNode,
                      Complex thisDestination,
                      boolean now)
Animate node to destination location

Parameters:
thisNode - node
thisDestination - unit circle destination location
now - whether to start now

animate

private void animate(Complex thisFrom,
                     Complex thisTo,
                     boolean now)
Animate tree. Translate as per vector(start,end)

Parameters:
thisFrom - unit circle vector start
thisTo - unit circle vector end
now - whether to start now

findNode

public INode findNode(int vx,
                      int vy)
Find node given view location

Parameters:
vx - view x location
vy - view y location
Returns:
node

getFocusNode

public INode getFocusNode()
Get focused node

Returns:
focus noe (at center of unit circle)

viewToUnitCircle

public Complex viewToUnitCircle(int vx,
                                int vy)
Convert from view coordinates to unit circle euclidian coordinates

Parameters:
vx - view x-coordinate
vy - view x-coordinate
Returns:
unit circle euclidian coordinate