Question

I would like to create a tree with a column which contains various data types, such as some cells are date, some cells are number, some cells are SWT color, etc. Then I will apply different cell editors for different types, so there will be date chooser, text area, or color chooser,etc for above cells. Is that possible to do so in TreeViewer or XViewer(from nebula)?

P.S, I find a similiar question for JTable:Jtable with different types of cells depending on data type. That could be solved by TableCellRenderer.

Était-ce utile?

La solution

If you use TreeColumnLayout for the tree layout with TreeViewerColumn for each column you can then set up the cell editing support using TreeViewerColumn.setEditingSupport. You provide this with a class derived from EditingSupport.

EditingSupport has a getCellEditor(Object element) method to get the cell editor for the column with the particular element value. So you can return different cell editors for different element.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top