Class StringTableEditor
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.csstudio.ui.util.swt.stringtable.StringTableEditor
- All Implemented Interfaces:
Drawable
Editor for table (list) of String or String[] entries, allows up/down ordering, add and delete
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
-
Constructor Summary
ConstructorDescriptionStringTableEditor
(Composite parent, String[] headers, boolean[] editable, List<String[]> items, RowEditDialog rowEditDialog, int[] columnsMinWidth) Creates an editable table.StringTableEditor
(Composite parent, String[] headers, boolean[] editable, List<String[]> items, RowEditDialog rowEditDialog, int[] columnsMinWidth, StringTableEditor.CellEditorType[] cellEditorTypes, Object[] cellEditorDatas) Creates an editable table.StringTableEditor
(Composite parent, List<String> items) Create a string list editor which is a table with only one column. -
Method Summary
Modifier and TypeMethodDescriptionvoid
refresh()
Refresh the editor after the list of items was changedvoid
setEnabled
(boolean enabled) void
updateInput
(List<?> new_items) Update the input to the table.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
-
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
Create a string list editor which is a table with only one column.- Parameters:
parent
- Parent widgetitems
- List of strings, will be changed in-place
-
-
Method Details
-
updateInput
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 classControl
-
getTableViewer
-