From 2fcd5eea1fd9c4c9030fdc6b830ce7c9582aaeae Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Thu, 7 Aug 2014 16:30:45 -0400 Subject: [PATCH] tmf: Do not expose TmfEventTableColumn in TmfVirtualTable Change-Id: Iabfc690c5c09be1a58d63514ad0d22d7f0033db6 Signed-off-by: Alexandre Montplaisir Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/31239 Tested-by: Hudson CI --- .../tmf/ui/viewers/events/TmfEventsTable.java | 8 ++- .../widgets/virtualtable/TmfVirtualTable.java | 68 ++++++++----------- 2 files changed, 36 insertions(+), 40 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java index d54dc4a45a..611a0758b9 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java @@ -408,7 +408,13 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS } // Create the UI columns in the table - fTable.createColumns(fColumns); + for (TmfEventTableColumn col : fColumns) { + TableColumn column = fTable.newTableColumn(SWT.LEFT); + column.setText(col.getHeaderName()); + column.setToolTipText(col.getHeaderTooltip()); + column.setData(Key.FIELD_ID, col.getFilterFieldId()); + column.pack(); + } // Set the frozen row for header row fTable.setFrozenRowCount(1); diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java index 94800631e9..7dd7dec169 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java @@ -15,11 +15,7 @@ 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; @@ -618,6 +614,35 @@ public class TmfVirtualTable extends Composite { // 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 @@ -906,41 +931,6 @@ public class TmfVirtualTable extends Composite { /* 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 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 -- 2.34.1