ucar.unidata.idv
Class IdvPersistenceManager

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

public class IdvPersistenceManager
extends IdvManager
implements PrototypeManager

This class defines what is to be saved when we are doing an advanced save of the state to a bundle

Author:
IDV development team

Field Summary
static int BUNDLES_ALL
          The type to specify all bundles
static int BUNDLES_DATA
          The type to specify the data
static int BUNDLES_DISPLAY
          The type to specify the display templates
static int BUNDLES_FAVORITES
          The type to specify the "Favorites" bundles
static String CAT_GENERAL
          Category name
static String CAT_TOOLBAR
          Category name
static String CATEGORY_SEPARATOR
          The separator to use when displaying categories
static String PROP_BUNDLEPATH
          The macro for the bundle path in data paths
static String PROP_ZIDVPATH
          The macro for the zidv path in data paths
 
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
IdvPersistenceManager(IntegratedDataViewer idv)
          The ctor
 
Method Summary
 boolean addBundleCategory(int bundleType, String category)
          Add the directory
 void addFileMapping(String identifier, List files)
          Add a file mapping.
protected  boolean addToBundle(Hashtable data, boolean usePersistenceManager, List displayControls)
          This method adds into the given hashtable the data sources, display controls, view managers and extra gui state for later persistence.
protected  boolean addToBundle(Hashtable data, List dataSources, List displayControls, List viewManagers, String jython)
          Add the given state, if non null, to the bundle hashtable
protected  String applyPropertiesToBundle(String xml)
          replace any macros in the bundle xml
static String categoriesToString(List cats)
          Utility to convert a list of categories into a single string to show the user.
 void changeData(Object[] input)
           
 boolean changeState(DataSource dataSource)
           
 boolean changeState(DataSource dataSource, boolean andReload)
           
 void clearFileMapping()
          Clear any filemappings.
 void clearPrototype(Class c)
          Clear the prototype for the given class
 void copyBundle(SavedBundle bundle, List categories, int bundleType)
          Copy the bundle to the given category area
 void decodeBase64Bundle(String base64Bundle)
          This does the actual work of converting the given base 64 encoded bundle xml into a String and loading it in.
 void decodeBase64Bundle(String base64Bundle, List overrideTimes)
          This does the actual work of converting the given base 64 encoded bundle xml into a String and loading it in.
 void decodeJnlpFile(String filename)
          This reads in the jnlp xml from the given filename.
 void decodeXml(String xml, boolean fromCollab, String label, boolean showDialog)
          Using the XmlEncoder, decode the given xml string.
 void decodeXml(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, List overrideTimes, boolean removeAll, boolean letUserChangeData)
          Using the XmlEncoder, decode the given xml string.
 boolean decodeXmlFile(String xmlFile, boolean checkToRemove)
          Read in the contents of the given xmlFile and evaluate the xml
 boolean decodeXmlFile(String xmlFile, boolean checkToRemove, boolean letUserChangeData)
          Read in the contents of the given xmlFile and evaluate the xml
 boolean decodeXmlFile(String xmlFile, boolean checkToRemove, List overrideTimes)
          Read in the contents of the given xmlFile and evaluate the xml
 boolean decodeXmlFile(String xmlFile, String label, boolean checkToRemove)
          Read in the contents of the given xmlFile and evaluate the xml
 boolean decodeXmlFile(String xmlFile, String label, boolean checkToRemove, boolean letUserChangeData, List overrideTimes)
          decode the xml
 boolean decodeXmlFile(String xmlFile, String label, boolean checkToRemove, List overrideTimes)
          Import the bundle file
protected  void decodeXmlInner(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog)
          This does the real work of decoding an xml bundle.
