Class AutocompletionEvent<T>

java.lang.Object
docking.widgets.autocomplete.AutocompletionEvent<T>
Type Parameters:
T - the type of suggestions given by the autocompleter.

public class AutocompletionEvent<T> extends Object
An event related to autocompletion, usually a completion being activated by the user.
See Also:
  • Constructor Details

    • AutocompletionEvent

      public AutocompletionEvent(T sel, JTextField field)
      Create a new event on the given selection and text field.
      Parameters:
      sel - the currently-selected (or activated) item.
      field - the field having focus at the time of the event.
  • Method Details

    • getSelection

      public T getSelection()
      Get the item that was selected at the time of the event. For activation, this is the activated suggestion.
      Returns:
      the selected suggestion.
    • getField

      public JTextField getField()
      Get the field having focus at the time of the event. If the autocompleter is attached to multiple fields, this can be used to identify which field produced the event.
      Returns:
      the focused field
    • consume

      public void consume()
      Prevent this event from being further processed. The actual completion action will still be completed, though.
    • isConsumed

      public boolean isConsumed()
      Check if this event has been consumed by an earlier listener.
      Returns:
      true if the event has been consumed, i.e., should not be further processed.
    • cancel

      public void cancel()
      Prevent the actual completion action from taking place. Further listeners may still process this event, though.
    • isCancelled

      public boolean isCancelled()
      Check if the actual completion action will be performed.
      Returns:
      true if the completion action has been cancelled.