ucar.unidata.idv.chooser
Class IdvChooserManager

java.lang.Object
  extended by ucar.unidata.ui.WindowHolder
      extended by ucar.unidata.idv.IdvManager
          extended by ucar.unidata.idv.chooser.IdvChooserManager
All Implemented Interfaces:
ActionListener, EventListener, IdvConstants

public class IdvChooserManager
extends IdvManager

This creates and manages the set of choosers. It makes the chooser GUI from an xml specification e.g.: /ucar/unidata/idv/resources/choosers.xml It uses the XmlUi to process the xml.

This class also processes the end-user created choosers. This piece has always been a bit flaky

Version:
$Revision: 1.98 $Date: 2007/07/30 19:38:22 $
Author:
IDV development team

Field Summary
static String ATTR_CHOOSERID
          Xml attribute to identify different choosers
static String ATTR_CLASS
          Class attribute in choosers.xml
static String ATTR_DATASOURCE
          Data source tag
static String ATTR_DOPOLLING
          Xml dopolling attribute name.
static String ATTR_HELPPATH
          Xml attribute for the help path
static String ATTR_LABEL
          Xml label attribute name.
static String ATTR_MENUTITLE
          Xml menu title attribute name.
static String ATTR_PATH
          Xml path attribute name.
static String ATTR_PATTERN
          Xml pattern attribute name.
static String ATTR_POLLINTERVAL
          Xml pollinterval attribute name.
static String ATTR_SHOWINMENU
          Xml attribute to see if this chooser should go in the data menu
static String ATTR_TITLE
          Xml title attribute name.
static String PROP_CHOOSER_TREEVIEW
           
static String PROP_CHOOSER_TREEVIEW_USESPLITPANE
           
static String PROP_CHOOSER_TREEVIEW_WIDTH
           
static String TAG_DIRECTORY
          Xml tag name for directory tags.
static String TAG_LABEL
          Xml tag name for the label tags.
static String TAG_TAB
          Xml tag name for the tab tags.
 
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
 
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_TIMEZONE, FILE_VMSTATE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_HISTORY, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV
 
Constructor Summary
IdvChooserManager(IntegratedDataViewer idv)
          Create a new IdvChooserManager.
 
Method Summary
 void activateAddeServerGroup(AddeServer server, AddeServer.Group group)
          Make the group active
 AddeServer addAddeServer(String name)
          Create a new AddeServer or find an existing one with the given name.
 AddeServer.Group addAddeServerGroup(AddeServer server, String groupName, String type)
          Add the given AddeServer.Group into the list of servers.
 JMenu addUserChooserToMenu(JMenu menu, JMenu pullRight)
          Inserts menu items into the given menu for creating the data sources that are defined by the user chooser
 void closeDataChooser()
          Close me
 Component createChooser(Node chooserNode)
          Overwrite the component factory method in XmlUi to handler chooser xml nodes.
 JComponent createChoosers(boolean inTabs)
          Create the Choosers component from the choosers.xml resources
 JComponent createChoosers(boolean inTabs, List theseChoosers, Element choosersNode)
          Create the Choosers component from the choosers.xml resources
 List getAddeServers(String groupType)
          Get AddeServers to use
 List getAddeServers(String groupType, boolean onlyActive)
          Get AddeServers to use
 JComponent getChooserContents()
          Deprecated. no longer in use
static String getChooserId(Element node)
          This tries to find some identifier for the chooser defied by the given xml node.
 List getChooserIds()
          Return a list of the (String) chooser ids that have been processed by this manager.
 String getChooserName(String chooserId)
          Get the name of the given chooser
 List getChoosers()
          Get the list of current choosers.
protected  String getWindowTitle()
          Window title
 void init()
          Initialize the set of choosers.
 List makeChooserMenus(List items)
          Make the chooser menu items
 void makeDataSourceFromXml(Element theNode)
          Create the data source from the given user chooser xml
protected  void popupXmlChooserDialog(Element tabNode, Element dirNode)
          Show the dialog for editing the user chooser entry
 void processChooserXml()
          Process the user chooser resources
 void processChooserXml(boolean writable, Element root)
          Process the user chooser xml root
 void removeAddeServer(AddeServer server, boolean markAsInactive)
          Remove the given adde server.
 void removeAddeServerGroup(AddeServer server, AddeServer.Group group, boolean markAsInactive)
          Remove the group held by the server.
