public final class CompositeFeatureHandlesProvider extends Object implements AutoCloseable, IFeatureHandlesProvider
IFeatureHandlesProvider
.
This composite allows you to:
CompositeFeatureHandlesProvider#add
CompositeFeatureHandlesProvider#remove
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 and Description |
---|
CompositeFeatureHandlesProvider()
Creates an empty composite instance.
|
Modifier and Type | Method and Description |
---|---|
void |
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<Feature> feature,
FeatureEditContext context)
Indicates if this handles provider can create handles for the given
Feature . |
void |
close() |
static CompositeFeatureHandlesProvider |
createDefault()
Creates a composite instance with a default set of instances that can handle any
Feature instance that can be edited through its Geometry , using the configured geometry provider. |
protected void |
finalize() |
List<IFeatureHandlesProvider> |
getList() |
IEditHandles |
provide(Observable<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.
|
public CompositeFeatureHandlesProvider()
public void close()
close
in interface AutoCloseable
@NotNull public static CompositeFeatureHandlesProvider createDefault()
Feature
instance that can be edited through its Geometry
, using the configured
geometry provider.public boolean canProvide(@NotNull Observable<Feature> feature, @NotNull FeatureEditContext context)
Feature
.canProvide
in interface IFeatureHandlesProvider
feature
- an observable Feature
.context
- the context. Contains additional information about the edited feature.Feature
.@Nullable public IEditHandles provide(@NotNull Observable<Feature> feature, @NotNull FeatureEditContext context, @NotNull IFeatureEditCallback featureEditCallback)
If this provider doesn't support the given feature, it can return null
.
provide
in interface IFeatureHandlesProvider
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 the Feature
has changed.null
.public void add(@NotNull IFeatureHandlesProvider handlesProvider, @NotNull Priority priority) throws NullPointerException
If you want to remove an instance again, use CompositeFeatureHandlesProvider#remove
.
handlesProvider
- a new instance to registerpriority
- a priority. The default is PriorityDefault.NullPointerException
- when null
is passed.public void add(@NotNull IFeatureHandlesProvider handlesProvider) throws NullPointerException
If you want to remove an instance again, use CompositeFeatureHandlesProvider#remove
.
handlesProvider
- a new instance to registerNullPointerException
- when null
is passed.public void remove(@NotNull IFeatureHandlesProvider handlesProvider) throws NullPointerException
Nothing will happen if the given instance was never added before.
handlesProvider
- the instance to remove from this composite.NullPointerException
- when null
is passed.@NotNull public List<IFeatureHandlesProvider> getList()