freemind.modes
Class NodeAdapter

java.lang.Object
  extended byfreemind.modes.NodeAdapter
All Implemented Interfaces:
MindMapNode, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
BrowseNodeModel, FileNodeModel, MindMapNodeModel, SchemeNodeModel

public abstract class NodeAdapter
extends java.lang.Object
implements MindMapNode

This class represents a single Node of a Tree. It contains direct handles to its parent and children and to its view.


Field Summary
protected  java.util.List children
           
protected  java.awt.Color color
           
protected  boolean folded
           
protected  java.awt.Font font
           
protected  java.util.Vector icons
          stores the icons associated with this node.
protected  java.lang.String style
           
protected  boolean underlined
           
protected  java.lang.Object userObject
           
 
Fields inherited from interface freemind.modes.MindMapNode
STYLE_BUBBLE, STYLE_FORK
 
Constructor Summary
protected NodeAdapter(FreeMindMain frame)
           
protected NodeAdapter(java.lang.Object userObject, FreeMindMain frame)
           
 
Method Summary
 void addIcon(MindIcon _icon)
           
protected  MindMapNode basicCopy()
           
 java.util.Enumeration children()
          AFAIK there is no way to get an enumeration out of a linked list.
 java.util.ListIterator childrenFolded()
           
 java.util.ListIterator childrenUnfolded()
           
 void estabilishOwnFont()
           
 boolean getAllowsChildren()
           
 javax.swing.tree.TreeNode getChildAt(int childIndex)
           
 int getChildCount()
           
 int getChildPosition(MindMapNode childNode)
           
 java.awt.Color getColor()
          The Foreground/Font Color
 MindMapEdge getEdge()
           
 java.awt.Font getFont()
           
 java.lang.String getFontFamilyName()
           
 java.lang.String getFontSize()
           
 FreeMindMain getFrame()
           
 java.util.Vector getIcons()
           
 int getIndex(javax.swing.tree.TreeNode node)
           
 java.lang.String getLink()
           
 int getNodeLevel()
           
 javax.swing.tree.TreeNode getParent()
           
 MindMapNode getParentNode()
           
 javax.swing.tree.TreePath getPath()
          Creates the TreePath recursively
 MindMapNode getPreferredChild()
           
 java.lang.String getStyle()
          A Node-Style like MindMapNode.STYLE_FORK or MindMapNode.STYLE_BUBBLE
 NodeView getViewer()
           
 boolean hasChildren()
           
 boolean hasFoldedStrictDescendant()
          True iff one of node's strict descendants is folded.
 void insert(javax.swing.tree.MutableTreeNode child, int index)
           
 boolean isBold()
           
 boolean isDescendantOf(MindMapNode node)
          Returns whether the argument is parent or parent of one of the grandpa's of this node.
 boolean isFolded()
           
 boolean isItalic()
           
 boolean isLeaf()
           
 boolean isRoot()
           
 boolean isUnderlined()
           
 void remove(int index)
           
 void remove(javax.swing.tree.MutableTreeNode node)
           
 void removeFromParent()
           
 int removeLastIcon()
           
 void setBold(boolean bold)
           
 void setColor(java.awt.Color color)
           
 void setEdge(MindMapEdge edge)
           
 void setFolded(boolean folded)
           
 void setFont(java.awt.Font font)
           
 void setFontSize(int fontSize)
           
 void setItalic(boolean italic)
           
 void setLink(java.lang.String link)
           
 void setParent(MindMapNode newParent)
           
 void setParent(javax.swing.tree.MutableTreeNode newParent)
           
 void setPreferredChild(MindMapNode node)
           
 void setStyle(java.lang.String style)
           
 void setUnderlined(boolean underlined)
           
 void setUserObject(java.lang.Object object)
           
 void setViewer(NodeView viewer)
           
 MindMapNode shallowCopy()
           
 void toggleBold()
           
 void toggleItalic()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

userObject

protected java.lang.Object userObject

style

protected java.lang.String style

icons

protected java.util.Vector icons
stores the icons associated with this node.


color

protected java.awt.Color color

folded

protected boolean folded

children

protected java.util.List children

font

protected java.awt.Font font

underlined

protected boolean underlined
Constructor Detail

NodeAdapter

protected NodeAdapter(FreeMindMain frame)

NodeAdapter

protected NodeAdapter(java.lang.Object userObject,
                      FreeMindMain frame)
Method Detail

getLink

public java.lang.String getLink()
Specified by:
getLink in interface MindMapNode

setLink

public void setLink(java.lang.String link)
Specified by:
setLink in interface MindMapNode

getFrame

public FreeMindMain getFrame()

getViewer

public NodeView getViewer()
Specified by:
getViewer in interface MindMapNode

setViewer

public void setViewer(NodeView viewer)
Specified by:
setViewer in interface MindMapNode

getPath

public javax.swing.tree.TreePath getPath()
Creates the TreePath recursively

Specified by:
getPath in interface MindMapNode

getEdge

