Class PersistenceManager
- All Implemented Interfaces:
ActionListener
,EventListener
,IdvConstants
,PrototypeManager
- Bundles prior to alpha 9 use the
TabbedUIManager
. Each tab is, internally, an IDV window. This is reflected in the contents of bundles, so the IDV wants to create a new window for each tab upon loading. Alpha 10 allows the user to force bundles to only create one window. This work is done ininjectComponentGroups(List)
. - The IDV allows users to save bundles that contain both
ViewManagers
with component groups and without! This is actually only a problem when limiting the windows;injectComponentGroups
has to wrap ViewManagers without component groups in dynamic skins. These ViewManagers must be removed from the bundle's internal list of ViewManagers, as they don't exist until the dynamic skin is built. Do not simply clear the list! The ViewManagers within component groups must appear in it, otherwise the IDV does not add them to theVMManager
. If limiting windows is off, everything will be caught properly by the unpersisting facilities inUIManager
.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ucar.unidata.idv.IdvPersistenceManager
IdvPersistenceManager.DataSourceComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
Dynamic skin template for buildWindow.private boolean
Whether or not a bundle is actively loading.private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
static final String
Key used to access a bundle's McIDAS-V in-depth versioning info section.private ViewManager
Stores the last active ViewManager from before a bundle load.private JRadioButton
Use radio buttons to control state savingprivate JRadioButton
private JRadioButton
(package private) static LogUtil.LogCategory
private static final org.slf4j.Logger
static final String
Macro used as a place holder for wherever the IDV decides to place extracted contents of a bundle.private boolean
Whether or not the user wants to attempt merging bundled layers into current displays.private static final String
private static final String
private static final String
private static final String
private XmlResourceCollection
Cache the parameter sets XMLprivate static Document
private static Element
private boolean
Is the bundle being saved a layout bundle?private static final String
XML template for generating dynamic skins.private static final String
private static final String
Fields inherited from class ucar.unidata.idv.IdvPersistenceManager
bundleIdvVersion, BUNDLES_ALL, BUNDLES_DATA, BUNDLES_DISPLAY, BUNDLES_FAVORITES, BUNDLES_SYSTEM, CAT_GENERAL, CAT_TOOLBAR, CATEGORY_SEPARATOR, CATEGORY_SEPARATOR_XML, makeDataEditable, makeDataEditableCbx, makeDataRelative, makeDataRelativeCbx, PROP_BUNDLEPATH, PROP_ENSLIST, PROP_TIMESLIST, PROP_ZIDVPATH, publishCbx, saveDataCbx, saveDataSources, saveDataSourcesCbx, saveDisplays, saveDisplaysCbx, saveJythonBox, saveViewState, saveViewStateCbx
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, 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_NOERRORSINGUI, 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, 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_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_APPEARANCEMODE, 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_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, 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_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, 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_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, PROP_USE_TIMEDRIVER, 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
ConstructorsConstructorDescriptionJava requires this constructor.Create a new persistence manager. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addParameterSetCategory
(String parameterType, String category) Add the directory.protected boolean
addToBundle
(Hashtable data, List dataSources, List displayControls, List viewManagers, String jython) Overridden so that McIDAS-V can: add better versioning information to bundles removeReadoutProbes
from thedisplayControls
that are getting persisted. disallow saving multi-banded ADDE data sources until we have fix!protected List
<WindowInfo> betterInject
(List<WindowInfo> windows) Builds an altered copy ofwindows
that preserves the number of windows while ensuring all displays are inside component holders.static IdvWindow
buildDynamicSkin
(int width, int height, int rows, int cols, boolean showWidgets, List<org.python.core.PyObject> panelTypes) protected List
<IdvComponentHolder> buildHolders
(WindowInfo window) Builds a list of component holders with all ofwindow
's displays.private void
checkForBadMaps
(String bundlePath) void
decodeXml
(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean removeAll, boolean letUserChangeData) Overridden so that McIDAS-V can redirect to the version of this method that supports limiting the number of new windows.void
decodeXml
(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean removeAll, boolean letUserChangeData, boolean limitWindows) Hijacks the second part of the IDV bundle loading pipeline so that McIDAS-V can limit the number of new windows.boolean
decodeXmlFile
(String xmlFile, String label, boolean checkToRemove, boolean letUserChangeData, Hashtable bundleProperties) Hijacks control of the IDV's bundle loading facilities.protected void
decodeXmlInner
(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean changeData) Overridden so that McIDAS-V can redirect to the version of this method that supports limiting the number of new windows.protected void
decodeXmlInner
(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData, boolean limitNewWindows) Hijacks the third part of the bundle loading pipeline.void
deleteParameterSet
(String parameterType, ParameterSet set) Delete the given parameter setvoid
deleteParameterSetCategory
(String parameterType, String category) Delete the directory and all of its contents that the given category represents.void
Overridden because McIDAS-V has a different definition of "default bundle" than the IDV.void
doSaveAs()
Have the user select an xidv filename and write the current application state to it.void
protected static List
<ViewManager> extractCompGroupVMs
(List<WindowInfo> windows) Builds a list of an incoming bundle'sViewManager
s that are part of a component group.private boolean
Attempts to reconcile McIDAS-V's ability to easily load all files in a directory with the way the IDV expects file data sources to behave upon unpersistence.protected IdvComponentGroup
flattenGroup
(IdvComponentGroup nested) Altersnested
so that there are no nested component groups.protected void
flattenWindows
(List<WindowInfo> windows) Alterswindows
so that no windows in the bundle contain nested component groups.private List
<ViewManager> generateViewManagers
(List<DisplayControlImpl> controls) getAllParameterSetCategories
(String parameterType) Get a list of all of the categories for the given parameterTypegetAllParameterSets
(String parameterType) Get the list ofParameterSet
s that are writableCreate, if needed, and return te GUI panel to put into the file dialog when saving a file.Returns the last activeViewManager
from before loading the most recent bundle.Create, if needed, and return the list of locally savedSavedBundle
sboolean
private Element
getParameterTypeNode
(String parameterType) Get the node representing the parameterTypeboolean
Should the data sources be savedboolean
Should the displays be savedboolean
Should the jython be savedboolean
Should the view state be savedprotected List
<WindowInfo> injectComponentGroups
(List<WindowInfo> windows) Builds a single window with a single component group.protected void
instantiateFromBundle
(Hashtable ht, boolean fromCollab, LoadBundleDialog loadDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData) Overridden so that McIDAS-V can redirect to the version of this method that supports limiting the number of new windows.protected void
instantiateFromBundle
(Hashtable ht, boolean fromCollab, LoadBundleDialog loadDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData, boolean limitNewWindows) Overridden so that McIDAS-V can preempt the IDV's bundle loading.private boolean
Attempts to determine whether or not a givenDataSourceImpl
is the result of a McIDAS-V "bulk load".boolean
Returns whether or not a bundle is currently being loaded.protected void
loadBundlesInDirectory
(List<SavedBundle> allBundles, List categories, File file) For each of of the bundle files in the given file directory create a SavedBundle object with the given categories list ad add it into the given allBundles list.makeDynSkin
(WindowInfo info) Uses theViewManagers
ininfo
to build a dynamic skin.mapDynamicSkins
(List<WindowInfo> windows) Builds a list of any dynamic skins in the bundle and adds them to the UIMananger's "cache" of encountered ViewManagers.void
moveParameterSet
(String parameterType, ParameterSet set, List categories) Move the bundle to the given category area.void
moveParameterSetCategory
(String parameterType, List fromCategories, List toCategories) Move the bundle category.protected static void
populateEssentialLists
(String[] ids, Hashtable<String, Object> table) Ensures that the lists corresponding to the ids inids
actually exist intable
, even if they are empty.protected static List
<WindowInfo> removeUIHolders
(List<WindowInfo> windows) Returns an altered copy ofwindows
containing only component holders that have displays.protected static List
<IdvComponentHolder> removeUIHolders
(IdvComponentGroup group) Remove component holders that are "UI-only".void
renameParameterSet
(String parameterType, ParameterSet set) Rename the parameter set.protected void
reverseCollisions
(List<ViewManager> vms) Does the work in fixing the collisions described in theinstantiateFromBundle
javadoc.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'sMcIDAS-V/displaytemplates
directory.boolean
saveParameterSet
(String parameterType, Hashtable parameterValues) Show the Save Parameter Set dialog.private void
setMergeBundledLayers
(boolean newValue) private List
<WindowInfo> wrapViewManagers
(List<ViewManager> vms) void
Write the parameter setsMethods inherited from class ucar.unidata.idv.IdvPersistenceManager
addBundleCategories, addBundleCategory, addFileMapping, addToBundle, applyPropertiesToBundle, categoriesToString, changeData, changeState, changeState, cleanupOldSavedBundles, clearDataSourcesState, clearDataSourcesState, clearFileMapping, clearPrototype, copyBundle, decodeBase64Bundle, decodeJnlpFile, decodeXml, decodeXmlFile, decodeXmlFile, decodeXmlFile, decodeXmlFile, decodeXmlFile, decodeXmlInner, deleteBundle, deleteBundleCategory, doImport, doSave, doSave, doSave, doSaveAsDefault, doSaveAsFavorite, encodeSpecial, export, extractBundleFromJnlp, fileToCategories, flushState, getAllCategories, getBundleDirectory, getBundleIdvVersion, getBundles, getBundleTitle, getBundleXml, getBundleXml, getBundleXml, getCategories, getCategorizedFile, getControlDescriptors, getCurrentFileName, getCurrentTemplateName, getDataSourceBundles, getDataSourcesToPersist, getDefaultBundles, getDisplayTemplates, getFavorites, getFavoritesCategories, getJnlpBundle, getJnlpBundle, getPrototype, getPrototypeFile, getSaveData, getWritableBundles, getXmlBundles, initBundleMenu, instantiateFromTemplate, loadB64Bundle, makeCategoryBox, makeDataSourceFromXml, moveBundle, moveCategory, moveOrCopyBundle, open, open, rename, renameBundleCategory, saveDataSource, saveDisplayControl, saveDisplayControl, setCurrentFileName, setFileMapping, showDataEditableGui, showDataEmbedGui, showDataRelativeGui, stringToCategories, updateDataPaths, writePrototype
Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDone
Methods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
-
Field Details
-
ID_MCV_VERSION
Key used to access a bundle's McIDAS-V in-depth versioning info section.- See Also:
-
logger
-
MACRO_ZIDVPATH
Macro used as a place holder for wherever the IDV decides to place extracted contents of a bundle.- See Also:
-
log_
-
savingDefaultLayout
Is the bundle being saved a layout bundle? -
lastBeforeBundle
Stores the last active ViewManager from before a bundle load. -
mergeBundledLayers
Whether or not the user wants to attempt merging bundled layers into current displays. -
bundleLoading
Whether or not a bundle is actively loading. -
parameterSets
Cache the parameter sets XML -
parameterSetsDocument
-
parameterSetsRoot
-
TAG_FOLDER
- See Also:
-
TAG_DEFAULT
- See Also:
-
ATTR_NAME
- See Also:
-
layoutOnlyRadio
Use radio buttons to control state saving -
layoutSourcesRadio
-
layoutSourcesDataRadio
-
OLD_COMP_STUFF
- See Also:
-
NEW_COMP_STUFF
- See Also:
-
OLD_SOURCE_MACRO
- See Also:
-
NEW_SOURCE_MACRO
- See Also:
-
DYNSKIN_TMPNAME
- See Also:
-
DYNSKIN_TAG_PANEL
- See Also:
-
DYNSKIN_TAG_VIEW
- See Also:
-
DYNSKIN_ATTR_ID
- See Also:
-
DYNSKIN_ATTR_COLS
- See Also:
-
DYNSKIN_ATTR_ROWS
- See Also:
-
DYNSKIN_ATTR_PROPS
- See Also:
-
DYNSKIN_ATTR_CLASS
- See Also:
-
DYNSKIN_ATTR_VIEWID
- See Also:
-
DYNSKIN_PROPS_GLOBE
- See Also:
-
DYNSKIN_PROPS_GENERAL
- See Also:
-
DYNSKIN_ID_VALUE
- See Also:
-
SIMPLE_SKIN_TEMPLATE
XML template for generating dynamic skins.- See Also:
-
BUILDWINDOW_COMP_GROUP_HIDE_WIDGETS
- See Also:
-
BUILDWINDOW_PROPS_GENERAL
- See Also:
-
BUILDWINDOW_SKIN_TEMPLATE
Dynamic skin template for buildWindow.- See Also:
-
-
Constructor Details
-
PersistenceManager
public PersistenceManager()Java requires this constructor. -
PersistenceManager
Create a new persistence manager.- Parameters:
idv
- Reference back to the application session. Cannot benull
.- See Also:
-
-
Method Details
-
getLastViewManager
Returns the last activeViewManager
from before loading the most recent bundle.- Returns:
- Either the ViewManager or
null
if there was no previous ViewManager (such as loading a default bundle/layout).
-
isBundleLoading
Returns whether or not a bundle is currently being loaded.- Returns:
- Either
true
ifinstantiateFromBundle
is doing what it needs to do, orfalse
. - See Also:
-
getMergeBundledLayers
-
setMergeBundledLayers
-
getSaveDataSources
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
Should the data sources be saved- Overrides:
getSaveDataSources
in classIdvPersistenceManager
- Returns:
- Save the data sources
-
getSaveDisplays
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
Should the displays be saved- Overrides:
getSaveDisplays
in classIdvPersistenceManager
- Returns:
- Save the displays
-
getSaveViewState
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
Should the view state be saved- Overrides:
getSaveViewState
in classIdvPersistenceManager
- Returns:
- Save the view state
-
getSaveJython
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
Should the jython be saved- Overrides:
getSaveJython
in classIdvPersistenceManager
- Returns:
- Save the data sources
-
doSaveAsDefaultLayout
-
getFileAccessory
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
Create, if needed, and return te GUI panel to put into the file dialog when saving a file.- Overrides:
getFileAccessory
in classIdvPersistenceManager
- Returns:
- The file accessory panel
-
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.- Overrides:
doSaveAs
in classIdvPersistenceManager
-
doOpenDefault
Overridden because McIDAS-V has a different definition of "default bundle" than the IDV.The McV default bundle is the "startup bundle" from the advanced preferences.
- Overrides:
doOpenDefault
in classIdvPersistenceManager
-
saveDisplayControlFavorite
Prompt the user for a name and write out the given display control as a bundle into the user'sMcIDAS-V/displaytemplates
directory.- Overrides:
saveDisplayControlFavorite
in classIdvPersistenceManager
- Parameters:
displayControl
- Display control to write.templateName
- Possiblynull
initial name for the template.
-
addToBundle
protected boolean addToBundle(Hashtable data, List dataSources, List displayControls, List viewManagers, String jython) Overridden so that McIDAS-V can:- add better versioning information to bundles
- remove
ReadoutProbes
from thedisplayControls
that are getting persisted. - disallow saving multi-banded ADDE data sources until we have fix!
- Overrides:
addToBundle
in classIdvPersistenceManager
- Parameters:
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- Returns:
- If user is ok
-
getLocalBundles
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
Create, if needed, and return the list of locally savedSavedBundle
s- Overrides:
getLocalBundles
in classIdvPersistenceManager
- Returns:
- List of saved bundles
-
loadBundlesInDirectory
Description copied from class:ucar.unidata.idv.IdvPersistenceManager
For each of of the bundle files in the given file directory create a SavedBundle object with the given categories list ad add it into the given allBundles list.- Overrides:
loadBundlesInDirectory
in classIdvPersistenceManager
- Parameters:
allBundles
- The list to put the bundles incategories
- Categories for the SavedBundle objectsfile
- Where to look
-
decodeXml
public void decodeXml(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean removeAll, boolean letUserChangeData) Overridden so that McIDAS-V can redirect to the version of this method that supports limiting the number of new windows.
- Overrides:
decodeXml
in classIdvPersistenceManager
- Parameters:
xml
- The bundle xmlfromCollab
- Was this bundle from the collaboration facility. If it was we treat it differently.xmlFile
- The filename this came from. May be null.label
- The label to use in the dialogshowDialog
- Should the dialog be shownshouldMerge
- Should we merge the windows/views in the bundle into the existing windowsbundleProperties
- set of propertiesremoveAll
- Should we remove all data/displaysletUserChangeData
- Should popup the data path dialog- See Also:
-
decodeXmlFile
public boolean decodeXmlFile(String xmlFile, String label, boolean checkToRemove, boolean letUserChangeData, Hashtable bundleProperties) Hijacks control of the IDV's bundle loading facilities. Due to the way versions of McIDAS-V prior to alpha 10 handled tabs, the user will end up with a new window for each tab in the bundle. McIDAS-V alpha 10 has the ability to only create one new window and have everything else go into that window's tabs.
- Overrides:
decodeXmlFile
in classIdvPersistenceManager
- Parameters:
xmlFile
- filelabel
- labelcheckToRemove
- check to removeletUserChangeData
- if true then ask user to change data pathsbundleProperties
- set of properties- Returns:
- everything cool
- See Also:
-
decodeXmlInner
protected void decodeXmlInner(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean changeData) Overridden so that McIDAS-V can redirect to the version of this method that supports limiting the number of new windows.
- Overrides:
decodeXmlInner
in classIdvPersistenceManager
- Parameters:
xml
- The xml bundlefromCollab
- Was this bundle from the collaboration facility. If it was we treat it differently.xmlFile
- The filename where the xml came from - may be null.label
- The label to show in the guishowDialog
- Should the loadbundle dialog be shownshouldMerge
- Should we merge the windows/views in the bundle into the existing windowsbundleProperties
- set of propertiesdidRemoveAll
- Was remove all called before we decoded the xmlchangeData
- Should popup data path change dialog- See Also:
-
instantiateFromBundle
protected void instantiateFromBundle(Hashtable ht, boolean fromCollab, LoadBundleDialog loadDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData) throws Exception Overridden so that McIDAS-V can redirect to the version of this method that supports limiting the number of new windows.
- Overrides:
instantiateFromBundle
in classIdvPersistenceManager
- Parameters:
ht
- Contains the unpersisted objectsfromCollab
- Was this bundle from the collaboration facility. If it was we treat it differently.loadDialog
- The load bundle dialogshouldMerge
- Should we merge the windows/views in the bundle into the existing windowsbundleProperties
- set of propertiesdidRemoveAll
- Was remove all called before we decoded the xmlletUserChangeData
- Should popup data path change dialog- Throws:
Exception
- See Also:
-
decodeXml
public void decodeXml(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean removeAll, boolean letUserChangeData, boolean limitWindows) Hijacks the second part of the IDV bundle loading pipeline so that McIDAS-V can limit the number of new windows.- Parameters:
xml
- XML withinxmlFile
.fromCollab
- Whether or not this bundle load was started by collaborator.xmlFile
- Bundled XML file.label
- Label to use in dialog title.showDialog
- Whether or not dialogs should be shown.shouldMerge
- Whether or not displays should be merged into existing displays.bundleProperties
- Mapping of bundle properties.removeAll
- Whether or not existing displays should be removed.letUserChangeData
- Whether or not users can alter data sources.limitWindows
- Whether or not multiple windows should be created.- See Also:
-
decodeXmlInner
protected void decodeXmlInner(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData, boolean limitNewWindows) Hijacks the third part of the bundle loading pipeline.
- Parameters:
xml
- XML withinxmlFile
.fromCollab
- Whether or not this bundle load was started by collaborator.xmlFile
- Bundled XML file.label
- Label to use in dialog title.showDialog
- Whether or not dialogs should be shown.shouldMerge
- Whether or not displays should be merged into existing displays.bundleProperties
- Mapping of bundle properties.didRemoveAll
- Were existing displays removed?letUserChangeData
- Whether or not users can alter data sources.limitNewWindows
- Whether or not multiple windows should be created.- See Also:
-
checkForBadMaps
-
extractCompGroupVMs
Builds a list of an incoming bundle's
ViewManager
s that are part of a component group.The reason for only being interested in component groups is because any windows not using component groups will be made into a dynamic skin. The associated ViewManagers do not technically exist until the skin has been "built", so there's nothing to do. These ViewManagers must also be removed from the bundle's list of ViewManagers.
However, any ViewManagers associated with component groups still need to appear in the bundle's ViewManager list, and that's where this method comes into play!
- Parameters:
windows
- WindowInfos to be searched.- Returns:
- List of ViewManagers inside any component groups.
-
reverseCollisions
Does the work in fixing the collisions described in the
instantiateFromBundle
javadoc. Basically just queries theVMManager
for eachViewManager
. If a match is found, a new ID is generated and associated with the ViewManager, itsViewDescriptor
, and any associatedDisplayControl
s.- Parameters:
vms
- ViewManagers in the incoming bundle.- See Also:
-
injectComponentGroups
Builds a single window with a single component group. The group contains component holders that correspond to each window or component holder stored in the incoming bundle.- Parameters:
windows
- The bundle's list ofWindowInfos
.- Returns:
- List of WindowInfos that contains only one element/window.
- Throws:
Exception
- Bubble up any exceptions frommakeImpromptuSkin
.
-
betterInject
Builds an altered copy ofwindows
that preserves the number of windows while ensuring all displays are inside component holders.- Parameters:
windows
- List of bundled windows. Cannot benull
.- Returns:
windows
with all displays inside component groups.- Throws:
Exception
- Bubble up dynamic skin exceptions.- See Also:
-
buildHolders
Builds a list of component holders with all ofwindow
's displays.- Parameters:
window
- Window containing displays.- Returns:
List
of component holders forwindow
.- Throws:
Exception
- Bubble up any problems creating a dynamic skin.
-
mapDynamicSkins
Builds a list of any dynamic skins in the bundle and adds them to the UIMananger's "cache" of encountered ViewManagers.
- Parameters:
windows
- The bundle's windows.- Returns:
- Any dynamic skins in
windows
.
-
fixBulkDataSources
Attempts to reconcile McIDAS-V's ability to easily load all files in a directory with the way the IDV expects file data sources to behave upon unpersistence.The problem is twofold: the paths referenced in the data source's
Sources
may not exist, and the persistence code combines each individual file into a blob.The current solution is to note that the data source's
PollingInfo
is used byFilesDataSource.initWithPollingInfo()
to replace the contents of the data source's file paths. Simply overwritePollingInfo#filePaths
with the path to the blob.- Parameters:
ds
-List
ofDataSourceImpls
to inspect and/or fix. Cannot benull
.- Returns:
- true if able to load data ok
- See Also:
-
isBulkDataSource
Attempts to determine whether or not a givenDataSourceImpl
is the result of a McIDAS-V "bulk load".- Parameters:
d
-DataSourceImpl
to check. Cannot benull
.- Returns:
true
if theDataSourceImpl
matched the criteria.
-
instantiateFromBundle
protected void instantiateFromBundle(Hashtable ht, boolean fromCollab, LoadBundleDialog loadDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData, boolean limitNewWindows) throws Exception Overridden so that McIDAS-V can preempt the IDV's bundle loading. There will be problems if any of the incomingViewManagers
share an ID with an existing ViewManager. While this case may seem unlikely, it can be triggered when loading a bundle and then reloading. The problem is that the ViewManagers are the same, and if the previous ViewManagers were not removed, the IDV doesn't know what to do.Assigning the incoming ViewManagers a new ID, and associating its
ViewDescriptors
andDisplayControls
with the new ID fixes this problem.McIDAS-V also allows the user to limit the number of new windows the bundle may create. If enabled, one new window will be created, and any additional windows will become tabs (component holders) inside the new window.
McIDAS-V also prefers the bundles being loaded to be in a semi-regular regular state. For example, say you have bundle containing only data. The bundle will probably not contain lists of WindowInfos or ViewManagers. Perhaps the bundle contains nested component groups as well! McIDAS-V will alter the unpersisted bundle state (not the actual bundle file) to make it fit into the expected idiom. Mostly this just entails wrapping things in component groups and holders while "flattening" any nested component groups.
- Parameters:
ht
- Holds unpersisted objects.fromCollab
- Did the bundle come from the collab stuff?loadDialog
- Show the bundle loading dialog?shouldMerge
- Merge bundle contents into an existing window?bundleProperties
- If non-null, use the set of time indices for data sources?didRemoveAll
- Remove all data and displays?letUserChangeData
- Allow changes to the data path?limitNewWindows
- Only create one new window?- Throws:
Exception
- if there was a problem re-instantiating the bundle.- See Also:
-
wrapViewManagers
-
generateViewManagers
-
flattenWindows
Alterswindows
so that no windows in the bundle contain nested component groups.- Parameters:
windows
-List
of windows to "flatten".
-
flattenGroup
Altersnested
so that there are no nested component groups.- Parameters:
nested
- Component group to "flatten".- Returns:
- An altered version of
nested
that contains no nested component groups.
-
removeUIHolders
Remove component holders that are "UI-only"."UI-only" refers to things like having the dashboard embedded in a component holder.
- Parameters:
group
- Component group from which "UI-only" holders will be removed.- Returns:
- An altered
group
containing only component holders with displays.
-
populateEssentialLists
Ensures that the lists corresponding to the ids inids
actually exist intable
, even if they are empty.- Parameters:
ids
- IDs that should have a correspondingList
.table
- Table that should be a mapping ofids
toLists
.
-
removeUIHolders
Returns an altered copy ofwindows
containing only component holders that have displays.The IDV allows users to embed HTML controls or things like the dashboard into component holders. This ability, while powerful, could make for a confusing UI.
- Parameters:
windows
- Windows from which "UI-only" holders should be removed.- Returns:
List
of windows that contain displays.
-
makeDynSkin
Uses theViewManagers
ininfo
to build a dynamic skin.- Parameters:
info
- Window that needs to become a dynamic skin.- Returns:
McvComponentHolder
containing the ViewManagers insideinfo
.- Throws:
Exception
- Bubble up any XML problems.
-
buildDynamicSkin
public static IdvWindow buildDynamicSkin(int width, int height, int rows, int cols, boolean showWidgets, List<org.python.core.PyObject> panelTypes) throws Exception - Throws:
Exception
-
writeParameterSets
Write the parameter sets -
getParameterTypeNode
Get the node representing the parameterType- Parameters:
parameterType
- What type of parameter set- Returns:
- Element representing parameterType node
-
getAllParameterSetCategories
Get a list of all of the categories for the given parameterType- Parameters:
parameterType
- What type of parameter set- Returns:
- List of (String) categories
-
getAllParameterSets
Get the list ofParameterSet
s that are writable- Parameters:
parameterType
- The type of parameter set- Returns:
- List of writable parameter sets
-
addParameterSetCategory
Add the directory.- Parameters:
parameterType
- Type of parameter set.category
- Category (really a ">" delimited string).- Returns:
true
if the create was successful.false
if there already is a category with that name
-
deleteParameterSet
Delete the given parameter set- Parameters:
parameterType
- The type of parameter setset
- Parameter set to delete.
-
deleteParameterSetCategory
Delete the directory and all of its contents that the given category represents.- Parameters:
parameterType
- Type of parameter set.category
- Category (really a ">" delimited string).
-
renameParameterSet
Rename the parameter set.- Parameters:
parameterType
- Type of parameter set.set
- Parameter set.
-
moveParameterSet
Move the bundle to the given category area.- Parameters:
parameterType
- Type of parameter set.set
- Parameter set.categories
- Where to move to.
-
moveParameterSetCategory
Move the bundle category.- Parameters:
parameterType
- Type of parameter set.fromCategories
- Category to move.toCategories
- Where to move to.
-
saveParameterSet
Show the Save Parameter Set dialog.- Parameters:
parameterType
- Type of parameter set.parameterValues
- Values to save.- Returns:
- Whether or not the parameter set was saved.
-