com.mucommander.ui.autocomplete
Class AutocompleterTextComponent

java.lang.Object
  extended by com.mucommander.ui.autocomplete.AutocompleterTextComponent
Direct Known Subclasses:
BasicAutocompleterTextComponent, TypicalAutocompleterEditableCombobox

public abstract class AutocompleterTextComponent
extends java.lang.Object

AutocompleterTextComponent convert any text component to auto-completion supported text component. In order to support auto-completion two abstract methods need to be implemented:

Author:
Arik Hadas

Constructor Summary
protected AutocompleterTextComponent(EditableComboBox editableComboBox)
           
  AutocompleterTextComponent(javax.swing.text.JTextComponent textComp)
           
 
Method Summary
 void addFocusListener(java.awt.event.FocusListener listener)
           
 void addKeyListener(java.awt.event.KeyAdapter adapter)
           
 int getCaretPosition()
           
 javax.swing.text.Document getDocument()
           
 int getHeight()
           
 java.util.Vector getItemNames()
          getItemsNames
 java.lang.String getText()
           
 javax.swing.text.JTextComponent getTextComponent()
           
 boolean hasFocus()
           
 boolean isCarentAtEndOfTextAtInsertion()
           
 boolean isCarentAtEndOfTextAtRemoval()
           
 boolean isComponentsPopupVisible()
          isPopupVisible
 boolean isEnabled()
           
 boolean isShowing()
           
 java.awt.Rectangle modelToView()
           
 void moveCarentToEndOfText()
           
abstract  void OnEnterPressed(java.awt.event.KeyEvent keyEvent)
          This function will be called when the text component has the focus and enter key is pressed, while the auto-completion popup window is unvisible.
abstract  void OnEscPressed(java.awt.event.KeyEvent keyEvent)
          This function will be called when the text component has the focus and escape key is pressed, while the auto-completion popup window is unvisible.
 void requestFocus()
           
 void setComponentsPopupUnvisibe()
          setPopupUnvisibe - make the combo-box list of items unvisible.
 void setText(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutocompleterTextComponent

public AutocompleterTextComponent(javax.swing.text.JTextComponent textComp)

AutocompleterTextComponent

protected AutocompleterTextComponent(EditableComboBox editableComboBox)
Method Detail

OnEnterPressed

public abstract void OnEnterPressed(java.awt.event.KeyEvent keyEvent)
This function will be called when the text component has the focus and enter key is pressed, while the auto-completion popup window is unvisible.


OnEscPressed

public abstract void OnEscPressed(java.awt.event.KeyEvent keyEvent)
This function will be called when the text component has the focus and escape key is pressed, while the auto-completion popup window is unvisible.


getDocument

public javax.swing.text.Document getDocument()

isShowing

public boolean isShowing()

setText

public void setText(java.lang.String text)

getText

public java.lang.String getText()

hasFocus

public boolean hasFocus()

isEnabled

public boolean isEnabled()

getCaretPosition

public int getCaretPosition()

requestFocus

public void requestFocus()

getHeight

public int getHeight()

modelToView

public java.awt.Rectangle modelToView()
                               throws javax.swing.text.BadLocationException
Throws:
javax.swing.text.BadLocationException

moveCarentToEndOfText

public void moveCarentToEndOfText()

isCarentAtEndOfTextAtInsertion

public boolean isCarentAtEndOfTextAtInsertion()

isCarentAtEndOfTextAtRemoval

public boolean isCarentAtEndOfTextAtRemoval()

getTextComponent

public javax.swing.text.JTextComponent getTextComponent()

addKeyListener

public void addKeyListener(java.awt.event.KeyAdapter adapter)

addFocusListener

public void addFocusListener(java.awt.event.FocusListener listener)

getItemNames

public java.util.Vector getItemNames()
getItemsNames

Returns:
empty Vector if component is not an EditableComboBox, otherwise return Vector which contains the names of the combobox items.

isComponentsPopupVisible

public boolean isComponentsPopupVisible()
isPopupVisible

Returns:
false if component is not an EditableComboBox, otherwise, true if the combo-box list of items is visible.

setComponentsPopupUnvisibe

public void setComponentsPopupUnvisibe()
setPopupUnvisibe - make the combo-box list of items unvisible.



This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard