Class AutocompletionEvent<T>

  • Type Parameters:
    T - the type of suggestions given by the autocompleter.

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

      Constructors 
      Constructor Description
      AutocompletionEvent​(T sel, javax.swing.JTextField field)
      Create a new event on the given selection and text field.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()
      Prevent the actual completion action from taking place.
      void consume()
      Prevent this event from being further processed.
      javax.swing.JTextField getField()
      Get the field having focus at the time of the event.
      T getSelection()
      Get the item that was selected at the time of the event.
      boolean isCancelled()
      Check if the actual completion action will be performed.
      boolean isConsumed()
      Check if this event has been consumed by an earlier listener.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AutocompletionEvent

        public AutocompletionEvent​(T sel,
                                   javax.swing.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 Detail

      • 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 javax.swing.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.