문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top