protected  void decodeXmlInner(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, List overrideTimes, boolean didRemoveAll, boolean letUserChangeData)
          This does the real work of decoding an xml bundle.
 void deleteBundle(String templateFile)
          Remove the given template
 void deleteBundleCategory(int bundleType, String category)
          Delete the directory and all of its contents that the given category represents.
 void doImport(int bundleType, String file, String category)
          Import the given file as the given bundle type
 void doOpenDefault()
          Called from the menu command to open the default bundle
 void doSave()
          Save the current state off to the current xidv filename
 boolean doSave(String filename)
          Save the current state into the specified filename
 boolean doSave(String filename, boolean usePersistenceManager)
          Save the current state into the specified filename
 void doSaveAs()
          Have the user select an xidv filename and write the current application state to it.
 void doSaveAsDefault()
          Called from the menu command to save the current state as the default bundle
 void doSaveAsFavorite()
          Have the user select an xidv filename for their favorites
 void export(SavedBundle bundle, int bundleType)
          Export the bundle
static List fileToCategories(String root, String filename)
          The given filename is a full path under the given root.
 List getAllCategories(int bundleType)
          Get a list of all of the categories for the given bundleType
 String getBundleDirectory(int bundleType)
          Get the directory that holds the given bundle type
 List getBundles(int bundleType)
          Get the list of SavedBundles
 String getBundleTitle(int bundleType)
          Get the title to use for the given bundle type
 String getBundleXml(boolean formatXml)
          This creates an xml encoded hashtable that contains the application state.
 String getBundleXml(boolean formatXml, boolean usePersistenceManager)
          This creates an xml encoded hashtable that contains the application state.
static String getBundleXml(List bundles, boolean includeCategoryInUrl)
          Make the bundles xml
 void getControlDescriptors(List l)
          Create and add into the list the specical ControlDescriptors that use the display templates.
 String getCurrentFileName()
          Get the last xidv filename for doing saves/saveas.
 String getCurrentTemplateName()
          Get the CurrentTemplateName property.
 List getDataSourceBundles()
          Get list of data soruce bundles
protected  List getDataSourcesToPersist()
          Get the data sources we should persist
 List getDisplayTemplates()
          Get the list of display templates.
 List getFavorites()
          Create, if needed, and return the list of SavedBundles
 List getFavoritesCategories()
          get categories
 JPanel getFileAccessory()
          Create, if needed, and return te GUI panel to put into the file dialog when saving a file.
 String getJnlpBundle(String xml)
          A utility to create a jnlp file from the given bundle
 String getJnlpBundle(String xml, boolean embedBundle, String extraArgs)
          A utility to create a jnlp file from the given bundle
 List getLocalBundles()
          Create, if needed, and return the list of locally saved SavedBundles
 Object getPrototype(Class c)
          Instantiate a new object for the given class.
 boolean getSaveData()
          Should the visad data be saved
 boolean getSaveDataSources()
          Should the data sources be saved
 boolean getSaveDisplays()
          Should the displays be saved
 boolean getSaveJython()
          Should the jython be saved
 boolean getSaveViewState()
          Should the view state be saved
 List getWritableBundles(int bundleType)
          Get the list of SavedBundles that are writable
 List getXmlBundles(int type)
          get list of xml bundles for the given type
 void initBundleMenu(int bundleType, JMenu bundleMenu)
          Initialize the bundle menu
protected  void instantiateFromBundle(Hashtable ht, boolean fromCollab, LoadBundleDialog loadDialog, boolean shouldMerge, List overrideTimes, boolean didRemoveAll, boolean letUserChangeData)
          The given Hashtable contains the objects taht were saved in the xml bundle file.
 DisplayControl instantiateFromTemplate(String templateFile)
          Create the DisplayControl from the bundle in the given templateFile
 void loadB64Bundle(String base64Bundle)
          This converts the given base 64 encoded xml bundle into an xml String and loads it in.
 JComboBox makeCategoryBox()
          make category widget
 DataSourceResults makeDataSourceFromXml(String dataSourceXml)
          This creates a new data source from the xml encoded representation of a persisted data source.
 void moveBundle(SavedBundle bundle, List categories, int bundleType)
          Move the bundle to the given category area
 void moveCategory(List fromCategories, List toCategories, int bundleType)
          Move the bundle category
 void moveOrCopyBundle(SavedBundle bundle, List categories, int bundleType, boolean move)
          Move or copy the bundle to the given category area, depending on the given argument.
 boolean open(SavedBundle bundle)
          Open the given bundle
 boolean open(SavedBundle bundle, boolean askToRemove)
          Open the given bundle
 void rename(SavedBundle bundle, int bundleType)
          Rename the bundle
 void saveDataSource(DataSource dataSource)
           
 void saveDisplayControl(DisplayControl displayControl)
          Write out the given display control
 void saveDisplayControl(DisplayControl displayControl, File file)
          Write out the given display control to te given file
 void saveDisplayControlFavorite(DisplayControl displayControl, String templateName)
          Prompt the user for a name and write out the given display control as a bundle into the user's .metapps/displaytemplates directory.
 void setCurrentFileName(String f)
          Set the last xidv filename for doing saves/saveas.
 void setFileMapping(List ids, List files)
          Define one or more file mappings.
