|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fife.ui.autocomplete.AutoCompletion
Adds autocompletion to a text component. Provides a popup window with a list of autocomplete choices on a given keystroke, such as Crtrl+Space.
Depending on the CompletionProvider installed, the following
auto-completion features may be enabled:
| Constructor Summary | |
AutoCompletion(CompletionProvider provider)
Constructor. |
|
| Method Summary | |
void |
doCompletion()
Displays the popup window. |
boolean |
getAutoCompleteSingleChoices()
Returns whether, if a single autocomplete choice is available, it should be automatically inserted, without displaying the popup menu. |
CompletionProvider |
getCompletionProvider()
Returns the completion provider. |
static javax.swing.KeyStroke |
getDefaultTriggerKey()
Returns the default autocomplete "trigger key" for this OS. |
ExternalURLHandler |
getExternalURLHandler()
Returns the handler to use when an external URL is clicked in the description window. |
javax.swing.ListCellRenderer |
getListCellRenderer()
Returns the default list cell renderer used when a completion provider does not supply its own. |
protected java.lang.String |
getReplacementText(Completion c,
javax.swing.text.Document doc,
int start,
int len)
Returns the text to replace with in the document. |
boolean |
getShowDescWindow()
Returns whether the "description window" should be shown alongside the completion window. |
javax.swing.text.JTextComponent |
getTextComponent()
Returns the text component for which autocompletion is enabled. |
javax.swing.KeyStroke |
getTriggerKey()
Returns the "trigger key" used for autocomplete. |
boolean |
hideChildWindows()
Hides any child windows being displayed by the auto-completion system. |
void |
hierarchyChanged(java.awt.event.HierarchyEvent e)
Called when the component hierarchy for our text component changes. |
void |
install(javax.swing.text.JTextComponent c)
Installs this autocompletion on a text component. |
boolean |
isAutoCompleteEnabled()
Returns whether autocompletion is enabled. |
boolean |
isParameterAssistanceEnabled()
Returns whether parameter assistance is enabled. |
protected int |
refreshPopupWindow()
Refreshes the popup window. |
void |
setAutoCompleteEnabled(boolean enabled)
Sets whether auto-completion is enabled. |
void |
setAutoCompleteSingleChoices(boolean autoComplete)
Sets whether, if a single auto-complete choice is available, it should be automatically inserted, without displaying the popup menu. |
void |
setChoicesWindowSize(int w,
int h)
Sets the size of the completion choices window. |
void |
setCompletionProvider(CompletionProvider provider)
Sets the completion provider being used. |
void |
setDescriptionWindowSize(int w,
int h)
Sets the size of the description window. |
void |
setExternalURLHandler(ExternalURLHandler handler)
Sets the handler to use when an external URL is clicked in the description window. |
void |
setListCellRenderer(javax.swing.ListCellRenderer renderer)
Sets the default list cell renderer to use when a completion provider does not supply its own. |
void |
setParameterAssistanceEnabled(boolean enabled)
Sets whether parameter assistance is enabled. |
void |
setShowDescWindow(boolean show)
Sets whether the "description window" should be shown beside the completion window. |
void |
setTriggerKey(javax.swing.KeyStroke ks)
Sets the keystroke that should be used to trigger the auto-complete popup window. |
void |
uninstall()
Uninstalls this auto-completion from its text component. |
void |
updateUI()
Updates the LookAndFeel of the popup window. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AutoCompletion(CompletionProvider provider)
provider - The completion provider. This cannot be
null.| Method Detail |
public void doCompletion()
public boolean getAutoCompleteSingleChoices()
setAutoCompleteSingleChoices(boolean)public CompletionProvider getCompletionProvider()
public static javax.swing.KeyStroke getDefaultTriggerKey()
public ExternalURLHandler getExternalURLHandler()
setExternalURLHandler(ExternalURLHandler)public javax.swing.ListCellRenderer getListCellRenderer()
setListCellRenderer(ListCellRenderer)
protected java.lang.String getReplacementText(Completion c,
javax.swing.text.Document doc,
int start,
int len)
c - The completion being inserted.doc - The document being modified.start - The start of the text being replaced.len - The length of the text being replaced.
public boolean getShowDescWindow()
setShowDescWindow(boolean)public javax.swing.text.JTextComponent getTextComponent()
null if this
AutoCompletion is not installed on any text component.install(JTextComponent)public javax.swing.KeyStroke getTriggerKey()
setTriggerKey(KeyStroke)public void hierarchyChanged(java.awt.event.HierarchyEvent e)
Window, this method
registers listeners on that Window.
hierarchyChanged in interface java.awt.event.HierarchyListenere - The event.public boolean hideChildWindows()
public void install(javax.swing.text.JTextComponent c)
AutoCompletion is already installed on another text component,
it is uninstalled first.
c - The text component.uninstall()public boolean isAutoCompleteEnabled()
setAutoCompleteEnabled(boolean)public boolean isParameterAssistanceEnabled()
setParameterAssistanceEnabled(boolean)protected int refreshPopupWindow()
public void setAutoCompleteEnabled(boolean enabled)
enabled - Whether auto-completion is enabled.isAutoCompleteEnabled()public void setAutoCompleteSingleChoices(boolean autoComplete)
autoComplete - Whether to auto-complete single choices.getAutoCompleteSingleChoices()public void setCompletionProvider(CompletionProvider provider)
provider - The new completion provider. This cannot be
null.
java.lang.IllegalArgumentException - If provider is
null.
public void setChoicesWindowSize(int w,
int h)
w - The new width.h - The new height.setDescriptionWindowSize(int, int)
public void setDescriptionWindowSize(int w,
int h)
w - The new width.h - The new height.setChoicesWindowSize(int, int)public void setExternalURLHandler(ExternalURLHandler handler)
handler - The new handler.getExternalURLHandler()public void setListCellRenderer(javax.swing.ListCellRenderer renderer)
renderer - The renderer to use. If this is null,
a default renderer is used.getListCellRenderer()public void setParameterAssistanceEnabled(boolean enabled)
enabled - Whether parameter assistance should be enabled.isParameterAssistanceEnabled()public void setShowDescWindow(boolean show)
show - Whether to show the description window.getShowDescWindow()public void setTriggerKey(javax.swing.KeyStroke ks)
ks - The keystroke.
java.lang.IllegalArgumentException - If ks is null.getTriggerKey()public void uninstall()
install(JTextComponent)public void updateUI()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||