public abstract class ALcyFileFormat extends ALcyGeneralFormat
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.
Modifier | Constructor and Description |
---|---|
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 to
ALcyFileFormat(aLucyEnv, ALcyTool.getLongPrefix(aClass),
ALcyTool.getShortPrefix(aClass), aProperties) . |
protected |
ALcyFileFormat(ILcyLucyEnv aLucyEnv,
String aLongPrefix,
String aShortPrefix,
ALcyProperties aProperties)
Creates a
ALcyFileFormat for the specified Lucy backend and configuration. |
protected |
ALcyFileFormat(ILcyLucyEnv aLucyEnv,
String aLongPrefix,
String aShortPrefix,
ALcyProperties aProperties,
String aPropertyPrefix)
Creates a
ALcyFileFormat for the specified Lucy backend and properties. |
Modifier and Type | Method and Description |
---|---|
protected String[][] |
createModelDecoderFileTypeDescriptorGroups()
Creates file type descriptor groups for all decoders.
|
protected ALcyFileTypeDescriptor[] |
createModelDecoderFileTypeDescriptors()
Creates the
ALcyFileTypeDescriptor instances corresponding to the
ILcdModelDecoder instances created by this format. |
protected ALcyFileTypeDescriptor[] |
createModelEncoderFileTypeDescriptors()
Creates the array of
ALcyFileTypeDescriptor instances for the
ILcdModelEncoder instances created by this format. |
createAsynchronousPaintHintProvider, createDomainObjectWorkspaceCodecs, createLabelPlacementHintProvider, createModelWorkspaceCodecs, getLongPrefix, getLucyEnv, getProperties, getPropertyPrefix, getShortPrefix
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
@Deprecated protected ALcyFileFormat(ILcyLucyEnv aLucyEnv, Class aClass, ALcyProperties aProperties)
ALcyFileFormat(aLucyEnv, ALcyTool.getLongPrefix(aClass),
ALcyTool.getShortPrefix(aClass), aProperties)
.aLucyEnv
- The Lucy backend for which to create this format. Must not be
null
.aClass
- A representative class for using this ALcyApplicationPaneTool
,
normally an extension of ALcyAddOn
. It is used to retrieve the
long and short prefixes using getLongPrefix
and getShortPrefix
. 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
- The ALcyProperties
holding the configuration of this format.
Must not be null
.ALcyFileFormat(com.luciad.lucy.ILcyLucyEnv, String, String, com.luciad.lucy.util.properties.ALcyProperties)
protected ALcyFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties)
Creates a ALcyFileFormat
for the specified Lucy backend and configuration.
Shorthand for ALcyFileFormat( aLucyEnv, aLongPrefix, aShortPrefix, aProperties,
aShortPrefix )
aLucyEnv
- The Lucy backend for which this format is created. Must not be
null
.aLongPrefix
- The long prefix
of this format. Must not be
null
.aShortPrefix
- The short prefix of this format. This prefix will also be set as the property prefix and be used when reading values from aProperties
.
See ALcyGeneralFormat.getShortPrefix()
and ALcyGeneralFormat.getPropertyPrefix()
.
Must not be null
.aProperties
- The ALcyProperties
holding the configuration of this format.
Must not be null
.protected ALcyFileFormat(ILcyLucyEnv aLucyEnv, String aLongPrefix, String aShortPrefix, ALcyProperties aProperties, String aPropertyPrefix)
Creates a ALcyFileFormat
for the specified Lucy backend and properties.
aLucyEnv
- The Lucy backend for which this format is created. Must not be
null
.aLongPrefix
- The long prefix
of this format. Must not be
null
.aShortPrefix
- The short prefix
of this format. Must not be
null
.aProperties
- The ALcyProperties
holding the configuration of this
format. Must not be null
.aPropertyPrefix
- The prefix to use when deriving keys to use for the
ALcyProperties
.protected ALcyFileTypeDescriptor[] createModelDecoderFileTypeDescriptors()
Creates the ALcyFileTypeDescriptor
instances corresponding to the
ILcdModelDecoder
instances 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 ILcdModelDecoder
created, this method must be overridden to return an array of matching length.
createModelDecoderFileTypeDescriptors
in class ALcyFormat
ALcyFileTypeDescriptor
instances. Must not be
null
. Its length should be equal to the length of the array created by
createModelDecoders
. It may contain null
.protected String[][] 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 ILcdModelDecoder
created, this method must be overridden to return an array of matching length.
createModelDecoderFileTypeDescriptorGroups
in class ALcyFormat
ALcyFileTypeDescriptor
instances of the ILcdModelDecoder
s. The first dimension must be equal to
the length of the array of ILcdModelDecoder
instances created by this
format. It must not contain null
, but may contain empty arrays.protected ALcyFileTypeDescriptor[] createModelEncoderFileTypeDescriptors()
Creates the array of ALcyFileTypeDescriptor
instances for the
ILcdModelEncoder
instances created by this format.
When the ALcyFormat.createModelEncoders()
and ALcyFormat.createModelDecoders()
methods both return exactly
one instance, this method will return the ALcyFileTypeDescriptor
which is configured in the configuration file.
createModelEncoderFileTypeDescriptors
in class ALcyFormat
ALcyFileTypeDescriptor
instances. Must not be
null
and its length must be equal to the length of the array of
ILcdModelEncoder
instances created by this format. May contain
null
.ALcyFormat.createModelEncoders()