static List stringToCategories(String category)
          Retur a list of categories from the given string
 void writePrototype(Object object)
          Save off the given object as a prototype
 
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, getWindowTitle, isShowing, removeAll, setWindowTitle, shouldMakeDialog, 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_BUNDLEPATH

public static final String PROP_BUNDLEPATH
The macro for the bundle path in data paths

See Also:
Constant Field Values

PROP_ZIDVPATH

public static final String PROP_ZIDVPATH
The macro for the zidv path in data paths

See Also:
Constant Field Values

CAT_GENERAL

public static final String CAT_GENERAL
Category name

See Also:
Constant Field Values

CAT_TOOLBAR

public static final String CAT_TOOLBAR
Category name

See Also:
Constant Field Values

BUNDLES_ALL

public static final int BUNDLES_ALL
The type to specify all bundles

See Also:
Constant Field Values

BUNDLES_FAVORITES

public static final int BUNDLES_FAVORITES
The type to specify the "Favorites" bundles

See Also:
Constant Field Values

BUNDLES_DISPLAY

public static final int BUNDLES_DISPLAY
The type to specify the display templates

See Also:
Constant Field Values

BUNDLES_DATA

public static final int BUNDLES_DATA
The type to specify the data

See Also:
Constant Field Values

CATEGORY_SEPARATOR

public static final String CATEGORY_SEPARATOR
The separator to use when displaying categories

See Also:
Constant Field Values
Constructor Detail

IdvPersistenceManager

public IdvPersistenceManager(IntegratedDataViewer idv)
The ctor

Parameters:
idv - The IDV
Method Detail

getControlDescriptors

public void getControlDescriptors(List l)
Create and add into the list the specical ControlDescriptors that use the display templates.

Parameters:
l - List of control descriptors to add to

setFileMapping

public void setFileMapping(List ids,
                           List files)
Define one or more file mappings. The ids is a list of Strings that are used to identify a data source. The files is a list of Lists of filenames, one list for each corresponding data source id. This gets used when we unpersist data sources. If we have any file mappings we pass these onto the data source so they can change their actual file

Parameters:
ids - List of String ids
files - List of lists of filenames

clearFileMapping

public void clearFileMapping()
Clear any filemappings.


addFileMapping

public void addFileMapping(String identifier,
                           List files)
Add a file mapping. See above.

Parameters:
identifier - Id use to identify a data source
files - List of files (or urls).

getFileAccessory

public JPanel getFileAccessory()
Create, if needed, and return te GUI panel to put into the file dialog when saving a file.

Returns:
The file accessory panel

categoriesToString

public static String categoriesToString(List cats)
Utility to convert a list of categories into a single string to show the user.

Parameters:
cats - List of categories - String.
Returns:
String representation

stringToCategories

public static List stringToCategories(String category)
Retur a list of categories from the given string

Parameters:
category - The string representation of the categories
Returns:
List of (String) categories

fileToCategories

public static List fileToCategories(String root,
                                    String filename)
The given filename is a full path under the given root. This method prunes the root path from the filepath and splits the filepath into a list of categories.

