java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.csstudio.swt.widgets.natives.SpreadSheetTable
public class SpreadSheetTable
Nested Class Summary | |
---|---|
static interface |
SpreadSheetTable.ITableCellEditingListener
Listener on table cell editing events. |
static interface |
SpreadSheetTable.ITableModifiedListener
Listener on table contents modified events. |
static interface |
SpreadSheetTable.ITableSelectionChangedListener
Listener on table selection changed events. |
Field Summary |
---|
Fields inherited from class org.eclipse.swt.widgets.Control |
---|
handle |
Constructor Summary | |
---|---|
SpreadSheetTable(org.eclipse.swt.widgets.Composite parent)
Create a spreadsheet table. |
Method Summary | |
---|---|
void |
addCellEditingListener(SpreadSheetTable.ITableCellEditingListener listener)
Add a table cell editing listener. |
void |
addModifiedListener(SpreadSheetTable.ITableModifiedListener listener)
Add a table modified listener. |
void |
addSelectionChangedListener(SpreadSheetTable.ITableSelectionChangedListener listener)
Add a selection changed listener. |
void |
autoSizeColumns()
Auto size all columns. |
void |
deleteColumn(int index)
Delete a column. |
void |
deleteRow(int index)
Delete a row. |
java.lang.String |
getCellText(int row,
int col)
Get text of a cell. |
int |
getColumnCount()
Get number of columns. |
java.lang.String[][] |
getContent()
Get content of the table in a 2D string array. |
java.util.List<java.util.List<java.lang.String>> |
getInput()
Get input of the table by which the table is backed. |
int[] |
getRowColumnIndex(org.eclipse.swt.graphics.Point point)
Get row and column index under given point. |
int |
getRowCount()
|
java.lang.String[][] |
getSelection()
Get selected part. |
org.eclipse.jface.viewers.TableViewer |
getTableViewer()
|
void |
insertColumn(int index)
Insert a column. |
void |
insertRow(int index)
Insert a row. |
boolean |
isEditable()
|
boolean |
isEmpty()
|
void |
pack()
|
void |
refresh()
Refresh the table to reflect its content. |
void |
setCellBackground(int row,
int col,
org.eclipse.swt.graphics.RGB rgbColor)
Set background color of the cell. |
void |
setCellForeground(int row,
int col,
org.eclipse.swt.graphics.RGB rgbColor)
Set forground color of the cell. |
void |
setCellText(int row,
int col,
java.lang.String text)
Set the text of a cell. |
void |
setColumnHeader(int columnIndex,
java.lang.String header)
Set the header of a column. |
void |
setColumnHeaders(java.lang.String[] headers)
Set column headers. |
void |
setColumnHeaderVisible(boolean show)
Show/hide table column headers. |
void |
setColumnsCount(int count)
Set number of columns. |
void |
setColumnWidth(int col,
int width)
|
void |
setColumnWidths(int[] widthes)
Set width of each column. |
void |
setContent(java.lang.String[][] content)
Set content of the table.Old content in table will be replaced by the new content. |
void |
setEditable(boolean editable)
Set if the table is editable. |
void |
setFont(org.eclipse.swt.graphics.Font font)
|
void |
setInput(java.util.List<java.util.List<java.lang.String>> input)
Set input of the table. |
void |
setMenu(org.eclipse.swt.widgets.Menu menu)
|
void |
setRowBackground(int row,
org.eclipse.swt.graphics.RGB rgbColor)
Set background color of the row. |
void |
setRowForeground(int row,
org.eclipse.swt.graphics.RGB rgbColor)
Set foreground color of the row. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Control |
---|
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpreadSheetTable(org.eclipse.swt.widgets.Composite parent)
parent
- parent composite.style
- the style of widget to constructMethod Detail |
---|
public void addCellEditingListener(SpreadSheetTable.ITableCellEditingListener listener)
listener
- the listenerpublic void addModifiedListener(SpreadSheetTable.ITableModifiedListener listener)
listener
- the listenerpublic void addSelectionChangedListener(SpreadSheetTable.ITableSelectionChangedListener listener)
listener
- the listenerpublic void autoSizeColumns()
public void deleteColumn(int index)
index
- index of the column.public void deleteRow(int index)
index
- index of the row.public java.lang.String getCellText(int row, int col)
row
- row index of the cell.col
- column index of the cell.
public int getColumnCount()
Table#getColumnCount()}
public java.lang.String[][] getContent()
public java.util.List<java.util.List<java.lang.String>> getInput()
refresh()
if the returned list has been modified outside.
public int[] getRowColumnIndex(org.eclipse.swt.graphics.Point point)
point
- the widget-relative coordinates
public int getRowCount()
public java.lang.String[][] getSelection()
public org.eclipse.jface.viewers.TableViewer getTableViewer()
TableViewer
wrapped by this widget.public void insertColumn(int index)
index
- index of the column.public void insertRow(int index)
index
- index of the row.public boolean isEditable()
public boolean isEmpty()
public void pack()
pack
in class org.eclipse.swt.widgets.Control
public void refresh()
public void setCellBackground(int row, int col, org.eclipse.swt.graphics.RGB rgbColor)
row
- row index of the cell.col
- column index of the cell.rgbColor
- color in RGB.public void setCellForeground(int row, int col, org.eclipse.swt.graphics.RGB rgbColor)
row
- row index of the cell.col
- column index of the cell.rgbColor
- color in RGB.public void setCellText(int row, int col, java.lang.String text)
row
- row index of the cell. Start from 0.col
- column index of the cell. Start from 0.text
- text to be set.public void setColumnHeader(int columnIndex, java.lang.String header)
columnIndex
- index of the column.header
- header text.public void setColumnHeaders(java.lang.String[] headers)
headers
- headers text.public void setColumnHeaderVisible(boolean show)
show
- the new visibility statepublic void setColumnsCount(int count)
count
- number of columns.public void setColumnWidth(int col, int width)
public void setColumnWidths(int[] widthes)
widthes
- column size in pixels.public void setContent(java.lang.String[][] content)
content
- the new content.public void setEditable(boolean editable)
editable
- true if table is editable.public void setFont(org.eclipse.swt.graphics.Font font)
setFont
in class org.eclipse.swt.widgets.Control
public void setInput(java.util.List<java.util.List<java.lang.String>> input)
input
- input of the table.public void setMenu(org.eclipse.swt.widgets.Menu menu)
setMenu
in class org.eclipse.swt.widgets.Control
public void setRowBackground(int row, org.eclipse.swt.graphics.RGB rgbColor)
row
- row index of the cell.rgbColor
- color in RGB.public void setRowForeground(int row, org.eclipse.swt.graphics.RGB rgbColor)
row
- row index of the cell.rgbColor
- color in RGB.