|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xnap.gui.component.CompletionMode
public abstract class CompletionMode
This class handles the way completion is actually done.
It decides when and how to offer completion to the user. Completion may be
triggered using a special key, it may be visible all the time, it may use a
CompletionPopup
to present all possibilities
or may insert the text directly.
Constructor Summary | |
---|---|
CompletionMode(javax.swing.text.JTextComponent textComponent)
|
|
CompletionMode(javax.swing.text.JTextComponent textComponent,
boolean wholeText)
|
|
CompletionMode(javax.swing.text.JTextComponent textComponent,
CompletionModel model)
|
|
CompletionMode(javax.swing.text.JTextComponent textComponent,
CompletionModel model,
boolean wholeText)
|
Method Summary | |
---|---|
protected abstract void |
disable()
Disables the completion mode letting it remove its listeners from the text component. |
protected abstract void |
enable()
Enables the completion mode letting it add its listeners to the text component. |
CompletionModel |
getModel()
Returns the currently used model. |
abstract java.lang.String |
getName()
Returns the name of this completion mode. |
protected java.lang.String |
getText()
Returns the text which should be completed. |
javax.swing.text.JTextComponent |
getTextComponent()
Returns the text component this completion mode is responsible for |
boolean |
isEnabled()
Returns true if the completion mode is enabled. |
boolean |
isWholeTextCompletion()
Returns whether this completion mode is supposed to complete the whole text of its text component made availabe through JTextComponent.getText() or just the last word before the cursor. |
void |
setEnabled(boolean enabled)
Enables or disables the completion mode. |
void |
setModel(CompletionModel model)
Sets the completion model. |
protected void |
setText(java.lang.String text)
Convenience wrapper for setText(String, int, int) . |
protected void |
setText(java.lang.String text,
int selectionStart,
int selectionEnd)
Sets the given text honoring the whole text mode. |
void |
setTextComponent(javax.swing.text.JTextComponent jtc)
Sets a new text component for this completion mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompletionMode(javax.swing.text.JTextComponent textComponent, CompletionModel model, boolean wholeText)
public CompletionMode(javax.swing.text.JTextComponent textComponent, boolean wholeText)
public CompletionMode(javax.swing.text.JTextComponent textComponent, CompletionModel model)
public CompletionMode(javax.swing.text.JTextComponent textComponent)
Method Detail |
---|
public abstract java.lang.String getName()
protected abstract void enable()
protected abstract void disable()
public final void setEnabled(boolean enabled)
enabled
- true to enable the completion mode, false to disable itpublic final boolean isEnabled()
public void setModel(CompletionModel model)
disable()
enable()
methods.
model
- the new completion model which will be used henceforthpublic CompletionModel getModel()
public void setTextComponent(javax.swing.text.JTextComponent jtc)
disable()
and
enable()
are called to give listeners a chance to remove
themselves from the old text component add themselves to the new text
component.
public javax.swing.text.JTextComponent getTextComponent()
public final boolean isWholeTextCompletion()
JTextComponent.getText()
or just the last word before the cursor.
protected void setText(java.lang.String text)
setText(String, int, int)
.
Sets the text without any selection and setts the cursor to the end
of the set text.
text
- the text to setprotected void setText(java.lang.String text, int selectionStart, int selectionEnd)
text
- the text to setselectionStart
- the offset of the selection start relative to the
beginning of the set text. Can be greater than selectionEnd
.selectionEnd
- the offset of the selection end relative
to the beginning of the set text. This is where the cursor is afterwards.protected java.lang.String getText()
JTextComponent.getText()
if wholeText is true
otherwise the word before the cursor.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |