freemind.modes
Class ControllerAdapter

java.lang.Object
  extended byfreemind.modes.ControllerAdapter
All Implemented Interfaces:
ModeController
Direct Known Subclasses:
BrowseController, FileController, MindMapController, SchemeController

public abstract class ControllerAdapter
extends java.lang.Object
implements ModeController

Derive from this class to implement the Controller for your mode. Overload the methods you need for your data model, or use the defaults. There are some default Actions you may want to use for easy editing of your model. Take MindMapController as a sample.


Nested Class Summary
protected  class ControllerAdapter.CopyAction
           
protected  class ControllerAdapter.CopySingleAction
           
protected  class ControllerAdapter.CutAction
           
protected  class ControllerAdapter.EditAction
           
protected  class ControllerAdapter.EditCopyAction
           
protected  class ControllerAdapter.EditLongAction
           
protected  class ControllerAdapter.FileOpener
           
protected  class ControllerAdapter.FindAction
           
protected  class ControllerAdapter.FindNextAction
           
protected  class ControllerAdapter.FollowLinkAction
           
protected  class ControllerAdapter.NewChildAction
           
protected  class ControllerAdapter.NewChildWithoutFocusAction
           
protected  class ControllerAdapter.NewMapAction
           
protected  class ControllerAdapter.NewPreviousSiblingAction
           
protected  class ControllerAdapter.NewSiblingAction
           
protected  class ControllerAdapter.NodeDownAction
           
protected  class ControllerAdapter.NodeUpAction
           
protected  class ControllerAdapter.OpenAction
           
protected  class ControllerAdapter.PasteAction
           
protected  class ControllerAdapter.RemoveAction
           
protected  class ControllerAdapter.SaveAction
           
protected  class ControllerAdapter.SaveAsAction
           
protected  class ControllerAdapter.SetImageByFileChooserAction
           
protected  class ControllerAdapter.SetLinkByFileChooserAction
           
protected  class ControllerAdapter.SetLinkByTextFieldAction
           
protected  class ControllerAdapter.ToggleChildrenFoldedAction
           
protected  class ControllerAdapter.ToggleFoldedAction
           
 
Field Summary
 javax.swing.Action copy
           
 javax.swing.Action copySingle
           
 javax.swing.Action cut
           
 int NEW_CHILD
           
 int NEW_CHILD_WITHOUT_FOCUS
           
 int NEW_SIBLING_BEFORE
           
 int NEW_SIBLING_BEHIND
           
 javax.swing.Action paste
           
 
Constructor Summary
ControllerAdapter()
           
ControllerAdapter(Mode mode)
           
 
Method Summary
protected  void add(javax.swing.JMenu menu, javax.swing.Action action)
           
protected  void add(javax.swing.JMenu menu, javax.swing.Action action, java.lang.String keystroke)
           
 void addNew(NodeView target, int newNodeMode, java.awt.event.KeyEvent e)
           
 void anotherNodeSelected(MindMapNode n)
           
protected  boolean binOptionIsTrue(java.lang.String option)
           
 boolean close()
          Return false if user has canceled.
 void doubleClick(java.awt.event.MouseEvent e)
           
 void edit(java.awt.event.KeyEvent e, boolean addNew, boolean editLong)
           
 Controller getController()
           
protected  javax.swing.filechooser.FileFilter getFileFilter()
          You may want to implement this...
 FreeMindMain getFrame()
           
protected  java.lang.String getLinkByFileChooser(javax.swing.filechooser.FileFilter fileFilter)
           
 MapAdapter getMap()
           
protected  MapModule getMapModule()
           
protected  Mode getMode()
           
 java.net.URL getResource(java.lang.String name)
           
protected  java.util.LinkedList getSelecteds()
           
protected  java.lang.String getText(java.lang.String textId)
          Get text identification of the map
 MapView getView()
           
 void handleLoadingException(java.lang.Exception ex)
           
 boolean isBlocked()
           
 void load(java.io.File file)
          You may decide to overload this or take the default and implement the functionality in your MapModel (implements MindMap)
 void loadURL()
           
 void loadURL(java.lang.String relative)
           
 void mapOpened(boolean open)
          Call this method if you have opened a map for this mode with true, and if you have closed a map of this mode with false.
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
           
 void newMap()
           
protected  void newMap(MindMap map)
           
 MapAdapter newModel()
          You _must_ implement this if you use one of the following actions: OpenAction, NewMapAction.
protected abstract  MindMapNode newNode()
           
 void nodeChanged(MindMapNode n)
           
 void open()
           
 void plainClick(java.awt.event.MouseEvent e)
           
 boolean save()
           
 boolean save(java.io.File file)
          Return false is the action was cancelled, e.g. when it has to lead to saving as.
 boolean saveAs()
          Save as; return false is the action was cancelled
 void select(java.awt.event.MouseEvent e)
           
protected  void setAllActions(boolean enabled)
          Overwrite this to set all of your actions which are dependent on whether there is a map or not.
protected  void setImageByFileChooser()
           
protected  void setLinkByFileChooser()
           
protected  void setLinkByTextField()
           
protected  void setMode(Mode mode)
           
 void showPopupMenu(java.awt.event.MouseEvent e)
           
protected  void toggleChildrenFolded()
          If any children are folded, unfold all folded children.
 void toggleFolded()
           