Parameters:
root - File root
filename - File path to split
Returns:
List of (String) categories

getBundleXml

public static String getBundleXml(List bundles,
                                  boolean includeCategoryInUrl)
Make the bundles xml

Parameters:
bundles - List of saved bundle
includeCategoryInUrl - Should we add the category to the file name
Returns:
bundles.xml

getXmlBundles

public List getXmlBundles(int type)
get list of xml bundles for the given type

Parameters:
type - bundle type
Returns:
list of bundles

getFavorites

public List getFavorites()
Create, if needed, and return the list of SavedBundles

Returns:
List of saved bundles

getCurrentFileName

public String getCurrentFileName()
Get the last xidv filename for doing saves/saveas.

Returns:
The last xidv file name

setCurrentFileName

public void setCurrentFileName(String f)
Set the last xidv filename for doing saves/saveas.

Parameters:
f - The filename

doSaveAs

public void doSaveAs()
Have the user select an xidv filename and write the current application state to it. This also sets the current file name and adds the file to the history list.


moveCategory

public void moveCategory(List fromCategories,
                         List toCategories,
                         int bundleType)
Move the bundle category

Parameters:
fromCategories - The category to move
toCategories - Where to move to
bundleType - What type are we dealing with

export

public void export(SavedBundle bundle,
                   int bundleType)
Export the bundle

Parameters:
bundle - The bundle
bundleType - What type

rename

public void rename(SavedBundle bundle,
                   int bundleType)
Rename the bundle

Parameters:
bundle - The bundle
bundleType - What type

copyBundle

public void copyBundle(SavedBundle bundle,
                       List categories,
                       int bundleType)
Copy the bundle to the given category area

Parameters:
bundle - The bundle
categories - The category location
bundleType - What type

moveBundle

public void moveBundle(SavedBundle bundle,
                       List categories,
                       int bundleType)
Move the bundle to the given category area

Parameters:
bundle - The bundle
categories - The category location
bundleType - What type

moveOrCopyBundle

public void moveOrCopyBundle(SavedBundle bundle,
                             List categories,
                             int bundleType,
                             boolean move)
Move or copy the bundle to the given category area, depending on the given argument.

Parameters:
bundle - The bundle
categories - The category location
bundleType - What type
move - Move or copy

makeCategoryBox

public JComboBox makeCategoryBox()
make category widget

Returns:
box

doImport

public void doImport(int bundleType,
                     String file,
                     String category)
Import the given file as the given bundle type

Parameters:
bundleType - What type
file - The file
category - The category

getFavoritesCategories

public List getFavoritesCategories()
get categories

Returns:
categories

doSaveAsFavorite

public void doSaveAsFavorite()
Have the user select an xidv filename for their favorites


doSave

public void doSave()
Save the current state off to the current xidv filename


doSaveAsDefault

public void doSaveAsDefault()
Called from the menu command to save the current state as the default bundle


doOpenDefault

public void doOpenDefault()
Called from the menu command to open the default bundle


doSave

public boolean doSave(String filename)
Save the current state into the specified filename

Parameters:
filename - bundle file name to write to. If this ends in ".jnlp" then we base 64 encode the bundle and wrap it in a jnlp file.
Returns:
Was this save successful

getJnlpBundle

public String getJnlpBundle(String xml)
A utility to create a jnlp file from the given bundle

Parameters:
xml - The bundle xml
Returns:
The jnlp file xml

getJnlpBundle

public String getJnlpBundle(String xml,
                            boolean embedBundle,
                            String extraArgs)
A utility to create a jnlp file from the given bundle

Parameters:
xml - The bundle xml
embedBundle - Embed the b64 encoded bundle right in the jnlp
extraArgs - extra jnlp args
Returns:
The jnlp file xml

doSave

public boolean doSave(String filename,
                      boolean usePersistenceManager)
Save the current state into the specified filename

Parameters:
filename - bundle file name to write to. If this ends in ".jnlp" then we base 64 encode the bundle and wrap it in a jnlp file.
usePersistenceManager - If true then we use the persistence manager to determine what is to be saved.
Returns:
Was this save successful

