freemind.controller
Class MapModuleManager

java.lang.Object
  extended by freemind.controller.MapModuleManager

public class MapModuleManager
extends java.lang.Object

Manages the list of MapModules. As this task is very complex, I exported it from Controller to this class to keep Controller simple. The information exchange between controller and this class is managed by oberser pattern (the controller observes changes to the map modules here). TODO: Use an vector with the map modules ordered by the screen order.


Nested Class Summary
static interface MapModuleManager.MapModuleChangeObserver
           
static class MapModuleManager.MapModuleChangeObserverCompound
           
static interface MapModuleManager.MapTitleChangeListener
          You can register yourself to this listener at the main controller.
 
Method Summary
 void addListener(MapModuleManager.MapModuleChangeObserver pListener)
           
 boolean changeToMapModule(java.lang.String mapModuleDisplayName)
           
 void changeToMapOfMode(Mode mode)
           
 java.lang.String checkIfFileIsAlreadyOpened(java.net.URL urlToCheck)
          Checks, whether or not a given url is already opened.
 boolean close(boolean force)
          Close the currently active map, return false if closing canceled.
 java.util.List getMapKeys()
           
 MapModule getMapModule()
           
 java.util.Map getMapModules()
          Deprecated. use getMapModuleVector instead (and get the displayname as MapModule.getDisplayName().
 java.util.List getMapModuleVector()
           
 void newMapModule(MindMap map, ModeController modeController)
           
 void removeListener(MapModuleManager.MapModuleChangeObserver pListener)
           
 boolean tryToChangeToMapModule(java.lang.String mapModule)
          This is the question whether the map is already opened.
 void updateMapModuleName()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addListener

public void addListener(MapModuleManager.MapModuleChangeObserver pListener)

removeListener

public void removeListener(MapModuleManager.MapModuleChangeObserver pListener)

getMapModules

public java.util.Map getMapModules()
Deprecated. use getMapModuleVector instead (and get the displayname as MapModule.getDisplayName().

Returns:
a map of String to MapModule elements.

getMapModuleVector

public java.util.List getMapModuleVector()

getMapKeys

public java.util.List getMapKeys()
Returns:
an unmodifiable set of all display names of current opened maps.

getMapModule

public MapModule getMapModule()

newMapModule

public void newMapModule(MindMap map,
                         ModeController modeController)

updateMapModuleName

public void updateMapModuleName()

tryToChangeToMapModule

public boolean tryToChangeToMapModule(java.lang.String mapModule)
This is the question whether the map is already opened. If this is the case, the map is automatically opened + returns true. Otherwise does nothing + returns false.


checkIfFileIsAlreadyOpened

public java.lang.String checkIfFileIsAlreadyOpened(java.net.URL urlToCheck)
                                            throws java.net.MalformedURLException
Checks, whether or not a given url is already opened. Unlike tryToChangeToMapModule, it does not consider the map+extension identifiers nor switches to the module.

Returns:
null, if not found, the map+extension identifier otherwise.
Throws:
java.net.MalformedURLException

changeToMapModule

public boolean changeToMapModule(java.lang.String mapModuleDisplayName)

changeToMapOfMode

public void changeToMapOfMode(Mode mode)

close

public boolean close(boolean force)
Close the currently active map, return false if closing canceled.

Parameters:
force - forces the closing without any save actions.