public MindMapEdge getEdge()
Specified by:
getEdge in interface MindMapNode

setEdge

public void setEdge(MindMapEdge edge)

getStyle

public java.lang.String getStyle()
A Node-Style like MindMapNode.STYLE_FORK or MindMapNode.STYLE_BUBBLE

Specified by:
getStyle in interface MindMapNode

getColor

public java.awt.Color getColor()
The Foreground/Font Color

Specified by:
getColor in interface MindMapNode

setStyle

public void setStyle(java.lang.String style)

setColor

public void setColor(java.awt.Color color)
Specified by:
setColor in interface MindMapNode

estabilishOwnFont

public void estabilishOwnFont()

setBold

public void setBold(boolean bold)

toggleBold

public void toggleBold()

setItalic

public void setItalic(boolean italic)

toggleItalic

public void toggleItalic()

setUnderlined

public void setUnderlined(boolean underlined)

setFont

public void setFont(java.awt.Font font)
Specified by:
setFont in interface MindMapNode

getParentNode

public MindMapNode getParentNode()
Specified by:
getParentNode in interface MindMapNode

setFontSize

public void setFontSize(int fontSize)
Specified by:
setFontSize in interface MindMapNode

getFont

public java.awt.Font getFont()
Specified by:
getFont in interface MindMapNode

getFontSize

public java.lang.String getFontSize()
Specified by:
getFontSize in interface MindMapNode

getFontFamilyName

public java.lang.String getFontFamilyName()
Specified by:
getFontFamilyName in interface MindMapNode

isBold

public boolean isBold()
Specified by:
isBold in interface MindMapNode

isItalic

public boolean isItalic()
Specified by:
isItalic in interface MindMapNode

isUnderlined

public boolean isUnderlined()
Specified by:
isUnderlined in interface MindMapNode

isFolded

public boolean isFolded()
Specified by:
isFolded in interface MindMapNode

getIcons

public java.util.Vector getIcons()
Specified by:
getIcons in interface MindMapNode

addIcon

public void addIcon(MindIcon _icon)
Specified by:
addIcon in interface MindMapNode

removeLastIcon

public int removeLastIcon()
Specified by:
removeLastIcon in interface MindMapNode

hasFoldedStrictDescendant

public boolean hasFoldedStrictDescendant()
True iff one of node's strict descendants is folded. A node N is not its strict descendant - the fact that node itself is folded is not sufficient to return true.


setFolded

public void setFolded(boolean folded)
Specified by:
setFolded in interface MindMapNode

basicCopy

protected MindMapNode basicCopy()

shallowCopy

public MindMapNode shallowCopy()
Specified by:
shallowCopy in interface MindMapNode

toString

public java.lang.String toString()
Specified by:
toString in interface MindMapNode

isDescendantOf

public boolean isDescendantOf(MindMapNode node)
Returns whether the argument is parent or parent of one of the grandpa's of this node. (transitive)

Specified by:
isDescendantOf in interface MindMapNode

isRoot

public boolean isRoot()
Specified by:
isRoot in interface MindMapNode

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface MindMapNode

getChildPosition

public int getChildPosition(MindMapNode childNode)
Specified by:
getChildPosition in interface MindMapNode

childrenUnfolded

public java.util.ListIterator childrenUnfolded()
Specified by:
childrenUnfolded in interface MindMapNode

childrenFolded

public java.util.ListIterator childrenFolded()
Specified by:
childrenFolded in interface MindMapNode

children

public java.util.Enumeration children()
AFAIK there is no way to get an enumeration out of a linked list. So this exception must be thrown, or we can't implement TreeNode anymore (maybe we shouldn't?)

Specified by:
children in interface javax.swing.tree.TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Specified by:
getIndex in interface javax.swing.tree.TreeNode

getParent

public javax.swing.tree.TreeNode getParent()
Specified by:
getParent in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode

insert

public void insert(javax.swing.tree.MutableTreeNode child,
                   int index)
Specified by:
insert in interface javax.swing.tree.MutableTreeNode

remove

public void remove(int index)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode

remove

public void remove(javax.swing.tree.MutableTreeNode node)
Specified by:
remove in interface javax.swing.tree.MutableTreeNode

getPreferredChild

public MindMapNode getPreferredChild()
Specified by:
getPreferredChild in interface MindMapNode

setPreferredChild

public void setPreferredChild(MindMapNode node)
Specified by:
setPreferredChild in interface MindMapNode

removeFromParent

public void removeFromParent()
Specified by:
removeFromParent in interface javax.swing.tree.MutableTreeNode

setParent

public void setParent(javax.swing.tree.MutableTreeNode newParent)
Specified by:
setParent in interface javax.swing.tree.MutableTreeNode

setParent

public void setParent(MindMapNode newParent)

setUserObject

public void setUserObject(java.lang.Object object)
Specified by:
setUserObject in interface javax.swing.tree.MutableTreeNode

getNodeLevel

public int getNodeLevel()
Specified by:
getNodeLevel in interface MindMapNode