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:

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 Details

    • CompositeFeatureHandlesProvider

      public CompositeFeatureHandlesProvider()
      Creates an empty composite instance.
  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • createDefault

      @NotNull public 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.
      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 given Feature.
      Specified by:
      canProvide in interface IFeatureHandlesProvider
      Parameters:
      feature - an observable Feature.
      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 interface IFeatureHandlesProvider
      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 the Feature 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 register
      priority - a priority. The default is PriorityDefault.
      Throws:
      NullPointerException - when null is passed.
    • add

      public void add(@NotNull IFeatureHandlesProvider handlesProvider) 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 register
      Throws:
      NullPointerException - when null is passed.
    • remove

      public void remove(@NotNull IFeatureHandlesProvider handlesProvider) throws NullPointerException
      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 - when null is passed.
    • getList

      @NotNull public List<@NotNull IFeatureHandlesProvider> 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).