ucar.unidata.view.geoloc
Class ProjectionManager

java.lang.Object
  extended by ucar.unidata.view.geoloc.ProjectionManager
All Implemented Interfaces:
ActionListener, EventListener

public class ProjectionManager
extends Object
implements ActionListener

Manages a modal dialogue box that allows the user to define projections using subclasses of ucar.unidata.gis.ProjectionImpl.

    1) It uses bean introspection on ProjectionImpl subclasses to dynamically
       configure edit fields for the projection's parameters. The subclass should
       define getXXX() and setXXX() methods for each parameter.
    3) when the user selects a projection, a NewProjectionEvent is sent to any listeners
    4) currently the list of possible projection classes is maintained as a
       hard-wired list of class names. This should be rethunk.
 

Version:
$Revision: 1.57 $
Author:
John Caron

Field Summary
static String PROPERTY_CHANGE
          property change identifier
 
Constructor Summary
ProjectionManager()
          Default constructor
ProjectionManager(RootPaneContainer parent)
          Create a new ProjectionManager
ProjectionManager(RootPaneContainer parent, boolean makeDialog)
          Create a new ProjectionManager.
ProjectionManager(RootPaneContainer parent, List projections)
          Create a new ProjectionManager.
ProjectionManager(RootPaneContainer parent, List projections, boolean makeDialog)
          Create a new ProjectionManager.
ProjectionManager(RootPaneContainer parent, List projections, boolean makeDialog, String helpId)
          Create a new ProjectionManager.
ProjectionManager(RootPaneContainer parent, List projections, boolean makeDialog, String helpId, List maps)
          Create a new ProjectionManager.
ProjectionManager(RootPaneContainer parent, Object dummy)
          Create a new ProjectionManager.
 
Method Summary
 void accept()
          Accept a change.
 void actionPerformed(ActionEvent event)
          Handle action events
static void addDefaultProjection(String projectionClass)
          Add the given class to the list of default projections
 void addPropertyChangeListener(PropertyChangeListener l)
          Add a property change listener.
 void close()
          Close this widget
 boolean contains(String id)
          See if the manager contains the projection by name.
 void destroy()
          Destroy this object
 void doDelete()
          Delete the selected projection.
 void doEdit()
          _more_
 void doExport()
          Export a list of user selected projections
 void doNew()
          _more_
 void edit(boolean isNew)
          Edit a projection.
 Component getContents()
          Get the contents as a component.
static List getDefaultProjections()
          Create the list of default projection classes
 JDialog getDialog()
          Get this as a dialog.
 String getManagerName()
          Get the name of this manager to put in a menu
 Class getPersistentObjectClass()
          Get the Class type of the objects managed; must implement Serializable, Cloneable
 List getProjections()
          Get the list of projections that this manager manages
 PersistentObject getSelection()
          Get the currently selected object, of type getPersistentObjectClass()
static void main(String[] args)
          Test the class
static List makeDefaultProjections()
          Make the default projections from the internal list of classes.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a property change listener.
 void saveProjection(ucar.unidata.geoloc.ProjectionImpl proj)
          Store this Projection in the data table
 void setMaps(List maps)
          Set the list of maps to use in this ProjectionManager
 void setProjections(List list)
          Set the list of projections for this manager
 void setSelection(PersistentObject select)
          Set the currently selected thing: must be of type getPersistentObjectClass().
 void show()
          Popup the Manager Dialog
 void storePersistentData()
          Dummy method for stores
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CHANGE

public static final String PROPERTY_CHANGE
property change identifier

See Also:
Constant Field Values
Constructor Detail

ProjectionManager

public ProjectionManager()
Default constructor


ProjectionManager

public ProjectionManager(RootPaneContainer parent,
                         Object dummy)
Create a new ProjectionManager.

Parameters:
parent - parent container
dummy - dummy argument for clients that try to pass in a store

ProjectionManager

public ProjectionManager(RootPaneContainer parent)
Create a new ProjectionManager

Parameters:
parent - parent container

ProjectionManager

