Class TLspStaticCreateHandle


public class TLspStaticCreateHandle extends ALspCreateHandle
A handle used to create objects. This create handle implementation can be used when the list of handles is known at construction time. An example of an editor that uses a static create handle is TLspCircleEditor. For instance when creating a TLcdLonLatCircle, the number and type of handles is fixed and known a-priori.

The handle delegates input events to a list of other handles from which always one is active. When this active handle in the list becomes inactive, the next handle is automatically activated. If the last handle in the list becomes inactive, the create handle itself becomes inactive as well.

Since:
2012.0
  • Constructor Details

    • TLspStaticCreateHandle

      public TLspStaticCreateHandle(Object aDomainObject, Collection<ALspEditHandle> aHandles)
      Creates a new static creation handle for the given object, delegating to the given collection of handles.
      Parameters:
      aDomainObject - the domain object.
      aHandles - a collection of delegate handles.
  • Method Details

    • getHandles

      public List<ALspEditHandle> getHandles()
      Returns the handles to which this create handle delegates. This list should not be modified.
      Returns:
      the handles to which this create handle delegates.
    • setNextHandleIndex

      public void setNextHandleIndex(int aIndex)
      Sets the next handle index. The next handle index indicates which handle will be active the next time next is called. By default the first handle (with index 0) is the next handle. However, in some cases a number of handles is not used during creation but are still added to the create handle to be painted to yield a consistent number of handles during creation and editing.
      Parameters:
      aIndex - the index of the handle that will be active next. Must be in the [0,handles size[ interval.
    • getNextHandleIndex

      public int getNextHandleIndex()
      Returns the index of the next handle.
      Returns:
      the index of the next handle.
      See Also:
    • hasNext

      protected boolean hasNext(AWTEvent aEvent, TLspEditContext aEditContext)
      Checks whether there is a next handle to be used in the creation process.

      By default, this method returns true if the next handle index < the number of handles.

      Specified by:
      hasNext in class ALspCreateHandle
      Parameters:
      aEvent - the event
      aEditContext - the edit context
      Returns:
      true if another handle is available, false otherwise.
    • hasNext

      protected boolean hasNext(Event aEvent, TLspEditContext aEditContext)
      Overrides:
      hasNext in class ALspCreateHandle
      Parameters:
      aEvent - the event
      aEditContext - the edit context
      Returns:
      true if another handle is available, false otherwise.
      Since:
      2020.0
    • next

      public ALspEditHandle next(AWTEvent aEvent, TLspEditContext aEditContext)
      Makes the next handle the active handle.

      By default, this method returns the handle at the next handle index.

      Specified by:
      next in class ALspCreateHandle
      Parameters:
      aEvent - the event
      aEditContext - the edit context
      Returns:
      the next handle.
    • next

      public ALspEditHandle next(Event aEvent, TLspEditContext aEditContext)
      JavaFX equivalent of next(AWTEvent, TLspEditContext).
      Overrides:
      next in class ALspCreateHandle
      Parameters:
      aEvent - the event
      aEditContext - the edit context
      Returns:
      the next handle.
      Since:
      2020.0
    • requestsDeactivation

      protected boolean requestsDeactivation(AWTEvent aEvent, TLspEditContext aEditContext)
      Checks whether the create handle should be deactivated. This is the case if the current handle is the last handle and it is not active.

      Subclasses can implement this method to perform additional checks on the input event and for example request deactivation when the right mouse button is clicked.

      The result of having this method return true is that the currently active handle (if any) is invoked one more time, and the resulting TLspEditHandleResult will contain a ELspInteractionStatus.FINISHED as an interaction status.

      Note that this create handle automatically deactivates if hasNext returns false, regardless of this method. This method should be considered an "early-out".

      By default, this method returns false.

      Specified by:
      requestsDeactivation in class ALspCreateHandle
      Parameters:
      aEvent - the event
      aEditContext - the edit context for this request
      Returns:
      true if deactivation is requested, false otherwise.
    • requestsDeactivation

      protected boolean requestsDeactivation(Event aEvent, TLspEditContext aEditContext)
      Overrides:
      requestsDeactivation in class ALspCreateHandle
      Parameters:
      aEvent - the event
      aEditContext - the edit context for this request
      Returns:
      true if deactivation is requested, false otherwise.
      Since:
      2020.0
    • getStyleTargetProviders

      public List<ALspStyleTargetProvider> getStyleTargetProviders(TLspHandleGeometryType aType)
      Description copied from class: ALspCreateHandle
      Returns all style target providers components of the currently active handle and previously used handles.
      Overrides:
      getStyleTargetProviders in class ALspCreateHandle
      Parameters:
      aType - the handle component type for which the visual representations are to be retrieved
      Returns:
      the combined collection of visual handle components of the active handle, and possibly of all previously used handles