freemind.modes

Class MapAdapter

public abstract class MapAdapter extends Object implements MindMap

Field Summary
protected intchangesPerformedSinceLastSave
denotes the amount of changes since the last save.
protected booleanreadOnly
Constructor Summary
MapAdapter(FreeMindMain frame)
Method Summary
voidaddTreeModelListener(TreeModelListener l)
voidapplyPattern(NodeAdapter node, StylePattern pattern)
protected voidapplyPattern(NodeAdapter node, StylePattern pattern, boolean visible)
voidchangeNode(MindMapNode node, String newText)
Transferablecopy(MindMapNode node)
Transferablecopy()
TransferablecopySingle()
Transferablecut(MindMapNode node)
Transferablecut()
voiddestroy()
voiddisplayNode(MindMapNode node, ArrayList NodesUnfoldedByDisplay)
booleanfind(MindMapNode node, String what, boolean caseSensitive)
booleanfindNext()
StringgetAsPlainText(List mindMapNodes)
StringgetAsRTF(List mindMapNodes)
ColorgetBackgroundColor()
ObjectgetChild(Object parent, int index)
intgetChildCount(Object parent)
FilegetFile()
Change this to always return null if your model doesn't support files.
StringgetFindFromText()
StringgetFindWhat()
FreeMindMaingetFrame()
intgetIndexOfChild(Object parent, Object child)
StringgetLink(NodeAdapter node)
MindMapLinkRegistrygetLinkRegistry()
protected intgetNumberOfChangesSinceLastSave()
Object[]getPathToRoot(TreeNode node)
StringgetRestoreable()
ObjectgetRoot()
protected StringgetText(String textId)
URLgetURL()
Return URL of the map (whether as local file or a web location)
voidinsertNodeInto(MindMapNode newChild, MindMapNode parent)
voidinsertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)
Use this method to add children because it will cause the appropriate event.
voidinsertNodeIntoNoEvent(MindMapNode newChild, MindMapNode parent)
voidinsertNodeIntoNoEvent(MindMapNode newChild, MindMapNode parent, boolean asSibling)
booleanisLeaf(Object node)
booleanisReadOnly()
booleanisSaved()
abstract voidload(File file)
intmoveNodeTo(MindMapNode newChild, MindMapNode parent, int index, int direction)
The direction is used if side left and right are present. then the next suitable place on the same side# is searched. if there is no such place, then the side is changed.
protected voidnodeChanged(TreeNode node)
Invoke this method after you've changed how node is to be represented in the tree.
protected voidnodesChanged(TreeNode node, int[] childIndices)
Invoke this method after you've changed how the children identified by childIndicies are to be represented in the tree.
protected voidnodesWereInserted(TreeNode node, int[] childIndices)
Invoke this method after you've inserted some TreeNodes into node. childIndices should be the index of the new elements and must be sorted in ascending order.
protected voidnodesWereRemoved(TreeNode parent, int[] childIndices, Object[] removedChildren)
Invoke this method after you've removed some TreeNodes from node. childIndices should be the index of the removed elements and must be sorted in ascending order.
protected voidnodeStructureChanged(TreeNode node)
Invoke this method if you've totally changed the children of node and its childrens children...
voidpaste(Transferable t, MindMapNode parent)
voidpaste(Transferable t, MindMapNode target, boolean asSibling, boolean isLeft)
voidpaste(MindMapNode node, MindMapNode parent)
protected voidreload(TreeNode node)
Invoke this method if you've modified the TreeNodes upon which this model depends.
voidremoveNodeFromParent(MutableTreeNode node)
Joerg: Message this to remove node from its parent.
voidremoveNodeFromParent(MutableTreeNode node, boolean notify)
voidremoveTreeModelListener(TreeModelListener l)
abstract booleansave(File file)
voidsetBackgroundColor(Color backgroundColor)
protected voidsetFile(File file)
voidsetFolded(MindMapNode node, boolean folded)
voidsetLink(NodeAdapter node, String link)
protected voidsetRoot(MindMapNode root)
protected voidsetSaved(boolean saved)
voidsplitNode(MindMapNode node, int caretPosition, String newText)
StringtryToLock(File file)
Attempts to lock the map using semaphore file.
voidvalueForPathChanged(TreePath path, Object newValue)

Field Detail

changesPerformedSinceLastSave

protected int changesPerformedSinceLastSave
denotes the amount of changes since the last save. The initial value is one, to ensure, that the model is dirty.

readOnly

protected boolean readOnly

Constructor Detail

MapAdapter

public MapAdapter(FreeMindMain frame)

Method Detail

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)

applyPattern

public void applyPattern(NodeAdapter node, StylePattern pattern)

applyPattern

protected void applyPattern(NodeAdapter node, StylePattern pattern, boolean visible)

changeNode

public void changeNode(MindMapNode node, String newText)

