public class PersistenceManager extends IdvPersistenceManager
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 in injectComponentGroups(List)
.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 the VMManager
. If limiting
windows is off, everything will be caught properly by the unpersisting
facilities in UIManager
.IdvPersistenceManager
,
UIManager
IdvPersistenceManager.DataSourceComponent
Modifier and Type | Field and Description |
---|---|
private static String |
ATTR_NAME |
private static String |
BUILDWINDOW_COMP_GROUP_HIDE_WIDGETS |
private static String |
BUILDWINDOW_PROPS_GENERAL |
private static String |
BUILDWINDOW_SKIN_TEMPLATE
Dynamic skin template for buildWindow.
|
private boolean |
bundleLoading
Whether or not a bundle is actively loading.
|
private static String |
DYNSKIN_ATTR_CLASS |
private static String |
DYNSKIN_ATTR_COLS |
private static String |
DYNSKIN_ATTR_ID |
private static String |
DYNSKIN_ATTR_PROPS |
private static String |
DYNSKIN_ATTR_ROWS |
private static String |
DYNSKIN_ATTR_VIEWID |
private static String |
DYNSKIN_ID_VALUE |
private static String |
DYNSKIN_PROPS_GENERAL |
private static String |
DYNSKIN_PROPS_GLOBE |
private static String |
DYNSKIN_TAG_PANEL |
private static String |
DYNSKIN_TAG_VIEW |
private static String |
DYNSKIN_TMPNAME |
static String |
ID_MCV_VERSION
Key used to access a bundle's McIDAS-V in-depth versioning info section.
|
private ViewManager |
lastBeforeBundle
Stores the last active ViewManager from before a bundle load.
|
private JRadioButton |
layoutOnlyRadio
Use radio buttons to control state saving
|
private JRadioButton |
layoutSourcesDataRadio |
private JRadioButton |
layoutSourcesRadio |
(package private) static LogUtil.LogCategory |
log_ |
private static org.slf4j.Logger |
logger |
static String |
MACRO_ZIDVPATH
Macro used as a place holder for wherever the IDV decides to place
extracted contents of a bundle.
|
private boolean |
mergeBundledLayers
Whether or not the user wants to attempt merging bundled layers into
current displays.
|
private static String |
NEW_COMP_STUFF |
private static String |
NEW_SOURCE_MACRO |
private static String |
OLD_COMP_STUFF |
private static String |
OLD_SOURCE_MACRO |
private XmlResourceCollection |
parameterSets
Cache the parameter sets XML
|
private static Document |
parameterSetsDocument |
private static Element |
parameterSetsRoot |
private boolean |
savingDefaultLayout
Is the bundle being saved a layout bundle?
|
private static String |
SIMPLE_SKIN_TEMPLATE
XML template for generating dynamic skins.
|
private static String |
TAG_DEFAULT |
private static String |
TAG_FOLDER |
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
contents, dialog, frame, window
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_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 and Description |
---|
PersistenceManager()
Java requires this constructor.
|
PersistenceManager(IntegratedDataViewer idv)
Create a new persistence manager.
|
Modifier and Type | Method and Description |
---|---|
boolean |
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
remove
ReadoutProbes from the displayControls that are getting persisted. |
protected List<WindowInfo> |
betterInject(List<WindowInfo> windows)
Builds an altered copy of
windows 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 of
window '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 set
|
void |
deleteParameterSetCategory(String parameterType,
String category)
Delete the directory and all of its contents that the given category
represents.
|
void |
doSaveAs()
Have the user select an xidv filename and
write the current application state to it.
|
void |
doSaveAsDefaultLayout() |
protected static List<ViewManager> |
extractCompGroupVMs(List<WindowInfo> windows)
Builds a list of an incoming bundle's
ViewManager s that are part of a component
group. |
private void |
fixBulkDataSources(List<DataSourceImpl> ds)
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)
Alters
nested so that there are no nested component groups. |
protected void |
flattenWindows(List<WindowInfo> windows)
Alters
windows so that no windows in the bundle contain
nested component groups. |
private List<ViewManager> |
generateViewManagers(List<DisplayControlImpl> controls) |
List<String> |
getAllParameterSetCategories(String parameterType)
Get a list of all of the categories for the given parameterType
|
List<ParameterSet> |
getAllParameterSets(String parameterType)
Get the list of
ParameterSet s that are writable |
JPanel |
getFileAccessory()
Create, if needed, and return te GUI panel to put into the
file dialog when saving a file.
|
ViewManager |
getLastViewManager()
Returns the last active
ViewManager from before loading
the most recent bundle. |
List |
getLocalBundles()
Create, if needed, and return the list of locally saved
SavedBundle s |
boolean |
getMergeBundledLayers() |
private Element |
getParameterTypeNode(String parameterType)
Get the node representing the parameterType
|
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
|
protected 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 |
isBulkDataSource(DataSourceImpl d)
Attempts to determine whether or not a given
DataSourceImpl is
the result of a McIDAS-V "bulk load". |
boolean |
isBundleLoading()
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.
|
McvComponentHolder |
makeDynSkin(WindowInfo info)
Uses the
ViewManagers in info
to build a dynamic skin. |
List<ViewManager> |
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 in
ids
actually exist in table , even if they are empty. |
protected static List<IdvComponentHolder> |
removeUIHolders(IdvComponentGroup group)
Remove component holders that are "UI-only".
|
protected static List<WindowInfo> |
removeUIHolders(List<WindowInfo> windows)
Returns an altered copy of
windows containing only
component holders that have displays. |
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 the
instantiateFromBundle 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's
McIDAS-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 |
writeParameterSets()
Write the parameter sets
|
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, doOpenDefault, 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
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
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
public static final String ID_MCV_VERSION
private static final org.slf4j.Logger logger
public static final String MACRO_ZIDVPATH
static LogUtil.LogCategory log_
private boolean savingDefaultLayout
private ViewManager lastBeforeBundle
private boolean mergeBundledLayers
private boolean bundleLoading
private XmlResourceCollection parameterSets
private static Document parameterSetsDocument
private static Element parameterSetsRoot
private static final String TAG_FOLDER
private static final String TAG_DEFAULT
private static final String ATTR_NAME
private JRadioButton layoutOnlyRadio
private JRadioButton layoutSourcesRadio
private JRadioButton layoutSourcesDataRadio
private static final String OLD_COMP_STUFF
private static final String NEW_COMP_STUFF
private static final String OLD_SOURCE_MACRO
private static final String NEW_SOURCE_MACRO
private static final String DYNSKIN_TMPNAME
private static final String DYNSKIN_TAG_PANEL
private static final String DYNSKIN_TAG_VIEW
private static final String DYNSKIN_ATTR_ID
private static final String DYNSKIN_ATTR_COLS
private static final String DYNSKIN_ATTR_ROWS
private static final String DYNSKIN_ATTR_PROPS
private static final String DYNSKIN_ATTR_CLASS
private static final String DYNSKIN_ATTR_VIEWID
private static final String DYNSKIN_PROPS_GLOBE
private static final String DYNSKIN_PROPS_GENERAL
private static final String DYNSKIN_ID_VALUE
private static final String SIMPLE_SKIN_TEMPLATE
private static final String BUILDWINDOW_COMP_GROUP_HIDE_WIDGETS
private static final String BUILDWINDOW_PROPS_GENERAL
private static final String BUILDWINDOW_SKIN_TEMPLATE
public PersistenceManager()
public PersistenceManager(IntegratedDataViewer idv)
idv
- Reference back to the application session.
Cannot be null
.IdvPersistenceManager.IdvPersistenceManager(IntegratedDataViewer)
public ViewManager getLastViewManager()
ViewManager
from before loading
the most recent bundle.null
if there was no previous
ViewManager (such as loading a default bundle/layout).public boolean isBundleLoading()
true
if instantiateFromBundle
is doing
what it needs to do, or false
.instantiateFromBundle(Hashtable, boolean, LoadBundleDialog, boolean, Hashtable, boolean, boolean, boolean)
public boolean getMergeBundledLayers()
private void setMergeBundledLayers(boolean newValue)
public boolean getSaveDataSources()
ucar.unidata.idv.IdvPersistenceManager
getSaveDataSources
in class IdvPersistenceManager
public boolean getSaveDisplays()
ucar.unidata.idv.IdvPersistenceManager
getSaveDisplays
in class IdvPersistenceManager
public boolean getSaveViewState()
ucar.unidata.idv.IdvPersistenceManager
getSaveViewState
in class IdvPersistenceManager
public boolean getSaveJython()
ucar.unidata.idv.IdvPersistenceManager
getSaveJython
in class IdvPersistenceManager
public void doSaveAsDefaultLayout()
public JPanel getFileAccessory()
ucar.unidata.idv.IdvPersistenceManager
getFileAccessory
in class IdvPersistenceManager
public void doSaveAs()
doSaveAs
in class IdvPersistenceManager
public void saveDisplayControlFavorite(DisplayControl displayControl, String templateName)
McIDAS-V/displaytemplates
directory.saveDisplayControlFavorite
in class IdvPersistenceManager
displayControl
- Display control to write.templateName
- Possibly null
initial name for the template.protected boolean addToBundle(Hashtable data, List dataSources, List displayControls, List viewManagers, String jython)
ReadoutProbes
from the displayControls
that are getting persisted.addToBundle
in class IdvPersistenceManager
data
- Holds the bundle statedataSources
- List of data sources to adddisplayControls
- List of displays to addviewManagers
- List of view managers to addjython
- jython to addpublic List getLocalBundles()
ucar.unidata.idv.IdvPersistenceManager
SavedBundle
sgetLocalBundles
in class IdvPersistenceManager
protected void loadBundlesInDirectory(List<SavedBundle> allBundles, List categories, File file)
ucar.unidata.idv.IdvPersistenceManager
loadBundlesInDirectory
in class IdvPersistenceManager
allBundles
- The list to put the bundles incategories
- Categories for the SavedBundle objectsfile
- Where to lookpublic 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.
decodeXml
in class IdvPersistenceManager
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 dialogdecodeXml(String, boolean, String, String, boolean, boolean,
Hashtable, boolean, boolean, boolean)
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.
decodeXmlFile
in class IdvPersistenceManager
xmlFile
- filelabel
- labelcheckToRemove
- check to removeletUserChangeData
- if true then ask user to change data pathsbundleProperties
- set of propertiesIdvPersistenceManager.decodeXmlFile(String, String, boolean, boolean, Hashtable)
,
decodeXml(String, boolean, String, String, boolean, boolean, Hashtable,
boolean, boolean, boolean)
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.
decodeXmlInner
in class IdvPersistenceManager
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 dialogdecodeXmlInner(String, boolean, String, String, boolean, boolean, Hashtable, boolean, boolean, boolean)
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.
instantiateFromBundle
in class IdvPersistenceManager
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 dialogException
instantiateFromBundle(Hashtable, boolean, LoadBundleDialog,
boolean, Hashtable, boolean, boolean, boolean)
public void decodeXml(String xml, boolean fromCollab, String xmlFile, String label, boolean showDialog, boolean shouldMerge, Hashtable bundleProperties, boolean removeAll, boolean letUserChangeData, boolean limitWindows)
xml
- XML within xmlFile
.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.IdvPersistenceManager.decodeXml(String, boolean,
String, String, boolean, boolean, Hashtable, boolean, boolean)
,
decodeXmlInner(String, boolean, String, String, boolean, boolean,
Hashtable, boolean, boolean, boolean)
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.
xml
- XML within xmlFile
.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.IdvPersistenceManager.decodeXmlInner(String, boolean, String, String, boolean, boolean, Hashtable, boolean, boolean)
,
instantiateFromBundle(Hashtable, boolean, LoadBundleDialog, boolean, Hashtable, boolean, boolean, boolean)
private void checkForBadMaps(String bundlePath)
protected static List<ViewManager> extractCompGroupVMs(List<WindowInfo> windows)
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!
windows
- WindowInfos to be searched.protected void reverseCollisions(List<ViewManager> vms)
Does the work in fixing the collisions described in the
instantiateFromBundle
javadoc. Basically just queries the
VMManager
for each
ViewManager
. If a match is found, a new ID is
generated and associated with the ViewManager, its
ViewDescriptor
, and any associated
DisplayControl
s.
vms
- ViewManagers in the incoming bundle.instantiateFromBundle(Hashtable, boolean, LoadBundleDialog, boolean, Hashtable, boolean, boolean, boolean)
protected List<WindowInfo> injectComponentGroups(List<WindowInfo> windows) throws Exception
windows
- The bundle's list of
WindowInfos
.Exception
- Bubble up any exceptions from
makeImpromptuSkin
.protected List<WindowInfo> betterInject(List<WindowInfo> windows) throws Exception
windows
that preserves the
number of windows while ensuring all displays are inside component
holders.windows
- List of bundled windows. Cannot be null
.windows
with all displays inside component groups.Exception
- Bubble up dynamic skin exceptions.injectComponentGroups(List)
protected List<IdvComponentHolder> buildHolders(WindowInfo window) throws Exception
window
's
displays.window
- Window containing displays.List
of component holders for window
.Exception
- Bubble up any problems creating a dynamic skin.public List<ViewManager> 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.
windows
- The bundle's windows.windows
.private void fixBulkDataSources(List<DataSourceImpl> ds)
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 by FilesDataSource.initWithPollingInfo()
to replace the contents of the data source's file paths. Simply
overwrite PollingInfo#filePaths
with the path to the blob.
ds
- List
of DataSourceImpl
s to inspect and/or fix.
Cannot be null
.isBulkDataSource(DataSourceImpl)
private boolean isBulkDataSource(DataSourceImpl d)
DataSourceImpl
is
the result of a McIDAS-V "bulk load".d
- DataSourceImpl
to check. Cannot be null
.true
if the DataSourceImpl
matched the criteria.protected void instantiateFromBundle(Hashtable ht, boolean fromCollab, LoadBundleDialog loadDialog, boolean shouldMerge, Hashtable bundleProperties, boolean didRemoveAll, boolean letUserChangeData, boolean limitNewWindows) throws Exception
ViewManagers
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
and
DisplayControls
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.
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?Exception
- if there was a problem re-instantiating the bundle.IdvPersistenceManager.instantiateFromBundle(Hashtable, boolean, LoadBundleDialog, boolean, Hashtable, boolean, boolean)
private List<WindowInfo> wrapViewManagers(List<ViewManager> vms)
private List<ViewManager> generateViewManagers(List<DisplayControlImpl> controls)
protected void flattenWindows(List<WindowInfo> windows)
windows
so that no windows in the bundle contain
nested component groups.windows
- List
of windows to "flatten".protected IdvComponentGroup flattenGroup(IdvComponentGroup nested)
nested
so that there are no nested component groups.nested
- Component group to "flatten".nested
that contains no
nested component groups.protected static List<IdvComponentHolder> removeUIHolders(IdvComponentGroup group)
"UI-only" refers to things like having the dashboard embedded in a component holder.
group
- Component group from which "UI-only" holders will
be removed.group
containing only component holders
with displays.protected static void populateEssentialLists(String[] ids, Hashtable<String,Object> table)
ids
actually exist in table
, even if they are empty.ids
- IDs that should have a corresponding List
.table
- Table that should be a mapping of ids
to
Lists
.protected static List<WindowInfo> removeUIHolders(List<WindowInfo> windows)
windows
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.
windows
- Windows from which "UI-only" holders should be
removed.List
of windows that contain displays.public McvComponentHolder makeDynSkin(WindowInfo info) throws Exception
ViewManagers
in info
to build a dynamic skin.info
- Window that needs to become a dynamic skin.McvComponentHolder
containing the ViewManagers inside
info
.Exception
- Bubble up any XML problems.public static IdvWindow buildDynamicSkin(int width, int height, int rows, int cols, boolean showWidgets, List<org.python.core.PyObject> panelTypes) throws Exception
Exception
public void writeParameterSets()
private Element getParameterTypeNode(String parameterType)
parameterType
- What type of parameter setpublic List<String> getAllParameterSetCategories(String parameterType)
parameterType
- What type of parameter setpublic List<ParameterSet> getAllParameterSets(String parameterType)
ParameterSet
s that are writableparameterType
- The type of parameter setpublic boolean addParameterSetCategory(String parameterType, String category)
parameterType
- Type of parameter set.category
- Category (really a ">" delimited string).true
if the create was successful. false
if
there already is a category with that namepublic void deleteParameterSet(String parameterType, ParameterSet set)
parameterType
- The type of parameter setset
- Parameter set to delete.public void deleteParameterSetCategory(String parameterType, String category)
parameterType
- Type of parameter set.category
- Category (really a ">" delimited string).public void renameParameterSet(String parameterType, ParameterSet set)
parameterType
- Type of parameter set.set
- Parameter set.public void moveParameterSet(String parameterType, ParameterSet set, List categories)
parameterType
- Type of parameter set.set
- Parameter set.categories
- Where to move to.public void moveParameterSetCategory(String parameterType, List fromCategories, List toCategories)
parameterType
- Type of parameter set.fromCategories
- Category to move.toCategories
- Where to move to.public boolean saveParameterSet(String parameterType, Hashtable parameterValues)
parameterType
- Type of parameter set.parameterValues
- Values to save.