public ProjectionManager(RootPaneContainer parent,
                         boolean makeDialog)
Create a new ProjectionManager.

Parameters:
parent - parent container
makeDialog - true to make this a dialog

ProjectionManager

public ProjectionManager(RootPaneContainer parent,
                         List projections)
Create a new ProjectionManager.

Parameters:
parent - JFrame (application) or JApplet (applet)
projections - list of initial projections

ProjectionManager

public ProjectionManager(RootPaneContainer parent,
                         List projections,
                         boolean makeDialog)
Create a new ProjectionManager.

Parameters:
parent - JFrame (application) or JApplet (applet)
projections - list of initial projections
makeDialog - true to make this a dialog

ProjectionManager

public ProjectionManager(RootPaneContainer parent,
                         List projections,
                         boolean makeDialog,
                         String helpId)
Create a new ProjectionManager.

Parameters:
parent - JFrame (application) or JApplet (applet)
projections - list of initial projections
makeDialog - true to make this a dialog
helpId - help id if dialog

ProjectionManager

public ProjectionManager(RootPaneContainer parent,
                         List projections,
                         boolean makeDialog,
                         String helpId,
                         List maps)
Create a new ProjectionManager.

Parameters:
parent - JFrame (application) or JApplet (applet)
projections - list of initial projections
makeDialog - true to make this a dialog
helpId - help id if dialog
maps - List of MapData
Method Detail

addDefaultProjection

public static void addDefaultProjection(String projectionClass)
Add the given class to the list of default projections

Parameters:
projectionClass - The class

getDefaultProjections

public static List getDefaultProjections()
Create the list of default projection classes

Returns:
list of default projection classes

storePersistentData

public void storePersistentData()
Dummy method for stores


actionPerformed

public void actionPerformed(ActionEvent event)
Handle action events

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - event to handle

close

public void close()
Close this widget


doExport

public void doExport()
Export a list of user selected projections


makeDefaultProjections

public static List makeDefaultProjections()
Make the default projections from the internal list of classes.

Returns:
list of default projections

setMaps

public void setMaps(List maps)
Set the list of maps to use in this ProjectionManager

Parameters:
maps - list of MapData's (may be null)

setProjections

public void setProjections(List list)
Set the list of projections for this manager

Parameters:
list - list of projections

getProjections

public List getProjections()
Get the list of projections that this manager manages

Returns:
list of projections

getManagerName

public String getManagerName()
Get the name of this manager to put in a menu

Returns:
manager name

getPersistentObjectClass

public Class getPersistentObjectClass()
Get the Class type of the objects managed; must implement Serializable, Cloneable

Returns:
the type of class that this manager manages

getContents

public Component getContents()
Get the contents as a component.

Returns:
the contents

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener.

Parameters:
l - listener to add

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Remove a property change listener.

Parameters:
l - listener to remove

getDialog

public JDialog getDialog()
Get this as a dialog.

Returns:
the dialog or null if not made as a dialog

show

public void show()
Popup the Manager Dialog


destroy

public void destroy()
Destroy this object


getSelection

public PersistentObject getSelection()
Get the currently selected object, of type getPersistentObjectClass()

Returns:
currently selected object

setSelection

public void setSelection(PersistentObject select)
Set the currently selected thing: must be of type getPersistentObjectClass(). This does NOT fire a PropertyChangeEvent

Parameters:
select - the object to select.

accept

public void accept()
Accept a change.


contains

public boolean contains(String id)
See if the manager contains the projection by name.

Parameters:
id - name of projection
Returns:
true if the projection is managed by this

doDelete

public void doDelete()
Delete the selected projection.


doEdit

public void doEdit()
_more_


doNew

public void doNew()
_more_


edit

public void edit(boolean isNew)
Edit a projection. Used to change an existing projection or add a new one.

Parameters:
isNew - true if this is a new projection.

saveProjection

public void saveProjection(ucar.unidata.geoloc.ProjectionImpl proj)
Store this Projection in the data table

Parameters:
proj - the Projection to store

main

public static void main(String[] args)
Test the class

Parameters:
args - not used