freemind.view.mindmapview
Class NodeView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by freemind.view.mindmapview.NodeView
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.swing.event.TreeModelListener

public class NodeView
extends javax.swing.JComponent
implements javax.swing.event.TreeModelListener

This class represents a single Node of a MindMap (in analogy to TreeCellRenderer).

See Also:
Serialized Form

Nested Class Summary
 
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
protected static java.awt.Color dragColor
           
static int DRAGGED_OVER_NO
           
static int DRAGGED_OVER_SIBLING
           
static int DRAGGED_OVER_SON
           
static int DRAGGED_OVER_SON_LEFT
          For RootNodeView.
protected  MapView map
           
protected  MindMapNode model
           
protected  NodeMotionListenerView motionListenerView
           
 
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
protected NodeView(MindMapNode model, int position, MapView map, java.awt.Container parent)
           
 
Method Summary
 boolean contains(int x, int y)
           
protected  void convertPointToMap(java.awt.Point p)
           
 void createAttributeView()
           
 boolean focused()
           
 int getAdditionalCloudHeigth()
          Calculates the tree height increment because of the clouds.
protected static java.awt.Color getAntiColor1(java.awt.Color c)
          Determines to a given color a color, that is the best contrary color.
protected static java.awt.Color getAntiColor2(java.awt.Color c)
          Determines to a given color a color, that is the best contrary color.
 AttributeView getAttributeView()
           
 java.util.LinkedList getChildrenViews()
          This method returns the NodeViews that are children of this node.
 javax.swing.JComponent getContent()
           
 java.awt.Container getContentPane()
           
 void getCoordinates(java.util.LinkedList inList)
          Returns the coordinates occupied by the node and its children as a vector of four point per node.
 int getDeltaX()
          get x coordinate including folding symbol
 int getDeltaY()
          get y coordinate including folding symbol
 int getHGap()
           
 boolean getIsLong()
           
 java.awt.Point getLinkPoint(java.awt.Point declination)
          Returns the Point where the Links should arrive the Node.
 MainView getMainView()
           
protected  int getMainViewHeightWithFoldingMark()
          get height including folding symbol
protected  int getMainViewWidthWithFoldingMark()
           
 MapView getMap()
           
 int getMaxToolTipWidth()
           
 MindMapNode getModel()
           
 NodeMotionListenerView getMotionListenerView()
           
protected  NodeView getNextPage()
           
protected  NodeView getNextSiblingSingle()
           
protected  NodeView getNextVisibleSibling()
           
 NodeView getParentView()
           
 NodeView getPreferredVisibleChild(boolean left)
           
protected  NodeView getPreviousPage()
           
protected  NodeView getPreviousSiblingSingle()
           
protected  NodeView getPreviousVisibleSibling()
           
protected  java.awt.Color getSelectedColor()
           
 int getShift()
           
protected  java.util.LinkedList getSiblingViews()
           
 java.lang.String getText()
           
 java.awt.Color getTextBackground()
           
 java.awt.Color getTextColor()
           
 java.awt.Font getTextFont()
           
 int getVGap()
           
 NodeView getVisibleParentView()
           
 int getZoomedFoldingSymbolHalfWidth()
           
 boolean isChildOf(NodeView myNodeView)
           
 boolean isContentVisible()
           
 boolean isLeft()
          Is the node left of root?
 boolean isParentOf(NodeView myNodeView)
           
 boolean isRoot()
           
 boolean isSelected()
           
 boolean isSiblingOf(NodeView myNodeView)
           
 void paint(java.awt.Graphics g)
           
protected  void paintChildren(java.awt.Graphics g)
           
 void paintFoldingMark(java.awt.Graphics2D g)
           
protected  void removeFromMap()
           
 void requestFocus()
           
 void setBounds(int x, int y, int width, int height)
           
 void setIcon(MultipleImage image)
           
protected  void setModel(MindMapNode model)
           
 void setPreferredChild(NodeView view)
           
 void setText(java.lang.String string)
           
 void setVisible(boolean isVisible)
           
 java.lang.String toString()
           
 void treeNodesChanged(javax.swing.event.TreeModelEvent e)
           
 void treeNodesInserted(javax.swing.event.TreeModelEvent e)
           
 void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
           
 void treeStructureChanged(javax.swing.event.TreeModelEvent e)
           
 void updateToolTip()
          Updates the tool tip of the node.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, 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, unregisterKeyboardAction, update, updateUI
 
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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

protected MindMapNode model

map

protected MapView map

dragColor

protected static final java.awt.Color dragColor

DRAGGED_OVER_NO

public static final int DRAGGED_OVER_NO
See Also:
Constant Field Values

DRAGGED_OVER_SON

public static final int DRAGGED_OVER_SON
See Also:
Constant Field Values

DRAGGED_OVER_SIBLING

public static final int DRAGGED_OVER_SIBLING
See Also:
Constant Field Values

DRAGGED_OVER_SON_LEFT

public static final int DRAGGED_OVER_SON_LEFT
For RootNodeView.

See Also:
Constant Field Values

motionListenerView

protected NodeMotionListenerView motionListenerView
Constructor Detail