protected  void updateMapModuleName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface freemind.modes.ModeController
getPopupMenu
 

Field Detail

copy

public javax.swing.Action copy

copySingle

public javax.swing.Action copySingle

cut

public javax.swing.Action cut

paste

public javax.swing.Action paste

NEW_CHILD_WITHOUT_FOCUS

public final int NEW_CHILD_WITHOUT_FOCUS
See Also:
Constant Field Values

NEW_CHILD

public final int NEW_CHILD
See Also:
Constant Field Values

NEW_SIBLING_BEHIND

public final int NEW_SIBLING_BEHIND
See Also:
Constant Field Values

NEW_SIBLING_BEFORE

public final int NEW_SIBLING_BEFORE
See Also:
Constant Field Values
Constructor Detail

ControllerAdapter

public ControllerAdapter()

ControllerAdapter

public ControllerAdapter(Mode mode)
Method Detail

newNode

protected abstract MindMapNode newNode()

newModel

public MapAdapter newModel()
You _must_ implement this if you use one of the following actions: OpenAction, NewMapAction.


getFileFilter

protected javax.swing.filechooser.FileFilter getFileFilter()
You may want to implement this... It returns the FileFilter that is used by the open() and save() JFileChoosers.


nodeChanged

public void nodeChanged(MindMapNode n)
Specified by:
nodeChanged in interface ModeController

anotherNodeSelected

public void anotherNodeSelected(MindMapNode n)
Specified by:
anotherNodeSelected in interface ModeController

doubleClick

public void doubleClick(java.awt.event.MouseEvent e)
Specified by:
doubleClick in interface ModeController

plainClick

public void plainClick(java.awt.event.MouseEvent e)
Specified by:
plainClick in interface ModeController

getText

protected java.lang.String getText(java.lang.String textId)
Get text identification of the map


binOptionIsTrue

protected boolean binOptionIsTrue(java.lang.String option)

newMap

public void newMap()
Specified by:
newMap in interface ModeController

newMap

protected void newMap(MindMap map)

load

public void load(java.io.File file)
          throws java.io.FileNotFoundException,
                 java.io.IOException,
                 XMLParseException
You may decide to overload this or take the default and implement the functionality in your MapModel (implements MindMap)

Specified by:
load in interface ModeController
Throws:
java.io.FileNotFoundException
java.io.IOException
XMLParseException

save

public boolean save()
Specified by:
save in interface ModeController

getSelecteds

protected java.util.LinkedList getSelecteds()

save

public boolean save(java.io.File file)
Return false is the action was cancelled, e.g. when it has to lead to saving as.

Specified by:
save in interface ModeController

add

protected void add(javax.swing.JMenu menu,
                   javax.swing.Action action,
                   java.lang.String keystroke)

add

protected void add(javax.swing.JMenu menu,
                   javax.swing.Action action)

open

public void open()
Specified by:
open in interface ModeController

handleLoadingException

public void handleLoadingException(java.lang.Exception ex)

saveAs

public boolean saveAs()
Save as; return false is the action was cancelled

Specified by:
saveAs in interface ModeController

close

public boolean close()
Return false if user has canceled.

Specified by:
close in interface ModeController

mapOpened

public void mapOpened(boolean open)
Call this method if you have opened a map for this mode with true, and if you have closed a map of this mode with false. It updates the Actions that are dependent on whether there is a map or not. --> What to do if either newMap or load or close are overwritten by a concrete implementation? uups.


setAllActions

protected void setAllActions(boolean enabled)
Overwrite this to set all of your actions which are dependent on whether there is a map or not.


showPopupMenu

public void showPopupMenu(java.awt.event.MouseEvent e)
Specified by:
showPopupMenu in interface ModeController

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface ModeController

edit

public void edit(java.awt.event.KeyEvent e,
                 boolean addNew,
                 boolean editLong)
Specified by:
edit in interface ModeController

isBlocked

public boolean isBlocked()
Specified by:
isBlocked in interface ModeController

addNew

public void addNew(NodeView target,
                   int newNodeMode,
                   java.awt.event.KeyEvent e)
Specified by:
addNew in interface ModeController

toggleFolded

public void toggleFolded()
Specified by:
toggleFolded in interface ModeController

toggleChildrenFolded

protected void toggleChildrenFolded()
If any children are folded, unfold all folded children. Otherwise, fold all children.


setLinkByTextField

protected void setLinkByTextField()

setLinkByFileChooser

protected void setLinkByFileChooser()

setImageByFileChooser

protected void setImageByFileChooser()

getLinkByFileChooser

protected java.lang.String getLinkByFileChooser(javax.swing.filechooser.FileFilter fileFilter)

loadURL

public void loadURL(java.lang.String relative)

loadURL

public void loadURL()

getMode

protected Mode getMode()

setMode

protected void setMode(Mode mode)

getMapModule

protected MapModule getMapModule()

getMap

public MapAdapter getMap()

getResource

public java.net.URL getResource(java.lang.String name)

getController

public Controller getController()

getFrame

public FreeMindMain getFrame()

getView

public MapView getView()

updateMapModuleName

protected void updateMapModuleName()

select

public void select(java.awt.event.MouseEvent e)
Specified by:
select in interface ModeController