edu.ucsb.nceas.morpho.framework
Class UIController

java.lang.Object
  extended byedu.ucsb.nceas.morpho.framework.UIController

public class UIController
extends java.lang.Object

The UIController handles the state of the morpho menu and toolbars so that they are synchronized across the various plugins. This is a singleton class because only one instance is ever needed. Plugins that need a new frame for a window should call UIController.newWindow(). The single instance of UIController can be obtained statically using getInstance().

Author:
jones

Field Summary
static java.lang.String MENU_PATH
           
static java.lang.String PULL_RIGHT_MENU
           
static java.lang.String SEPARATOR_FOLLOWING
           
static java.lang.String SEPARATOR_PRECEDING
           
static java.lang.String YES
           
 
Method Summary
 void addGuiAction(GUIAction action)
          Add a menu item and optionally a toolbar button by registering an instance of GUIAction.
 MorphoFrame addHiddenWindow(java.lang.String windowName)
           
 MorphoFrame addWindow(java.lang.String windowName)
          This method is called by plugins to get a new window that is an instance of MorphoFrame.
 AbstractDataPackage getCurrentAbstractDataPackage()
          get AbstractDataPackage from currently active window
 MorphoFrame getCurrentActiveWindow()
          get currently active window
 AbstractDataPackage getCurrentExistingAbstractDataPackage()
          get AbstractDataPackage from currently active window.
static GUIAction getGUIActionCloneUsedByMorphoFrame(GUIAction action, MorphoFrame frame)
          This method can be used if you have the original GUIAction instance and want to get the existing clone of it that was put into a particular MorphoFrame by UIController.
static UIController getInstance()
          Get the single instance of the UIController, creating it if needed.
static Morpho getMorpho()
          get Morpho
static MorphoFrame getMorphoFrameContainingGUIAction(GUIAction clone)
          return the MorphoFrame that contains the GUIAction clone provided
static UIController initialize(Morpho morpho)
          Initialize the single instance of the UIController, creating it if needed.
 boolean isWizardRunning()
          called by DataPackageWizardPlugin whenever wizard starts running, and is passed a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running
 void launchEditorAtSubtreeForCurrentFrame(java.lang.String subtreeRootNodeName, int subtreeRootIndex)
          launches the XML tree editor, rooted at the subtree node denoted by the passed string and index, to edit the datapackage associated with the current MorphoFrame
 void refreshWindows()
          refresh all visible the windows that are in the windowList.
 void removeAllWindows()
          Method to remove all windows in window list
 java.util.Vector removeCleanWindows()
           
 void removeGuiAction(GUIAction action)
          Remove a menu item and its toolbar button for a particular instance of GUIAction.
 void removeWindow(MorphoFrame window)
          This method is called to de-register a Window that the plugin has created.
 void setCurrentActiveWindow(MorphoFrame window)
          set currently active window
 void setWizardIsRunning(AbstractDataPackage tempDataPackage)
          called by DataPackageWizardPlugin whenever wizard starts running, and is passed a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running.
 void setWizardNotRunning()
          called by DataPackageWizardPlugin whenever wizard starts running, and is passed a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running.
static void showNewPackage(AbstractDataPackage adp)
          method to display the new package after changes have been made
static void showNewPackageNoLocChange(AbstractDataPackage adp)
          method to display the new package after changes have been made with no change in location
 void updateAllStatusBars()
          updates status bar in response to changes in connection parameters
 void updateWindow(MorphoFrame window, java.lang.String title)
          This method is called by plugins to update window that is an instance of MorphoFrame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR_PRECEDING

public static final java.lang.String SEPARATOR_PRECEDING
See Also:
Constant Field Values

SEPARATOR_FOLLOWING

public static final java.lang.String SEPARATOR_FOLLOWING
See Also:
Constant Field Values

PULL_RIGHT_MENU

public static final java.lang.String PULL_RIGHT_MENU
See Also:
Constant Field Values

YES

public static final java.lang.String YES
See Also:
Constant Field Values

MENU_PATH

public static final java.lang.String MENU_PATH
See Also:
Constant Field Values
Method Detail

initialize

public static UIController initialize(Morpho morpho)
Initialize the single instance of the UIController, creating it if needed.

Parameters:
morpho - Morpho
Returns:
UIController

getInstance

