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
.viewers
.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
26 public class TmfBaseColumnData
implements ITmfStatisticsColumnData
{
31 protected final String fHeader
;
34 * Width of the column.
36 protected final int fWidth
;
39 * Alignment of the column.
41 protected final int fAlignment
;
44 * Tooltip of the column.
46 protected final String fTooltip
;
49 * Adapts a StatisticsTreeNode into the content of it's corresponding cell
52 protected final ColumnLabelProvider fLabelProvider
;
55 * Used to sort elements of this column. Can be null.
57 protected final ViewerComparator fComparator
;
60 * Used to draw bar charts in this column. Can be null.
62 protected final ITmfColumnPercentageProvider fPercentageProvider
;
65 * Used to draw bar charts in columns.
67 public interface ITmfColumnPercentageProvider
{
73 * The statistics tree node
74 * @return The value as a percentage
76 public double getPercentage(TmfStatisticsTreeNode node
);
80 * Constructor with parameters
83 * header of the column. The name will be shown at the top of the
86 * width of the column.
88 * alignment of the text
90 * text to shown as a tooltip when the cursor comes over the
93 * provide all the column element
95 * used to compare element between them to be able to classify
96 * the content of the columns
98 * provide the percentage of a specific element
100 public TmfBaseColumnData(String h
, int w
, int a
, String t
,
101 ColumnLabelProvider l
, ViewerComparator c
,
102 ITmfColumnPercentageProvider p
) {
109 fPercentageProvider
= p
;
114 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getHeader()
117 public String
getHeader() {
123 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getWidth()
126 public int getWidth() {
132 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getAlignment()
135 public int getAlignment() {
141 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getTooltip()
144 public String
getTooltip() {
150 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getLabelProvider()
153 public ColumnLabelProvider
getLabelProvider() {
154 return fLabelProvider
;
159 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getComparator()
162 public ViewerComparator
getComparator() {
168 * @see org.eclipse.linuxtools.tmf.ui.viewers.statistics.model.ITmfStatisticsColumnData#getPercentageProvider()
171 public ITmfColumnPercentageProvider
getPercentageProvider() {
172 return fPercentageProvider
;