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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IFeatureHandlesProvider handlesProvider) Adds the given instance to the list of registered instances with the given priority.voidadd(IFeatureHandlesProvider handlesProvider, Priority priority) Adds the given instance to the list of registered instances with the given priority.booleancanProvide(Observable<@NotNull Feature> feature, FeatureEditContext context) Indicates if this handles provider can create handles for the givenFeature.voidclose()Creates a composite instance with a default set of instances that can handle anyFeatureinstance that can be edited through itsGeometry, using theconfiguredgeometry provider.booleanprotected voidfinalize()List<@NotNull IFeatureHandlesProvider> getList()Returns the list containing all registered instances, ordered by priority (highest priority first).inthashCode()provide(Observable<@NotNull Feature> feature, FeatureEditContext context, IFeatureEditCallback featureEditCallback) Returns handles for the given feature.voidremove(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:
closein interfaceAutoCloseable
-
createDefault
Creates a composite instance with a default set of instances that can handle anyFeatureinstance that can be edited through itsGeometry, using theconfiguredgeometry 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:
canProvidein 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:
providein 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 theFeaturehas 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- whennullis 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- whennullis 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- whennullis 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).
-
hashCode
public int hashCode() -
equals
-