edu.ucsb.nceas.morpho.framework
Class ClientFramework

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--edu.ucsb.nceas.morpho.framework.ClientFramework
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class ClientFramework
extends javax.swing.JFrame

The ClientFramework is the main entry point for the Morpho application. It creates the main application frame and sets up the menus and toolbars for the application. The framework also provides a mechanism for "plugins" to add menus, toolbars, and services to the application. These plugins are dynamically loaded at runtime. Plugins are classes that implement the "PluginInterface" interface.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static java.lang.String SEPARATOR_FOLLOWING
           
static java.lang.String SEPARATOR_PRECEDING
          Constant to indicate a spearator should precede an action
static java.lang.String VERSION
          The version of this release of Morpho
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ClientFramework(ConfigXML config)
          Creates a new instance of ClientFramework
ClientFramework(java.lang.String sTitle, ConfigXML config)
          Creates a new instance of ClientFramework with the given title.
 
Method Summary
 void addConnectionListener(ConnectionListener listener)
          This method is called by plugins to register a listener for changes in the Connection status.
 void addMenu(java.lang.String menuName, java.lang.Integer menuPosition)
          This method is called by plugins to register a menu that the plugin wants created, but that currently has no items.
 void addMenu(java.lang.String menuName, java.lang.Integer menuPosition, javax.swing.Action[] menuActions)
          This method is called by plugins to register a menu and its associated Actions.
 void addNotify()
          Notifies this component that it has been added to a container This method should be called by Container.add, and not by user code directly.
 void addService(java.lang.Class serviceInterface, ServiceProvider provider)
          This method is called by plugins to register a particular service that the plugin can perform.
 void addToolbarActions(javax.swing.Action[] toolbarActions)
          This method is called by plugins to register a toolbar Action.
 void addWindow(javax.swing.JFrame window)
          This method is called by plugins to register a Window that the plugin has created.
 boolean checkForService(java.lang.Class serviceInterface)
          This method is called by plugins to determine if a particular service has been registered and is available.
 void checkJavaVersion()
           
static void debug(int severity, java.lang.String message)
          Print debugging messages based on severity level, where severity level 1 are the most critical and higher numbers are more trivial messages.
 ConfigXML getConfiguration()
          Get the configuration object associated with the framework.
 boolean getJavaVersionFlag()
          returns true if the JVM version is 1.3 or greater
 java.io.InputStream getMetacatInputStream(java.util.Properties prop)
          Send a request to Metacat
 java.io.InputStream getMetacatInputStream(java.util.Properties prop, boolean requiresLogin)
          Send a request to Metacat
 java.lang.String getMetacatString(java.util.Properties prop)
          Send a request to Metacat
 java.lang.String getMetacatString(java.util.Properties prop, boolean requiresLogin)
          Send a request to Metacat
 java.lang.String getPassword()
          get password associated with this framework
 ConfigXML getProfile()
          Get the profile for the currently logged in user.
 ServiceProvider getServiceProvider(java.lang.Class serviceInterface)
          This method is called by plugins to get a reference to an object that implements a particular interface
 java.lang.String getSessionCookie()
           
 java.util.Vector getTaxonSynonyms(java.lang.String taxonName)
          Look up the synonyms of a taxon from ITIS, and return the list of names
 java.lang.String getUserName()
          Get the username associated with this framework
 boolean isConnected()
          Determines if the framework has a valid login
 boolean logIn()
          Log into metacat
 void logOut()
          Log out of metacat
static void main(java.lang.String[] args)
          The entry point for this application.
 void removeMenuItem(java.lang.String menuName, int index)
          This method is called by plugins to remove a menu item from a menu based on the index of the menu item.
 void removeWindow(javax.swing.JFrame window)
          This method is called by plugins to de-register a Window that the plugin has created.
 java.io.InputStream sendDataFile(java.lang.String id, java.io.File file)
          sends a data file to the metacat using "multipart/form-data" encoding
 void setMainContentPane(java.awt.Component comp)
          Set the content pane of the main Morpho window to display the component indicated.
 void setPassword(java.lang.String pword)
          Set the password associated with this framework
 void setProfile(ConfigXML newProfile)
          Set the profile for the currently logged in user (on startup, or when switching profiles).
 void setProfile(java.lang.String newProfileName)
          Set the profile associated with this framework based on its name
 void setUserName(java.lang.String uname)
          Set the username associated with this framework
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

VERSION

public static java.lang.String VERSION
The version of this release of Morpho

SEPARATOR_PRECEDING

public static java.lang.String SEPARATOR_PRECEDING
Constant to indicate a spearator should precede an action

SEPARATOR_FOLLOWING

public static java.lang.String SEPARATOR_FOLLOWING
Constructor Detail

ClientFramework

public ClientFramework(java.lang.String sTitle,
                       ConfigXML config)
Creates a new instance of ClientFramework with the given title.
Parameters:
sTitle - the title for the new frame.
See Also:
#JFrame1()

ClientFramework

public ClientFramework(ConfigXML config)
Creates a new instance of ClientFramework
See Also:
#JFrame1()
Method Detail

setMainContentPane

public void setMainContentPane(java.awt.Component comp)
Set the content pane of the main Morpho window to display the component indicated. Note that this will replace the current content pane, and so only one plugin should call this routine.
Parameters:
comp - the component to display

addMenu

public void addMenu(java.lang.String menuName,
                    java.lang.Integer menuPosition)
This method is called by plugins to register a menu that the plugin wants created, but that currently has no items.
Parameters:
menuName - the name of the menu to be added to the framework
menuPosition - the position of the menu to be added to the framework

addMenu

