edu.ucsb.nceas.morpho.framework
Class UIController

java.lang.Object
  |
  +--edu.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 addWindow(java.lang.String windowName)
          This method is called by plugins to get a new window that is an instance of MorphoFrame.
 MorphoFrame getCurrentActiveWindow()
          get 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.
 void refreshWindows()
          refresh all visible the windows that are in the windowList.
 void removeAllWindows()
          Method to remove all windows in window list
 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 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

SEPARATOR_FOLLOWING

public static final java.lang.String SEPARATOR_FOLLOWING

PULL_RIGHT_MENU

public static final java.lang.String PULL_RIGHT_MENU

YES

public static final java.lang.String YES

MENU_PATH

public static final java.lang.String MENU_PATH
Method Detail

initialize

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

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

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

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

getMorpho

public static Morpho getMorpho()
get Morpho


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