public class EntryCompletion extends Object implements CellLayout
Entry
to provide completion
functionality.
To add completion functionality to an Entry, use its
setCompletion()
method.
Modifier and Type | Class and Description |
---|---|
static interface |
EntryCompletion.ActionActivated
Emitted when an action item is selected from the popup action list.
|
static interface |
EntryCompletion.CursorOnMatch
Emitted when the cursor is on a completion string without select it.
|
static interface |
EntryCompletion.InsertPrefix
Emitted when the inline auto-completion is triggered.
|
static interface |
EntryCompletion.Match
The callback invoked when a EntryCompletion wants to ask if a given row
in the TreeModel should be in the completion list.
|
static interface |
EntryCompletion.MatchSelected
Emitted when a completion string was selected from the completion list.
|
Constructor and Description |
---|
EntryCompletion()
Create a new EntryCompletion.
|
Modifier and Type | Method and Description |
---|---|
void |
complete()
Refilter the current list of completions based on the current key.
|
void |
connect(EntryCompletion.ActionActivated handler)
Hook up the
EntryCompletion.ActionActivated handler. |
void |
connect(EntryCompletion.CursorOnMatch handler)
Hook up the
EntryCompletion.CursorOnMatch handler. |
void |
connect(EntryCompletion.InsertPrefix handler)
Hook up the
EntryCompletion.InsertPrefix handler. |
void |
connect(EntryCompletion.MatchSelected handler)
Hook up the
EntryCompletion.MatchSelected handler. |
void |
deleteAction(int index)
Delete the item at the position in the action item list specified by
index . |
boolean |
emitMatchSelected(TreeIter row)
Force the
EntryCompletion.MatchSelected signal to be emitted. |
String |
getCompletionPrefix()
Get the original text entered that triggered the completion or
null if there is no completion. |
Entry |
getEntry()
Retrieve the Entry that this EntryCompletion is attached to.
|
boolean |
getInlineCompletion()
Has automatic inline completion been enabled?
|
boolean |
getInlineSelection()
Return
true if inline-selection mode is turned on. |
int |
getMinimumKeyLength()
Return the minimum key length set for the entry completion.
|
TreeModel |
getModel()
Get the TreeModel currently providing the data powering this
EntryCompletion, or
null if not yet set. |
boolean |
getPopupCompletion()
Return
true if automatic completion popup is enabled. |
boolean |
getPopupSetWidth()
Return
true if completion popup resize is enabled. |
boolean |
getPopupSingleMatch()
Return
true if completion popup appears when there is a
single match. |
void |
insertActionMarkup(int index,
String markup)
Insert an action item in the action item list of the EntryCompletion at
the position specified by
index with the markup specified
by markup . |
void |
insertActionText(int index,
String text)
Insert an action in the action item list of the EntryCompletion at the
position specified by
index with the text specified by
text . |
void |
insertPrefix()
Request a prefix insertion.
|
void |
setInlineCompletion(boolean setting)
Enable or disable the automatic inline completion.
|
void |
setInlineSelection(boolean setting)
Enable or disable the possibility of cycle through the possible
completions inside the entry.
|
void |
setMatchCallback(EntryCompletion.Match callback)
Hookup the
EntryCompletion.Match callback that will be
used to determine if a row of the associated TreeModel should be in the
completion list. |
void |
setMinimumKeyLength(int length)
Set the minimum length of the search key to the value specified by
length . |
void |
setModel(TreeModel store)
Set the TreeModel being used to source data for this EntryCompletion.
|
void |
setPopupCompletion(boolean setting)
Enable or disable completion popup.
|
void |
setPopupSetWidth(boolean setting)
Enable or disable the completion popup resize.
|
void |
setPopupSingleMatch(boolean setting)
Enable or disable the popup when there is only a single match.
|
void |
setTextColumn(DataColumn column)
Create and adds a
CellRendererText using the specified
DataColumn in your TreeModel as the source for completion strings |
public EntryCompletion()
public void complete()
If you are looking to duplicate the effect of a line in the completion
list being selected by the user see
emitMatchSelected()
instead.
public void connect(EntryCompletion.ActionActivated handler)
EntryCompletion.ActionActivated
handler.public void connect(EntryCompletion.CursorOnMatch handler)
EntryCompletion.CursorOnMatch
handler.public void connect(EntryCompletion.InsertPrefix handler)
EntryCompletion.InsertPrefix
handler.public void connect(EntryCompletion.MatchSelected handler)
EntryCompletion.MatchSelected
handler.public void deleteAction(int index)
index
.public boolean emitMatchSelected(TreeIter row)
EntryCompletion.MatchSelected
signal to be emitted.
This action will result in the completion of the associated Entry using
the completion string pointed at by the given TreeIter.public String getCompletionPrefix()
null
if there is no completion.public Entry getEntry()
public boolean getInlineCompletion()
public boolean getInlineSelection()
true
if inline-selection mode is turned on.public int getMinimumKeyLength()
setMinimumKeyLength()
for more
information.public TreeModel getModel()
null
if not yet set.public boolean getPopupCompletion()
true
if automatic completion popup is enabled.public boolean getPopupSetWidth()
true
if completion popup resize is enabled.public boolean getPopupSingleMatch()
true
if completion popup appears when there is a
single match.public void insertActionMarkup(int index, String markup)
index
with the markup specified
by markup
.public void insertActionText(int index, String text)
index
with the text specified by
text
.
If you want the action item to have markup, use
insertActionMarkup()
instead.
public void insertPrefix()
public void setInlineCompletion(boolean setting)
If setting
is true
, the common prefix of the
possible completions will be automatically inserted in the Entry.
The default is false
.
public void setInlineSelection(boolean setting)
This is ordinarily unset.
public void setMatchCallback(EntryCompletion.Match callback)
EntryCompletion.Match
callback that will be
used to determine if a row of the associated TreeModel should be in the
completion list.public void setMinimumKeyLength(int length)
length
. This means that the key string (which is in the
Entry) must be at least length characters before a completion list will
be displayed.
This is useful for long lists, where completing using a small key will take too much time and will return a too large dataset.
public void setModel(TreeModel store)
store
- a value of null
will remove the data model
underlying this EntryCompletion, leaving it unset for the
present.public void setPopupCompletion(boolean setting)
The default is true
, which is that completions will be
presented in a popup window.
public void setPopupSetWidth(boolean setting)
If setting
is true
the popup window will be
resized according to the completion width.
public void setPopupSingleMatch(boolean setting)
If setting
is true
the popup will appear even
if there is a single match. The default is that this is the case.
public void setTextColumn(DataColumn column)
CellRendererText
using the specified
DataColumn in your TreeModel as the source for completion strings