public class TLcyMutableFileFormatWrapper extends ALcyFormatWrapper
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:
ILcySimulatorModelFactory
only gets access to the model,
not the layer.
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 to ILcdModelEncoder.export
.
Constructor and Description |
---|
TLcyMutableFileFormatWrapper(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.
|
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
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
public TLcyMutableFileFormatWrapper(ALcyFormat aFormat)
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)
aFormat
- the format to add workspace saving for.TLcyMutableFileFormatWrapper(ALcyFormat, boolean, boolean)
public TLcyMutableFileFormatWrapper(ALcyFormat aFormat, boolean aAutoSave, boolean aWorkspaceOnly)
aFormat
- the format to add workspace saving for.aAutoSave
- if true
, it automatically picks a name for the companion file to save the model
to. If false
, the user is prompted with a file chooser to pick an appropriate
name for the companion file.aWorkspaceOnly
- if true
, hides the format's model decoders and encoders from ILcyLucyEnv
.
This means the user for example won't be able to load a companion file directly using File|Open.
If false
, the model decoders and encoders of the format are registered with the
ILcyLucyEnv
, as is normally the case, so they can be used by other parts of the
application.