Class TLcyDataFormatManager
ILcdModelDecoder
:getCompositeModelDecoder()
ILcdModelEncoder
:getCompositeModelEncoder()
ALcyDataSourceHandler
:getCompositeDataSourceHandler()
ILcdGXYLayerFactory
:getCompositeGXYLayerFactory()
ILcyGXYLayerTypeProvider
:getCompositeGXYLayerTypeProvider()
ILcyAsynchronousPaintHintProvider
:getCompositeAsynchronousPaintHintProvider()
ILcyModelContentTypeProvider
:getCompositeModelContentTypeProvider()
ILcdGXYLayerDecoder
:getCompositeGXYLayerDecoder()
ILcdGXYLayerEncoder
:getCompositeGXYLayerEncoder()
ILcdModelReferenceDecoder
:getCompositeModelReferenceDecoder()
TLcyDataFormatManager
is that it allows
to programmatically handle data sources, for example opening data files. This can be done
using handleDataSources(ILcdDataSource[], ILcyGenericMapComponent, Component)
.
Consult the "Loading data in Lucy" chapter in the Lucy developer guide for more information about how this class can be used for data loading, and for some examples.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class that represents the logic to choose aILcdModelDecoder
orALcyDataSourceHandler
out of a list of candidates.static class
Class that represents the logic to choose one or multipleILcyGenericMapComponent
(s) out of a list of candidates. -
Constructor Summary
ConstructorDescriptionTLcyDataFormatManager
(ILcyLucyEnv aLucyEnv) Create a new data format manager -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataSourceListener
(ILcyDataSourceListener aDataSourceListener) Adds the givenILcyDataSourceListener
.Deprecated.Deprecated.Usenew TLcyCompositeDataSourceHandler(aLucyEnv)
instead.Returns theTLcyCompositeFileTypeDescriptor
that represents the list of associatedALcyFileTypeDescriptor
s.Deprecated.Usenew TLcyCompositeGXYLayerDecoder(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeGXYLayerEncoder(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeGXYLayerFactory(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeGXYLayerTypeProvider(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeModelContentTypeProvider(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeModelDecoder(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeModelEncoder(aLucyEnv)
instead.Deprecated.Usenew TLcyCompositeModelReferenceDecoder(aLucyEnv)
instead.Returns theALcyHandlerChooser
that is currently used.Returns the one and onlyILcdLogListener
to which end-user messages will be passed when handling data.Returns theALcyMapComponentChooser
that is currently used.void
handleDataSources
(ILcdDataSource[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, ILcdModelDecoder[] aModelDecoders, Component aParentComponent) Opens the data represented byaDataSources
onaMapComponent
by using all theILcdModelDecoder
s inaModelDecoders
.void
handleDataSources
(ILcdDataSource[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, Component aParentComponent) Opens the data represented byaDataSources
onaMapComponent
by using all theILcdModelDecoder
s that are registered on the Lucy back-end.void
handleDataSources
(String[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, ALcyFileTypeDescriptor aSelectedFileTypeDescriptor, Component aParentComponent) Opens the data represented byaDataSources
onaMapComponent
by using all theILcdModelDecoder
s andALcyDataSourceHandler
s that are registered on the Lucy back-end.void
handleDataSources
(String[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, ILcdModelDecoder[] aModelDecoders, ALcyFileTypeDescriptor[] aModelDecoderFileTypeDescriptors, ALcyDataSourceHandler[] aDataSourceHandlers, ALcyFileTypeDescriptor[] aDataSourceHandlerFileTypeDescriptors, ALcyFileTypeDescriptor aSelectedFileTypeDescriptor, Component aParentComponent) Opens the data represented byaDataSources
onaMapComponent
by using theILcdModelDecoder
s inaModelDecoders
and theALcyDataSourceHandler
s inaDataSourceHandlers
.void
removeDataSourceListener
(ILcyDataSourceListener aDataSourceListener) Removes the givenILcyDataSourceListener
.void
setHandlerChooser
(TLcyDataFormatManager.ALcyHandlerChooser aHandlerChooser) TheALcyHandlerChooser
is responsible for deciding whichILcdModelDecoder
orALcyDataSourceHandler
is used when a data source (aString
orILcdDataSource
) is passed to thisTLcyDataFormatManager
.void
setLogListener
(ILcdLogListener aLogListener) Sets the one and onlyILcdLogListener
to which end-user messages will be passed when handling data.void
setMapComponentChooser
(TLcyDataFormatManager.ALcyMapComponentChooser aMapComponentChooser) TheALcyMapComponentChooser
is responsible for deciding on whichILcyGenericMapComponent
(s) a data source (aString
orILcdDataSource
) should be opened when handling data sources.
-
Constructor Details
-
TLcyDataFormatManager
Create a new data format manager
Note: normally this constructor should never be used. Use the
TLcyDataFormatManager
available on the Lucy back-end instead by callingILcyLucyEnv#getDataFormatManager()
.- Parameters:
aLucyEnv
- the Lucy backend
-
-
Method Details
-
handleDataSources
public void handleDataSources(String[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, ALcyFileTypeDescriptor aSelectedFileTypeDescriptor, Component aParentComponent) Opens the data represented by
aDataSources
onaMapComponent
by using all theILcdModelDecoder
s andALcyDataSourceHandler
s that are registered on the Lucy back-end.When data can not be opened on
aMapComponent
, the map component chooser will be asked for other map(s) on which theTLcyDataFormatManager
re-tries opening the data.- Parameters:
aDataSources
- The data sources to open.aMapComponent
- The map component to which the data will be added if possible.aSelectedFileTypeDescriptor
- The selected file type descriptor, can be used if there is ambiguity (multiple decoders can read a file). Usenull
for default behavior.aParentComponent
- A parent component, used to display message dialogs.- See Also:
-
handleDataSources
public void handleDataSources(ILcdDataSource[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, Component aParentComponent) Opens the data represented by
aDataSources
onaMapComponent
by using all theILcdModelDecoder
s that are registered on the Lucy back-end.When data can not be opened on
aMapComponent
, the map component chooser will be asked for other map(s) on which theTLcyDataFormatManager
re-tries opening the data.- Parameters:
aDataSources
- The data sources to open.aMapComponent
- The map component to which the data will be added if possible.aParentComponent
- A parent component, used to display message dialogs.- See Also:
-
handleDataSources
public void handleDataSources(String[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, ILcdModelDecoder[] aModelDecoders, ALcyFileTypeDescriptor[] aModelDecoderFileTypeDescriptors, ALcyDataSourceHandler[] aDataSourceHandlers, ALcyFileTypeDescriptor[] aDataSourceHandlerFileTypeDescriptors, ALcyFileTypeDescriptor aSelectedFileTypeDescriptor, Component aParentComponent) Opens the data represented by
aDataSources
onaMapComponent
by using theILcdModelDecoder
s inaModelDecoders
and theALcyDataSourceHandler
s inaDataSourceHandlers
.Before handling starts, and after handling has finished, all
ILcyDataSourceListener
s are informed. Such a listener can be added usingaddDataSourceListener
.Choosing which
ILcdModelDecoder
orALcyDataSourceHandler
to use for a particular data source and a particular map component is left to aALcyHandlerChooser
. That handler can be replaced usingsetHandlerChooser
.If errors occur while handling the data sources, messages will be send to
getLogListener()
. It is up to that listener to inform the end user of these messages.When the data cannot be opened on
aMapComponent
it will be re-tried on other available maps. The maps on which opening the data is re-tried are determined by theALcyMapComponentChooser
. This chooser can be replaced usingsetMapComponentChooser
.Note that the data sources are handled on the calling thread. As this is probably a task that may take some time, it is advised to call this method from a worker thread.
- Parameters:
aDataSources
- The data sources to open.aMapComponent
- The map component to which the data will be added if possible.aModelDecoders
- A list ofILcdModelDecoder
s to use when handling the data sources.aModelDecoderFileTypeDescriptors
- The file type descriptors corresponding to aModelDecoders. Isnull
iff aModelDecoders isnull
. Array must have equal length as aModelDecoders. It can contain null values for thoseILcdModelDecoder
s that don't work with files.aDataSourceHandlers
- A list ofALcyDataSourceHandler
s to use when handling the data sources.aDataSourceHandlerFileTypeDescriptors
- The file type descriptors corresponding to aDataSourceHandlers. Isnull
iff aDataSourceHandlers isnull
. Array must have equal length as aDataSourceHandlers. It can contain null values for thoseALcyDataSourceHandler
s that don't work with files.aSelectedFileTypeDescriptor
- The selected file type descriptor, can be used if there is ambiguity (multiple decoders can read a file). Usenull
for default behavior.aParentComponent
- A parent component, used to display message dialogs.
-
handleDataSources
public void handleDataSources(ILcdDataSource[] aDataSources, ILcyGenericMapComponent<? extends ILcdView, ? extends ILcdLayer> aMapComponent, ILcdModelDecoder[] aModelDecoders, Component aParentComponent) Opens the data represented by
aDataSources
onaMapComponent
by using all theILcdModelDecoder
s inaModelDecoders
.Before handling starts, and after handling has finished, all
ILcyDataSourceListener
s are informed. Such a listener can be added usingaddDataSourceListener(ILcyDataSourceListener)
.Choosing which
ILcdModelDecoder
to use for a particular data source and a particular map component is left to aALcyHandlerChooser
. That chooser can be replaced usingsetHandlerChooser
.If errors occur while handling the data sources, messages will be send to
getLogListener()
. It is up to that listener to inform the end user of these messages.When the data cannot be opened on
aMapComponent
it will be re-tried on other available maps. The maps on which opening the data is re-tried are determined by theALcyMapComponentChooser
. This chooser can be replaced usingsetMapComponentChooser
.Note that the data sources are handled on the calling thread. As this is probably a task that may take some time, it is advised to call this method from a worker thread.
- Parameters:
aDataSources
- The data sources to open.aMapComponent
- The map component to which the data will be added if possible.aModelDecoders
- A list ofILcdModelDecoder
s to use when handling the data sources.aParentComponent
- A parent component, used to display message dialogs.
-
addDataSourceListener
Adds the givenILcyDataSourceListener
. The listener will be notified when datasources are handled usinghandleDataSources(ILcdDataSource[], ILcyGenericMapComponent, Component)
.- Parameters:
aDataSourceListener
- The listener to add.- See Also:
-
removeDataSourceListener
Removes the givenILcyDataSourceListener
.- Parameters:
aDataSourceListener
- The listener to remove.- See Also:
-
getLogListener
Returns the one and only
ILcdLogListener
to which end-user messages will be passed when handling data.- Returns:
- The log listener.
- See Also:
-
setLogListener
Sets the one and only
ILcdLogListener
to which end-user messages will be passed when handling data.The listener could for example pop up a message dialog if a message is received, or it could collect all messages and display one dialog when handling the data sources has finished (
addDataSourceListener
can be useful in that context).- Parameters:
aLogListener
- The log listener. Should not benull
- See Also:
-
getCompositeModelDecoder
Deprecated.Usenew TLcyCompositeModelDecoder(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeModelDecoder
that represents the list of associatedILcdModelDecoder
s. It can also be directly used as aILcdModelDecoder
itself.Adding
ILcdModelDecoder
s to this list allows an add-on to provide Lucy with its ownILcdModelDecoder
s, offering a wider set of supported data formats.When a
ILcdModelDecoder
is registered, a matchingILcdGXYLayerFactory
,ILcyModelContentTypeProvider
andILcyGXYLayerTypeProvider
might need to be registered as well. Please refer togetCompositeGXYLayerFactory()
,getCompositeGXYLayerTypeProvider()
andgetCompositeModelContentTypeProvider()
for more details.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeModelDecoder
.
-
getCompositeModelEncoder
Deprecated.Usenew TLcyCompositeModelEncoder(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeModelEncoder
that represents the list of associatedILcdModelEncoder
s. It can also be directly used as aILcdModelEncoder
itself.Adding
ILcdModelEncoder
s to this list allows an add-on to provide Lucy with its ownILcdModelEncoder
s, allowing to export to more data formats.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeModelEncoder
.
-
getCompositeDataSourceHandler
Deprecated.Usenew TLcyCompositeDataSourceHandler(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeDataSourceHandler
that represents the list of associatedALcyDataSourceHandler
s. It can also be directly used as aALcyDataSourceHandler
itself.Adding
ALcyDataSourceHandler
s to this list allows an add-on to provide Lucy with its ownALcyDataSourceHandler
s, offering a wider set of supported data formats.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeDataSourceHandler
.
-
getCompositeGXYLayerFactory
Deprecated.Usenew TLcyCompositeGXYLayerFactory(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeGXYLayerFactory
that represents the list of associatedILcdGXYLayerFactory
s. It can also be directly used as aILcdGXYLayerFactory
itself.ILcdGXYLayerFactory
s that are added to this composite should only createILcdGXYLayer
s forILcdModel
's they know about. It should not simply create aILcdGXYLayer
for everyILcdModel
it gets passed in itscreateGXYLayer
, but instead verify if the givenILcdModel
is supported, e.g. by testing theILcdModelDescriptor
of theILcdModel
. If theILcdModel
passed in thecreateGXYLayer
method is not supported, it should returnnull
.When a
ILcdGXYLayerFactory
is registered, a matchingILcyGXYLayerTypeProvider
might need to be registered as well. Please refer togetCompositeGXYLayerTypeProvider()
for more details.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeGXYLayerFactory
.
-
getCompositeGXYLayerTypeProvider
Deprecated.Usenew TLcyCompositeGXYLayerTypeProvider(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeGXYLayerTypeProvider
that represents the list of associatedILcyGXYLayerTypeProvider
s. It can also be directly used as aILcyGXYLayerTypeProvider
itself.Adding
ILcyGXYLayerTypeProvider
s to this list allows an add-on to provide Lucy with its own layer type providers.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeGXYLayerTypeProvider
.
-
getCompositeModelContentTypeProvider
Deprecated.Usenew TLcyCompositeModelContentTypeProvider(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeModelContentTypeProvider
that represents the list of associatedILcyModelContentTypeProvider
s. It can also be directly used as aILcyModelContentTypeProvider
itself.Adding
ILcyModelContentTypeProvider
s to this list allows an add-on to provide Lucy with its ownILcyModelContentTypeProvider
s.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeModelContentTypeProvider
. - See Also:
-
getCompositeAsynchronousPaintHintProvider
@Deprecated public TLcyCompositeAsynchronousPaintHintProvider getCompositeAsynchronousPaintHintProvider()Deprecated.Usenew TLcyCompositeAsynchronousPaintHintProvider(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeAsynchronousPaintHintProvider
that represents the list of associatedILcyAsynchronousPaintHintProvider
s. It can also be directly used as aILcyAsynchronousPaintHintProvider
itself.Adding
ILcyAsynchronousPaintHintProvider
s to this list allows an add-on to provide Lucy with its ownILcyAsynchronousPaintHintProvider
s.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeAsynchronousPaintHintProvider
.
-
getCompositeGXYLayerDecoder
Deprecated.Usenew TLcyCompositeGXYLayerDecoder(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeGXYLayerDecoder
that represents the list of associatedILcdGXYLayerDecoder
s. It can also be directly used as aILcdGXYLayerDecoder
itself.Adding
ILcdGXYLayerDecoder
s to this list allows an add-on to provide Lucy with its ownILcdGXYLayerDecoder
s.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeGXYLayerDecoder
.
-
getCompositeGXYLayerEncoder
Deprecated.Usenew TLcyCompositeGXYLayerEncoder(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeGXYLayerEncoder
that represents the list of associatedILcdGXYLayerEncoder
s. It can also be directly used as aILcdGXYLayerEncoder
itself.Adding
ILcdGXYLayerEncoder
s to this list allows an add-on to provide Lucy with its ownILcdGXYLayerEncoder
s.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeGXYLayerEncoder
.
-
getCompositeModelReferenceDecoder
Deprecated.Usenew TLcyCompositeModelReferenceDecoder(aLucyEnv)
instead. The Lucy API offers composite implementations of all interfaces which can be registered on the services. Those composite implementations will use those registered instances when the constructor with the Lucy back-end as parameter is used. See the javadoc ofILcyLucyEnv.addService(Object, int)
and the Lucy developer guide for more information.Returns the
TLcyCompositeModelReferenceDecoder
that represents the list of associatedILcdModelReferenceDecoder
s. It can also be directly used as aILcdModelReferenceDecoder
itself.Adding
ILcdModelReferenceDecoder
s to this list allows an add-on to provide Lucy with its ownILcdModelReferenceDecoder
s.Note: the returned composite instance works on the
Lucy services
.- Returns:
- The
TLcyCompositeModelReferenceDecoder
.
-
getCompositeFileTypeDescriptorGroup
Returns theTLcyCompositeFileTypeDescriptor
that represents the list of associatedALcyFileTypeDescriptor
s. It can also be directly used as aALcyFileTypeDescriptor
itself. AddingALcyFileTypeDescriptor
s to this list allows an add-on to provide Lucy with its ownALcyFileTypeDescriptor
groups. Such a group could be (though not mandatory) aTLcyCompositeFileTypeDescriptor
itself. It could for example represent "All known vector files", composed of several otherALcyFileTypeDescriptor
s.- Returns:
- The
TLcyCompositeModelReferenceDecoder
.
-
getHandlerChooser
Returns theALcyHandlerChooser
that is currently used.- Returns:
- the
ALcyHandlerChooser
that is currently used. - See Also:
-
setHandlerChooser
The
ALcyHandlerChooser
is responsible for deciding whichILcdModelDecoder
orALcyDataSourceHandler
is used when a data source (aString
orILcdDataSource
) is passed to thisTLcyDataFormatManager
.- Parameters:
aHandlerChooser
- The handler chooser.
-
setMapComponentChooser
public void setMapComponentChooser(TLcyDataFormatManager.ALcyMapComponentChooser aMapComponentChooser) The
ALcyMapComponentChooser
is responsible for deciding on whichILcyGenericMapComponent
(s) a data source (aString
orILcdDataSource
) should be opened when handling data sources.- Parameters:
aMapComponentChooser
- The map component chooser.
-
getMapComponentChooser
Returns theALcyMapComponentChooser
that is currently used.- Returns:
- the
ALcyMapComponentChooser
that is currently used. - See Also:
-
new TLcyCompositeAsynchronousPaintHintProvider(aLucyEnv)
instead.