package org.eclipse.linuxtools.tmf.ui.widgets.virtualtable;
-import java.util.List;
-
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
-import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable.Key;
-import org.eclipse.linuxtools.tmf.ui.viewers.events.columns.TmfEventTableColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.custom.TableEditor;
// Simulated Table API
// ------------------------------------------------------------------------
+ /**
+ * Constructs a new TableColumn instance given a style value describing its
+ * alignment behavior. The column is added to the end of the columns
+ * maintained by the table.
+ *
+ * @param style
+ * the alignment style
+ * @return the new TableColumn
+ *
+ * @see SWT#LEFT
+ * @see SWT#RIGHT
+ * @see SWT#CENTER
+ *
+ * @since 3.1
+ */
+ public TableColumn newTableColumn(int style) {
+ TableColumn column = new TableColumn(fTable, style);
+
+ /*
+ * In Linux the table does not receive a control resized event when
+ * a table column resize causes the horizontal scroll bar to become
+ * visible or invisible, so a resize listener must be added to every
+ * table column to properly update the number of fully visible rows.
+ */
+ column.addControlListener(fResizeListener);
+
+ return column;
+ }
+
/**
* Method setHeaderVisible.
* @param b boolean
/* No-op */
}
- /**
- * Method setColumnHeaders.
- *
- * @param columns
- * The configuration elements of every column, in the order they
- * should be initially in the table.
- * @since 3.1
- */
- public void createColumns(List<TmfEventTableColumn> columns) {
- for (TmfEventTableColumn column : columns) {
-
- /* Set the column's header and properties */
- TableColumn tableCol = new TableColumn(fTable, SWT.LEFT);
- tableCol.setText(column.getHeaderName());
-
- /* Set the column's tooltip, if any */
- String tooltip = column.getHeaderTooltip();
- if (tooltip != null) {
- tableCol.setToolTipText(tooltip);
- }
-
- /* Set the column's Field ID (for filtering) */
- tableCol.setData(Key.FIELD_ID, column.getFilterFieldId());
-
- /*
- * In Linux the table does not receive a control resized event when
- * a table column resize causes the horizontal scroll bar to become
- * visible or invisible, so a resize listener must be added to every
- * table column to properly update the number of fully visible rows.
- */
- tableCol.addControlListener(fResizeListener);
- tableCol.pack();
- }
- }
-
/**
* Method removeAll.
* @return int 0 the number of elements in the table