org.xnap.commons.gui.completion
Class AbstractCompletionMode

java.lang.Object
  extended by org.xnap.commons.gui.completion.AbstractCompletionMode
All Implemented Interfaces:
CompletionMode
Direct Known Subclasses:
DropDownListCompletionMode, EmacsCompletionMode, ManualCompletionMode, ShortAutomaticCompletionMode

public abstract class AbstractCompletionMode
extends Object
implements CompletionMode

Abstract convenience class which provides some wrapping function to ease the implementation of a CompletionMode.

Author:
Felix Berger

Constructor Summary
AbstractCompletionMode()
           
 
Method Summary
abstract  void disable()
          Disables the completion mode letting it remove its listeners from the text component.
protected abstract  void enable()
          Has to be implemented by subclasses which don't have to worry about setting the completion object and simply use the accessors provided here.
 void enable(Completion completion)
          Enables the completion mode letting it add its listeners to the text component.
protected  Completion getCompletion()
          Returns the completion object that uses this completion mode.
protected  CompletionModel getModel()
          Convenience accessor, returns the completion model
protected  String getText()
          Convenience accessor, returns the text which should be completed.
protected  JTextComponent getTextComponent()
          Convenience accessor, returns the text component.
protected  void setText(String text)
          Convenience setter, forwards to Completion.setText(String).
protected  void setText(String text, int selectionStart, int selectionEnd)
          Convenience setter, forwards to Completion.setText(String, int, int).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCompletionMode

public AbstractCompletionMode()
Method Detail

enable

public void enable(Completion completion)
Description copied from interface: CompletionMode
Enables the completion mode letting it add its listeners to the text component.

Specified by:
enable in interface CompletionMode
Parameters:
completion - provides all components and information the completion mode must know about

enable

protected abstract void enable()
Has to be implemented by subclasses which don't have to worry about setting the completion object and simply use the accessors provided here.


disable

public abstract void disable()
Description copied from interface: CompletionMode
Disables the completion mode letting it remove its listeners from the text component.

Specified by:
disable in interface CompletionMode

getModel

protected CompletionModel getModel()
Convenience accessor, returns the completion model


getTextComponent

protected JTextComponent getTextComponent()
Convenience accessor, returns the text component.


getCompletion

protected Completion getCompletion()
Returns the completion object that uses this completion mode.


getText

protected String getText()
Convenience accessor, returns the text which should be completed.

Returns:
the whole text up to the current caret position, if Completion.isWholeTextCompletion() is true, otherwise the previous word up to the current care position

setText

protected void setText(String text,
                       int selectionStart,
                       int selectionEnd)
Convenience setter, forwards to Completion.setText(String, int, int).


setText

protected void setText(String text)
Convenience setter, forwards to Completion.setText(String).



Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.