Class ALcyDomainObjectSupplier
- Direct Known Subclasses:
TLcySLDDomainObjectSupplier
Groups all functionality related to a specific domain object, in order to easily allow adding new domain objects to the drawing addon.
This class offers support for everything that needs to be done for a domain object:
- Creation of the domain object
- Encoding and decoding into the drawing format by providing an XML marshaller and unmarshaller.
- Conversion of domain objects. For example a circle can be converted to a dome, a polyline to a buffer, ... , or domain objects can be converted to an extruded version of it.
- Creation of adapter objects for the domain object. For example a domain object containing a
circle can return an adapter object which is an instance of
ILcdCircle
. Altering the adapter object will also change the original object. -
ILcyCustomizerPanel
to customize the domain object. In order to have undo/redo functionality these panels should generate the necessaryTLcdUndoableEvent
s. More information on this can be found in the developer guide. - Providing a painter and editor for the domain object
Note: the painter and editor should be able to handle converted
domain objects as well. See createDomainObjectConverter
for more information
about converted domain objects.
Adding or removing support for a domain object can be done by adding or removing the corresponding
instance of this class from TLcyDrawingFormat
by using the methods addDomainObjectSupplier
and removeDomainObjectSupplier
.
- Since:
- 8.2
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
ALcyDomainObjectSupplier
(String aDomainObjectID, ALcyProperties aProperties) Create a new domain object supplier with unique IDaDomainObjectID
. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
canCreateDomainObject
(ILcdModel aForModel) Indicates if this domain object supplier is capable of creating a domain object inaForModel
.abstract boolean
Checks whether this domain object supplier is capable of providing several items foraDomainObject
.abstract ILcdShape
createDomainObject
(ILcdModel aForModel) Creates a new domain object that matches with the givenILcdModel
.abstract ALcyDomainObjectConverter
Creates the domain object converter that can export the domain objects of this supplier to other models or, conversely, import the data of other models as domain objects supported by this domain object supplier.abstract ILcyCustomizerPanelFactory
Returns a ILcyCustomizerPanelFactory that creates ILcyCustomizerPanels for this type of domain object.abstract ILcdGXYEditorProvider
Creates the editor provider for the objects of this domain object supplier.abstract ILcdGXYPainterProvider
Creates the painter provider for the objects of this domain object supplier.abstract ILcdXMLSchemaBasedDecoderLibrary[]
Creates the XML schema decoder libraries that will be used to load domain objects from the native format.abstract ILcdXMLSchemaBasedEncoderLibrary[]
Creates the XML schema encoder libraries that will be used to save domain objects to the native format.Returns the unique ID of this domain object supplier.Returns the ALcyProperties that holds the configuration of this domain object supplier instance.
-
Constructor Details
-
ALcyDomainObjectSupplier
Create a new domain object supplier with unique IDaDomainObjectID
.- Parameters:
aDomainObjectID
- a unique ID for this supplier.aProperties
- The properties object that holds the configuration of this domain object supplier instance.
-
-
Method Details
-
getDomainObjectID
Returns the unique ID of this domain object supplier. Can for example be used to find out which 2D domain object suppliers match with which 3D domain object suppliers.
The IDs of the default supported domain objects and their corresponding suppliers can be accessed through the constants on the
TLcyDrawingFormat
class.- Returns:
- the ID of this domain object supplier.
-
getProperties
Returns the ALcyProperties that holds the configuration of this domain object supplier instance.- Returns:
- The
ALcyProperties
that holds the configuration. May benull
.
-
canHandle
Checks whether this domain object supplier is capable of providing several items for
aDomainObject
. These items are:- XML marshallers and unmarshallers
- A painter provider
- An editor provider
- A domain object customizer panel factory
- A converter
This method is mainly used to find the correct supplier from a list of suppliers, or from a composite supplier. If for example a painter provider is requested from a composite supplier, the composite supplier will iterate through its known suppliers and check first if the supplier can handle the domain object, before actually asking for the painter provider.
Before requesting for example marshallers, painter providers, ... directly from an
ALcyDomainObjectSupplier
it is appropriate to call this method to make sure the marshallers, painter providers, ... which are returned are actually capable of dealing with a certain domain object.- Parameters:
aDomainObject
- the domain object- Returns:
true
if this domain object supplier can handleaDomainObject
-
canCreateDomainObject
Indicates if this domain object supplier is capable of creating a domain object inaForModel
.- Parameters:
aForModel
- TheILcdModel
for which this domain object supplier should create a domain object- Returns:
- if this domain object supplier can create a domain object in this model.
-
createDomainObject
Creates a new domain object that matches with the givenILcdModel
.- Parameters:
aForModel
- TheILcdModel
for which the domain object is created. The implementation of this method can use this model to determine, for instance, the model reference or the ILcdDataModelDescriptor. Nevernull
. The implementation of this method should not insert the created domain object in thisILcdModel
.- Returns:
- A new instance of the domain object represented by this domain object supplier implementation.
Must not be
null
.
-
createXMLSchemaBasedEncoderLibraries
Creates the XML schema encoder libraries that will be used to save domain objects to the native format.
- Returns:
- an array of XML schema encoder libraries that are capable of saving domain objects to the native format.
-
createXMLSchemaBasedDecoderLibraries
Creates the XML schema decoder libraries that will be used to load domain objects from the native format.- Returns:
- an XML schema decoder libraries that are capable of loading domain objects from the native format.
-
createDomainObjectCustomizerPanelFactory
Returns a ILcyCustomizerPanelFactory that creates ILcyCustomizerPanels for this type of domain object.
This factory is wrapped by a factory that filters for TLcyDomainObjectContext instances.
- Returns:
- a ILcyCustomizerPanelFactory that creates ILcyCustomizerPanels for this type of domain object.
-
createGXYPainterProvider
Creates the painter provider for the objects of this domain object supplier.
The provided painters are responsible for painting the geometry of the domain object as well as the style.
- Returns:
- The painter provider. Must not be
null
.
-
createGXYEditorProvider
Creates the editor provider for the objects of this domain object supplier.
The provided editors are responsible for editing the geometry of the domain object as well as the style.
- Returns:
- The editor provider. Must not be
null
.
-
createDomainObjectConverter
Creates the domain object converter that can export the domain objects of this supplier to other models or, conversely, import the data of other models as domain objects supported by this domain object supplier.
This domain object supplier must be able to provide all facilities (ie. painting, editing, encoding, decoding etc.) for a converted domain object if the target model is a drawing model.
- Returns:
- The domain object converter of this domain object supplier. Must not be
null
.
-