NodeView

protected NodeView(MindMapNode model,
                   int position,
                   MapView map,
                   java.awt.Container parent)
Method Detail

removeFromMap

protected void removeFromMap()

isRoot

public boolean isRoot()

getIsLong

public boolean getIsLong()

isSiblingOf

public boolean isSiblingOf(NodeView myNodeView)

isChildOf

public boolean isChildOf(NodeView myNodeView)

isParentOf

public boolean isParentOf(NodeView myNodeView)

getModel

public MindMapNode getModel()

getCoordinates

public void getCoordinates(java.util.LinkedList inList)
Returns the coordinates occupied by the node and its children as a vector of four point per node.


setText

public void setText(java.lang.String string)

getText

public java.lang.String getText()

getMainViewWidthWithFoldingMark

protected int getMainViewWidthWithFoldingMark()

getMainViewHeightWithFoldingMark

protected int getMainViewHeightWithFoldingMark()
get height including folding symbol


getDeltaX

public int getDeltaX()
get x coordinate including folding symbol


getDeltaY

public int getDeltaY()
get y coordinate including folding symbol


requestFocus

public void requestFocus()
Overrides:
requestFocus in class javax.swing.JComponent

focused

public boolean focused()

getAdditionalCloudHeigth

public int getAdditionalCloudHeigth()
Calculates the tree height increment because of the clouds.


isSelected

public boolean isSelected()

isLeft

public boolean isLeft()
Is the node left of root?


setModel

protected void setModel(MindMapNode model)

getMap

public MapView getMap()

getParentView

public NodeView getParentView()

getVisibleParentView

public NodeView getVisibleParentView()

getChildrenViews

public java.util.LinkedList getChildrenViews()
This method returns the NodeViews that are children of this node.


getSiblingViews

protected java.util.LinkedList getSiblingViews()

getLinkPoint

public java.awt.Point getLinkPoint(java.awt.Point declination)
Returns the Point where the Links should arrive the Node.


convertPointToMap

protected void convertPointToMap(java.awt.Point p)

getNextPage

protected NodeView getNextPage()

getPreviousPage

protected NodeView getPreviousPage()

getNextVisibleSibling

protected NodeView getNextVisibleSibling()

isContentVisible

public boolean isContentVisible()

getPreviousVisibleSibling

protected NodeView getPreviousVisibleSibling()

getNextSiblingSingle

protected NodeView getNextSiblingSingle()

getPreviousSiblingSingle

protected NodeView getPreviousSiblingSingle()

createAttributeView

public void createAttributeView()

updateToolTip

public void updateToolTip()
Updates the tool tip of the node.


getMaxToolTipWidth

public int getMaxToolTipWidth()

setIcon

public void setIcon(MultipleImage image)

getSelectedColor

protected java.awt.Color getSelectedColor()
Returns:
returns the color that should used to select the node.

getAntiColor1

protected static java.awt.Color getAntiColor1(java.awt.Color c)
Determines to a given color a color, that is the best contrary color. It is different from getAntiColor2(java.awt.Color).

Since:
PPS 1.1.1

getAntiColor2

protected static java.awt.Color getAntiColor2(java.awt.Color c)
Determines to a given color a color, that is the best contrary color. It is different from getAntiColor1(java.awt.Color).

Since:
PPS 1.1.1

getShift

public int getShift()
Returns:
Returns the sHIFT.

getVGap

public int getVGap()
Returns:
Returns the VGAP.

getHGap

public int getHGap()

getMainView

public MainView getMainView()

getTextFont

public java.awt.Font getTextFont()

getTextColor

public java.awt.Color getTextColor()

getAttributeView

public AttributeView getAttributeView()

getPreferredVisibleChild

public NodeView getPreferredVisibleChild(boolean left)

setPreferredChild

public void setPreferredChild(NodeView view)

treeNodesChanged

public void treeNodesChanged(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesChanged in interface javax.swing.event.TreeModelListener

treeNodesInserted

public void treeNodesInserted(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesInserted in interface javax.swing.event.TreeModelListener

treeNodesRemoved

public void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesRemoved in interface javax.swing.event.TreeModelListener

treeStructureChanged

public void treeStructureChanged(javax.swing.event.TreeModelEvent e)
Specified by:
treeStructureChanged in interface javax.swing.event.TreeModelListener

getZoomedFoldingSymbolHalfWidth

public int getZoomedFoldingSymbolHalfWidth()

paintFoldingMark

public void paintFoldingMark(java.awt.Graphics2D g)

getContent

public javax.swing.JComponent getContent()

getContentPane

public java.awt.Container getContentPane()

getMotionListenerView

public NodeMotionListenerView getMotionListenerView()

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Overrides:
setBounds in class java.awt.Component

setVisible

public void setVisible(boolean isVisible)
Overrides:
setVisible in class javax.swing.JComponent

paint

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

paintChildren

protected void paintChildren(java.awt.Graphics g)
Overrides:
paintChildren in class javax.swing.JComponent

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

contains

public boolean contains(int x,
                        int y)
Overrides:
contains in class javax.swing.JComponent

getTextBackground

public java.awt.Color getTextBackground()