1 /*******************************************************************************
2 * Copyright (c) 2011, 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Mathieu Denis (mathieu.denis@polymtl.ca) - Initial Implementation
11 * Bernd Hufmann - Added Annotations
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.views
.statistics
.model
;
16 import org
.eclipse
.jface
.viewers
.ColumnLabelProvider
;
17 import org
.eclipse
.jface
.viewers
.ViewerComparator
;
20 * Contains all the information necessary to build a column of the table.
23 * @author Mathieu Denis
25 public class TmfBaseColumnData
implements ITmfStatisticsColumnData
{
30 protected final String fHeader
;
32 * Width of the column.
34 protected final int fWidth
;
36 * Alignment of the column.
38 protected final int fAlignment
;
40 * Tooltip of the column.
42 protected final String fTooltip
;
44 * Adapts a StatisticsTreeNode into the content of it's corresponding cell for that column.
46 protected final ColumnLabelProvider fLabelProvider
;
48 * Used to sort elements of this column. Can be null.
50 protected final ViewerComparator fComparator
;
52 * Used to draw bar charts in this column. Can be null.
54 protected final ITmfColumnPercentageProvider fPercentageProvider
;
57 * Used to draw bar charts in columns.
59 public interface ITmfColumnPercentageProvider
{
60 public double getPercentage(TmfStatisticsTreeNode node
);
64 * Constructor with parameters
66 * @param h header of the column. The name will be shown at the top of the column.
67 * @param w width of the column.
68 * @param a alignment of the text
69 * @param t text to shown as a tooltip when the cursor comes over the header
70 * @param l provide all the column element
71 * @param c used to compare element between them to be able to classify the content of the columns
72 * @param p provide the percentage of a specific element
74 public TmfBaseColumnData(String h
, int w
, int a
, String t
, ColumnLabelProvider l
, ViewerComparator c
, ITmfColumnPercentageProvider p
) {
81 fPercentageProvider
= p
;
86 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getHeader()
89 public String
getHeader() {
95 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getWidth()
98 public int getWidth() {
104 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getAlignment()
107 public int getAlignment() {
113 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getTooltip()
116 public String
getTooltip() {
122 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getLabelProvider()
125 public ColumnLabelProvider
getLabelProvider() {
126 return fLabelProvider
;
131 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getComparator()
134 public ViewerComparator
getComparator() {
140 * @see org.eclipse.linuxtools.tmf.ui.views.statistics.model.ITmfStatisticsColumnData#getPercentageProvider()
143 public ITmfColumnPercentageProvider
getPercentageProvider() {
144 return fPercentageProvider
;