Class ALspEditHandle

java.lang.Object
com.luciad.view.lightspeed.editor.handle.ALspHandle
com.luciad.view.lightspeed.editor.handle.ALspEditHandle
Direct Known Subclasses:
ALsp3StepEditHandle, ALspCreateHandle, TLspPointSetHandle

public abstract class ALspEditHandle extends ALspHandle
An edit handle is a widget that manipulates a domain object or some part of that object. An ILspEditor is responsible for providing the appropriate handles for a particular object. A handle should be able to capture user input from the handleAWTEvent method (mouse, keyboard, ...) and convert it into an edit handle result, containing zero or more edit operations.

An edit handle can have focus. The edit controller can respond to this by forwarding event objects to this handle by calling handleAWTEvent. At the same time, the handle can be visualized differently, and the handle's cursor can be shown to indicate that the handle can be used to interact with.

Each handle generally corresponds to the geometry of an object for which the handle will generate edit operations. As an example, an editor might edit a four-sided polygon with five handles: four to move each of the individual vertices of the polygon, and a fifth one to move the polygon as a whole. A handle is not allowed to modify its corresponding object geometry directly -- that responsibility lies with the ILspEditor.

Since:
2012.0
See Also:
  • Constructor Details

    • ALspEditHandle

      protected ALspEditHandle(Object aGeometry)
      Creates a new edit handle, given the geometry that it is going to edit.
      Parameters:
      aGeometry - the geometry that is edited by this handle. Null is allowed, for instance if editing doesn't involve geometry directly.
  • Method Details

    • getGeometry

      public Object getGeometry()
      Returns the geometry that is being edited with this edit handle
      Returns:
      the geometry that is being edited with this edit handle
    • handleAWTEvent

      public abstract TLspEditHandleResult handleAWTEvent(AWTEvent aEvent, TLspEditContext aEditContext)
      Handle the given input event for the given edit context. The edit handle can choose the operation to perform based on the type and state of the input event.

      When the edit handle has processed the input event, this method will return a edit handle result containing a null event to indicate that the event has been consumed. Note that sometimes an event might be partially consumed (which is often the case with touch events), in which case this method will return an edit handle result with an altered version of the given input event.

      If incoming event should be ignored, this method should return a TLspEditHandleResult without any edit operations, and an unconsumed AWTEvent. An unconsumed AWTEvent means that it should contain the original, unmodified aEvent parameter passed to this method. This result indicates that the event was not consumed, and that some other object needs to consume the event instead.

      As a side effect, a handle is allowed to activate or deactivate itself as a result of processing an input event.

      Parameters:
      aEvent - the input event
      aEditContext - the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled
      Returns:
      an edit handle result containing a collection of operations to perform, and the (partially) consumed event object. The handle result itself should not be null.
      See Also:
    • handleFXEvent

      public TLspEditHandleResultFX handleFXEvent(Event aEvent, TLspEditContext aEditContext)
      Parameters:
      aEvent - the input event
      aEditContext - the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled
      Returns:
      an edit handle result containing a collection of operations to perform, and the (partially) consumed event object. The handle result itself should not be null.
      Since:
      2020.0
    • requestsFocus

      public boolean requestsFocus(AWTEvent aEvent, TLspEditContext aEditContext)
      Indicates whether this handle requests focus for the given event. The edit controller can respond to this by forwarding event objects to this handle by calling handleAWTEvent. However, this is not ensured, because another handle may have precedence over this handle and also request focus. Precedence is primarily determined by the handle priority.

      The default implementation returns true if the handle is active. Subclasses can override this method for custom behavior. An example would be to request focus when the mouse hovers over a visual handle component.

      Parameters:
      aEvent - the AWTEvent that might result in a focus request
      aEditContext - the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled
      Returns:
      true if this handle requests focus for the given event, false otherwise.
      See Also:
    • requestsFocus

      public boolean requestsFocus(Event aEvent, TLspEditContext aEditContext)
      Parameters:
      aEvent - the AWTEvent that might result in a focus request
      aEditContext - the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled
      Returns:
      true if this handle requests focus for the given event, false otherwise.
      Since:
      2020.0