Class TLcyMutableFileFormatWrapper
This format decorator adds workspace support for saving changed models. When saving the workspace, it uses the
format's ILcdModelEncoder
to export every ILcdModel
of this format into a companion file. When
the workspace is decoded, the companion file is decoded to restore the model, using the ILcdModelDecoder
.
This format wrapper creates a ALcyWorkspaceObjectCodec
for the ILcdModel
's to achieve this, so
you shouldn't have to provide one yourself.
The name of the companion file is either automatically chosen, or the user is prompted for input. See
TLcyMutableFileFormatWrapper(ALcyFormat, boolean, boolean)
.
Assumptions:
- model.getModelDescriptor().getDisplayName() is in sync with
layer.getLabel(), so that getDisplayName() can be used as the name to present
to the user. For instance,
ILcySimulatorModelFactory
only gets access to the model, not the layer. - The
ILcdModelEncoder
s must adapt the source name of the model descriptor in their export method, so that the source name of the model always corresponds to the location where the model was last saved. In code:ILcdModel.getModelDescriptor().getSourceName()
must be equal to the last destination name given toILcdModelEncoder.export
.
-
Constructor Summary
ConstructorDescriptionTLcyMutableFileFormatWrapper
(ALcyFormat aFormat) Creates a wrapper for the given format that enables models to be saved.TLcyMutableFileFormatWrapper
(ALcyFormat aFormat, boolean aAutoSave, boolean aWorkspaceOnly) Creates a wrapper for the given format that enables models to be saved. -
Method Summary
Methods inherited from class com.luciad.lucy.format.ALcyFormatWrapper
createAll, createAsynchronousPaintHintProvider, createBalloonContentProviders, createDataPropertyValueCustomizerPanelFactories, createDataSourceHandlerFileTypeDescriptorGroups, createDataSourceHandlerFileTypeDescriptors, createDataSourceHandlers, createDefaultModelDescriptorFactories, createDomainObjectCustomizerPanelFactories, createDomainObjectCustomizerPanelWorkspaceCodecs, createDomainObjectWorkspaceCodecs, createFormatBarFactory, createGXYLayerCustomizerPanelFactories, createGXYLayerCustomizerPanelWorkspaceCodecs, createGXYLayerDecoderFileTypeDescriptors, createGXYLayerDecoders, createGXYLayerEncoderFileTypeDescriptors, createGXYLayerEncoders, createGXYLayerFactory, createGXYLayerSelectionTransferHandlers, createGXYLayerStyleProvider, createGXYLayerTypeProvider, createGXYLayerWorkspaceCodecs, createLabelPlacementHintProvider, createLayerHeightProviderFactory, createLayerMeasureProviderFactory, createModelContentTypeProvider, createModelCustomizerPanelFactories, createModelCustomizerPanelWorkspaceCodecs, createModelDecoderFileTypeDescriptorGroups, createModelDecoderFileTypeDescriptors, createModelDecoders, createModelEncoderCustomizerPanelFactories, createModelEncoderCustomizerPanelWorkspaceCodecs, createModelEncoderFileTypeDescriptors, createModelEncoders, createModelFactory, createModelHeightProviderFactory, createModelMeasureProviderFactory, createModelMetaDataCustomizerPanelFactories, createModelMetaDataCustomizerPanelWorkspaceCodecs, createModelWorkspaceCodecs, getFormat, getLongPrefix, getLucyEnv, getShortPrefix, isGXYLayerOfFormat, isModelOfFormat
Methods inherited from class com.luciad.lucy.format.ALcyFormat
createGXYLayerOfFormatFilter, createLayerContextOfFormatFilter, createModelContextOfFormatFilter, createModelOfFormatFilter, getAsynchronousPaintHintProvider, getBalloonContentProviders, getDataPropertyValueCustomizerPanelFactories, getDataSourceHandlerFileTypeDescriptorGroups, getDataSourceHandlerFileTypeDescriptors, getDataSourceHandlers, getDefaultModelDescriptorFactories, getDomainObjectCustomizerPanelFactories, getDomainObjectCustomizerPanelWorkspaceCodecs, getDomainObjectWorkspaceCodecs, getFormatBarFactory, getGXYLayerCustomizerPanelFactories, getGXYLayerCustomizerPanelWorkspaceCodecs, getGXYLayerDecoderFileTypeDescriptors, getGXYLayerDecoders, getGXYLayerEncoderFileTypeDescriptors, getGXYLayerEncoders, getGXYLayerFactory, getGXYLayerSelectionTransferHandlers, getGXYLayerStyleProvider, getGXYLayerTypeProvider, getGXYLayerWorkspaceCodecs, getLabelPlacementHintProvider, getLayerHeightProviderFactory, getLayerMeasureProviderFactory, getModelContentTypeProvider, getModelCustomizerPanelFactories, getModelCustomizerPanelWorkspaceCodecs, getModelDecoderFileTypeDescriptorGroups, getModelDecoderFileTypeDescriptors, getModelDecoders, getModelEncoderCustomizerPanelFactories, getModelEncoderCustomizerPanelWorkspaceCodecs, getModelEncoderFileTypeDescriptors, getModelEncoders, getModelFactory, getModelHeightProviderFactory, getModelMeasureProviderFactory, getModelMetaDataCustomizerPanelFactories, getModelMetaDataCustomizerPanelWorkspaceCodecs, getModelWorkspaceCodecs, toString
-
Constructor Details
-
TLcyMutableFileFormatWrapper
Creates a wrapper for the given format that enables models to be saved. When a model is modified, it will ask the user to save the changes to a file name of choice.
Equivalent to
TLcyMutableFileFormatWrapper(aFormat, false, false)
- Parameters:
aFormat
- the format to add workspace saving for.- See Also:
-
TLcyMutableFileFormatWrapper
Creates a wrapper for the given format that enables models to be saved.- Parameters:
aFormat
- the format to add workspace saving for.aAutoSave
- iftrue
, it automatically picks a name for the companion file to save the model to. Iffalse
, the user is prompted with a file chooser to pick an appropriate name for the companion file.aWorkspaceOnly
- iftrue
, hides the format's model decoders and encoders fromILcyLucyEnv
. This means the user for example won't be able to load a companion file directly using File|Open. Iffalse
, the model decoders and encoders of the format are registered with theILcyLucyEnv
, as is normally the case, so they can be used by other parts of the application.
-