public void addMenu(java.lang.String menuName,
                    java.lang.Integer menuPosition,
                    javax.swing.Action[] menuActions)
This method is called by plugins to register a menu and its associated Actions. If the menu already exists, the actions are added to it.
Parameters:
menuName - the name of the menu to which to add the action
menuPosition - the position of the menu on the menu bar
menuActions - an array of Actions to be added to the menu

removeMenuItem

public void removeMenuItem(java.lang.String menuName,
                           int index)
This method is called by plugins to remove a menu item from a menu based on the index of the menu item.
Parameters:
menuName - the name of the menu from which to remove the item
index - the position of the menu item to remove

addToolbarActions

public void addToolbarActions(javax.swing.Action[] toolbarActions)
This method is called by plugins to register a toolbar Action.
Parameters:
toolbarActions - an array of Actions to be added to the toolbar

addWindow

public void addWindow(javax.swing.JFrame window)
This method is called by plugins to register a Window that the plugin has created. The window is listed in the "Windows" menu by name.
Parameters:
window - the window to be added to the framework

removeWindow

public void removeWindow(javax.swing.JFrame window)
This method is called by plugins 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

addService

public void addService(java.lang.Class serviceInterface,
                       ServiceProvider provider)
                throws ServiceExistsException
This method is called by plugins to register a particular service that the plugin can perform. The service is identified by the class of an interface that the service implements.
Parameters:
serviceInterface - the interface representing this service
provider - a reference to the object providing the service
Throws:
ServiceExistsException -  

checkForService

public boolean checkForService(java.lang.Class serviceInterface)
This method is called by plugins to determine if a particular service has been registered and is available.
Parameters:
serviceInterface - the service interface desired

getServiceProvider

public ServiceProvider getServiceProvider(java.lang.Class serviceInterface)
                                   throws ServiceNotHandledException
This method is called by plugins to get a reference to an object that implements a particular interface
Parameters:
serviceInterface - the service interface desired

addNotify

public void addNotify()
Notifies this component that it has been added to a container This method should be called by Container.add, and not by user code directly. Overridden here to adjust the size of the frame if needed.
Overrides:
addNotify in class java.awt.Frame
See Also:
Container.removeNotify()

getMetacatInputStream

public java.io.InputStream getMetacatInputStream(java.util.Properties prop,
                                                 boolean requiresLogin)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
requiresLogin - indicates whether a valid connection is required for the operation
Returns:
InputStream as returned by Metacat

sendDataFile

public java.io.InputStream sendDataFile(java.lang.String id,
                                        java.io.File file)
sends a data file to the metacat using "multipart/form-data" encoding
Parameters:
id - the id to assign to the file on metacat (e.g., knb.1.1)
file - the file to send
Returns:
the response stream from metacat

getSessionCookie

public java.lang.String getSessionCookie()

getMetacatInputStream

public java.io.InputStream getMetacatInputStream(java.util.Properties prop)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
Returns:
InputStream as returned by Metacat

getMetacatString

public java.lang.String getMetacatString(java.util.Properties prop,
                                         boolean requiresLogin)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
requiresLogin - indicates whether a valid connection is required for the operation
Returns:
a string as returned by Metacat

getMetacatString

public java.lang.String getMetacatString(java.util.Properties prop)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
Returns:
a string as returned by Metacat

logIn

public boolean logIn()
Log into metacat

logOut

public void logOut()
Log out of metacat

setUserName

public void setUserName(java.lang.String uname)
Set the username associated with this framework
Parameters:
the - new username for the framework

getUserName

public java.lang.String getUserName()
Get the username associated with this framework

setPassword

public void setPassword(java.lang.String pword)
Set the password associated with this framework
Parameters:
the - new password for the framework

getPassword

public java.lang.String getPassword()
get password associated with this framework

isConnected

public boolean isConnected()
Determines if the framework has a valid login

addConnectionListener

public void addConnectionListener(ConnectionListener listener)
This method is called by plugins to register a listener for changes in the Connection status. Any change in the username, password, or other connect change will trigger notification.
Parameters:
listener - a reference to the object to be notified of changes
Throws:
ServiceExistsException -  

getConfiguration

public ConfigXML getConfiguration()
Get the configuration object associated with the framework. Plugins use this object to get and set persistent configuration parameters.

getProfile

public ConfigXML getProfile()
Get the profile for the currently logged in user.

setProfile

public void setProfile(ConfigXML newProfile)
Set the profile for the currently logged in user (on startup, or when switching profiles).
Parameters:
newProfile - the profile object

setProfile

public void setProfile(java.lang.String newProfileName)
Set the profile associated with this framework based on its name
Parameters:
newProfileName - the name of the new profile for the framework

getTaxonSynonyms

public java.util.Vector getTaxonSynonyms(java.lang.String taxonName)
Look up the synonyms of a taxon from ITIS, and return the list of names
Parameters:
taxonName -  
Returns:
vector of the names of synonym taxa

debug

public static void debug(int severity,
                         java.lang.String message)
Print debugging messages based on severity level, where severity level 1 are the most critical and higher numbers are more trivial messages. Messages with severity 1 to 4 will result in an error dialog box for the user to inspect. Those with severity 5-9 result in a warning dialog box for the user to inspect. Those with severity greater than 9 are printed only to standard error. Setting the debug_level to 0 in the configuration file turns all messages off.
Parameters:
severity - the severity of the debug message
message - the message to log

main

public static void main(java.lang.String[] args)
The entry point for this application. Sets the Look and Feel to the System Look and Feel. Creates a new JFrame1 and makes it visible.

checkJavaVersion

public void checkJavaVersion()

getJavaVersionFlag

public boolean getJavaVersionFlag()
returns true if the JVM version is 1.3 or greater


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