getBundleXml

public String getBundleXml(boolean formatXml)
                    throws Exception
This creates an xml encoded hashtable that contains the application state.

Parameters:
formatXml - Should the result be formatted (i.e., new lines and indents for easy reading).
Returns:
The xml encoded application state
Throws:
Exception

getBundleXml

public String getBundleXml(boolean formatXml,
                           boolean usePersistenceManager)
                    throws Exception
This creates an xml encoded hashtable that contains the application state.

Parameters:
formatXml - Should the result be formatted (i.e., new lines and indents for easy reading).
usePersistenceManager - If true then use the persistence manager to decide what is saved
Returns:
The xml encoded application state
Throws:
Exception

instantiateFromTemplate

public DisplayControl instantiateFromTemplate(String templateFile)
Create the DisplayControl from the bundle in the given templateFile

Parameters:
templateFile - File path to the template
Returns:
The instantiated DisplayControl

getAllCategories

public List getAllCategories(int bundleType)
Get a list of all of the categories for the given bundleType

Parameters:
bundleType - What type of bundle (e.g., favorites)
Returns:
List of (String) categories

getBundleTitle

public String getBundleTitle(int bundleType)
Get the title to use for the given bundle type

Parameters:
bundleType - The type of bundle (e.g., favorites)
Returns:
The title

getBundleDirectory

public String getBundleDirectory(int bundleType)
Get the directory that holds the given bundle type

Parameters:
bundleType - The type of bundle (e.g., favorites)
Returns:
The directory

getBundles

public List getBundles(int bundleType)
Get the list of SavedBundles

Parameters:
bundleType - The type of bundle (e.g., favorites)
Returns:
List of bundles

initBundleMenu

public void initBundleMenu(int bundleType,
                           JMenu bundleMenu)
Initialize the bundle menu

Parameters:
bundleType - The type of bundle (e.g., favorites)
bundleMenu - The menu

getWritableBundles

public List getWritableBundles(int bundleType)
Get the list of SavedBundles that are writable

Parameters:
bundleType - The type of bundle (e.g., favorites)
Returns:
List of writable bundles

saveDataSource

public void saveDataSource(DataSource dataSource)
Parameters:
dataSource - data source to save

saveDisplayControlFavorite

public void saveDisplayControlFavorite(DisplayControl displayControl,
                                       String templateName)
Prompt the user for a name and write out the given display control as a bundle into the user's .metapps/displaytemplates directory.

Parameters:
displayControl - The display control to write
templateName - Possibly null initial name for the template

saveDisplayControl

public void saveDisplayControl(DisplayControl displayControl)
Write out the given display control

Parameters:
displayControl - The display control to write

saveDisplayControl

public void saveDisplayControl(DisplayControl displayControl,
                               File file)
Write out the given display control to te given file

Parameters:
displayControl - The display control to write
file - The file to write to

getLocalBundles

public List getLocalBundles()
Create, if needed, and return the list of locally saved SavedBundles

Returns:
List of saved bundles

getDataSourceBundles

public List getDataSourceBundles()
Get list of data soruce bundles

Returns:
data source bundle list

getDisplayTemplates

public List getDisplayTemplates()
Get the list of display templates. This is a list of String file paths

Returns:
List of display template

open

public boolean open(SavedBundle bundle)
Open the given bundle

Parameters:
bundle - The bundle to open
Returns:
success

open

public boolean open(SavedBundle bundle,
                    boolean askToRemove)
Open the given bundle

Parameters:
bundle - bundle
askToRemove - ask
Returns:
success

deleteBundle

public void deleteBundle(String templateFile)
Remove the given template

Parameters:
templateFile - The template file to remove

deleteBundleCategory

public void deleteBundleCategory(int bundleType,
                                 String category)
Delete the directory and all of its contents that the given category represents.

Parameters:
bundleType - The type of bundle (e.g., favorites)
category - The category (really a directory path)

addBundleCategory

public boolean addBundleCategory(int bundleType,
                                 String category)