copy

public Transferable copy(MindMapNode node)

copy

public Transferable copy()

copySingle

public Transferable copySingle()

cut

public final Transferable cut(MindMapNode node)

cut

public final Transferable cut()

destroy

public void destroy()

displayNode

public void displayNode(MindMapNode node, ArrayList NodesUnfoldedByDisplay)

find

public boolean find(MindMapNode node, String what, boolean caseSensitive)

findNext

public boolean findNext()

getAsPlainText

public String getAsPlainText(List mindMapNodes)

getAsRTF

public String getAsRTF(List mindMapNodes)

getBackgroundColor

public Color getBackgroundColor()

getChild

public Object getChild(Object parent, int index)

getChildCount

public int getChildCount(Object parent)

getFile

public File getFile()
Change this to always return null if your model doesn't support files.

getFindFromText

public String getFindFromText()

getFindWhat

public String getFindWhat()

getFrame

public FreeMindMain getFrame()

getIndexOfChild

public int getIndexOfChild(Object parent, Object child)

getLink

public String getLink(NodeAdapter node)

getLinkRegistry

public MindMapLinkRegistry getLinkRegistry()

getNumberOfChangesSinceLastSave

protected int getNumberOfChangesSinceLastSave()

getPathToRoot

public Object[] getPathToRoot(TreeNode node)

getRestoreable

public String getRestoreable()

getRoot

public Object getRoot()

getText

protected String getText(String textId)

getURL

public URL getURL()
Return URL of the map (whether as local file or a web location)

insertNodeInto

public void insertNodeInto(MindMapNode newChild, MindMapNode parent)

insertNodeInto

public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)
Use this method to add children because it will cause the appropriate event.

insertNodeIntoNoEvent

public void insertNodeIntoNoEvent(MindMapNode newChild, MindMapNode parent)

insertNodeIntoNoEvent

public void insertNodeIntoNoEvent(MindMapNode newChild, MindMapNode parent, boolean asSibling)

isLeaf

public boolean isLeaf(Object node)

isReadOnly

public boolean isReadOnly()

isSaved

public boolean isSaved()

load

public abstract void load(File file)

moveNodeTo

public int moveNodeTo(MindMapNode newChild, MindMapNode parent, int index, int direction)
The direction is used if side left and right are present. then the next suitable place on the same side# is searched. if there is no such place, then the side is changed.

Returns: returns the new index.

nodeChanged

protected void nodeChanged(TreeNode node)
Invoke this method after you've changed how node is to be represented in the tree.

nodesChanged

protected void nodesChanged(TreeNode node, int[] childIndices)
Invoke this method after you've changed how the children identified by childIndicies are to be represented in the tree.

nodesWereInserted

protected void nodesWereInserted(TreeNode node, int[] childIndices)
Invoke this method after you've inserted some TreeNodes into node. childIndices should be the index of the new elements and must be sorted in ascending order.

nodesWereRemoved

protected void nodesWereRemoved(TreeNode parent, int[] childIndices, Object[] removedChildren)
Invoke this method after you've removed some TreeNodes from node. childIndices should be the index of the removed elements and must be sorted in ascending order. And removedChildren should be the array of the children objects that were removed.

nodeStructureChanged

protected void nodeStructureChanged(TreeNode node)
Invoke this method if you've totally changed the children of node and its childrens children... This will post a treeStructureChanged event.

paste

public void paste(Transferable t, MindMapNode parent)

paste

public void paste(Transferable t, MindMapNode target, boolean asSibling, boolean isLeft)

paste

public void paste(MindMapNode node, MindMapNode parent)

reload

protected void reload(TreeNode node)
Invoke this method if you've modified the TreeNodes upon which this model depends. The model will notify all of its listeners that the model has changed below the node node (PENDING).

removeNodeFromParent

public void removeNodeFromParent(MutableTreeNode node)
Joerg: Message this to remove node from its parent. This will message nodesWereRemoved to create the appropriate event. This is the preferred way to remove a node as it handles the event creation for you.

removeNodeFromParent

public void removeNodeFromParent(MutableTreeNode node, boolean notify)

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)

save

public abstract boolean save(File file)

setBackgroundColor

public void setBackgroundColor(Color backgroundColor)

setFile

protected void setFile(File file)

setFolded

public void setFolded(MindMapNode node, boolean folded)

setLink

public void setLink(NodeAdapter node, String link)

setRoot

protected void setRoot(MindMapNode root)

setSaved

protected void setSaved(boolean saved)

splitNode

public void splitNode(MindMapNode node, int caretPosition, String newText)

tryToLock

public String tryToLock(File file)
Attempts to lock the map using semaphore file.

Parameters: file

Returns: If the map is locked, return the name of the locking user, return null otherwise.

Throws: Exception

valueForPathChanged

public void valueForPathChanged(TreePath path, Object newValue)