I am creating a new project using SWT. I will have 3 or 4 different tables in the project. I am new to SWT and I ask if I should use only Table or should there be a TableViewer .
I want to learn some good recommendations about when to use only Table , and when TableViewer is the best route.
- What is the advantage of using
TableViewer instead of Table ? - Should all tables have a
TableViewer ? - If I work with data from a table, is
Table best?
I just really want clarity to create a project. I am doing it right.
EDIT
I created the Tablemodel class that I use for my first table. But the createColumns method createColumns specialized for this particular table.
Is it possible to have a TableViewer class template?
Can I change the method for more convenient use for different tables?
Here is a fragment of the method:
private void createColumns() { String[] titles = { "ItemId", "RevId", "PRL", "Dataset Name", "EC Markup" }; int[] bounds = { 150, 150, 100, 150, 100 }; TableViewerColumn col = createTableViewerColumn(titles[0], bounds[0], 0); col.setLabelProvider(new ColumnLabelProvider() { public String getText(Object element) { if(element instanceof AplotDataModel.AplotDatasetData) return ((AplotDataModel.AplotDatasetData)element).getDataset().toString(); return super.getText(element); } }); col = createTableViewerColumn(titles[1], bounds[1], 1); col.setLabelProvider(new ColumnLabelProvider() { public String getText(Object element) { if(element instanceof AplotDataModel.AplotDatasetData) return ((AplotDataModel.AplotDatasetData)element).getRev().toString(); return super.getText(element); } });
jkteater
source share