org.csstudio.ui.util.swt.stringtable
Class StringTableEditor

java.lang.Object
  extended by Composite
      extended by org.csstudio.ui.util.swt.stringtable.StringTableEditor

public class StringTableEditor
extends Composite

Editor for table (list) of String or String[] entries, allows up/down ordering, add and delete

Author:
Kay Kasemir, Xihui Chen

Constructor Summary
StringTableEditor(Composite parent, java.util.List<java.lang.String> items)
          Create a string list editor which is a table with only one column.
StringTableEditor(Composite parent, java.lang.String[] headers, boolean[] editable, java.util.List<java.lang.String[]> items, RowEditDialog rowEditDialog, int[] columnsMinWidth)
          Creates an editable table.
 
Method Summary
 TableViewer getTableViewer()
           
 void refresh()
          Refresh the editor after the list of items was changed
 void setEnabled(boolean enabled)
           
 void updateInput(java.util.List<?> new_items)
          Update the input to the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringTableEditor

public StringTableEditor(Composite parent,
                         java.lang.String[] headers,
                         boolean[] editable,
                         java.util.List<java.lang.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,
                         java.util.List<java.lang.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 Detail

updateInput

public void updateInput(java.util.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)

getTableViewer

public TableViewer getTableViewer()