Revision 3a45849e
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/QuantitativeChartTooltip.java | ||
---|---|---|
16 | 16 |
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; |
17 | 17 |
import org.eclipse.swt.SWT; |
18 | 18 |
import org.eclipse.swt.graphics.Point; |
19 |
import org.eclipse.swt.layout.FillLayout; |
|
19 | 20 |
import org.eclipse.swt.layout.GridData; |
20 | 21 |
import org.eclipse.swt.layout.GridLayout; |
21 | 22 |
import org.eclipse.swt.widgets.Composite; |
22 | 23 |
import org.eclipse.swt.widgets.Event; |
24 |
import org.eclipse.swt.widgets.Label; |
|
23 | 25 |
import org.swtchart.Chart; |
24 | 26 |
import org.swtchart.IAxis; |
25 | 27 |
import org.swtchart.ILineSeries; |
... | ... | |
53 | 55 |
@Override |
54 | 56 |
protected Composite createToolTipContentArea(Event event, |
55 | 57 |
Composite parent) { |
56 |
parent.setLayout(new GridLayout()); |
|
57 | 58 |
|
59 |
int colPos = matrix.getNatTable().getColumnPositionByX(event.x); |
|
60 |
int colIndex = matrix.getNatTable().getColumnIndexByPosition(colPos); |
|
61 |
Feature feature = matrix.getIndexToFeatureMap().get(colIndex); |
|
62 |
QuantitativeDataStatistics dataStatistics = matrix.getFeatureToQuantDataStatisticsMap().get(feature); |
|
63 |
|
|
64 |
Composite tooltip; |
|
65 |
if(dataStatistics!=null){ |
|
66 |
parent.setLayout(new GridLayout()); |
|
67 |
tooltip = createTooltip(event, parent); |
|
68 |
} |
|
69 |
else{ |
|
70 |
tooltip = new Composite(parent, SWT.NONE); |
|
71 |
tooltip.setLayout(new FillLayout()); |
|
72 |
Label label = new Label(tooltip, SWT.NONE); |
|
73 |
label.setText(CategoricalChartTooltip.TOOLTIP_NOT_AVAILABLE); |
|
74 |
} |
|
75 |
return tooltip; |
|
76 |
|
|
77 |
} |
|
78 |
|
|
79 |
private Composite createTooltip(Event event, Composite parent){ |
|
58 | 80 |
Chart chart = new Chart(parent, SWT.NONE); |
59 | 81 |
chart.setLayoutData(new GridData(600, 300)); |
60 | 82 |
|
... | ... | |
115 | 137 |
int colIndex = matrix.getNatTable().getColumnIndexByPosition(colPos); |
116 | 138 |
int rowPos = matrix.getNatTable().getRowPositionByY(event.y); |
117 | 139 |
Feature feature = matrix.getIndexToFeatureMap().get(colIndex); |
118 |
QuantitativeDataStatistics dataStatistics = matrix.getFeatureToQuantDataStatisticsMap().get(feature); |
|
119 | 140 |
|
120 | 141 |
if(matrix.isShowTooltips() |
121 | 142 |
&& rowPos==1 |
122 |
&& colIndex>=CharacterMatrix.LEADING_COLUMN_COUNT
|
|
123 |
&& dataStatistics!=null) {
|
|
143 |
&& feature.isSupportsQuantitativeData()
|
|
144 |
&& colIndex>=CharacterMatrix.LEADING_COLUMN_COUNT) {
|
|
124 | 145 |
return true; |
125 | 146 |
} |
126 | 147 |
return false; |
Also available in: Unified diff
ref #7549 Add fallback tooltip