Class AutoCompleterListView
- java.lang.Object
-
- org.omegat.gui.editor.autocompleter.AbstractAutoCompleterView
-
- org.omegat.gui.editor.autocompleter.AutoCompleterListView
-
- Direct Known Subclasses:
AutotextAutoCompleterView
,GlossaryAutoCompleterView
,HistoryCompleter
,HistoryPredictor
,TagAutoCompleterView
public abstract class AutoCompleterListView extends AbstractAutoCompleterView
A list based auto-completer view.
-
-
Constructor Summary
Constructors Constructor Description AutoCompleterListView(java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.List<AutoCompleterItem>
computeListData(java.lang.String prevText, boolean contextualOnly)
Compute the items visible in the auto-completer listjavax.swing.JList<AutoCompleterItem>
getList()
int
getPreferredHeight()
get the preferred height of the componentint
getPreferredWidth()
get the preferred width of the componentint
getRowCount()
return the size of the data list / array.AutoCompleterItem
getSelectedValue()
get the selected valuejava.awt.Component
getViewContent()
Obtain the content to put in the autocompleter popup.abstract java.lang.String
itemToString(AutoCompleterItem item)
Each view should determine how to print a view item.boolean
processKeys(java.awt.event.KeyEvent e)
Process the autocompletion keysboolean
shouldPopUp()
Return true to indicate that the view has relevant contextual suggestions that merit displaying the AutoCompleter popup unprompted.void
updateViewData()
Update the view data-
Methods inherited from class org.omegat.gui.editor.autocompleter.AbstractAutoCompleterView
getName, getTargetLanguage, getTokenizer, setParent, shouldCloseOnSelection
-
-
-
-
Method Detail
-
getList
public javax.swing.JList<AutoCompleterItem> getList()
-
processKeys
public boolean processKeys(java.awt.event.KeyEvent e)
Description copied from class:AbstractAutoCompleterView
Process the autocompletion keys- Specified by:
processKeys
in classAbstractAutoCompleterView
- Parameters:
e
- the key event to process- Returns:
- true if a key has been processed, false if otherwise.
-
getRowCount
public int getRowCount()
Description copied from class:AbstractAutoCompleterView
return the size of the data list / array.- Specified by:
getRowCount
in classAbstractAutoCompleterView
- Returns:
-
getPreferredHeight
public int getPreferredHeight()
Description copied from class:AbstractAutoCompleterView
get the preferred height of the component- Specified by:
getPreferredHeight
in classAbstractAutoCompleterView
- Returns:
-
getPreferredWidth
public int getPreferredWidth()
Description copied from class:AbstractAutoCompleterView
get the preferred width of the component- Specified by:
getPreferredWidth
in classAbstractAutoCompleterView
- Returns:
-
getSelectedValue
public AutoCompleterItem getSelectedValue()
Description copied from class:AbstractAutoCompleterView
get the selected value- Specified by:
getSelectedValue
in classAbstractAutoCompleterView
- Returns:
-
getViewContent
public java.awt.Component getViewContent()
Description copied from class:AbstractAutoCompleterView
Obtain the content to put in the autocompleter popup. The view should also do any other preparation necessary for display.- Specified by:
getViewContent
in classAbstractAutoCompleterView
- Returns:
- the component to show in the autocompleter popup
-
updateViewData
public void updateViewData()
Description copied from class:AbstractAutoCompleterView
Update the view data- Specified by:
updateViewData
in classAbstractAutoCompleterView
-
shouldPopUp
public boolean shouldPopUp()
Description copied from class:AbstractAutoCompleterView
Return true to indicate that the view has relevant contextual suggestions that merit displaying the AutoCompleter popup unprompted.- Specified by:
shouldPopUp
in classAbstractAutoCompleterView
- Returns:
- Whether or not the AutoCompleter should appear
-
computeListData
public abstract java.util.List<AutoCompleterItem> computeListData(java.lang.String prevText, boolean contextualOnly)
Compute the items visible in the auto-completer list- Parameters:
prevText
- the text in the editing field up to the cursor location- Returns:
- a list of AutoCompleterItems.
-
itemToString
public abstract java.lang.String itemToString(AutoCompleterItem item)
Each view should determine how to print a view item.- Parameters:
item
- The item to print- Returns:
- A string representation of the view item
-
-