protected  boolean shouldMakeDialog()
          Should we make a dialog
 void writeAddeServers()
          Write out the addeservers.xml file
protected  void writeChooserXml()
          Write out the user chooser xml document
 
Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone
 
Methods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, isShowing, removeAll, setWindowTitle, show, show, showModal, toFront, windowIsClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROP_CHOOSER_TREEVIEW

public static final String PROP_CHOOSER_TREEVIEW
See Also:
Constant Field Values

PROP_CHOOSER_TREEVIEW_WIDTH

public static final String PROP_CHOOSER_TREEVIEW_WIDTH
See Also:
Constant Field Values

PROP_CHOOSER_TREEVIEW_USESPLITPANE

public static final String PROP_CHOOSER_TREEVIEW_USESPLITPANE
See Also:
Constant Field Values

ATTR_CLASS

public static final String ATTR_CLASS
Class attribute in choosers.xml

See Also:
Constant Field Values

ATTR_LABEL

public static final String ATTR_LABEL
Xml label attribute name. For user chooser

See Also:
Constant Field Values

ATTR_HELPPATH

public static final String ATTR_HELPPATH
Xml attribute for the help path

See Also:
Constant Field Values

ATTR_CHOOSERID

public static final String ATTR_CHOOSERID
Xml attribute to identify different choosers

See Also:
Constant Field Values

TAG_DIRECTORY

public static final String TAG_DIRECTORY
Xml tag name for directory tags. Used for the user chooser

See Also:
Constant Field Values

TAG_TAB

public static final String TAG_TAB
Xml tag name for the tab tags. Used for the user chooser

See Also:
Constant Field Values

TAG_LABEL

public static final String TAG_LABEL
Xml tag name for the label tags. Used for the user chooser

See Also:
Constant Field Values

ATTR_DATASOURCE

public static final String ATTR_DATASOURCE
Data source tag

See Also:
Constant Field Values

ATTR_PATH

public static final String ATTR_PATH
Xml path attribute name. For user chooser

See Also:
Constant Field Values

ATTR_PATTERN

public static final String ATTR_PATTERN
Xml pattern attribute name. For user chooser

See Also:
Constant Field Values

ATTR_DOPOLLING

public static final String ATTR_DOPOLLING
Xml dopolling attribute name. For user chooser

See Also:
Constant Field Values

ATTR_POLLINTERVAL

public static final String ATTR_POLLINTERVAL
Xml pollinterval attribute name. For user chooser

See Also:
Constant Field Values

ATTR_TITLE

public static final String ATTR_TITLE
Xml title attribute name.

See Also:
Constant Field Values

ATTR_MENUTITLE

public static final String ATTR_MENUTITLE
Xml menu title attribute name.

See Also:
Constant Field Values

ATTR_SHOWINMENU

public static final String ATTR_SHOWINMENU
Xml attribute to see if this chooser should go in the data menu

See Also:
Constant Field Values
Constructor Detail

IdvChooserManager

public IdvChooserManager(IntegratedDataViewer idv)
Create a new IdvChooserManager.

Parameters:
idv - The singleton IDV
Method Detail

removeAddeServerGroup

public void removeAddeServerGroup(AddeServer server,
                                  AddeServer.Group group,
                                  boolean markAsInactive)
Remove the group held by the server. Write out the addeservers.xml file

Parameters:
server - The server
group - The group to remove
markAsInactive - If true then don't really remove the group, just mark it as inactive

activateAddeServerGroup

public void activateAddeServerGroup(AddeServer server,
                                    AddeServer.Group group)
Make the group active

Parameters:
server - The server
group - The group to remove

addAddeServerGroup

public AddeServer.Group addAddeServerGroup(AddeServer server,
                                           String groupName,
                                           String type)
Add the given AddeServer.Group into the list of servers. Write out the addeserver.xml file

Parameters:
server - Server to add
groupName - The new group name
type - Its type
Returns:
The new Group

writeAddeServers

public void writeAddeServers()
Write out the addeservers.xml file


addAddeServer

