Class MarkedTextCompletionGUI

  • All Implemented Interfaces:
    java.awt.event.KeyListener, java.util.EventListener, CompletionGUI

    public class MarkedTextCompletionGUI
    extends AbstractCompletionGUI
    implements java.awt.event.KeyListener
    DOCUMENT ME!
    Version:
    1.0
    Author:
    Andreas
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkMarkedText()  
      void cycleCompletion​(javax.swing.text.JTextComponent editor, java.util.Collection<Completion> completions, java.lang.String stub, int index)
      DOCUMENT-ME
      boolean editorMayLoseFocus()
      If the editor my lose the focus because of a GUI action(usually after specialKeyPressed()), this method should return true to avoid AutoCompletion calling stopOffer().
      boolean editorMayUpdateCaret()
      If the editor my update the caret because of a GUI action(usually after specialKeyPressed()), this method should return true to avoid AutoCompletion calling stopOffer().
      Completion getSelectedCompletion()
      Returns the currently selected Completion object.
      int[] getSpecialKeys()
      If this GUI needs some special keys the Key-Codes con be obtained by this method.
      java.lang.String getTitle()
      Returns the name of this CompletionGUI.
      void init​(AutoCompletion ac)
      Initialize this GUI for use with the given AutoCompletion.
      boolean isOfferingCompletion()
      Should return true if this GUI is currently offering a completion to the user.
      void keyPressed​(java.awt.event.KeyEvent e)
      DOCUMENT-ME
      void keyReleased​(java.awt.event.KeyEvent p1)
      DOCUMENT-ME
      void keyTyped​(java.awt.event.KeyEvent p1)
      DOCUMENT-ME
      void offerCompletion​(javax.swing.text.JTextComponent editor, java.util.Collection<Completion> completions, java.lang.String stub)
      Called the advice this GUI to offer the given completions in the given Editor to the user.
      void specialKeyPressed​(int key)
      When AutoCompletion recognizes a special key of getSpecialKeys(), this method is called with the key found.
      protected boolean startsWith​(java.lang.String s1, java.lang.String s2)
      Checks if s1 is starting with s2, case-insensitive
      void stopOffer()
      Called when this GUI should stop offering completions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • addLinebreak

        protected boolean addLinebreak
      • lastCompletion

        protected Completion lastCompletion
      • lastEditor

        protected javax.swing.text.JTextComponent lastEditor
      • markedText

        protected boolean markedText
      • caretUpdate

        protected boolean caretUpdate
      • selectedArea

        protected int[] selectedArea
    • Constructor Detail

      • MarkedTextCompletionGUI

        public MarkedTextCompletionGUI()
    • Method Detail

      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent p1)
        DOCUMENT-ME
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        DOCUMENT-ME
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent p1)
        DOCUMENT-ME
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
      • init

        public void init​(AutoCompletion ac)
        Initialize this GUI for use with the given AutoCompletion. This method is called by AutoCompletion when the GUI is added to it.
        Specified by:
        init in interface CompletionGUI
      • isOfferingCompletion

        public boolean isOfferingCompletion()
        Should return true if this GUI is currently offering a completion to the user.
        Specified by:
        isOfferingCompletion in interface CompletionGUI
      • startsWith

        protected boolean startsWith​(java.lang.String s1,
                                     java.lang.String s2)
        Checks if s1 is starting with s2, case-insensitive
      • cycleCompletion

        public void cycleCompletion​(javax.swing.text.JTextComponent editor,
                                    java.util.Collection<Completion> completions,
                                    java.lang.String stub,
                                    int index)
        DOCUMENT-ME
        Specified by:
        cycleCompletion in interface CompletionGUI
      • stopOffer

        public void stopOffer()
        Called when this GUI should stop offering completions.
        Specified by:
        stopOffer in interface CompletionGUI
      • checkMarkedText

        protected void checkMarkedText()
      • getSpecialKeys

        public int[] getSpecialKeys()
        If this GUI needs some special keys the Key-Codes con be obtained by this method.
        Specified by:
        getSpecialKeys in interface CompletionGUI
      • specialKeyPressed

        public void specialKeyPressed​(int key)
        When AutoCompletion recognizes a special key of getSpecialKeys(), this method is called with the key found.
        Specified by:
        specialKeyPressed in interface CompletionGUI
      • editorMayLoseFocus

        public boolean editorMayLoseFocus()
        If the editor my lose the focus because of a GUI action(usually after specialKeyPressed()), this method should return true to avoid AutoCompletion calling stopOffer().
        Specified by:
        editorMayLoseFocus in interface CompletionGUI
      • editorMayUpdateCaret

        public boolean editorMayUpdateCaret()
        If the editor my update the caret because of a GUI action(usually after specialKeyPressed()), this method should return true to avoid AutoCompletion calling stopOffer().
        Specified by:
        editorMayUpdateCaret in interface CompletionGUI