Class AutoCompleteTextEditingSupport<T,V>

java.lang.Object
org.eclipse.jface.viewers.EditingSupport
com.amalgamasimulation.desktop.binding.editingsupports.GenericEditingSupport<T,V>
com.amalgamasimulation.desktop.binding.editingsupports.TextEditingSupport<T,V>
com.amalgamasimulation.desktop.binding.editingsupports.AutoCompleteTextEditingSupport<T,V>
Type Parameters:
T - type of row value
V - type of column value (cell value)
Direct Known Subclasses:
EMFAutoCompleteTextEditingSupport

public class AutoCompleteTextEditingSupport<T,V> extends TextEditingSupport<T,V>
Class is used to enable editing a table cell via a auto complete with a list of values. After pressing CTRL-Space a combo box with a list of values ​​appears
Author:
Ionov Ivan
  • Constructor Details

    • AutoCompleteTextEditingSupport

      public AutoCompleteTextEditingSupport(org.eclipse.jface.viewers.ColumnViewer viewer, org.eclipse.swt.widgets.Composite parent)
  • Method Details

    • getCellEditorInternal

      protected org.eclipse.jface.viewers.CellEditor getCellEditorInternal(T element)
      Overrides:
      getCellEditorInternal in class TextEditingSupport<T,V>
    • setValueInternal

      protected void setValueInternal(T element, V value)
      Overrides:
      setValueInternal in class TextEditingSupport<T,V>
    • enableNullElement

      public AutoCompleteTextEditingSupport<T,V> enableNullElement(String notSetLiteral)
      Add an element on top of other elements in the combo box to clear the table cell value.
      Parameters:
      notSetLiteral - the label of the new combo box element that clears the cell value (typical values are: "", etc.)
      Returns:
      this object
    • setFilter

      public AutoCompleteTextEditingSupport<T,V> setFilter(BiPredicate<T,V> filter)
      Add a filter. Only matching items will be displayed in the combo box.
      Note that there may be at most one filter. If you call this method several times, only the last method call will be effective.
      Returns:
      this object
    • setComparator

      public AutoCompleteTextEditingSupport<T,V> setComparator(Comparator<V> comparator)
      Add a comparator that is used to sort combo box values.
      Note that there may be at most one comparator. If you call this method several times, only the last method call will be effective.
      Returns:
      this object
    • setNameExtractor

      public AutoCompleteTextEditingSupport<T,V> setNameExtractor(Function<V,String> nameExtractor)
      Set up the combo box elements naming. The name extractor.
      Parameters:
      nameExtractor - function that converts a combo box element to a String displayed in the combo box
      Returns:
      this object
    • setElements

      public AutoCompleteTextEditingSupport<T,V> setElements(org.eclipse.core.databinding.observable.list.IObservableList<V> elements)
      Set up the value elements
      Parameters:
      elements - List of elements to be shown in the auto complete
      Returns:
      this object