Class ALcyFileFormat
Extension of ALcyGeneralFormat that assumes working with files on disk.
It assumes that the concrete subclass will implement the ALcyFormat.createModelDecoders()
method and return an array containing a single ILcdModelDecoder:
public class MyFormat extends ALcyFileFormat{
...
@Override
protected ILcdModelDecoder[] createModelDecoders(){
return new ILcdModelDecoder[]{
new MyFormatModelDecoder();
}
}
}
In return, this format will provide a ALcyFileTypeDescriptor for that
model decoder (see createModelDecoderFileTypeDescriptors() and
createModelDecoderFileTypeDescriptorGroups()).
The returned ALcyFileTypeDescriptor is parsed from the configuration file.
The configuration file supports the following properties (where propertyPrefix.
is the property prefix passed in the constructor):
# This is the text that will be presented to the user to describe the format.
# For example when using File | Open, the file chooser will contain this text
propertyPrefix.fileTypeDescriptor.displayName = My Files
# The default extension, that can be used encoding a model corresponding to this
# file type descriptor. This default extension is used if
# data needs to be saved in the format, and the user does
# not enter the extension himself.
# The extensions do not include the dot (.)
propertyPrefix.fileTypeDescriptor.defaultExtension = ext
# Comma separated list that contains the patterns to which
# the filenames of the format needs to match.
# E.g. "*.ext, SomePrefix*, *SomeSuffix" means that not only the files with extension "ext" will pass the filter,
# but also all files which start with "SomePrefix" and the ones which end on "SomeSuffix".
propertyPrefix.fileTypeDescriptor.filters = *.ext
# Comma separated list of the display names of the groups to which this file type filters
# must be added. E.g. "All Raster Files, SomeOtherGroup" means that this file type descriptor will
# be added to both the "All Raster Files" and the "SomeOtherGroup" group.
# These ID's are used to group several formats, so that the user can filter on a group basis. Eg. (s)he might only want
# to see all raster files.
# Note that there is a default "All Known Files" group, this group should not be added to the list, because every file type
# descriptor which is registered to the ILcyLucyEnv is by default added to the "All Known Files" group.
propertyPrefix.fileTypeDescriptor.groupIDs = All Vector Files
The configured file type descriptor will also be returned by the createModelEncoderFileTypeDescriptors()
method when the concrete subclass implements the ALcyFormat.createModelEncoders() method and returns exactly one model
encoder. Consult the javadoc of the createModelEncoderFileTypeDescriptors method for more details.
Note that when the concrete subclass creates multiple model decoder and/or encoder instances, it will be responsible to create file type descriptors for all those decoders and encoders by overriding the corresponding methods.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedALcyFileFormat(ILcyLucyEnv aLucyEnv, Class aClass, ALcyProperties aProperties) Deprecated.Better use the constructor with explicit long and short prefix, to avoid any confusion.protectedALcyFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties) Creates aALcyFileFormatfor the specified Lucy backend and configuration.protectedALcyFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties, String aPropertyPrefix) Creates aALcyFileFormatfor the specified Lucy backend and properties. -
Method Summary
Modifier and TypeMethodDescriptionprotected String[][]Creates file type descriptor groups for all decoders.protected ALcyFileTypeDescriptor[]Creates theALcyFileTypeDescriptorinstances corresponding to theILcdModelDecoderinstances created by this format.protected ALcyFileTypeDescriptor[]Creates the array ofALcyFileTypeDescriptorinstances for theILcdModelEncoderinstances created by this format.Methods inherited from class com.luciad.lucy.format.ALcyGeneralFormat
createAsynchronousPaintHintProvider, createDomainObjectWorkspaceCodecs, createLabelPlacementHintProvider, createModelWorkspaceCodecs, getLongPrefix, getLucyEnv, getProperties, getPropertyPrefix, getShortPrefixMethods inherited from class com.luciad.lucy.format.ALcyFormat
createAll, createBalloonContentProviders, createDataPropertyValueCustomizerPanelFactories, createDataSourceHandlerFileTypeDescriptorGroups, createDataSourceHandlerFileTypeDescriptors, createDataSourceHandlers, createDefaultModelDescriptorFactories, createDomainObjectCustomizerPanelFactories, createDomainObjectCustomizerPanelWorkspaceCodecs, createFormatBarFactory, createGXYLayerCustomizerPanelFactories, createGXYLayerCustomizerPanelWorkspaceCodecs, createGXYLayerDecoderFileTypeDescriptors, createGXYLayerDecoders, createGXYLayerEncoderFileTypeDescriptors, createGXYLayerEncoders, createGXYLayerFactory, createGXYLayerOfFormatFilter, createGXYLayerSelectionTransferHandlers, createGXYLayerStyleProvider, createGXYLayerTypeProvider, createGXYLayerWorkspaceCodecs, createLayerContextOfFormatFilter, createLayerHeightProviderFactory, createLayerMeasureProviderFactory, createModelContentTypeProvider, createModelContextOfFormatFilter, createModelCustomizerPanelFactories, createModelCustomizerPanelWorkspaceCodecs, createModelDecoders, createModelEncoderCustomizerPanelFactories, createModelEncoderCustomizerPanelWorkspaceCodecs, createModelEncoders, createModelFactory, createModelHeightProviderFactory, createModelMeasureProviderFactory, createModelMetaDataCustomizerPanelFactories, createModelMetaDataCustomizerPanelWorkspaceCodecs, 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, isGXYLayerOfFormat, isModelOfFormat, toString
-
Constructor Details
-
ALcyFileFormat
@Deprecated protected ALcyFileFormat(ILcyLucyEnv aLucyEnv, Class aClass, ALcyProperties aProperties) Deprecated.Better use the constructor with explicit long and short prefix, to avoid any confusion. Functionally equivalent toALcyFileFormat(aLucyEnv, ALcyTool.getLongPrefix(aClass), ALcyTool.getShortPrefix(aClass), aProperties).- Parameters:
aLucyEnv- The Lucy backend for which to create this format. Must not benull.aClass- A representative class for using thisALcyApplicationPaneTool, normally an extension ofALcyAddOn. It is used to retrieve the long and short prefixes usinggetLongPrefixandgetShortPrefix. These prefixes are stored in workspace files, so if backward compatibility is a concern (e.g. read an old workspace file), the given class or its name must never change.aProperties- TheALcyPropertiesholding the configuration of this format. Must not benull.- See Also:
-
ALcyFileFormat
protected ALcyFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties) Creates a
ALcyFileFormatfor the specified Lucy backend and configuration. Shorthand forALcyFileFormat( aLucyEnv, aLongPrefix, aShortPrefix, aProperties, aShortPrefix )- Parameters:
aLucyEnv- The Lucy backend for which this format is created. Must not benull.aLongPrefix- Thelong prefixof this format. Must not benull.aShortPrefix- The short prefix of this format. This prefix will also be set as the property prefix and be used when reading values fromaProperties. SeeALcyGeneralFormat.getShortPrefix()andALcyGeneralFormat.getPropertyPrefix(). Must not benull.aProperties- TheALcyPropertiesholding the configuration of this format. Must not benull.
-
ALcyFileFormat
protected ALcyFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties, String aPropertyPrefix) Creates a
ALcyFileFormatfor the specified Lucy backend and properties.- Parameters:
aLucyEnv- The Lucy backend for which this format is created. Must not benull.aLongPrefix- Thelong prefixof this format. Must not benull.aShortPrefix- Theshort prefixof this format. Must not benull.aProperties- TheALcyPropertiesholding the configuration of this format. Must not benull.aPropertyPrefix- The prefix to use when deriving keys to use for theALcyProperties.
-
-
Method Details
-
createModelDecoderFileTypeDescriptors
Creates the
ALcyFileTypeDescriptorinstances corresponding to theILcdModelDecoderinstances created by this format.This implementation returns an array with only one element, parsed from the properties as described in the class comment. If there is not exactly one
ILcdModelDecodercreated, this method must be overridden to return an array of matching length.- Specified by:
createModelDecoderFileTypeDescriptorsin classALcyFormat- Returns:
- The array of
ALcyFileTypeDescriptorinstances. Must not benull. Its length should be equal to the length of the array created bycreateModelDecoders. It may containnull.
-
createModelDecoderFileTypeDescriptorGroups
Creates file type descriptor groups for all decoders. The groups may be empty, but the group count must equal the decoder count.
This implementation returns an array with only one element, parsed from the properties as described in the class comment. If there is not exactly one
ILcdModelDecodercreated, this method must be overridden to return an array of matching length.- Overrides:
createModelDecoderFileTypeDescriptorGroupsin classALcyFormat- Returns:
- A two-dimensional array containing the groups for the
ALcyFileTypeDescriptorinstances of theILcdModelDecoders. The first dimension must be equal to the length of the array ofILcdModelDecoderinstances created by this format. It must not containnull, but may contain empty arrays.
-
createModelEncoderFileTypeDescriptors
Creates the array of
ALcyFileTypeDescriptorinstances for theILcdModelEncoderinstances created by this format.When the
ALcyFormat.createModelEncoders()andALcyFormat.createModelDecoders()methods both return exactly one instance, this method will return theALcyFileTypeDescriptorwhich is configured in the configuration file.- Overrides:
createModelEncoderFileTypeDescriptorsin classALcyFormat- Returns:
- The array of
ALcyFileTypeDescriptorinstances. Must not benulland its length must be equal to the length of the array ofILcdModelEncoderinstances created by this format. May containnull. - See Also:
-