public AddeServer addAddeServer(String name)
Create a new AddeServer or find an existing one with the given name. If a new one is created then also write out the addeservers.xml file

Parameters:
name - new server name
Returns:
The server

removeAddeServer

public void removeAddeServer(AddeServer server,
                             boolean markAsInactive)
Remove the given adde server. Write out the addeservers.xml file

Parameters:
server - The server to remove
markAsInactive - If true then don't really remove the server, just mark it as inactive

getAddeServers

public List getAddeServers(String groupType)
Get AddeServers to use

Parameters:
groupType - If null return all, else return the servers that have groups of the given type
Returns:
List of AddeServers

getAddeServers

public List getAddeServers(String groupType,
                           boolean onlyActive)
Get AddeServers to use

Parameters:
groupType - If null return all, else return the servers that have groups of the given type
onlyActive - If true then only fetch the active servers
Returns:
List of AddeServers

getChoosers

public List getChoosers()
Get the list of current choosers. This looks at all of the IdvWindows in existence and checks for their component group 'choosers'.

Returns:
List of current choosers

getChooserContents

public JComponent getChooserContents()
Deprecated. no longer in use

Get the chooser contents

Returns:
null

init

public void init()
Initialize the set of choosers. Go through the chooser resources and create the chooser gui.


createChoosers

public JComponent createChoosers(boolean inTabs)
Create the Choosers component from the choosers.xml resources

Parameters:
inTabs - Do we use the buttontabbedpane or the treepanel
Returns:
choosers gui

createChoosers

public JComponent createChoosers(boolean inTabs,
                                 List theseChoosers,
                                 Element choosersNode)
Create the Choosers component from the choosers.xml resources

Parameters:
inTabs - Do we use the buttontabbedpane or the treepanel
theseChoosers - List to add the created choosers into
choosersNode - The xml node of the chooser skin
Returns:
choosers gui

createChooser

public Component createChooser(Node chooserNode)
Overwrite the component factory method in XmlUi to handler chooser xml nodes.

Parameters:
chooserNode - The chooser node
Returns:
The chooser's gui

makeChooserMenus

public List makeChooserMenus(List items)
Make the chooser menu items

Parameters:
items - List to put the menu items in
Returns:
List of chooser menu items

getChooserId

public static String getChooserId(Element node)
This tries to find some identifier for the chooser defied by the given xml node. This is used when the end user can define what choosers they want to see in the chooser GUI.

Parameters:
node - The chooser node
Returns:
Some (hopefully) unique identifier

getChooserIds

public List getChooserIds()
Return a list of the (String) chooser ids that have been processed by this manager. We have this here for the end user to define what choosers they want to see

Returns:
The list of (String) chooser ids.

getChooserName

public String getChooserName(String chooserId)
Get the name of the given chooser

Parameters:
chooserId - The id of the chooser
Returns:
Its name

addUserChooserToMenu

public JMenu addUserChooserToMenu(JMenu menu,
                                  JMenu pullRight)
Inserts menu items into the given menu for creating the data sources that are defined by the user chooser

Parameters:
menu - The menu
pullRight - Will end up being the sub menu
Returns:
The pullRight menu

makeDataSourceFromXml

public void makeDataSourceFromXml(Element theNode)
Create the data source from the given user chooser xml

Parameters:
theNode - User chooser xml node that defines a data source

closeDataChooser

public void closeDataChooser()
Close me


shouldMakeDialog

protected boolean shouldMakeDialog()
Should we make a dialog

Overrides:
shouldMakeDialog in class WindowHolder
Returns:
true

getWindowTitle

protected String getWindowTitle()
Window title

Overrides:
getWindowTitle in class WindowHolder
Returns:
window title

popupXmlChooserDialog

protected void popupXmlChooserDialog(Element tabNode,
                                     Element dirNode)
Show the dialog for editing the user chooser entry

Parameters:
tabNode - What tab the entry is in
dirNode - What entry

processChooserXml

public void processChooserXml()
Process the user chooser resources


processChooserXml

public void processChooserXml(boolean writable,
                              Element root)
Process the user chooser xml root

Parameters:
writable - Is this the writable resource
root - The xml document root

writeChooserXml

protected void writeChooserXml()
Write out the user chooser xml document