|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.IdvPersistenceManager
public class IdvPersistenceManager
This class defines what is to be saved when we are doing an advanced save of the state to a bundle
| 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 |
| 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.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 |
|---|
public static final String PROP_BUNDLEPATH
public static final String PROP_ZIDVPATH
public static final String CAT_GENERAL
public static final String CAT_TOOLBAR
public static final int BUNDLES_ALL
public static final int BUNDLES_FAVORITES
public static final int BUNDLES_DISPLAY
public static final int BUNDLES_DATA
public static final String CATEGORY_SEPARATOR
| Constructor Detail |
|---|
public IdvPersistenceManager(IntegratedDataViewer idv)
idv - The IDV| Method Detail |
|---|
public void getControlDescriptors(List l)
ControlDescriptors
that use the display templates.
l - List of control descriptors to add to
public void setFileMapping(List ids,
List files)
ids - List of String idsfiles - List of lists of filenamespublic void clearFileMapping()
public void addFileMapping(String identifier,
List files)
identifier - Id use to identify a data sourcefiles - List of files (or urls).public JPanel getFileAccessory()
public static String categoriesToString(List cats)
cats - List of categories - String.
public static List stringToCategories(String category)
category - The string representation of the categories
public static List fileToCategories(String root,
String filename)
root - File rootfilename - File path to split
public static String getBundleXml(List bundles,
boolean includeCategoryInUrl)
bundles - List of saved bundleincludeCategoryInUrl - Should we add the category to the file name
public List getXmlBundles(int type)
type - bundle type
public List getFavorites()
SavedBundles
public String getCurrentFileName()
public void setCurrentFileName(String f)
f - The filenamepublic void doSaveAs()
public void moveCategory(List fromCategories,
List toCategories,
int bundleType)
fromCategories - The category to movetoCategories - Where to move tobundleType - What type are we dealing with
public void export(SavedBundle bundle,
int bundleType)
bundle - The bundlebundleType - What type
public void rename(SavedBundle bundle,
int bundleType)
bundle - The bundlebundleType - What type
public void copyBundle(SavedBundle bundle,
List categories,
int bundleType)
bundle - The bundlecategories - The category locationbundleType - What type
public void moveBundle(SavedBundle bundle,
List categories,
int bundleType)
bundle - The bundlecategories - The category locationbundleType - What type
public void moveOrCopyBundle(SavedBundle bundle,
List categories,
int bundleType,
boolean move)
bundle - The bundlecategories - The category locationbundleType - What typemove - Move or copypublic JComboBox makeCategoryBox()
public void doImport(int bundleType,
String file,
String category)
bundleType - What typefile - The filecategory - The categorypublic List getFavoritesCategories()
public void doSaveAsFavorite()
public void doSave()
public void doSaveAsDefault()
public void doOpenDefault()
public boolean doSave(String filename)
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.
public String getJnlpBundle(String xml)
xml - The bundle xml
public String getJnlpBundle(String xml,
boolean embedBundle,
String extraArgs)
xml - The bundle xmlembedBundle - Embed the b64 encoded bundle right in the jnlpextraArgs - extra jnlp args
public boolean doSave(String filename,
boolean usePersistenceManager)
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.
public String getBundleXml(boolean formatXml)
throws Exception
formatXml - Should the result be formatted (i.e., new lines and indents
for easy reading).
Exception
public String getBundleXml(boolean formatXml,
boolean usePersistenceManager)
throws Exception
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
Exceptionpublic DisplayControl instantiateFromTemplate(String templateFile)
templateFile - File path to the template
public List getAllCategories(int bundleType)
bundleType - What type of bundle (e.g., favorites)
public String getBundleTitle(int bundleType)
bundleType - The type of bundle (e.g., favorites)
public String getBundleDirectory(int bundleType)
bundleType - The type of bundle (e.g., favorites)
public List getBundles(int bundleType)
SavedBundles
bundleType - The type of bundle (e.g., favorites)
public void initBundleMenu(int bundleType,
JMenu bundleMenu)
bundleType - The type of bundle (e.g., favorites)bundleMenu - The menupublic List getWritableBundles(int bundleType)
SavedBundles that are writable
bundleType - The type of bundle (e.g., favorites)
public void saveDataSource(DataSource dataSource)
dataSource - data source to save
public void saveDisplayControlFavorite(DisplayControl displayControl,
String templateName)
displayControl - The display control to writetemplateName - Possibly null initial name for the templatepublic void saveDisplayControl(DisplayControl displayControl)
displayControl - The display control to write
public void saveDisplayControl(DisplayControl displayControl,
File file)
displayControl - The display control to writefile - The file to write topublic List getLocalBundles()
SavedBundles
public List getDataSourceBundles()
public List getDisplayTemplates()
public boolean open(SavedBundle bundle)
bundle - The bundle to open
public boolean open(SavedBundle bundle,
boolean askToRemove)
bundle - bundleaskToRemove - ask
public void deleteBundle(String templateFile)
templateFile - The template file to remove
public void deleteBundleCategory(int bundleType,
String category)
bundleType - The type of bundle (e.g., favorites)category - The category (really a directory path)
public boolean addBundleCategory(int bundleType,
String category)
bundleType - The type of bundle (e.g., favorites)category - The category (really a directory path)
protected List getDataSourcesToPersist()
protected boolean addToBundle(Hashtable data,
boolean usePersistenceManager,
List displayControls)
throws Exception
data - The table to put things intousePersistenceManager - Should we use the settings of this managerdisplayControls - The display controls to add
Exception - When something bad happens
protected boolean addToBundle(Hashtable data,
List dataSources,
List displayControls,
List viewManagers,
String jython)
data - Holds the bundle statedataSources - List of data sources to adddisplayControls - List of displays to addviewManagers - List of view managers to addjython - jython to add
public void loadB64Bundle(String base64Bundle)
base64Bundle - The base64 encoded xml bundlepublic void decodeBase64Bundle(String base64Bundle)
base64Bundle - The base64 encoded xml bundle
public void decodeBase64Bundle(String base64Bundle,
List overrideTimes)
base64Bundle - The base64 encoded xml bundleoverrideTimes - If non-null then use the set of time indices for the data sourcespublic void decodeJnlpFile(String filename)
filename - The name of the jnlp file.
public boolean decodeXmlFile(String xmlFile,
boolean checkToRemove)
xmlFile - The bundle filecheckToRemove - Should check the user preference to remove all/show dialog or not.
public boolean decodeXmlFile(String xmlFile,
boolean checkToRemove,
boolean letUserChangeData)
xmlFile - filecheckToRemove - check to removeletUserChangeData - Set the 'user changes data flag' on decoding
public boolean decodeXmlFile(String xmlFile,
boolean checkToRemove,
List overrideTimes)
xmlFile - The bundle filecheckToRemove - 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
public boolean decodeXmlFile(String xmlFile,
String label,
boolean checkToRemove)
xmlFile - The bundle filelabel - If non-null ten use this as te load dialog labelcheckToRemove - Should check the user preference to remove all/show dialog or not.
public boolean decodeXmlFile(String xmlFile,
String label,
boolean checkToRemove,
List overrideTimes)
xmlFile - file namelabel - description for dialogcheckToRemove - Should we ask the user about removing data/displaysoverrideTimes - If non-null then use the set of time indices for the data sources