Add the directory

Parameters:
bundleType - The type of bundle (e.g., favorites)
category - The category (really a directory path)
Returns:
true if the create was successfull. False if there already is a category with that name

getDataSourcesToPersist

protected List getDataSourcesToPersist()
Get the data sources we should persist

Returns:
Data sources to persist

addToBundle

protected boolean addToBundle(Hashtable data,
                              boolean usePersistenceManager,
                              List displayControls)
                       throws Exception
This method adds into the given hashtable the data sources, display controls, view managers and extra gui state for later persistence.

Parameters:
data - The table to put things into
usePersistenceManager - Should we use the settings of this manager
displayControls - The display controls to add
Returns:
If user is ok
Throws:
Exception - When something bad happens

addToBundle

protected boolean addToBundle(Hashtable data,
                              List dataSources,
                              List displayControls,
                              List viewManagers,
                              String jython)
Add the given state, if non null, to the bundle hashtable

Parameters:
data - Holds the bundle state
dataSources - List of data sources to add
displayControls - List of displays to add
viewManagers - List of view managers to add
jython - jython to add
Returns:
If user is ok

loadB64Bundle

public void loadB64Bundle(String base64Bundle)
This converts the given base 64 encoded xml bundle into an xml String and loads it in. It prints out UI messages and shows the wait cursor.

Parameters:
base64Bundle - The base64 encoded xml bundle

decodeBase64Bundle

public void decodeBase64Bundle(String base64Bundle)
This does the actual work of converting the given base 64 encoded bundle xml into a String and loading it in.

Parameters:
base64Bundle - The base64 encoded xml bundle

decodeBase64Bundle

public void decodeBase64Bundle(String base64Bundle,
                               List overrideTimes)
This does the actual work of converting the given base 64 encoded bundle xml into a String and loading it in.

Parameters:
base64Bundle - The base64 encoded xml bundle
overrideTimes - If non-null then use the set of time indices for the data sources

decodeJnlpFile

public void decodeJnlpFile(String filename)
This reads in the jnlp xml from the given filename. It extracts from the "arguments" section of the xml the -b64bundle values. This is the base 64 encoded xml bundle. It then loads in the bundle.

Parameters:
filename - The name of the jnlp file.

decodeXmlFile

public boolean decodeXmlFile(String xmlFile,
                             boolean checkToRemove)
Read in the contents of the given xmlFile and evaluate the xml

Parameters:
xmlFile - The bundle file
checkToRemove - Should check the user preference to remove all/show dialog or not.
Returns:
success

decodeXmlFile

public boolean decodeXmlFile(String xmlFile,
                             boolean checkToRemove,
                             boolean letUserChangeData)
Read in the contents of the given xmlFile and evaluate the xml

Parameters:
xmlFile - file
checkToRemove - check to remove
letUserChangeData - Set the 'user changes data flag' on decoding
Returns:
everything cool

decodeXmlFile

public boolean decodeXmlFile(String xmlFile,
                             boolean checkToRemove,
                             List overrideTimes)
Read in the contents of the given xmlFile and evaluate the xml

Parameters:
xmlFile - The bundle file
checkToRemove - Should check the user preference to remove all/show dialog or not.
overrideTimes - If non-null then use the set of time indices for the data sources
Returns:
success

decodeXmlFile

public boolean decodeXmlFile(String xmlFile,
                             String label,
                             boolean checkToRemove)
Read in the contents of the given xmlFile and evaluate the xml

Parameters:
xmlFile - The bundle file
label - If non-null ten use this as te load dialog label
checkToRemove - Should check the user preference to remove all/show dialog or not.
Returns:
success

decodeXmlFile

public boolean decodeXmlFile(String xmlFile,
                             String label,
                             boolean checkToRemove,
                             List overrideTimes)
Import the bundle file

Parameters:
xmlFile - file name
label - description for dialog
checkToRemove - Should we ask the user about removing data/displays
overrideTimes - If non-null then use the set of time indices for the data sources
Returns:
success

deco