public static UIController getInstance()
Get the single instance of the UIController, creating it if needed. If the controller has not yet been created yet (using the method "initialize(Morpho)", then this method returns null.


addWindow

public MorphoFrame addWindow(java.lang.String windowName)
This method is called by plugins to get a new window that is an instance of MorphoFrame. They can set the content of the window to a panel of their choice using MorphoFrame.setMainContentPane().

Parameters:
windowName - the initial title for the window
Returns:
MorphoFrame

addHiddenWindow

public MorphoFrame addHiddenWindow(java.lang.String windowName)

updateWindow

public void updateWindow(MorphoFrame window,
                         java.lang.String title)
This method is called by plugins to update window that is an instance of MorphoFrame.

Parameters:
window - the window will be given new name
title - the new name will give to window

removeWindow

public void removeWindow(MorphoFrame window)
This method is called to de-register a Window that the plugin has created. The window is removed from the "Windows" menu.

Parameters:
window - the window to be removed from the framework

removeAllWindows

public void removeAllWindows()
Method to remove all windows in window list


removeCleanWindows

public java.util.Vector removeCleanWindows()

addGuiAction

public void addGuiAction(GUIAction action)
Add a menu item and optionally a toolbar button by registering an instance of GUIAction. The GUIAction will be cloned once for each of the MorphoFrame instances that currently exist or that are created.

Parameters:
action - the GUIAction instance describing the menu item

removeGuiAction

public void removeGuiAction(GUIAction action)
Remove a menu item and its toolbar button for a particular instance of GUIAction.

Parameters:
action - the GUIAction instance to be removed

getMorphoFrameContainingGUIAction

public static MorphoFrame getMorphoFrameContainingGUIAction(GUIAction clone)
return the MorphoFrame that contains the GUIAction clone provided

Parameters:
clone - the GUIAction clone for which the parent MorphoFrame will be returned
Returns:
the MorphoFrame which is the parent of this GUIAction

getGUIActionCloneUsedByMorphoFrame

public static GUIAction getGUIActionCloneUsedByMorphoFrame(GUIAction action,
                                                           MorphoFrame frame)
This method can be used if you have the original GUIAction instance and want to get the existing clone of it that was put into a particular MorphoFrame by UIController. .

Parameters:
action - the GUIAction whose clone is sought
frame - the MorphoFrame in which the clone is nested
Returns:
the GUIAction object that is a clone of the passed GUIAction, and that is nested inside the passed MorphoFrame

refreshWindows

public void refreshWindows()
refresh all visible the windows that are in the windowList.


updateAllStatusBars

public void updateAllStatusBars()
updates status bar in response to changes in connection parameters


setCurrentActiveWindow

public void setCurrentActiveWindow(MorphoFrame window)
set currently active window

Parameters:
window - the currently active MorphoFrame window

getCurrentActiveWindow

public MorphoFrame getCurrentActiveWindow()
get currently active window

Returns:
the currently active MorphoFrame window

getCurrentAbstractDataPackage

public AbstractDataPackage getCurrentAbstractDataPackage()
get AbstractDataPackage from currently active window

Returns:
the AbstractDataPackage from the currently active MorphoFrame window; returns null if current window is null, or if current window does not contain an AbstractDataPackage

getCurrentExistingAbstractDataPackage

public AbstractDataPackage getCurrentExistingAbstractDataPackage()
get AbstractDataPackage from currently active window. Even if a wizard is running currently, it returns the ADP of the currently open package for which the wizard is running

Returns:
the AbstractDataPackage from the currently active MorphoFrame window; returns null if current window is null, or if current window does not contain an AbstractDataPackage

setWizardIsRunning

public void setWizardIsRunning(AbstractDataPackage tempDataPackage)
called by DataPackageWizardPlugin whenever wizard starts running, and is passed a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running. NOTE that this datapackage will be discarded when the wizard is done, because it may not be complete. It is not used to create the new datapackage!! When the wizard ends, it should call

Parameters:
tempDataPackage - AbstractDataPackage - a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running. NOTE that this datapackage will be discarded when the wizard is done, because it may not be complete. It is not used to create the new datapackage!!

setWizardNotRunning

public void setWizardNotRunning()
called by DataPackageWizardPlugin whenever wizard starts running, and is passed a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running. NOTE that this datapackage will be discarded when the wizard is done, because it may not be complete. It is not used to create the new datapackage!! When the wizard ends, it should call


isWizardRunning

public boolean isWizardRunning()
called by DataPackageWizardPlugin whenever wizard starts running, and is passed a temporary AbstractDataPackage that is used to store wizard data (for references use) - this ADP will be returned by any calls to getCurrentAbstractDataPackage() while the wizard is running

Returns:
the AbstractDataPackage from the currently active MorphoFrame window; returns null if current window is null, or if current window does not contain an AbstractDataPackage

getMorpho

public static Morpho getMorpho()
get Morpho

Returns:
Morpho

launchEditorAtSubtreeForCurrentFrame

public void launchEditorAtSubtreeForCurrentFrame(java.lang.String subtreeRootNodeName,
                                                 int subtreeRootIndex)
launches the XML tree editor, rooted at the subtree node denoted by the passed string and index, to edit the datapackage associated with the current MorphoFrame

Parameters:
subtreeRootNodeName - String
subtreeRootIndex - int (zero-relative)

showNewPackageNoLocChange

public static void showNewPackageNoLocChange(AbstractDataPackage adp)
method to display the new package after changes have been made with no change in location

Parameters:
adp - AbstractDataPackage

showNewPackage

public static void showNewPackage(AbstractDataPackage adp)
method to display the new package after changes have been made

Parameters:
adp - AbstractDataPackage


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.