Class CompletionWindow

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class CompletionWindow extends JDialog
Window containing list of all suitable completion items.
See Also:
  • Field Details

    • textComponent

      private JTextComponent textComponent
      Text component that invoked this completion window.
    • allCompletionItems

      private Vector allCompletionItems
      List of all possible completion items.
    • taskDialog

      private final JDialog taskDialog
      Reference to task dialog for passing focus after completion is done.
    • jlCompletion

      private JList jlCompletion
    • spCompletion

      private JScrollPane spCompletion
  • Constructor Details

    • CompletionWindow

      public CompletionWindow(JTextComponent textComponent, Vector allCompletionItems, JDialog taskDialog)
      Creates new form CompletionWindow
      Parameters:
      textComponent - Text component that invoked this completion window.
      allCompletionItems - List of all possible completion items.
  • Method Details

    • initComponents

      private void initComponents()
      This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
    • jlCompletionMouseClicked

      private void jlCompletionMouseClicked(MouseEvent evt)
    • jlCompletionMouseExited

      private void jlCompletionMouseExited(MouseEvent evt)
    • jlCompletionFocusLost

      private void jlCompletionFocusLost(FocusEvent evt)
    • jlCompletionKeyPressed

      private void jlCompletionKeyPressed(KeyEvent evt)
    • setCompletionItems

      public void setCompletionItems(Vector completionItems)
      Sets list of completion items to given vector.
      Parameters:
      completionItems - New list of completion items.
    • getCompletionItems

      private Vector getCompletionItems(String prefix)
      Returns list of completion items that start with given prefix.
      Parameters:
      prefix - Prefix to be used for finding suitable completion items.
      Returns:
      List of all completion items that begin with given prefix.
    • reduceCompletionBy

      private void reduceCompletionBy(char key)
      Reduces list of completion items by given character.
      Parameters:
      key - New character that user typed to extend prefix.
    • completeItem

      private void completeItem(String value)
      Completes text in text component with selected completion item.
      Parameters:
      value - Selected completion item to be added to text component.
    • getIncompleteWord

      private String getIncompleteWord()
      Returns part of word that user typed to narrow list of all completion items. i.e. "meeting int|" returns "int".
      Returns:
      Incomplete word that user typed to narrow list of all completion items.
    • getPrefix

      private String getPrefix()
      Returns text that is before currently incomplete word. i.e. "meeting int|" returns "meeting ".
      Returns:
      Text that is before currently incomplete word.
    • getSuffix

      private String getSuffix()
      Returns text that is after currently incomplete word. i.e. "meeting int| hello" returns " hello".
      Returns:
      Text that is after currently incomplete word.
    • getUsedItems

      private Vector getUsedItems()
      Returns list of items that were already used in the text component. i.e. "meeting int| hello" returns "meeting" and "hello".
      Returns:
      Items that were already used in the text component.