Package com.luciad.edit.features
Class CompositeFeatureHandlesProvider
java.lang.Object
com.luciad.edit.features.CompositeFeatureHandlesProvider
- All Implemented Interfaces:
IFeatureHandlesProvider
,AutoCloseable
public final class CompositeFeatureHandlesProvider
extends Object
implements AutoCloseable, IFeatureHandlesProvider
A composite implementation of
IFeatureHandlesProvider
.
This composite allows you to:
- add instances:
CompositeFeatureHandlesProvider#add
- remove instances:
CompositeFeatureHandlesProvider#remove
- retrieve instances:
CompositeFeatureHandlesProvider#getList
The composite implementation uses its delegate instances in a specific order. The order is based on the priority you assign when you add the delegate instance. If the priorities of two instances are equal, the instance that you added first gets priority.
A default implementation is available, see createDefault
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(IFeatureHandlesProvider handlesProvider) Adds the given instance to the list of registered instances with the given priority.void
add
(IFeatureHandlesProvider handlesProvider, Priority priority) Adds the given instance to the list of registered instances with the given priority.boolean
canProvide
(Observable<@NotNull Feature> feature, FeatureEditContext context) Indicates if this handles provider can create handles for the givenFeature
.void
close()
Creates a composite instance with a default set of instances that can handle anyFeature
instance that can be edited through itsGeometry
, using theconfigured
geometry provider.protected void
finalize()
List
<@NotNull IFeatureHandlesProvider> getList()
Returns the list containing all registered instances, ordered by priority (highest priority first).provide
(Observable<@NotNull Feature> feature, FeatureEditContext context, IFeatureEditCallback featureEditCallback) Returns handles for the given feature.void
remove
(IFeatureHandlesProvider handlesProvider) Removes this given instance from the list of registered instances.
-
Constructor Details
-
CompositeFeatureHandlesProvider
public CompositeFeatureHandlesProvider()Creates an empty composite instance.
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
createDefault
Creates a composite instance with a default set of instances that can handle anyFeature
instance that can be edited through itsGeometry
, using theconfigured
geometry provider.- Returns:
- a composite instance with a default set of instances. These instances are registered using CompositeFeatureHandlesProvider::PriorityDefault.
-
canProvide
public boolean canProvide(@NotNull Observable<@NotNull Feature> feature, @NotNull FeatureEditContext context) Indicates if this handles provider can create handles for the givenFeature
.- Specified by:
canProvide
in interfaceIFeatureHandlesProvider
- Parameters:
feature
- an observableFeature
.context
- the context. Contains additional information about the edited feature.- Returns:
- if this handles provider can create handles for the given
Feature
.
-
provide
@Nullable public IEditHandles provide(@NotNull Observable<@NotNull Feature> feature, @NotNull FeatureEditContext context, @NotNull IFeatureEditCallback featureEditCallback) Returns handles for the given feature.If this provider doesn't support the given feature, it can return
null
.- Specified by:
provide
in interfaceIFeatureHandlesProvider
- Parameters:
feature
- the observable feature for which to create handles.context
- the context. Contains additional information about the edited feature.featureEditCallback
- a callback that notifies the caller when theFeature
has changed.- Returns:
- handles for the given feature. If this provider doesn't support the given feature, it can return
null
.
-
add
public void add(@NotNull IFeatureHandlesProvider handlesProvider, @NotNull Priority priority) throws NullPointerException Adds the given instance to the list of registered instances with the given priority.If you want to remove an instance again, use
CompositeFeatureHandlesProvider#remove
.- Parameters:
handlesProvider
- a new instance to registerpriority
- a priority. The default is PriorityDefault.- Throws:
NullPointerException
- whennull
is passed.
-
add
Adds the given instance to the list of registered instances with the given priority.If you want to remove an instance again, use
CompositeFeatureHandlesProvider#remove
.- Parameters:
handlesProvider
- a new instance to register- Throws:
NullPointerException
- whennull
is passed.
-
remove
Removes this given instance from the list of registered instances.Nothing will happen if the given instance was never added before.
- Parameters:
handlesProvider
- the instance to remove from this composite.- Throws:
NullPointerException
- whennull
is passed.
-
getList
Returns the list containing all registered instances, ordered by priority (highest priority first).- Returns:
- the list containing all registered instances, ordered by priority (highest priority first).
-