ucar.unidata.ui
Class PersistentDataDialog

java.lang.Object
  extended by ucar.unidata.ui.PersistentDataDialog
All Implemented Interfaces:
ActionListener, EventListener

public class PersistentDataDialog
extends Object
implements ActionListener

Provides common L&F for managing persistent data. Calling routine must implement PersistentDataManager interface that provides the services required.

Version:
$Id: PersistentDataDialog.java,v 1.20 2007/07/06 20:45:32 jeffmc Exp $
Author:
John Caron
See Also:
PersistentDataManager

Constructor Summary
PersistentDataDialog(RootPaneContainer parent, boolean modal, String name, JComponent view, JComponent list, PersistentDataManager manager)
          Constructor.
PersistentDataDialog(RootPaneContainer parent, boolean modal, String name, JComponent view, JComponent list, PersistentDataManager manager, String helpId)
          Constructor.
PersistentDataDialog(String name, JComponent view, JComponent list, PersistentDataManager manager)
          Create a new PersistentDataDialog
 
Method Summary
 void actionPerformed(ActionEvent event)
          Handle action events
 boolean checkSaveOK(String startingId, String id)
          Utility to provide validation of objects the user wants to save
 void close()
          Close this widget
 void destroy()
          Called to cleanup.
 Component getContents()
          Get the GUI contents
 JDialog getDialog()
          Get the JDialog for this
protected  void init(String name, JComponent view, JComponent list, PersistentDataManager manager, boolean doWindow)
          Initialize the class
protected  void init(String name, JComponent view, JComponent list, PersistentDataManager manager, boolean doWindow, String helpId)
          Initialize the class
 void setCurrent(String name)
          Set the name
 void setEnabled(boolean enabled)
          Set this widget enabled
 void setHelpId(String newId)
          Set the help id for this window.
 void show()
          Show the dialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentDataDialog

public PersistentDataDialog(String name,
                            JComponent view,
                            JComponent list,
                            PersistentDataManager manager)
Create a new PersistentDataDialog

Parameters:
name - name of managed components (eg "Projections").
view - shows a view of the selected object
list - manages the list of objects
manager - abstraction of the services required

PersistentDataDialog

public PersistentDataDialog(RootPaneContainer parent,
                            boolean modal,
                            String name,
                            JComponent view,
                            JComponent list,
                            PersistentDataManager manager)
Constructor.

Parameters:
parent - JFrame (application) or JApplet (applet)
modal - true for a modal dialog
name - name of managed components (eg "Projections").
view - shows a view of the selected object
list - manages the list of objects
manager - abstraction of the services required

PersistentDataDialog

public PersistentDataDialog(RootPaneContainer parent,
                            boolean modal,
                            String name,
                            JComponent view,
                            JComponent list,
                            PersistentDataManager manager,
                            String helpId)
Constructor.

Parameters:
parent - JFrame (application) or JApplet (applet)
modal - true for a modal dialog
name - name of managed components (eg "Projections").
view - shows a view of the selected object
list - manages the list of objects
manager - abstraction of the services required
helpId - id for help page when help button is clicked
Method Detail

getContents

public Component getContents()
Get the GUI contents

Returns:
the GUI contents

init

protected void init(String name,
                    JComponent view,
                    JComponent list,
                    PersistentDataManager manager,
                    boolean doWindow)
Initialize the class

Parameters:
name - name of managed components (eg "Projections").
view - shows a view of the selected object
list - manages the list of objects
manager - abstraction of the services required
doWindow - true to show in a separate window

init

protected void init(String name,
                    JComponent view,
                    JComponent list,
                    PersistentDataManager manager,
                    boolean doWindow,
                    String helpId)
Initialize the class

Parameters:
name - name of managed components (eg "Projections").
view - shows a view of the selected object
list - manages the list of objects
manager - abstraction of the services required
doWindow - true to show in a separate window
helpId - id for help page

destroy

public void destroy()
Called to cleanup.


show

public void show()
Show the dialog


getDialog

public JDialog getDialog()
Get the JDialog for this

Returns:
the dialog

close

public void close()
Close this widget


actionPerformed

public void actionPerformed(ActionEvent event)
Handle action events

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

setHelpId

public void setHelpId(String newId)
Set the help id for this window. If not called, the name supplied at construction is used.

Parameters:
newId - new help ID

setEnabled

public void setEnabled(boolean enabled)
Set this widget enabled

Parameters:
enabled - true to enable

setCurrent

public void setCurrent(String name)
Set the name

Parameters:
name - new name

checkSaveOK

public boolean checkSaveOK(String startingId,
                           String id)
Utility to provide validation of objects the user wants to save

Parameters:
startingId - the starting name of the edited object
id - the current name of the edited object
Returns:
true if okay to save