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()intgetPreferredHeight()get the preferred height of the componentintgetPreferredWidth()get the preferred width of the componentintgetRowCount()return the size of the data list / array.AutoCompleterItemgetSelectedValue()get the selected valuejava.awt.ComponentgetViewContent()Obtain the content to put in the autocompleter popup.abstract java.lang.StringitemToString(AutoCompleterItem item)Each view should determine how to print a view item.booleanprocessKeys(java.awt.event.KeyEvent e)Process the autocompletion keysbooleanshouldPopUp()Return true to indicate that the view has relevant contextual suggestions that merit displaying the AutoCompleter popup unprompted.voidupdateViewData()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:AbstractAutoCompleterViewProcess the autocompletion keys- Specified by:
processKeysin 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:AbstractAutoCompleterViewreturn the size of the data list / array.- Specified by:
getRowCountin classAbstractAutoCompleterView- Returns:
-
getPreferredHeight
public int getPreferredHeight()
Description copied from class:AbstractAutoCompleterViewget the preferred height of the component- Specified by:
getPreferredHeightin classAbstractAutoCompleterView- Returns:
-
getPreferredWidth
public int getPreferredWidth()
Description copied from class:AbstractAutoCompleterViewget the preferred width of the component- Specified by:
getPreferredWidthin classAbstractAutoCompleterView- Returns:
-
getSelectedValue
public AutoCompleterItem getSelectedValue()
Description copied from class:AbstractAutoCompleterViewget the selected value- Specified by:
getSelectedValuein classAbstractAutoCompleterView- Returns:
-
getViewContent
public java.awt.Component getViewContent()
Description copied from class:AbstractAutoCompleterViewObtain the content to put in the autocompleter popup. The view should also do any other preparation necessary for display.- Specified by:
getViewContentin classAbstractAutoCompleterView- Returns:
- the component to show in the autocompleter popup
-
updateViewData
public void updateViewData()
Description copied from class:AbstractAutoCompleterViewUpdate the view data- Specified by:
updateViewDatain classAbstractAutoCompleterView
-
shouldPopUp
public boolean shouldPopUp()
Description copied from class:AbstractAutoCompleterViewReturn true to indicate that the view has relevant contextual suggestions that merit displaying the AutoCompleter popup unprompted.- Specified by:
shouldPopUpin 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
-
-