Révision 574
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 574) | ||
---|---|---|
92 | 92 |
*/ |
93 | 93 |
protected HashMap<String, Object> lastComputingParameters = new HashMap<String, Object>(); |
94 | 94 |
|
95 |
public HashMap<String, Object> getLastComputingParameters() { |
|
96 |
return lastComputingParameters; |
|
97 |
} |
|
98 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
99 | 98 |
/** |
100 | 99 |
* Creates a new TXMResult, child of the specified parent. |
101 | 100 |
* |
... | ... | |
175 | 174 |
} |
176 | 175 |
} |
177 | 176 |
|
177 |
// FIXME: not used? |
|
178 |
public HashMap<String, Object> getLastComputingParameters() { |
|
179 |
return lastComputingParameters; |
|
180 |
} |
|
181 |
|
|
182 |
|
|
183 |
|
|
178 | 184 |
/** |
179 | 185 |
* Gets a current parameter specified by its annotation "key" attribute. |
180 | 186 |
* @param key |
... | ... | |
204 | 210 |
* @param key |
205 | 211 |
* @return |
206 | 212 |
*/ |
207 |
protected boolean parameterHasChanged(String key) {
|
|
213 |
public boolean parameterHasChanged(String key) {
|
|
208 | 214 |
if ("".equals(key)) { |
209 | 215 |
return false; |
210 | 216 |
} |
211 |
Object o = lastComputingParameters.get(key);
|
|
217 |
Object lastValue = lastComputingParameters.get(key);
|
|
212 | 218 |
Object newValue = getParameter(key); |
213 |
if (o == null && newValue != null) {
|
|
219 |
if (lastValue == null && newValue != null) {
|
|
214 | 220 |
return true; |
215 | 221 |
} |
216 | 222 |
else { |
217 |
return !o.equals(newValue);
|
|
223 |
return !lastValue.equals(newValue);
|
|
218 | 224 |
} |
219 | 225 |
} |
220 | 226 |
|
... | ... | |
223 | 229 |
/** |
224 | 230 |
* Updates the dirty state by comparing an old parameter with a new one. |
225 | 231 |
* |
226 |
* @param previousValue may be null
|
|
232 |
* @param lastValue may be null
|
|
227 | 233 |
* @param newValue may be null |
228 | 234 |
*/ |
229 |
protected void updateDirty(Object previousValue, Object newValue) {
|
|
230 |
if (previousValue == null || !previousValue.equals(newValue)) {
|
|
231 |
Log.info("Setting dirty to true: old = "+ previousValue + " / new = " + newValue);
|
|
235 |
protected void updateDirty(Object lastValue, Object newValue) {
|
|
236 |
if (lastValue == null || !lastValue.equals(newValue)) {
|
|
237 |
Log.info("Setting dirty to true: old = "+ lastValue + " / new = " + newValue);
|
|
232 | 238 |
this.setDirty(); |
233 | 239 |
} |
234 | 240 |
} |
... | ... | |
264 | 270 |
else { |
265 | 271 |
name = f.getName(); |
266 | 272 |
} |
267 |
|
|
268 | 273 |
|
269 | 274 |
f.setAccessible(true); // not to set accessible to test the field values |
270 | 275 |
Object previousValue = this.lastComputingParameters.get(name); |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 574) | ||
---|---|---|
65 | 65 |
showTitle.setToolTipText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_TITLE); |
66 | 66 |
|
67 | 67 |
if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_TITLE)) { |
68 |
showTitle.setSelection(TXMPreferences.getBoolean(ChartsEnginePreferences.SHOW_TITLE, chartEditorPart.getResultData(), chartEditorPart.getPreferencesNodeQualifier()));
|
|
68 |
showTitle.setSelection(chartEditorPart.getResultData().isTitleVisible());
|
|
69 | 69 |
} |
70 | 70 |
// disable if not managed |
71 | 71 |
else { |
... | ... | |
80 | 80 |
showLegend.setToolTipText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_LEGEND); |
81 | 81 |
|
82 | 82 |
if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_LEGEND)) { |
83 |
showLegend.setSelection(chartEditorPart.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND));
|
|
83 |
showLegend.setSelection(chartEditorPart.getResultData().isLegendVisible());
|
|
84 | 84 |
} |
85 | 85 |
// disable if not managed |
86 | 86 |
else { |
... | ... | |
95 | 95 |
showGrid.setToolTipText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_GRID); |
96 | 96 |
|
97 | 97 |
if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.SHOW_GRID)) { |
98 |
showGrid.setSelection(chartEditorPart.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID));
|
|
98 |
showGrid.setSelection(chartEditorPart.getResultData().isGridVisible());
|
|
99 | 99 |
} |
100 | 100 |
// disable if not managed |
101 | 101 |
else { |
... | ... | |
120 | 120 |
renderingComboItem.setWidth(renderingModeCombo.getBounds().width); |
121 | 121 |
|
122 | 122 |
if(!TXMPreferences.isEmpty(chartEditorPart.getPreferencesNodeQualifier(), ChartsEnginePreferences.RENDERING_COLORS_MODE)) { |
123 |
renderingModeCombo.select(chartEditorPart.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE));
|
|
123 |
renderingModeCombo.select(chartEditorPart.getResultData().getRenderingColorsMode());
|
|
124 | 124 |
} |
125 | 125 |
// disable if not managed |
126 | 126 |
else { |
... | ... | |
129 | 129 |
|
130 | 130 |
|
131 | 131 |
// Font selection |
132 |
final Font currentFont = ChartsEngine.createFont(chartEditorPart.getStringParameterValue(ChartsEnginePreferences.FONT));
|
|
132 |
final Font currentFont = ChartsEngine.createFont(chartEditorPart.getResultData().getFont());
|
|
133 | 133 |
|
134 | 134 |
final Combo fontCombo = new Combo(this, SWT.READ_ONLY); |
135 | 135 |
String fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); |
... | ... | |
217 | 217 |
|
218 | 218 |
boolean update = true; |
219 | 219 |
|
220 |
// Accessing the source must be done outside the Job |
|
221 | 220 |
if(e.getSource() == showTitle) { |
222 |
TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_TITLE, showTitle.getSelection());
|
|
221 |
chartEditorPart.getResultData().setTitleVisible(showTitle.getSelection());
|
|
223 | 222 |
} |
224 | 223 |
else if(e.getSource() == showLegend) { |
225 |
TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_LEGEND, showLegend.getSelection());
|
|
224 |
chartEditorPart.getResultData().setLegendVisible(showLegend.getSelection());
|
|
226 | 225 |
} |
227 | 226 |
else if(e.getSource() == showGrid) { |
228 |
TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_GRID, showGrid.getSelection());
|
|
227 |
chartEditorPart.getResultData().setGridVisible(showGrid.getSelection());
|
|
229 | 228 |
} |
230 | 229 |
else if(e.getSource() == renderingModeCombo) { |
231 |
TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.RENDERING_COLORS_MODE, renderingModeCombo.getSelectionIndex());
|
|
230 |
chartEditorPart.getResultData().setRenderingColorsMode(renderingModeCombo.getSelectionIndex());
|
|
232 | 231 |
} |
233 | 232 |
else if(e.getSource() == fontCombo || e.getSource() == fontSizeCombo) { |
234 |
TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.FONT, "1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|0");
|
|
233 |
chartEditorPart.getResultData().setFont("1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|0");
|
|
235 | 234 |
} |
236 | 235 |
else if(e.getSource() == chartTypeCombo) { |
237 | 236 |
chartEditorPart.getResultData().setChartType(chartTypeCombo.getItem(chartTypeCombo.getSelectionIndex())); |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 574) | ||
---|---|---|
535 | 535 |
} |
536 | 536 |
|
537 | 537 |
|
538 |
/** |
|
539 |
* Creates a composite panel used to extend the default tool bar. |
|
540 |
* @param toolBar |
|
541 |
* @return |
|
542 |
*/ |
|
543 |
// FIXME: became useless ? |
|
544 |
public static Composite createToolBarParametersPanel(ToolBar toolBar) { |
|
545 |
|
|
546 |
Composite parametersPanel = new Composite(toolBar, SWT.NONE); |
|
547 |
|
|
548 |
RowLayout layout = new RowLayout(); |
|
549 |
layout.wrap = true; |
|
550 |
layout.center = true; |
|
551 |
layout.marginTop = 0; |
|
552 |
layout.marginBottom = 0; |
|
553 |
layout.marginHeight = 0; |
|
554 |
parametersPanel.setLayout(layout); |
|
555 |
|
|
556 |
return parametersPanel; |
|
557 |
} |
|
558 |
|
|
559 | 538 |
|
560 |
|
|
561 |
|
|
562 | 539 |
/** |
563 | 540 |
* Export the current view of chart editor in the specified file. |
564 | 541 |
* @param chartEditor |
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 574) | ||
---|---|---|
40 | 40 |
|
41 | 41 |
|
42 | 42 |
|
43 |
@Parameter(type=Parameter.RENDERING) |
|
43 |
@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, type=Parameter.RENDERING)
|
|
44 | 44 |
protected boolean displayPartCountInTitle; |
45 | 45 |
|
46 |
@Parameter(type=Parameter.RENDERING) |
|
46 |
@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE, type=Parameter.RENDERING)
|
|
47 | 47 |
protected boolean sortBySize; |
48 | 48 |
|
49 | 49 |
|
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 574) | ||
---|---|---|
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
// colors |
66 |
this.getChartsEngine().setColors(result.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE), 1);
|
|
66 |
this.getChartsEngine().setColors(result.getRenderingColorsMode(), 1);
|
|
67 | 67 |
// FIXME: one color by part |
68 | 68 |
//this.getChartsEngine().setColors(TXMPreferences.getInt(preferencesNode, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE), parts.size()); |
69 | 69 |
|
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java (revision 574) | ||
---|---|---|
19 | 19 |
import org.txm.partition.core.chartsengine.base.Utils; |
20 | 20 |
import org.txm.partition.core.functions.PartitionDimensions; |
21 | 21 |
import org.txm.partition.core.messages.PartitionCoreMessages; |
22 |
import org.txm.partition.core.preferences.PartitionDimensionsPreferences; |
|
22 | 23 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
23 | 24 |
import org.txm.searchengine.cqp.corpus.Part; |
24 | 25 |
|
... | ... | |
63 | 64 |
boolean sortPartsBySize = partitionDimensions.isSortingBySize(); |
64 | 65 |
boolean displayPartsCountInTitle = partitionDimensions.isDisplayingPartCountInTitle(); |
65 | 66 |
|
66 |
// Fill the data set |
|
67 |
XYSeriesCollection dataset = (XYSeriesCollection) chart.getXYPlot().getDataset(); |
|
68 |
dataset.removeAllSeries(); |
|
69 | 67 |
|
70 |
XYSeries series = new XYSeries(PartitionCoreMessages.CHARTSENGINE_PARTITION_DIMENSIONS_CATEGORY); |
|
71 |
dataset.addSeries(series); |
|
72 |
|
|
73 |
List<Part> parts = partitionDimensions.getParts(sortPartsBySize); |
|
74 |
String[] xAxisSymbols = new String[parts.size()]; |
|
75 |
|
|
76 |
|
|
77 |
try { |
|
78 |
for (int i = 0 ; i < parts.size() ; i++) { |
|
79 |
series.add(i, parts.get(i).getSize()); |
|
80 |
|
|
81 |
// Add X axis symbol |
|
82 |
xAxisSymbols[i] = parts.get(i).getName(); |
|
68 |
if(result.renderingParameterHasChanged(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE)) { |
|
69 |
// Fill the data set |
|
70 |
XYSeriesCollection dataset = (XYSeriesCollection) chart.getXYPlot().getDataset(); |
|
71 |
dataset.removeAllSeries(); |
|
72 |
|
|
73 |
XYSeries series = new XYSeries(PartitionCoreMessages.CHARTSENGINE_PARTITION_DIMENSIONS_CATEGORY); |
|
74 |
dataset.addSeries(series); |
|
75 |
|
|
76 |
List<Part> parts = partitionDimensions.getParts(sortPartsBySize); |
|
77 |
String[] xAxisSymbols = new String[parts.size()]; |
|
78 |
|
|
79 |
|
|
80 |
try { |
|
81 |
for (int i = 0 ; i < parts.size() ; i++) { |
|
82 |
series.add(i, parts.get(i).getSize()); |
|
83 |
|
|
84 |
// Add X axis symbol |
|
85 |
xAxisSymbols[i] = parts.get(i).getName(); |
|
86 |
} |
|
83 | 87 |
} |
88 |
catch(CqiClientException e) { |
|
89 |
// TODO Auto-generated catch block |
|
90 |
e.printStackTrace(); |
|
91 |
} |
|
92 |
|
|
93 |
chart.getXYPlot().setDomainAxis(new SymbolAxisBetweenTicks(chart.getXYPlot().getDomainAxis().getLabel(), xAxisSymbols)); |
|
84 | 94 |
} |
85 |
catch(CqiClientException e) { |
|
86 |
// TODO Auto-generated catch block |
|
87 |
e.printStackTrace(); |
|
88 |
} |
|
89 |
|
|
90 |
chart.getXYPlot().setDomainAxis(new SymbolAxisBetweenTicks(chart.getXYPlot().getDomainAxis().getLabel(), xAxisSymbols)); |
|
91 | 95 |
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
92 | 100 |
// Create chart title |
93 | 101 |
chart.setTitle(Utils.createPartitionDimensionsChartTitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle)); |
94 | 102 |
|
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 574) | ||
---|---|---|
406 | 406 |
int previousposition = -99999; |
407 | 407 |
int distmin = 999999; |
408 | 408 |
for (int m : starts) { |
409 |
if (property != null) |
|
409 |
if (property != null) {
|
|
410 | 410 |
currentname = refValues.get(property).get(i); |
411 |
else |
|
411 |
} |
|
412 |
else { |
|
412 | 413 |
currentname = structuralUnit.getName() + i; |
414 |
} |
|
413 | 415 |
|
414 | 416 |
if (repeatValues) { |
415 | 417 |
structureNames[i] = currentname; |
416 | 418 |
structurePositions[i] = m; |
417 |
} else { |
|
419 |
} |
|
420 |
else { |
|
418 | 421 |
if (!previousname.equals(currentname)) { |
419 | 422 |
structureNames[i] = currentname; |
420 | 423 |
structurePositions[i] = m; |
421 | 424 |
} |
422 | 425 |
} |
423 |
if (i == 0) |
|
424 |
structurePositions[i] += 1; |
|
426 |
if (i == 0) { |
|
427 |
structurePositions[i] += 1; |
|
428 |
} |
|
425 | 429 |
|
426 | 430 |
if (m - previousposition < distmin) { |
427 | 431 |
distmin = m - previousposition; |
... | ... | |
431 | 435 |
previousposition = m; |
432 | 436 |
|
433 | 437 |
i++; |
438 |
|
|
439 |
this.worked(1); |
|
434 | 440 |
} |
435 | 441 |
this.bande = distmin * this.bandeMultiplier; |
436 | 442 |
} |
... | ... | |
452 | 458 |
|
453 | 459 |
XminCorpus = matches.get(0).getStart(); |
454 | 460 |
XmaxCorpus = matches.get(matches.size()-1).getEnd(); |
455 |
} else { |
|
461 |
} |
|
462 |
else { |
|
456 | 463 |
XminCorpus = 0; |
457 | 464 |
XmaxCorpus = corpus.getSize(); |
458 | 465 |
} |
459 | 466 |
//System.out.println("min: "+XminCorpus+ "max: "+XmaxCorpus); |
460 | 467 |
|
461 | 468 |
if (bande <= 0) { |
462 |
bande = ((XmaxCorpus - XminCorpus)/100)*bandeMultiplier;
|
|
463 |
if (bande == 0) |
|
469 |
bande = ((XmaxCorpus - XminCorpus) / 100) * bandeMultiplier;
|
|
470 |
if (bande == 0) {
|
|
464 | 471 |
bande = 1.0f; |
472 |
} |
|
465 | 473 |
} |
466 | 474 |
return true; |
467 | 475 |
} |
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java (revision 574) | ||
---|---|---|
33 | 33 |
Progression progression = (Progression) result; |
34 | 34 |
|
35 | 35 |
// parameters |
36 |
int renderingColorMode = result.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE);
|
|
36 |
int renderingColorMode = result.getRenderingColorsMode();
|
|
37 | 37 |
|
38 | 38 |
boolean monostyle = result.getBooleanParameterValue(ProgressionPreferences.CHART_MONO_STYLE); |
39 | 39 |
boolean cumulative = result.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE); |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 574) | ||
---|---|---|
22 | 22 |
|
23 | 23 |
|
24 | 24 |
|
25 |
/** |
|
26 |
* |
|
27 |
*/ |
|
28 |
public JFCChartCreator() { |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 | 25 |
@Override |
33 | 26 |
public void updateChart(ChartResult result) { |
34 | 27 |
this.updateChart(result, true); |
... | ... | |
46 | 39 |
|
47 | 40 |
// Java object |
48 | 41 |
if(result.getChart() instanceof JFreeChart) { |
49 |
JFreeChart cchart = (JFreeChart) result.getChart();
|
|
42 |
JFreeChart chart = (JFreeChart) result.getChart(); |
|
50 | 43 |
|
51 | 44 |
// freeze rendering |
52 |
cchart.setNotify(false);
|
|
45 |
chart.setNotify(false); |
|
53 | 46 |
|
54 | 47 |
|
55 |
if(cchart.getTitle() != null) { |
|
56 |
cchart.getTitle().setVisible(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE)); |
|
48 |
// title visibility |
|
49 |
if(chart.getTitle() != null && result.renderingParameterHasChanged(ChartsEnginePreferences.SHOW_TITLE)) { |
|
50 |
chart.getTitle().setVisible(result.isTitleVisible()); |
|
57 | 51 |
} |
58 |
if(cchart.getLegend() != null) { |
|
59 |
cchart.getLegend().setVisible(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND)); |
|
52 |
// legend visibility |
|
53 |
if(chart.getLegend() != null && result.renderingParameterHasChanged(ChartsEnginePreferences.SHOW_LEGEND)) { |
|
54 |
chart.getLegend().setVisible(result.isLegendVisible()); |
|
60 | 55 |
} |
61 | 56 |
|
62 |
// CategoryPlot |
|
63 |
if(cchart.getPlot() instanceof CategoryPlot) { |
|
64 |
CategoryPlot plot = (CategoryPlot) cchart.getPlot(); |
|
65 |
plot.setDomainGridlinesVisible(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID)); |
|
66 |
plot.setRangeGridlinesVisible(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID)); |
|
57 |
// grid visibility |
|
58 |
if(result.renderingParameterHasChanged(ChartsEnginePreferences.SHOW_GRID)) { |
|
59 |
// CategoryPlot |
|
60 |
if(chart.getPlot() instanceof CategoryPlot) { |
|
61 |
CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
|
62 |
plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
63 |
plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
64 |
} |
|
65 |
// XYPlot |
|
66 |
else if(chart.getPlot() instanceof XYPlot) { |
|
67 |
XYPlot plot = (XYPlot) chart.getPlot(); |
|
68 |
plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
69 |
plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
70 |
} |
|
67 | 71 |
} |
68 |
// XYPlot |
|
69 |
else if(cchart.getPlot() instanceof XYPlot) { |
|
70 |
XYPlot plot = (XYPlot) cchart.getPlot(); |
|
71 |
plot.setRangeGridlinesVisible(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID)); |
|
72 |
plot.setDomainGridlinesVisible(result.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID)); |
|
73 |
} |
|
74 |
|
|
72 |
|
|
73 |
|
|
75 | 74 |
if(applyTheme) { |
76 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(cchart, result, true);
|
|
75 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(result, true); |
|
77 | 76 |
} |
78 | 77 |
|
79 |
cchart.setNotify(true);
|
|
78 |
chart.setNotify(true); |
|
80 | 79 |
} |
81 | 80 |
// File |
82 | 81 |
else if(result.getChart() instanceof File) { |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/highcharts/defaulttheme/HighchartsDefaultTheme.java (revision 574) | ||
---|---|---|
33 | 33 |
import org.jfree.util.ShapeUtilities; |
34 | 34 |
import org.txm.chartsengine.core.ChartsEngine; |
35 | 35 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
36 |
import org.txm.chartsengine.core.results.ChartResult; |
|
36 | 37 |
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine; |
37 | 38 |
import org.txm.chartsengine.jfreechart.core.renderers.XYCardinalSplineRenderer; |
38 | 39 |
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection; |
... | ... | |
47 | 48 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYLineAndShapeRenderer; |
48 | 49 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYSplineRenderer; |
49 | 50 |
import org.txm.chartsengine.jfreechart.core.themes.highcharts.defaulttheme.renderers.ItemSelectionXYStepRenderer; |
50 |
import org.txm.core.preferences.TXMPreferences; |
|
51 |
import org.txm.core.results.TXMResult; |
|
52 | 51 |
|
53 | 52 |
/** |
54 | 53 |
* Highcharts GWT library default rendering theme. |
... | ... | |
144 | 143 |
* (The theme can not be used with ChartFactory.setChartTheme() because of additional plot, renderer and chart settings according to the type of chart.) |
145 | 144 |
* @param chart |
146 | 145 |
*/ |
147 |
public void applyThemeToChart(JFreeChart chart, TXMResult result, boolean applySeriesStrokes) {
|
|
146 |
public void applyThemeToChart(ChartResult result, boolean applySeriesStrokes) {
|
|
148 | 147 |
|
149 | 148 |
this.createFonts(result); |
150 | 149 |
|
150 |
JFreeChart chart = (JFreeChart) result.getChart(); |
|
151 | 151 |
|
152 | 152 |
super.apply(chart); |
153 | 153 |
|
154 | 154 |
|
155 | 155 |
|
156 |
int itemsColorsRenderingMode = result.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE);
|
|
156 |
int itemsColorsRenderingMode = result.getRenderingColorsMode();
|
|
157 | 157 |
|
158 | 158 |
// FIXME : UI settings |
159 | 159 |
// UIManager.put("ToolTip.background", Color.gray); |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/base/JFCTheme.java (revision 574) | ||
---|---|---|
35 | 35 |
import org.jfree.chart.title.LegendTitle; |
36 | 36 |
import org.txm.chartsengine.core.ChartsEngine; |
37 | 37 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
38 |
import org.txm.chartsengine.core.results.ChartResult; |
|
38 | 39 |
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine; |
39 | 40 |
import org.txm.chartsengine.jfreechart.core.renderers.XYCardinalSplineRenderer; |
40 |
import org.txm.core.preferences.TXMPreferences; |
|
41 | 41 |
import org.txm.core.results.TXMResult; |
42 | 42 |
|
43 | 43 |
public class JFCTheme extends StandardChartTheme { |
... | ... | |
130 | 130 |
* @param preferencesNode |
131 | 131 |
* @param applySeriesStrokes |
132 | 132 |
*/ |
133 |
public void applyThemeToChart(JFreeChart chart, TXMResult result, boolean applySeriesStrokes) {
|
|
133 |
public void applyThemeToChart(ChartResult result, boolean applySeriesStrokes) {
|
|
134 | 134 |
// FIXME |
135 | 135 |
} |
136 | 136 |
|
... | ... | |
142 | 142 |
* @param result |
143 | 143 |
* @param preferencesNode |
144 | 144 |
*/ |
145 |
public void applyThemeToChart(JFreeChart chart, TXMResult result) {
|
|
146 |
this.applyThemeToChart(chart, result, false);
|
|
145 |
public void applyThemeToChart(ChartResult result) {
|
|
146 |
this.applyThemeToChart(result, false); |
|
147 | 147 |
} |
148 | 148 |
|
149 | 149 |
/** |
150 | 150 |
* Creates fonts from the charts engine preferences current font. |
151 | 151 |
*/ |
152 |
protected void createFonts(TXMResult result) {
|
|
152 |
protected void createFonts(ChartResult result) {
|
|
153 | 153 |
|
154 |
Font baseFont = ChartsEngine.createFont(result.getStringParameterValue(ChartsEnginePreferences.FONT));
|
|
154 |
Font baseFont = ChartsEngine.createFont(result.getFont());
|
|
155 | 155 |
|
156 | 156 |
// Titles |
157 | 157 |
this.setExtraLargeFont(baseFont.deriveFont(Font.BOLD, baseFont.getSize() + 5)); |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 574) | ||
---|---|---|
72 | 72 |
public final static String RESULT_DATA_TYPE = PREFERENCES_PREFIX + "result_data_type"; //$NON-NLS-1$ |
73 | 73 |
|
74 | 74 |
|
75 |
/** |
|
76 |
* Default font string representation. |
|
77 |
*/ |
|
78 |
public final static String DEFAULT_FONT = "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"; //$NON-NLS-1$ |
|
79 |
|
|
75 | 80 |
|
76 | 81 |
@Override |
77 | 82 |
public void initializeDefaultPreferences() { |
... | ... | |
96 | 101 |
preferences.putInt(RENDERING_COLORS_MODE, ChartsEngine.RENDERING_COLORS_MODE); |
97 | 102 |
preferences.put(MONOCHROME_COLOR, "0,220,20"); //$NON-NLS-1$ |
98 | 103 |
|
99 |
// FIXME: maybe need need to check here the target OS and set a default unicode installed font
|
|
100 |
preferences.put(FONT, "1|Lucida Sans Unicode|11.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;"); //$NON-NLS-1$
|
|
104 |
// FIXME: maybe need need to check here the target OS and set a default Unicode installed font
|
|
105 |
preferences.put(FONT, DEFAULT_FONT);
|
|
101 | 106 |
|
102 | 107 |
} |
103 | 108 |
|
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 574) | ||
---|---|---|
4 | 4 |
package org.txm.chartsengine.core.results; |
5 | 5 |
|
6 | 6 |
import java.lang.reflect.Field; |
7 |
import java.util.ArrayList; |
|
8 |
import java.util.Arrays; |
|
7 | 9 |
import java.util.HashMap; |
10 |
import java.util.List; |
|
8 | 11 |
|
9 | 12 |
import org.eclipse.core.runtime.IProgressMonitor; |
10 | 13 |
import org.txm.chartsengine.core.ChartCreator; |
11 | 14 |
import org.txm.chartsengine.core.ChartsEngine; |
15 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
12 | 16 |
import org.txm.core.results.Parameter; |
13 | 17 |
import org.txm.core.results.TXMResult; |
14 | 18 |
import org.txm.utils.logger.Log; |
... | ... | |
42 | 46 |
|
43 | 47 |
|
44 | 48 |
/** |
45 |
* If true, the view will be reset when the chart will be updated. |
|
49 |
* If true, the view (zoom, pan, etc.) will be reset when the chart will be updated.
|
|
46 | 50 |
*/ |
47 | 51 |
protected boolean needsToResetView; |
48 | 52 |
|
... | ... | |
50 | 54 |
* If true, the items selection will cleared when the chart will be updated. |
51 | 55 |
*/ |
52 | 56 |
protected boolean needsToClearItemsSelection; |
57 |
|
|
53 | 58 |
|
54 | 59 |
|
55 | 60 |
|
56 | 61 |
|
57 | 62 |
/** |
63 |
* To show/hide title. |
|
64 |
*/ |
|
65 |
@Parameter(key=ChartsEnginePreferences.SHOW_TITLE, type=Parameter.RENDERING) |
|
66 |
protected boolean titleVisible; |
|
67 |
|
|
68 |
/** |
|
69 |
* To show/hide legend. |
|
70 |
*/ |
|
71 |
@Parameter(key=ChartsEnginePreferences.SHOW_LEGEND, type=Parameter.RENDERING) |
|
72 |
protected boolean legendVisible; |
|
73 |
|
|
74 |
/** |
|
75 |
* To show/hide grid. |
|
76 |
*/ |
|
77 |
@Parameter(key=ChartsEnginePreferences.SHOW_GRID, type=Parameter.RENDERING) |
|
78 |
protected boolean gridVisible; |
|
79 |
|
|
80 |
/** |
|
81 |
* Rendering colors mode |
|
82 |
*/ |
|
83 |
@Parameter(key=ChartsEnginePreferences.RENDERING_COLORS_MODE, type=Parameter.RENDERING) |
|
84 |
protected int renderingColorsMode; |
|
85 |
|
|
86 |
/** |
|
87 |
* Font. |
|
88 |
*/ |
|
89 |
@Parameter(key=ChartsEnginePreferences.FONT, type=Parameter.RENDERING) |
|
90 |
protected String font; |
|
91 |
|
|
92 |
|
|
93 |
/** |
|
58 | 94 |
* |
59 | 95 |
* @param parent |
60 | 96 |
*/ |
... | ... | |
63 | 99 |
this.chartDirty = true; |
64 | 100 |
this.needsToResetView = false; |
65 | 101 |
this.needsToClearItemsSelection = false; |
102 |
try { |
|
103 |
this.loadInternalParameters(); |
|
104 |
} |
|
105 |
catch (Exception e) { |
|
106 |
// TODO Auto-generated catch block |
|
107 |
e.printStackTrace(); |
|
108 |
} |
|
66 | 109 |
} |
67 | 110 |
|
111 |
|
|
112 |
/** |
|
113 |
* Loads internal parameters from local node or default preferences. |
|
114 |
* @return |
|
115 |
* @throws Exception |
|
116 |
*/ |
|
117 |
public boolean loadInternalParameters() throws Exception { |
|
118 |
this.titleVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE); |
|
119 |
this.legendVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND); |
|
120 |
this.gridVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID); |
|
121 |
this.renderingColorsMode = this.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE); |
|
122 |
this.font = this.getStringParameterValue(ChartsEnginePreferences.FONT); |
|
123 |
|
|
124 |
return super.loadParameters(); |
|
125 |
} |
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
/** |
|
130 |
* Checks if a parameter value has changed since last rendering. |
|
131 |
* @param key |
|
132 |
* @return |
|
133 |
*/ |
|
134 |
public boolean renderingParameterHasChanged(String key) { |
|
135 |
if ("".equals(key)) { |
|
136 |
return false; |
|
137 |
} |
|
138 |
Object lastValue = this.lastRenderingParameters.get(key); |
|
139 |
Object newValue = this.getRenderingParameter(key); |
|
140 |
if (lastValue == null && newValue != null) { |
|
141 |
return true; |
|
142 |
} |
|
143 |
else { |
|
144 |
return !lastValue.equals(newValue); |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
|
|
149 |
/** |
|
150 |
* |
|
151 |
* @param key |
|
152 |
* @return |
|
153 |
*/ |
|
154 |
protected Object getRenderingParameter(String key) { |
|
155 |
List<Field> fields = new ArrayList<Field>(); |
|
156 |
Class<?> clazz = this.getClass(); |
|
157 |
while (clazz != Object.class) { |
|
158 |
fields.addAll(Arrays.asList(clazz.getDeclaredFields())); |
|
159 |
clazz = clazz.getSuperclass(); |
|
160 |
} |
|
161 |
|
|
162 |
for (Field f : fields) { |
|
163 |
Parameter parameter = f.getAnnotation(Parameter.class); |
|
164 |
if (parameter == null || parameter.type() != Parameter.RENDERING) { |
|
165 |
continue; |
|
166 |
} |
|
167 |
f.setAccessible(true); |
|
168 |
if (parameter.key().equals(key)) { |
|
169 |
try { |
|
170 |
return f.get(this); |
|
171 |
} |
|
172 |
catch (Exception e) { |
|
173 |
e.printStackTrace(); |
|
174 |
} |
|
175 |
} |
|
176 |
} |
|
177 |
return null; |
|
178 |
} |
|
179 |
|
|
180 |
|
|
68 | 181 |
@Override |
69 | 182 |
public boolean compute(boolean update, IProgressMonitor monitor) throws Exception { |
70 | 183 |
|
... | ... | |
81 | 194 |
} |
82 | 195 |
} |
83 | 196 |
|
197 |
/** |
|
198 |
* |
|
199 |
* @param update |
|
200 |
* @return |
|
201 |
* @throws Exception |
|
202 |
*/ |
|
84 | 203 |
protected boolean renderChart(boolean update) throws Exception { |
85 | 204 |
|
86 | 205 |
this.subTask("Rendering chart."); |
... | ... | |
118 | 237 |
// FIXME: debug |
119 | 238 |
System.err.println("ChartResult.renderChart(): creating chart."); |
120 | 239 |
|
121 |
this.chart = chartCreator.createChart(this); |
|
240 |
this.chart = chartCreator.createChart(this); |
|
241 |
|
|
242 |
// FIXME: debug |
|
243 |
System.err.println("ChartResult.renderChart(): updating chart."); |
|
244 |
|
|
245 |
// FIXME: the update must be done here (BEFORE the call of this.updateLastRenderingParameters()) rather than in the SWTChartComponentsProvider => the problem is that for File based Engine, the file may be created twice, need to check this |
|
246 |
chartCreator.updateChart(this); |
|
122 | 247 |
} |
123 | 248 |
|
124 | 249 |
this.updateLastRenderingParameters(); |
... | ... | |
142 | 267 |
protected void updateLastRenderingParameters() throws Exception { |
143 | 268 |
Field[] fields = this.getClass().getDeclaredFields(); |
144 | 269 |
for (Field f : fields) { |
145 |
String name = f.getName(); |
|
146 | 270 |
Parameter parameter = f.getAnnotation(Parameter.class); |
147 | 271 |
if (parameter == null || parameter.type() != Parameter.RENDERING) { |
148 | 272 |
continue; |
149 | 273 |
} |
274 |
|
|
275 |
String name; |
|
276 |
if(!"".equals(parameter.key())) { |
|
277 |
name = parameter.key(); |
|
278 |
} |
|
279 |
else { |
|
280 |
name = f.getName(); |
|
281 |
} |
|
282 |
|
|
150 | 283 |
f.setAccessible(true); |
151 | 284 |
this.lastRenderingParameters.put(name, f.get(this)); |
152 | 285 |
} |
... | ... | |
158 | 291 |
|
159 | 292 |
Field[] fields = clazz.getDeclaredFields(); |
160 | 293 |
for (Field f : fields) { |
161 |
String name = f.getName(); |
|
162 |
Parameter annotation = f.getAnnotation(Parameter.class); |
|
163 |
if (annotation == null || annotation.type() != Parameter.RENDERING) { |
|
294 |
Parameter parameter = f.getAnnotation(Parameter.class); |
|
295 |
if (parameter == null || parameter.type() != Parameter.RENDERING) { |
|
164 | 296 |
continue; |
165 | 297 |
} |
298 |
|
|
299 |
String name; |
|
300 |
if(!"".equals(parameter.key())) { |
|
301 |
name = parameter.key(); |
|
302 |
} |
|
303 |
else { |
|
304 |
name = f.getName(); |
|
305 |
} |
|
306 |
|
|
166 | 307 |
f.setAccessible(true); // not to set accessible to test the field values |
167 | 308 |
Object previousValue = this.lastRenderingParameters.get(name); |
168 | 309 |
Object newValue = f.get(this); |
... | ... | |
178 | 319 |
/** |
179 | 320 |
* Updates the chart dirty state by comparing an old parameter with a new one. |
180 | 321 |
* |
181 |
* @param previousValue may be null
|
|
322 |
* @param lastValue may be null
|
|
182 | 323 |
* @param newValue may be null |
183 | 324 |
*/ |
184 |
protected void updateChartDirty(Object previousValue, Object newValue) {
|
|
185 |
if (previousValue == null || !previousValue.equals(newValue)) {
|
|
186 |
Log.info("Setting chart dirty to true: old = "+ previousValue + " / new = " + newValue);
|
|
325 |
protected void updateChartDirty(Object lastValue, Object newValue) {
|
|
326 |
if (lastValue == null || !lastValue.equals(newValue)) {
|
|
327 |
Log.info("Setting chart dirty to true: old = "+ lastValue + " / new = " + newValue);
|
|
187 | 328 |
this.chartDirty = true; |
188 | 329 |
} |
189 | 330 |
} |
... | ... | |
282 | 423 |
public void setNeedsToClearItemsSelection(boolean needsToClearItemsSelection) { |
283 | 424 |
this.needsToClearItemsSelection = needsToClearItemsSelection; |
284 | 425 |
} |
426 |
|
|
427 |
/** |
|
428 |
* @return the titleVisible |
|
429 |
*/ |
|
430 |
public boolean isTitleVisible() { |
|
431 |
return titleVisible; |
|
432 |
} |
|
433 |
|
|
434 |
/** |
|
435 |
* @param titleVisible the titleVisible to set |
|
436 |
*/ |
|
437 |
public void setTitleVisible(boolean titleVisible) { |
|
438 |
this.titleVisible = titleVisible; |
|
439 |
} |
|
440 |
|
|
441 |
/** |
|
442 |
* @return the legendVisible |
|
443 |
*/ |
|
444 |
public boolean isLegendVisible() { |
|
445 |
return legendVisible; |
|
446 |
} |
|
447 |
|
|
448 |
/** |
|
449 |
* @param legendVisible the legendVisible to set |
|
450 |
*/ |
|
451 |
public void setLegendVisible(boolean legendVisible) { |
|
452 |
this.legendVisible = legendVisible; |
|
453 |
} |
|
454 |
|
|
455 |
/** |
|
456 |
* @return the gridVisible |
|
457 |
*/ |
|
458 |
public boolean isGridVisible() { |
|
459 |
return gridVisible; |
|
460 |
} |
|
461 |
|
|
462 |
/** |
|
463 |
* @param gridVisible the gridVisible to set |
|
464 |
*/ |
|
465 |
public void setGridVisible(boolean gridVisible) { |
|
466 |
this.gridVisible = gridVisible; |
|
467 |
} |
|
468 |
|
|
469 |
|
|
470 |
/** |
|
471 |
* @return the renderingColorsMode |
|
472 |
*/ |
|
473 |
public int getRenderingColorsMode() { |
|
474 |
return renderingColorsMode; |
|
475 |
} |
|
476 |
|
|
477 |
|
|
478 |
/** |
|
479 |
* @param renderingColorsMode the renderingColorsMode to set |
|
480 |
*/ |
|
481 |
public void setRenderingColorsMode(int renderingColorsMode) { |
|
482 |
this.renderingColorsMode = renderingColorsMode; |
|
483 |
} |
|
484 |
|
|
485 |
|
|
486 |
/** |
|
487 |
* @return the font |
|
488 |
*/ |
|
489 |
public String getFont() { |
|
490 |
return font; |
|
491 |
} |
|
492 |
|
|
493 |
|
|
494 |
/** |
|
495 |
* @param font the font to set |
|
496 |
*/ |
|
497 |
public void setFont(String font) { |
|
498 |
this.font = font; |
|
499 |
} |
|
500 |
|
|
501 |
|
|
285 | 502 |
|
286 |
|
|
287 | 503 |
|
288 | 504 |
// FIXME |
289 | 505 |
// public Object createChart(IProgressMonitor monitor, String chartType) { |
tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java (revision 574) | ||
---|---|---|
35 | 35 |
boolean drawBars = specificitiesSelection.isDrawingBars(); |
36 | 36 |
boolean drawLines = specificitiesSelection.isDrawingLines(); |
37 | 37 |
float banality = specificitiesSelection.getBanality(); |
38 |
int renderingColorMode = result.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE);
|
|
38 |
int renderingColorMode = result.getRenderingColorsMode();
|
|
39 | 39 |
|
40 | 40 |
//boolean grayscale = (renderingColorMode == ChartsEngine.RENDERING_GRAYSCALE_MODE); |
41 | 41 |
|
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/JFCSWTChartsComponentsProvider.java (revision 574) | ||
---|---|---|
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
// update for shared preferences, show title, show legend, colors rendering mode, etc. |
82 |
chartsEngine.updateChart(chart, chartEditorInput.getResult()); |
|
82 |
// chartsEngine.updateChart(chart, chartEditorInput.getResult());
|
|
83 | 83 |
|
84 | 84 |
// sets and updates the local preferences node qualifier from the result data |
85 | 85 |
chartEditorInput.syncLocalPreferencesNode(); |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 574) | ||
---|---|---|
268 | 268 |
this.getChartPanel().setChart((JFreeChart) data); |
269 | 269 |
|
270 | 270 |
// FIXME: for updating chart. The problem here is the theme is applied twice? one time at the creation and onn time at the update? |
271 |
((JFCChartsEngine) this.chartEditor.getChartsEngine()).getJFCTheme().applyThemeToChart((JFreeChart) data, this.chartEditor.getResultData());
|
|
271 |
((JFCChartsEngine) this.chartEditor.getChartsEngine()).getJFCTheme().applyThemeToChart(this.chartEditor.getResultData()); |
|
272 | 272 |
|
273 | 273 |
// FIXME: tests, restore the zoom from local node |
274 | 274 |
//this.zoom(x, y, zoomIn); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 574) | ||
---|---|---|
236 | 236 |
StatusLine.setMessage(mess); |
237 | 237 |
// FIXME: Debug: |
238 | 238 |
// FIXME: à repasser dans TXMResult.toString(); |
239 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): ********************************************************************************");
|
|
239 |
System.out.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): ********************************************************************************");
|
|
240 | 240 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selected object = " + selectedItem + ", visible = " + ((TXMResult)selectedItem).isVisible()); |
241 | 241 |
if (selectedItem instanceof ChartResult) { |
242 | 242 |
System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): chart object = " + ((ChartResult)selectedItem).getChart()); |
Formats disponibles : Unified diff