Class StringTableEditor

All Implemented Interfaces:
Drawable

public class StringTableEditor extends Composite
Editor for table (list) of String or String[] entries, allows up/down ordering, add and delete
  • Constructor Details

    • StringTableEditor

      public StringTableEditor(Composite parent, String[] headers, boolean[] editable, List<String[]> items, RowEditDialog rowEditDialog, int[] columnsMinWidth)
      Creates an editable table. The size of headers array implies the number of columns.
      Parameters:
      parent - The composite which the table resides in. Cannot be null.
      headers - Contains the header for each column. Cannot be null.
      editable - Whether it is editable for each column. The size must be same as headers. If it's null, all columns will be editable.
      items - The items to be displayed and manipulated in the table. Cannot be null. Each element in the list, which is an array of string, represents the data in a row. In turn, each element in the string array represents the data in a cell. So it is required that every string array in the list must has the same size as headers.
      rowEditDialog - The dialog to edit a row. If it is null, there will be no edit button.
      columnsMinWidth - The minimum width for each column. Cannot be null.
    • StringTableEditor

      public StringTableEditor(Composite parent, String[] headers, boolean[] editable, List<String[]> items, RowEditDialog rowEditDialog, int[] columnsMinWidth, StringTableEditor.CellEditorType[] cellEditorTypes, Object[] cellEditorDatas)
      Creates an editable table. The size of headers array implies the number of columns.
      Parameters:
      parent - The composite which the table resides in. Cannot be null.
      headers - Contains the header for each column. Cannot be null.
      editable - Whether it is editable for each column. The size must be same as headers. If it's null, all columns will be editable.
      items - The items to be displayed and manipulated in the table. Cannot be null. Each element in the list, which is an array of string, represents the data in a row. In turn, each element in the string array represents the data in a cell. So it is required that every string array in the list must has the same size as headers.
      rowEditDialog - The dialog to edit a row. If it is null, there will be no edit button.
      columnsMinWidth - The minimum width for each column. Cannot be null.
      cellEditorTypes - the cell editor type for each column. null for default text cell editor.
      cellEditorDatas - the corresponding data for the cell editor. For example, a String[] for dropdown and checkbox cell editor. null if not needed. For checkbox, String[0] is the text for false, String[1] is for true.
    • StringTableEditor

      public StringTableEditor(Composite parent, List<String> items)
      Create a string list editor which is a table with only one column.
      Parameters:
      parent - Parent widget
      items - List of strings, will be changed in-place
  • Method Details

    • updateInput

      public void updateInput(List<?> new_items)
      Update the input to the table.
      Parameters:
      new_items - New items. Must be either List of String or String[], and type must match whatever was used to construct the StringTableEditor.
    • refresh

      public void refresh()
      Refresh the editor after the list of items was changed
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class Control
    • getTableViewer

      public TableViewer getTableViewer()