Revision 222

tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/themes/DefaultTheme.java (revision 222)
1 1
package org.txm.chartsengine.r.core.themes;
2 2

  
3 3

  
4

  
4 5
//FIXME: this class must be moved to org.txm.chartsengine.core level and used in all charts engine implementations
5 6
public class DefaultTheme {
6 7

  
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 222)
7 7
import org.txm.chartsengine.r.core.preferences.RChartsEnginePreferences;
8 8
import org.txm.core.preferences.TXMPreferences;
9 9
import org.txm.stat.StatException;
10
import org.txm.stat.engine.r.*;
10
import org.txm.stat.engine.r.RDevice;
11
import org.txm.stat.engine.r.RWorkspace;
12
import org.txm.stat.engine.r.RWorkspaceException;
13
import org.txm.stat.engine.r.RWorkspaceRenderer;
11 14
import org.txm.utils.logger.Log;
12 15

  
13 16

  
......
506 509
		}
507 510
	}
508 511
	
512
	
513
	/**
514
	 * Replaces or creates the vector nammed "colors" in the R workspace from the current charts engine theme palette according to specified rendering mode and items count.
515
	 * @param renderingColorMode
516
	 * @param itemsCount
517
	 */
518
	public void setColors(int renderingColorMode, int itemsCount)	{
519
		try {
520
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
521
			rw.eval("rm(colors)"); //$NON-NLS-1$
522
			rw.addVectorToWorkspace("colors", this.theme.getPaletteAsHexFor(renderingColorMode, itemsCount));  //$NON-NLS-1$
523
		}
524
		catch(RWorkspaceException e) {
525
			// TODO Auto-generated catch block
526
			e.printStackTrace();
527
		}
528
	}
529
	
509 530

  
510 531
	@Override
511 532
	public void setOutputFormat(String outputFormat)	{
......
583 604
	}
584 605

  
585 606

  
586

  
587
//
588
//	@Override
589
//	public void updateChartCAFactorialMapSetLabelItemsSelectionOrder(Object chart, String[] rowLabels, String[] colLabels) {
590
//		Log.severe(this.getClass() + ".updateChartCAFactorialMapSetLabelItemsSelectionOrder(): Not yet implemented."); //$NON-NLS-1$
591
//	}
592

  
593

  
594

  
595

  
596 607
}
tmp/org.txm.chartsengine.r.core/META-INF/MANIFEST.MF (revision 222)
3 3
Bundle-Name: R Charts Engine Core
4 4
Bundle-SymbolicName: org.txm.chartsengine.r.core;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6
Require-Bundle: org.eclipse.core.runtime,
6
Require-Bundle: org.txm.r;bundle-version="1.0.0",
7
 org.eclipse.core.runtime,
7 8
 org.txm.chartsengine.core;bundle-version="1.0.0";visibility:=reexport,
8 9
 org.txm.core,
9
 org.txm.r;bundle-version="1.0.0",
10 10
 org.txm.utils;bundle-version="1.0.0"
11 11
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
12 12
Bundle-ActivationPolicy: lazy
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCBalanceSpiderChartCreator.java (revision 222)
9 9
import org.jfree.chart.plot.SpiderWebPlot;
10 10
import org.jfree.data.category.CategoryDataset;
11 11
import org.jfree.data.category.DefaultCategoryDataset;
12
import org.txm.chartsengine.core.ChartsEngine;
12
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
13 13
import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
14
import org.txm.chartsengine.jfreechart.core.themes.base.Theme;
14
import org.txm.core.preferences.TXMPreferences;
15 15
import org.txm.textsbalance.core.functions.TextsBalance;
16 16

  
17 17
public class JFCBalanceSpiderChartCreator extends JFCChartCreator {
......
63 63

  
64 64
		// FIXME: tests
65 65
		//this.getChartsEngine().getTheme().apply(chart);
66
//		this.getChartsEngine().getTheme().applyThemeToChart(chart, ChartsEngine.RENDERING_GRAYSCALE_MODE);
66
		this.getChartsEngine().getJFCTheme().applyThemeToChart(chart, TXMPreferences.getInt(preferencesNode, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE));
67
		//this.getChartsEngine().getJFCTheme().apply(chart);
68
//		this.getChartsEngine().getJFCTheme().apply(chart);
67 69
		
70
		
71
		
72
		
68 73
		return chart;
69 74
		
70 75
	}
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/preferences/TextsBalancePreferences.java (revision 222)
43 43
		preferences.put(STRUCTURAL_UNIT, "text");
44 44
		preferences.putInt(STRUCTURAL_UNIT_PROPERTY_INDEX, 0);
45 45

  
46
		
46 47
		// shared charts rendering preferences
47 48
		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
49
		
50
		// to disable the functionality
51
		TXMPreferences.setEmpty(PREFERENCES_NODE, ChartsEnginePreferences.SHOW_GRID);
48 52
	}
49 53
	
50 54
	
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 222)
90 90
		itemSeparator.setWidth(factorsLabel.getBounds().width);
91 91
	    itemSeparator.setControl(factorsLabel);
92 92

  
93
	    final Combo plans = new Combo(this.toolBar, SWT.READ_ONLY);
93
	    final Combo plansCombo = new Combo(this.toolBar, SWT.READ_ONLY);
94 94

  
95 95
		// FIXME: commented because the infos panel is not ready to manage more axes
96 96
//		ArrayList<String> planes = null;
......
119 119
		//}
120 120

  
121 121

  
122
		plans.setItems(items);
122
		plansCombo.setItems(items);
123 123

  
124 124
		// Preselect the plan from the CA data
125 125
		if(this.getResultData().getFirstDimension() == 2)	{
126
			plans.select(2);
126
			plansCombo.select(2);
127 127
		}
128 128
		else if(this.getResultData().getSecondDimension() == 3)	{
129
			plans.select(1);
129
			plansCombo.select(1);
130 130
		}
131 131
		else	{
132
			plans.select(0);
132
			plansCombo.select(0);
133 133
		}
134 134

  
135 135

  
136 136
		ToolItem comboItem = new ToolItem(this.toolBar, SWT.SEPARATOR);
137
		comboItem.setControl(plans);
138
		plans.pack();
139
		comboItem.setWidth(plans.getBounds().width);
137
		comboItem.setControl(plansCombo);
138
		plansCombo.pack();
139
		comboItem.setWidth(plansCombo.getBounds().width);
140 140
		
141 141
		
142 142
		
......
175 175
					TXMPreferences.putLocalBoolean(getResultData(), CAPreferences.SHOW_POINT_SHAPES, ((ToolItem) e.getSource()).getSelection());
176 176
				}
177 177
				// Change factors
178
				else if(e.getSource() == plans)	{
178
				else if(e.getSource() == plansCombo)	{
179 179

  
180 180
					Combo plans = (Combo) e.getSource();
181 181

  
......
199 199
					resetView = true;
200 200
				}
201 201
				updateChart();
202
				loadChart(); // needed for file based implementations of charts engine that modify the external existing chart file
202
				loadChart(resetView, false);
203 203
				
204
				if(resetView)	{
205
					resetView();
206
				}
207
				
208 204
				forceFocus();
209 205
			}
210 206
			
......
219 215
		showColumns.addSelectionListener(listener);
220 216
		showRows.addSelectionListener(listener);
221 217
		showPointShapes.addSelectionListener(listener);
222
		plans.addSelectionListener(listener);
218
		plansCombo.addSelectionListener(listener);
223 219
	
224 220
	}
225 221

  
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 222)
2 2
import java.awt.BorderLayout;
3 3
import java.awt.EventQueue;
4 4
import java.awt.Frame;
5
import java.awt.Graphics2D;
5 6
import java.awt.Panel;
7
import java.awt.Toolkit;
8
import java.awt.datatransfer.DataFlavor;
9
import java.awt.datatransfer.Transferable;
10
import java.awt.datatransfer.UnsupportedFlavorException;
11
import java.awt.image.BufferedImage;
6 12
import java.io.File;
13
import java.io.IOException;
7 14
import java.net.MalformedURLException;
8 15

  
9 16
import org.eclipse.swt.awt.SWT_AWT;
......
111 118
	
112 119
	@Override
113 120
	public void loadChart()	{
114
		// Reload the file if exists
115
//		if(this.file != null)	{
116
//			this.loadSVGDocument(this.file);
117
//		}
118
//		else	{
119
			this.file = (File) this.chartEditor.getEditorInput().getChartContainer();
120
			this.loadSVGDocument(this.file);
121
//		}
121
		this.file = (File) this.chartEditor.getEditorInput().getChartContainer();
122
		this.loadSVGDocument(this.file);
122 123
	}
123 124
	
124 125
	
......
127 128
		this.loadSVGDocument((File) data);
128 129
	}
129 130

  
131
	
132

  
133

  
130 134
	@Override
135
	public void copyChartViewToClipboard() {
136
		SVGPanel panel = this.getPanel();
137
		int w = panel.getWidth();
138
		int h = panel.getHeight();
139
		final BufferedImage bufferedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
140
		Graphics2D g = bufferedImg.createGraphics();
141
		panel.paint(g);
142
		
143
		Transferable img = new Transferable() {
144
			
145
			@Override
146
			public boolean isDataFlavorSupported(DataFlavor flavor) {
147
				return DataFlavor.imageFlavor.equals(flavor);
148
			}
149
			
150
			@Override
151
			public DataFlavor[] getTransferDataFlavors() {
152
				return new DataFlavor[] {DataFlavor.imageFlavor};
153
			}
154
			
155
			@Override
156
			public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
157
				if(!DataFlavor.imageFlavor.equals(flavor))					    {
158
					throw new UnsupportedFlavorException(flavor);
159
				}
160
				return bufferedImg;
161
			}
162

  
163
		};
164
		
165
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(img, null);
166
		
167
	}
168

  
169
	@Override
131 170
	public Object getChart() {
132 171
		return this.file;
133 172
	}
......
145 184
	}
146 185

  
147 186

  
187
	@Override
188
	public void clearChartItemsSelection() {
189
		System.err.println("SVGComposite.clearChartItemsSelection(): not implemented.");
190
	}
191

  
192

  
148 193
	
149 194
}
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java (revision 222)
160 160
	 public static SVGComposite createCompositeStatic(ChartEditorPart chartEditor, Composite parent)	{
161 161

  
162 162
		 SVGComposite composite = new SVGComposite(chartEditor, parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
163
		 FormData formData = new FormData();
164 163

  
165
		 //formData.top = new FormAttachment(chartEditor.getToolBar());
166
		 formData.top = new FormAttachment(chartEditor.getParametersComposite());
167
		 formData.bottom = new FormAttachment(100);
168
		 formData.left = new FormAttachment(0);
169
		 formData.right = new FormAttachment(100);
170
		 composite.setLayoutData(formData);
171

  
172 164
		 // Link the composite to the chart editor (need to be done before initializing the AWT delegation events)
173 165
		 chartEditor.setComposite(composite);
174 166

  
......
410 402
	}
411 403

  
412 404

  
413

  
414
	@Override
415
	public void copyChartToClipboard(Object chartComponent) {
416
		SVGPanel panel = (SVGPanel) chartComponent;
417
		int w = panel.getWidth();
418
		int h = panel.getHeight();
419
		final BufferedImage bufferedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
420
		Graphics2D g = bufferedImg.createGraphics();
421
		panel.paint(g);
422
		
423
		Transferable img = new Transferable() {
424
			
425
			@Override
426
			public boolean isDataFlavorSupported(DataFlavor flavor) {
427
				return DataFlavor.imageFlavor.equals(flavor);
428
			}
429
			
430
			@Override
431
			public DataFlavor[] getTransferDataFlavors() {
432
				return new DataFlavor[] {DataFlavor.imageFlavor};
433
			}
434
			
435
			@Override
436
			public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
437
				if(!DataFlavor.imageFlavor.equals(flavor))					    {
438
					throw new UnsupportedFlavorException(flavor);
439
				}
440
				return bufferedImg;
441
			}
442

  
443
		};
444
		
445
		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(img, null);
446
		
447
	}
448

  
449 405
}
tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/jfreechart/JFCSpecificitiesBarChartCreator.java (revision 222)
13 13
import org.jfree.ui.TextAnchor;
14 14
import org.txm.chartsengine.core.ChartsEngine;
15 15
import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
16
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IItemSelectionRenderer;
16
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection;
17 17
import org.txm.chartsengine.jfreechart.core.themes.base.ExtendedNumberAxis;
18
import org.txm.core.messages.TXMCoreMessages;
18
import org.txm.chartsengine.jfreechart.core.themes.base.SymbolAxisBetweenTicks;
19 19
import org.txm.core.preferences.TXMPreferences;
20 20
import org.txm.specificities.core.functions.SpecificitesResult;
21 21
import org.txm.specificities.core.messages.SpecificitiesCoreMessages;
......
45 45
		JFreeChart chart = null;
46 46

  
47 47

  
48
		// FIXME: XY bar chart version
49 48
		// Create the data set
50
		final XYSeriesCollection dataset = new XYSeriesCollection();
49
		XYSeriesCollection dataset = new XYSeriesCollection();
51 50

  
51
        if(drawBars)	{
52
			// Create the bar chart
53
	        chart = this.getChartsEngine().createXYBarChart(dataset, specificitiesResult.getName(), SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false);
54
        }
55
        else	{
56
			// Create the line chart
57
	        chart = this.getChartsEngine().createXYLineChart(dataset, specificitiesResult.getName(), SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL,
58
	        		true, false, true, true, true, false, false);
59
        }
52 60

  
61
        ((IRendererWithItemSelection) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_SPECIFICITIES);
62

  
63

  
64

  
65
        // Add positive banality marker
66
        Marker marker = new ValueMarker(banality);
67
        marker.setPaint(Color.RED);
68
        marker.setLabel(SpecificitiesCoreMessages.bind(SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, banality));
69
        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
70
        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
71
        chart.getXYPlot().addRangeMarker(marker);
72

  
73

  
74
        // Add negative banality marker
75
        marker = new ValueMarker(-banality);
76
        marker.setPaint(Color.RED);
77
        marker.setLabel(SpecificitiesCoreMessages.bind(SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, -banality));
78
        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
79
        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
80
        chart.getXYPlot().addRangeMarker(marker);
81

  
82
		return chart;
83
		
84
	}
85

  
86
	@Override
87
	public void updateChart(Object chart, Object resultData, String preferencesNode) {
88
		
89
		SpecificitesResult specificitiesResult = (SpecificitesResult) resultData;
90
		JFreeChart jfcChart = (JFreeChart) chart;
91
		
92
		// Create the data set
93
		XYSeriesCollection dataset = (XYSeriesCollection) jfcChart.getXYPlot().getDataset();
94
		dataset.removeAllSeries();
53 95
		String[] xAxisSymbols;
54 96

  
55 97
		// Transpose the data set
56
		if(transpose)	{
98
		if(TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_TRANSPOSE))	{
57 99
	        xAxisSymbols = new String[specificitiesResult.getSelectedTypeNames().length];
58 100

  
59 101
			for(int i = 0; i < specificitiesResult.getSelectedPartNames().length; i++) {
60 102
				XYSeries series = new XYSeries(specificitiesResult.getSelectedPartNames()[i]);
61 103
				dataset.addSeries(series);
62 104

  
63

  
64 105
				for(int j = 0; j < specificitiesResult.getSelectedTypeNames().length; j++) {
65 106
					series.add(j, specificitiesResult.getSelectedSpecificitiesIndex()[j][i]);
66 107
					// Add X axis symbol
......
84 125
				}
85 126
			}
86 127
		}
87

  
88
        if(drawBars)	{
89
			// Create the bar chart
90
	        chart = this.getChartsEngine().createXYBarChart(dataset, specificitiesResult.getName(), SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false, false, xAxisSymbols);
91
        }
92
        else	{
93
			// Create the line chart
94
	        chart = this.getChartsEngine().createXYLineChart(dataset, specificitiesResult.getName(), SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL,
95
	        		true, false, true, true, true, false, false, xAxisSymbols);
96
        }
97

  
98
        ((IItemSelectionRenderer) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_SPECIFICITIES);
99

  
100

  
128
		
101 129
        // Custom range axis for ticks drawing options
102
        double minimumValue = DatasetUtilities.findMinimumRangeValue(chart.getXYPlot().getDataset()).doubleValue();
103
        double maximumValue = DatasetUtilities.findMaximumRangeValue(chart.getXYPlot().getDataset()).doubleValue();
130
        double minimumValue = DatasetUtilities.findMinimumRangeValue(jfcChart.getXYPlot().getDataset()).doubleValue();
131
        double maximumValue = DatasetUtilities.findMaximumRangeValue(jfcChart.getXYPlot().getDataset()).doubleValue();
104 132
        // Adjust ticks values according to data set contains only positives values or only negatives values
105 133
        if(minimumValue > 0)	{
106 134
        	minimumValue = 0;
107 135
        }
108 136
        if(maximumValue < 0)	{
109
        	maximumValue = banality;
137
        	maximumValue = TXMPreferences.getFloat(preferencesNode, resultData, SpecificitiesPreferences.CHART_BANALITY);
110 138
        }
111

  
112 139
        // Custom range axis to cut the values to minimum and maximum values
113
        chart.getXYPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getXYPlot().getRangeAxis(), true, true, minimumValue, maximumValue));
140
        jfcChart.getXYPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) jfcChart.getXYPlot().getRangeAxis(), true, true, minimumValue, maximumValue));
141
		
142
        jfcChart.getXYPlot().setDomainAxis(new SymbolAxisBetweenTicks(SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, xAxisSymbols));
114 143

  
115

  
116
        // Add positive banality marker
117
        Marker marker = new ValueMarker(banality);
118
        marker.setPaint(Color.red);
119
        marker.setLabel(SpecificitiesCoreMessages.bind(SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, banality));
120
        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
121
        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
122
        chart.getXYPlot().addRangeMarker(marker);
123

  
124

  
125
        // Add negative banality marker
126
        marker = new ValueMarker(-banality);
127
        marker.setPaint(Color.red);
128
        marker.setLabel(SpecificitiesCoreMessages.bind(SpecificitiesCoreMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, -banality));
129
        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
130
        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
131
        chart.getXYPlot().addRangeMarker(marker);
132

  
133

  
134

  
135
		// FIXME: Category bar chart version
136
//		// Create the data set
137
//		final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
138
//
139
//		// Transpose the data set
140
//		if(transpose)	{
141
//			for(int i = 0; i < specificitiesResult.getSelectedTypeNames().length; i++) {
142
//				for(int j = 0; j < specificitiesResult.getSelectedPartNames().length; j++) {
143
//					dataset.addValue(specificitiesResult.getSelectedSpecificitiesIndex()[i][j],
144
//							specificitiesResult.getSelectedPartNames()[j],
145
//							specificitiesResult.getSelectedTypeNames()[i]);
146
//				}
147
//			}
148
//		}
149
//		else {
150
//			for(int i = 0; i < specificitiesResult.getSelectedPartNames().length; i++) {
151
//				for(int j = 0; j < specificitiesResult.getSelectedTypeNames().length; j++) {
152
//					dataset.addValue(specificitiesResult.getSelectedSpecificitiesIndex()[j][i],
153
//							specificitiesResult.getSelectedTypeNames()[j],
154
//							specificitiesResult.getSelectedPartNames()[i]);
155
//				}
156
//			}
157
//		}
158
//
159
//        if(drawBars)	{
160
//			// Create the bar chart
161
//	        chart = this.createCategoryBarChart(dataset, specificitiesResult.getName(), ChartsEngineMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, ChartsEngineMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false);
162
//        }
163
//        else	{
164
//			// Create the line chart
165
//	        chart = this.createCategoryLineChart(dataset, specificitiesResult.getName(), ChartsEngineMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, ChartsEngineMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false);
166
//        }
167
//        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_SPECIFICITIES);
168
//
169
//
170
//        // Custom range axis for ticks drawing options
171
//        double minimumValue = DatasetUtilities.findMinimumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue();
172
//        double maximumValue = DatasetUtilities.findMaximumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue();
173
//        // Adjust ticks values according to data set contains only positives values or only negatives values
174
//        if(minimumValue > 0)	{
175
//        	minimumValue = 0;
176
//        }
177
//        if(maximumValue < 0)	{
178
//        	maximumValue = banality;
179
//        }
180
//
181
//        // Custom range axis to cut the values to minimum and maximum values
182
//        chart.getCategoryPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getCategoryPlot().getRangeAxis(), true, true, minimumValue, maximumValue));
183
//
184
//
185
//        // Add positive banality marker
186
//        Marker marker = new ValueMarker(banality);
187
//        marker.setPaint(Color.red);
188
//        marker.setLabel(JFreeChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, banality));
189
//        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
190
//        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
191
//        chart.getCategoryPlot().addRangeMarker(marker);
192
//
193
//
194
//        // Add negative banality marker
195
//        marker = new ValueMarker(-banality);
196
//        marker.setPaint(Color.red);
197
//        marker.setLabel(JFreeChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, -banality));
198
//        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
199
//        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
200
//        chart.getCategoryPlot().addRangeMarker(marker);
201

  
202

  
203
//        int itemsColorsRenderingMode = Theme.ITEMS_RENDERING_COLORS_MODE;
204
//		// Grayscale
205
//        if(grayscale)	{
206
//        	itemsColorsRenderingMode = Theme.ITEMS_RENDERING_GRAYSCALE_MODE;
207
//        }
208
//
209
//        // Re-apply theme to the chart to match the colors rendering mode
210
//        // FIXME : the rendering mode should be pass to all methods, even base methods as createXYLineChart(), createBarChart(), etc.
211
//		this.theme.applyThemeToChart(chart, itemsColorsRenderingMode);
212

  
213
		return chart;
144
        
145
		super.updateChart(chart, resultData, preferencesNode);
214 146
		
147
		
215 148
	}
149
	
216 150

  
217

  
218 151
	@Override
219 152
	public Class getResultDataClass() {
220 153
		return SpecificitesResult.class;
tmp/org.txm.index.rcp/META-INF/MANIFEST.MF (revision 222)
10 10
 org.eclipse.core.runtime;bundle-version="3.10.0",
11 11
 org.txm.rcp,
12 12
 org.txm.r;bundle-version="1.0.0"
13
Export-Package: org.txm.index.rcp.adapters,
14
 org.txm.index.rcp.editors,
15
 org.txm.index.rcp.handlers
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java (revision 222)
211 211
			// get preferences values
212 212
			TXMPreferenceStore store = new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE);
213 213
			
214
			this.blackAndWhite = (TXMPreferences.getInt(ProgressionPreferences.PREFERENCES_NODE, ChartsEnginePreferences.RENDERING_COLORS_MODE) == ChartsEngine.RENDERING_MONOCHROME_MODE);
214
			this.blackAndWhite = (TXMPreferences.getInt(ProgressionPreferences.PREFERENCES_NODE, ChartsEnginePreferences.RENDERING_COLORS_MODE) == ChartsEngine.RENDERING_BLACK_AND_WHITE_MODE);
215 215
			
216 216
			this.monostyle = store.getBoolean(ProgressionPreferences.CHART_MONO_STYLE);
217 217
			this.cumulative = store.getBoolean(ProgressionPreferences.CHART_CUMULATIVE);
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionSelectionListener.java (revision 222)
1 1
package org.txm.progression.rcp.chartsengine.events;
2 2

  
3 3
import org.eclipse.swt.events.SelectionEvent;
4
import org.eclipse.swt.events.SelectionListener;
4 5
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
5
import org.txm.chartsengine.rcp.events.BaseSelectionListener;
6 6

  
7 7
/**
8 8
 * Progression selection listener.
9 9
 * @author sjacquot
10 10
 *
11 11
 */
12
public class ProgressionSelectionListener extends BaseSelectionListener {
12
public class ProgressionSelectionListener implements SelectionListener {
13 13

  
14 14

  
15
	/**
16
	 * 
17
	 * @param chartEditor
18
	 * @param commandId
19
	 */
20
	public ProgressionSelectionListener(ChartEditorPart chartEditor, int commandId) {
21
		super(chartEditor, commandId);
22
	}
23 15

  
24 16

  
25

  
26 17
	@Override
27 18
	public void widgetSelected(SelectionEvent e) {
28 19
		
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 222)
155 155

  
156 156
			// FIXME: tests parameters composite extension
157 157
			if(!editor.wasAlreadyOpened())	{
158
				new ProgressionParametersComposite(editor.getParametersComposite(), SWT.NONE);
158
				new ProgressionParametersComposite(editor.getCommandParametersGroup(), SWT.NONE);
159
				editor.getCommandParametersGroup().pack();
159 160
			}
160 161
			// FIXME: tests to use Fields editor and ScopedPreferenceStore for command parameters
161 162
//			BooleanFieldEditor field = new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, "test2 show title store", editor.getParametersComposite());
......
229 230
					
230 231
					// persistence
231 232
					if(dialog.isBlackAndWhite())	{
232
						TXMPreferences.putLocalInt(progression, ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_MONOCHROME_MODE);	
233
						TXMPreferences.putLocalInt(progression, ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_BLACK_AND_WHITE_MODE);	
233 234
					}
234 235
					TXMPreferences.putLocalBoolean(progression, ProgressionPreferences.CHART_MONO_STYLE, dialog.isMonoStyle());
235 236
					TXMPreferences.putLocalBoolean(progression, ProgressionPreferences.CHART_CUMULATIVE, dialog.isCumulativeType());
tmp/org.txm.chartsengine.rcp/OSGI-INF/l10n/bundle.properties (revision 222)
10 10
ChartsEnginePreferencePage_RenderingModeBlackAndWhite=Black and white
11 11
ChartsEnginePreferencePage_RenderingModeColors=Colors
12 12
ChartsEnginePreferencePage_RenderingModeGrayscale=Grayscale
13
ChartsEnginePreferencePage_RenderingModeMonochrome=Monochrome
14
ChartsEnginePreferencePage_RenderingMonochromeColor=Monochrome rendering color
13 15
ChartsEngineSharedPreferencePage_CHARTS_RENDERING_DEFAULT_PREFERENCES=Charts rendering
14 16
command.description = Reset the chart view
15 17
command.description.0 = Export the current view
tmp/org.txm.chartsengine.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 222)
9 9
ChartsEnginePreferencePage_RenderingModeBlackAndWhite=Noir et blanc
10 10
ChartsEnginePreferencePage_RenderingModeColors=Couleurs
11 11
ChartsEnginePreferencePage_RenderingModeGrayscale=Niveaux de gris
12
ChartsEnginePreferencePage_RenderingModeMonochrome=Monochrome
13
ChartsEnginePreferencePage_RenderingMonochromeColor=Couleur du rendu monochrome
12 14
ChartsEngineSharedPreferencePage_CHARTS_RENDERING_DEFAULT_PREFERENCES=Rendu des graphiques
13 15
command.description = R├ętablir la vue initiale
14 16
command.description.0 = Exporter la vue actuelle du graphique
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java (revision 222)
17 17
 */
18 18
public class ChartEditorInput implements IEditorInput {
19 19

  
20

  
20 21
	/**
22
	 * 
23
	 */
24
	protected boolean alwaysRecreateEditor;
25
	
26
	/**
21 27
	 * The name.
22 28
	 */
23 29
	protected String name;
......
95 101
		this.preferencesNodeQualifier = preferencesNodeQualifier;
96 102
		this.chartType = chartType;
97 103
		this.chartContainer = chartContainer;
104
		this.alwaysRecreateEditor = false;
98 105
	}
99 106

  
100 107
	
......
216 223
		return this.swtChartsComponentsProvider.getChartsEngine();
217 224
	}
218 225
	
219
	
220
	@Override
221
	public boolean equals(Object obj)	{
222
		if(obj instanceof ChartEditorInput)	{
223
			// FIXME: validate these tests for all chart editors
224
//			if(this == obj)	{
225
//				return true;
226
//			};
227
			// Always recreate an editor for specificites result
228
//			if(((ChartEditorInput) obj).getResultData() instanceof SpecificitesResult)	{
229
//				return false;
230
//			}
231
			// Always recreate an editor for partition dimension result
232
			if(((ChartEditorInput) obj).getResultData() instanceof Partition)	{
233
				return false;
234
			}
235
			return this.resultData == ((ChartEditorInput) obj).getResultData();
236
		}
237
		return false;
238
	}
239 226

  
240

  
241

  
242 227
	/**
243 228
	 * @return the chartContainer
244 229
	 */
......
293 278
		TXMPreferences.putLocalString(this.resultData, ChartsEnginePreferences.RESULT_DATA_TYPE, this.resultData.getClass().getName());
294 279
	}
295 280
	
281

  
282

  
283
	/**
284
	 * If <code>true</code>, a new chart editor part will always be recreated even for the same TXM result object. 
285
	 * @param alwaysRecreateEditor the alwaysRecreateEditor to set
286
	 */
287
	public void setAlwaysRecreateEditor(boolean alwaysRecreateEditor) {
288
		this.alwaysRecreateEditor = alwaysRecreateEditor;
289
	}
290

  
296 291
	
292
	
293
	@Override
294
	public boolean equals(Object obj)	{
295
		if(obj instanceof ChartEditorInput)	{
296
			if(this.alwaysRecreateEditor)	{
297
				return false;
298
			}
299
			return this.resultData == ((ChartEditorInput) obj).getResultData();
300
		}
301
		return false;
302
	}
303

  
304
	
297 305
}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 222)
11 11
import org.eclipse.swt.SWT;
12 12
import org.eclipse.swt.events.SelectionEvent;
13 13
import org.eclipse.swt.events.SelectionListener;
14
import org.eclipse.swt.layout.FormAttachment;
15
import org.eclipse.swt.layout.FormData;
16
import org.eclipse.swt.layout.FormLayout;
14
import org.eclipse.swt.layout.GridData;
15
import org.eclipse.swt.layout.GridLayout;
17 16
import org.eclipse.swt.layout.RowLayout;
18 17
import org.eclipse.swt.widgets.Composite;
19 18
import org.eclipse.swt.widgets.Group;
......
26 25
import org.eclipse.ui.PlatformUI;
27 26
import org.eclipse.ui.part.EditorPart;
28 27
import org.eclipse.ui.part.MultiPageEditorPart;
29
import org.eclipse.ui.plugin.AbstractUIPlugin;
30 28
import org.txm.chartsengine.core.ChartsEngine;
31 29
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
32 30
import org.txm.chartsengine.rcp.events.EventCallBack;
33 31
import org.txm.chartsengine.rcp.events.EventCallBackHandler;
32
import org.txm.chartsengine.rcp.swt.AdvancedChartEditorToolBar;
34 33
import org.txm.chartsengine.rcp.swt.ChartComposite;
35 34
import org.txm.chartsengine.rcp.swt.ChartEditorToolBar;
36 35
import org.txm.functions.TXMResult;
37 36
import org.txm.rcp.editors.TXMEditorPart;
38
import org.txm.rcpapplication.Application;
37
import org.txm.rcpapplication.IImageKeys;
39 38
import org.txm.utils.logger.Log;
40 39

  
41 40
/**
......
47 46

  
48 47

  
49 48
	/**
50
	 * The <code>EditorPart</code> ID constant. 
51
	 */
52
	//protected static final String ID =  ChartEditorPart.class.getCanonicalName();
53
	 
54
	/**
55 49
	 * The tool bar.
56 50
	 */
57 51
	protected ChartEditorToolBar toolBar;
58 52

  
59
	protected Composite parametersComposite;
60 53
	
61
	protected Group parametersGroup;
54
	/**
55
	 * The advanced tool bar.
56
	 */
57
	protected AdvancedChartEditorToolBar advancedToolBar;
62 58
	
59
	protected Composite advancedToolBarComposite;
60
	protected Group advancedToolBarGroup;
61
	
62
	
63
	protected Composite commandParametersComposite;
64
	protected Group commandParametersGroup;
65
	
63 66

  
64 67
	/**
65 68
	 * The chart drawing area composite.
......
118 121

  
119 122
	
120 123

  
121
//	/**
122
//	 * Gets the <code>EditorPart</code> ID.
123
//	 * @return the ID
124
//	 */
125
//	public abstract String getID();
126

  
127

  
128

  
129 124
	@Override
130 125
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
131 126
		this.setSite(site);
132 127
		this.setInput(input);
133 128
		// FIXME: see how to use the Adapters and AdapterFactory to define image and title of Editor in the contributing plug-ins
134 129
		// another way is to use editors extension in plug-ins and redefine icon and name, using this solution the problem is that the name (which is also editor title) can not be dynamic according to the result data
135
		// so it seems better to use Adapters if that's possible
130
		// so it seems better to use Adapters if it's possible
136 131
		this.setPartName(input.getName());
137 132
	}
138 133

  
139 134

  
140
	@Override
141
	public void createPartControl(Composite parent) {
142

  
143
		super.createPartControl(parent);
135
	
136
	public Group initGroup(final Composite composite, String groupTitle, String buttonToolTip, String iconFilePath)	{
144 137
		
145
		// Test, original code
146
		FormLayout mainLayout = new FormLayout();
138
		final Group group = new Group(composite, SWT.NONE);
139
		group.setText(groupTitle);
147 140
		
148
//		mainLayout.marginHeight = 5;
149
//		mainLayout.marginWidth = 5;
141
//		GridData gd1 = new GridData();
142
//		group.setLayoutData(gd1);
143
//		gd1.exclude = true;
144
//		group.setVisible(false);
150 145
		
151
		mainLayout.marginTop = 3;
152
		mainLayout.marginLeft = 0;
153
		mainLayout.spacing = 3;
154
		parent.setLayout(mainLayout);
146
		RowLayout layout = new RowLayout();
147
//		layout.marginLeft = 10;
148
//		layout.marginTop = 10;
149
//		layout.spacing = 8;
150
		layout.wrap = true;
151
		layout.center = true;
152
		group.setLayout(layout);
155 153

  
156 154
		
157
//		parent.setLayout(new RowLayout(SWT.VERTICAL));
158
//		parent.setLayoutData(new RowData(50, 40));
159

  
160

  
161
		// Toolbar
162
		// FIXME: tests
163
		//this.toolBar = new ChartEditorToolBar(parent, SWT.FLAT | SWT.SHADOW_OUT, this);
164
		this.toolBar = new ChartEditorToolBar(parent, SWT.FLAT, this);
155
		GridData gd2 = new GridData(GridData.FILL_BOTH);;
156
		gd2.grabExcessVerticalSpace = false;
157
		gd2.grabExcessHorizontalSpace = true;
158
		gd2.exclude = true;
159
		composite.setLayoutData(gd2);
160
		composite.setVisible(false);
165 161
		
166 162
		
167
		// FIXME: dimensions/margin tests
168
//		this.toolBar.computeSize(1500, 800, true);
169
//		this.toolBar.setBounds(200, 400, 1500, 300);
170
//		this.toolBar.pack();
171
//		this.toolBar.setSize(1500, 800);
172

  
173

  
174
		// FIXME: command parameters composite
175
		this.parametersComposite = new Composite(parent, SWT.NONE);
163
//		FormData formData = new FormData();
164
//		formData.top = new FormAttachment(this.toolBar);
165
//		//formData.bottom = new FormAttachment(100);
166
//		formData.left = new FormAttachment(0);
167
//		formData.right = new FormAttachment(100);
168
//		formData.height = 0;
169
//		composite.setLayoutData(formData);
176 170
		
177

  
178
		// FIXME: group tests
179
		this.parametersGroup = new Group(this.parametersComposite, SWT.NONE);
180
		this.parametersGroup.setText("Command parameters");
181
		RowLayout layout1 = new RowLayout();
182
		layout1.marginLeft = 10;
183
		layout1.marginTop = 10;
184
		layout1.spacing = 8;
185
		layout1.wrap = true;
186
		layout1.center = true;
187
		this.parametersGroup.setLayout(layout1);
188

  
171
		//composite.setBackground(new Color (Display.getCurrent(), 255, 0, 0));
189 172
		
173
//		RowLayout layout2 = new RowLayout();
174
//		layout2.marginLeft = 10;
175
//		layout2.marginTop = 10;
176
//		layout2.spacing = 8;
177
//		layout2.wrap = true;
178
//		layout2.center = true;
179
//		composite.setLayout(layout2);
180
//		
181
//		
182
//		composite.setVisible(false);
183
//		composite.getParent().layout(true);
190 184
		
191
		FormData formData = new FormData();
192
		formData.top = new FormAttachment(this.toolBar);
193
		//formData.bottom = new FormAttachment(100);
194
		formData.left = new FormAttachment(0);
195
		formData.right = new FormAttachment(100);
196
		formData.height = 0;
197
		this.parametersComposite.setLayoutData(formData);
198 185
		
199
		//this.parametersComposite.setBackground(new Color (Display.getCurrent(), 255, 0, 0));
200
		
201
		RowLayout layout = new RowLayout();
202
		layout.marginLeft = 10;
203
		layout.marginTop = 10;
204
		layout.spacing = 8;
205
		layout.wrap = true;
206
		layout.center = true;
207
		this.parametersComposite.setLayout(layout);
208
		//this.parametersGroup.setLayout(layout);
209
		
210
		
211
		this.parametersComposite.setVisible(false);
212
		this.parametersComposite.getParent().layout(true);
213
		
214
		
215
		// FIXME: tests show/hide parameters
186
		// FIXME: tests show/hide computing parameters
216 187
		final ToolItem showParameters = new ToolItem(this.toolBar, SWT.CHECK);
217
		showParameters.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, "platform:/plugin/org.txm.rcp/icons/add.png").createImage());
218
		showParameters.setToolTipText("Show/Hide command parameters");
188
		showParameters.setImage(IImageKeys.getImage(this, iconFilePath));
189
		showParameters.setToolTipText(buttonToolTip);
219 190
		showParameters.setSelection(false);
220 191
		
221 192
		showParameters.addSelectionListener(new SelectionListener() {
......
223 194
			@Override
224 195
			public void widgetSelected(SelectionEvent e) {
225 196
				
226
				parametersComposite.pack();
227
				int height = 0; 
228
				if(showParameters.getSelection())	{
229
					height = parametersComposite.getSize().y;
230
				}
231
				((FormData)parametersComposite.getLayoutData()).height = height;
232
				parametersComposite.getParent().layout(true);
233
				parametersComposite.setVisible(showParameters.getSelection());
197
				((GridData)composite.getLayoutData()).exclude = !showParameters.getSelection();
198
				composite.setVisible(showParameters.getSelection());
199
				composite.getParent().layout(true);
200
				
234 201
			}
235 202
			
236 203
			@Override
......
240 207
			}
241 208
		});
242 209
		
210
		return group;
211
		//return null;
243 212

  
213
	}
214
	
215
	@Override
216
	public void createPartControl(Composite parent) {
217

  
218
		super.createPartControl(parent);
244 219
		
220
		// Test, original code
221
//		FormLayout mainLayout = new FormLayout();
222
////		mainLayout.marginHeight = 5;
223
////		mainLayout.marginWidth = 5;
224
//		mainLayout.marginTop = 3;
225
//		mainLayout.marginLeft = 0;
226
//		mainLayout.spacing = 3;
227
//		parent.setLayout(mainLayout);
228

  
229

  
230
		// tests for set visible
231
		GridLayout gl = new GridLayout();
232
		gl.marginTop = 5;
233
		gl.marginHeight = 0;
234
		gl.marginWidth = 0;
235
		parent.setLayout(gl);
236

  
237

  
238
		// Toolbar
239
		// FIXME: tests
240
		//this.toolBar = new ChartEditorToolBar(parent, SWT.FLAT | SWT.SHADOW_OUT, this);
241
		this.toolBar = new ChartEditorToolBar(parent, SWT.FLAT, this);
242
		//this.toolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
245 243
		
244
//		// FIXME: Tab folder tests
245
//		final TabFolder tabFolder = new TabFolder(parent, SWT.TOP);
246
//		GridData gd1 = new GridData();
247
//		tabFolder.setLayoutData(gd1);
248
//		gd1.exclude = true;
249
//		tabFolder.setVisible(false);
250
//		
251
//		// Command parameters
252
//		TabItem tabItem2 = new TabItem(tabFolder, SWT.NULL);
253
//		tabItem2.setText("Command parameters");
254
//		this.commandParametersComposite = new Composite(tabFolder, SWT.NONE);
255
//		RowLayout layout2 = new RowLayout();
256
//		layout2.marginLeft = 10;
257
//		layout2.marginTop = 10;
258
//		layout2.spacing = 8;
259
//		layout2.wrap = true;
260
//		layout2.center = true;
261
//		this.commandParametersComposite.setLayout(layout2);
262
//		tabItem2.setControl(this.commandParametersComposite);
263
//
264
//		// Charts rendering advanced tool bar
265
//		TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
266
//		tabItem.setText("Charts rendering");
267
//		this.advancedToolBar = new AdvancedChartEditorToolBar(tabFolder, SWT.FLAT, this);
268
//		tabItem.setControl(this.advancedToolBar);
269
////		this.advancedToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
270
//		
271
//		
272
//		// FIXME: tests show/hide computing parameters
273
//		final ToolItem showParameters = new ToolItem(this.toolBar, SWT.CHECK);
274
//		showParameters.setImage(IImageKeys.getImage(this, "platform:/plugin/org.txm.rcp/icons/add.png"));
275
//		showParameters.setToolTipText("Show/hide advanced parameters");
276
//		showParameters.setSelection(false);
277
//		
278
//		showParameters.addSelectionListener(new SelectionListener() {
279
//			
280
//			@Override
281
//			public void widgetSelected(SelectionEvent e) {
282
//				
283
//				
284
//				((GridData)tabFolder.getLayoutData()).exclude = !showParameters.getSelection();
285
//				tabFolder.setVisible(showParameters.getSelection());
286
//				tabFolder.getParent().layout(true);
287
//			}
288
//			
289
//			@Override
290
//			public void widgetDefaultSelected(SelectionEvent e) {
291
//				// TODO Auto-generated method stub
292
//				
293
//			}
294
//		});
295
//		
296
//		// adapt the height of the tab folder to current tab height
297
//		tabFolder.addSelectionListener(new SelectionAdapter() {
298
//			@Override
299
//			public void widgetSelected(SelectionEvent event) {
300
//				tabFolder.getSelection()[0].getControl().pack(true);
301
//				System.out.println("ChartEditorPart.createPartControl(...).new SelectionAdapter() {...}.widgetSelected(): current tab bounds " + tabFolder.getSelection()[0].getControl().getBounds());
302
//				//tabFolder.setBounds(tabFolder.getBounds().x, tabFolder.getBounds().y, tabFolder.getBounds().width, tabFolder.getSelection()[0].getControl().getBounds().height * 2);
303
//				//tabFolder.layout(true);
304
//				//tabFolder.pack();
305
//			}
306
//		});
307

  
308
		new ToolItem(this.toolBar, SWT.SEPARATOR);
309
		
310
		
311
		// Tests with groups instead of tabs 
312
		// FIXME: command parameters composite
313
		this.commandParametersComposite = new Composite(parent, SWT.NONE);
314
		this.commandParametersGroup = this.initGroup(this.commandParametersComposite, "Computing parameters", "Show/Hide command parameters", "icons/show_computing_parameters.png");
315
		this.commandParametersGroup.pack();
316
		
317
		
318
		
319
		// Advanced tool bar
320
		this.advancedToolBarComposite = new Composite(parent, SWT.NONE);
321
		Group group = this.initGroup(this.advancedToolBarComposite, "Rendering parameters", "Show/Hide rendering parameters", "icons/show_rendering_parameters.png");
322
		this.advancedToolBar = new AdvancedChartEditorToolBar(group, SWT.FLAT, this);
323
//		this.advancedToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
324
		this.advancedToolBarComposite.pack(true);
325
		group.pack(true);
326
		this.advancedToolBar.pack(true);
327
		
328

  
329
		
330
		
246 331
		// FIXME: background color tests
247 332
		//this.toolBar.setBackground(parent.getBackground());
248 333
		//this.toolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
249 334

  
250 335
		// Chart composite
251
		ChartComposite composite = this.getSWTChartsComponentsProvider().createComposite(this, parent);
252

  
253
//		FormData formData2 = new FormData();
254
//		formData2.top = new FormAttachment(toolBarsComposite, 10);
255
//		composite.setLayoutData(formData2);
336
		ChartComposite chartComposite = this.getSWTChartsComponentsProvider().createComposite(this, parent);
337
		GridData gd = new GridData(GridData.FILL_BOTH);
338
		gd.grabExcessVerticalSpace = true;
339
		gd.grabExcessHorizontalSpace = true;
340
		chartComposite.setLayoutData(gd);
256 341
		
257
		
258 342
		// FIXME: open dialog box message if the composite doesn't contain any chart (typically when the charts engine doesn't contain chart creator for the specified result data type)
259 343
//		if(composite.getChart() == null)	{
260 344
//			MessageDialog.openWarning(parent.getShell(), "Warning", "Current charts engine can not create chart for " + this.getResultData().getClass().getSimpleName() + " result type. You can set another charts engine in the preferences.");
......
267 351
		
268 352
		
269 353
		// initialize the default shared context menus as Export, etc.
270
		SWTChartsComponentsProvider.initDefaultContextMenus(composite);
354
		SWTChartsComponentsProvider.initDefaultContextMenus(chartComposite);
271 355

  
272 356
		
273 357
		// registers user entries event call back extensions
358
		this.registerEventCallBackExtensions();
359
	}
360

  
361

  
362
	/**
363
	 * Registers user entries event call back extensions.
364
	 */
365
	protected void registerEventCallBackExtensions()	{
274 366
		String extensionPointId = "org.txm.chartsengine.eventcallback"; //$NON-NLS-1$
275 367
		IConfigurationElement[] contributions = Platform.getExtensionRegistry().getConfigurationElementsFor(extensionPointId);
276 368
		
......
296 388
					
297 389
					eventCallBack.setChartEditor(this);
298 390
					
299
					EventCallBackHandler mouseHandler = composite.getMouseCallBackHandler();
391
					EventCallBackHandler mouseHandler = this.chartComposite.getMouseCallBackHandler();
300 392
					if(mouseHandler != null && mouseHandler.getEventCallBack(eventCallBack.getClass()) == null)	 {
301 393

  
302 394
						Log.info("ChartEditorPart.createPartControl(): call back of type " + eventCallBack.getClass()
......
307 399
						
308 400
						mouseHandler.registerEventCallBack(eventCallBack);
309 401
					}
310
					EventCallBackHandler keyboardHandler = composite.getKeyCallBackHandler();
402
					EventCallBackHandler keyboardHandler = this.chartComposite.getKeyCallBackHandler();
311 403
					if(keyboardHandler != null && keyboardHandler.getEventCallBack(eventCallBack.getClass()) == null)	 {
312 404
						
313 405
						Log.info("ChartEditorPart.createPartControl(): call back of type " + eventCallBack.getClass()
......
327 419
		}
328 420
		
329 421
	}
330

  
331 422
	
332 423
	/**
333 424
	 * Activate the editor in the UI.
......
424 515
	}
425 516

  
426 517
	/**
518
	 *  Clears the selected items in chart.
519
	 */
520
	public void clearChartItemsSelection()	{
521
		this.chartComposite.clearChartItemsSelection();
522
	}
523
	
524
	/**
427 525
	 * Zooms the chart view at x and y coordinates.
428 526
	 * @param x
429 527
	 * @param y
......
451 549
	 * Copy the current chart view to clipboard.
452 550
	 */
453 551
	public void copyChartViewToClipboard()	{
454
		this.getEditorInput().getSWTChartsComponentsProvider().copyChartToClipboard(this.getComposite().getChartComponent());
552
		this.chartComposite.copyChartViewToClipboard();
455 553
	}
456 554

  
457 555
	/**
556
	 * Loads the chart from the chart object stored into the composite (without reseting the view and clearing the selected items).
557
	 */
558
	public void loadChart()	{
559
		this.loadChart(false, false);
560
	}
561

  
562
	/**
458 563
	 * Loads the chart from the chart object stored into the composite.
564
	 * @param resetView
565
	 * @param clearChartItemsSelection
459 566
	 */
460
	public void loadChart()	{
567
	public void loadChart(final boolean resetView, final boolean clearChartItemsSelection)	{
461 568
		getSite().getShell().getDisplay().syncExec(new Runnable() {
462 569
			@Override
463 570
			public void run() {
464
				chartComposite.loadChart();
571
				chartComposite.loadChart(resetView, clearChartItemsSelection);
465 572
			}
466 573
		});
467 574
	}
468

  
469 575
	
576
	
577
	
470 578
	/**
471 579
	 * Updates the specified chart stored in the editor and according to the stored TXM result.
472 580
	 * @return
......
530 638
	}
531 639

  
532 640
	/**
641
	 * Returns the advanced tool bar of this editor.
642
	 * @return
643
	 */
644
	public AdvancedChartEditorToolBar getAdvancedToolBar()	{
645
		return this.advancedToolBar;
646
	}
647
	
648
	/**
533 649
	 * Returns the result object associated with the editor.
534 650
	 * @return
535 651
	 */
......
752 868

  
753 869

  
754 870
	/**
755
	 * @return the parametersComposite
756
	 */
757
	public Composite getParametersComposite() {
758
		return parametersComposite;
759
	}
760

  
761

  
762

  
763
	/**
764 871
	 * @return the wasAlreadyOpened
765 872
	 */
766 873
	public boolean wasAlreadyOpened() {
......
779 886

  
780 887

  
781 888
	/**
782
	 * @return the parametersGroup
783
	 */
784
	public Group getParametersGroup() {
785
		return parametersGroup;
786
	}
787
	
788
	/**
789 889
	 * Checks whatever the chart composite has the focus or not.
790 890
	 * @return <code>true</code> if the chart composite has the focus otherwise <code>false</code>
791 891
	 */
792 892
	public boolean hasFocus()	{
793
		return this.chartComposite.isFocusControl();
893
		return this.chartComposite.hasFocus();
794 894
	}
895

  
896

  
897

  
898
	/**
899
	 * @return the commandParametersGroup
900
	 */
901
	public Group getCommandParametersGroup() {
902
		return commandParametersGroup;
903
	}
904

  
905

  
906

  
907
	/**
908
	 * @return the commandParametersComposite
909
	 */
910
	public Composite getCommandParametersComposite() {
911
		return commandParametersComposite;
912
	}
795 913
}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/IChartComponent.java (revision 222)
49 49
	public void setChartEditor(ChartEditorPart editor);
50 50
	
51 51
	/**
52
	 * Update the mouse over item selection according to the specified mouse event.
52
	 * Updates the mouse over item selection according to the specified mouse event.
53 53
	 * @param event
54 54
	 */
55 55
	public void updateMouseOverItem(MouseEvent event);
56
	
57
	/**
58
	 * Checks if the component has the focus.
59
	 * @return
60
	 */
61
	public boolean hasFocus();
56 62
}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartComposite.java (revision 222)
126 126

  
127 127
	
128 128
	/**
129
	 * Reloads the chart from the chart object stored into the composite.
129
	 * Loads or reloads the chart from the chart object stored in the linked editor input.
130 130
	 * This method is especially used for file based implementations of charts engine for reloading a file that has been externally modified.
131 131
	 */
132 132
	public abstract void loadChart();
133
	
134
	
135
	/**
136
	 * Loads or reloads the chart from the chart object stored in the linked editor input.
137
	 * 
138
	 * @param resetView
139
	 * @param clearChartItemsSelection
140
	 */
141
	public void loadChart(boolean resetView, boolean clearChartItemsSelection)	{
142
		this.loadChart();
143
		
144
		if(clearChartItemsSelection)	{
145
			this.clearChartItemsSelection();
146
		}
133 147

  
148
		if(resetView)	{
149
			this.resetView();
150
		}
151
	}
134 152

  
153
	
135 154
	/**
155
	 * Copy the chart view as image in the clipboard from the specified chart component.
156
	 */
157
	public abstract void copyChartViewToClipboard();
158

  
159
	/**
136 160
	 * Requests that component gets the focus thread-safely.
137 161
	 */
138 162
	public abstract void requestFocusInComposite();
139 163

  
140 164
	/**
165
	 * Clears the selected items in chart.
166
	 */
167
	public abstract void clearChartItemsSelection();
168
	
169
	/**
141 170
	 * Gets the chart.
142 171
	 * @return
143 172
	 */
144 173
	public abstract Object getChart();
145 174

  
146
	
147 175
	/**
148 176
	 * Resets the chart view (zoom, pan, rotation).
149 177
	 */
......
178 206
	
179 207

  
180 208
	/**
209
	 * Checks if the composite AND the chart component have the focus.
210
	 * @return
211
	 */
212
	public boolean hasFocus()	{
213
		return this.chartComponent.hasFocus() && this.isFocusControl();
214
	}
215
	
216
	/**
181 217
	 * Gets the mouse call back handler registered for the chart component.
182 218
	 * @return
183 219
	 */
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartEditorToolBar.java (revision 222)
1 1
package org.txm.chartsengine.rcp.swt;
2 2

  
3
import org.eclipse.core.runtime.IProgressMonitor;
4
import org.eclipse.core.runtime.IStatus;
5
import org.eclipse.core.runtime.Status;
6
import org.eclipse.core.runtime.jobs.Job;
7 3
import org.eclipse.jface.action.ToolBarManager;
8
import org.eclipse.swt.SWT;
9
import org.eclipse.swt.events.SelectionEvent;
10
import org.eclipse.swt.events.SelectionListener;
4
import org.eclipse.swt.layout.FormLayout;
11 5
import org.eclipse.swt.widgets.Composite;
12 6
import org.eclipse.swt.widgets.ToolBar;
13
import org.eclipse.swt.widgets.ToolItem;
14 7
import org.eclipse.ui.menus.IMenuService;
15
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
16 8
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
17
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
18
import org.txm.core.preferences.TXMPreferences;
19
import org.txm.rcpapplication.IImageKeys;
20
import org.txm.rcpapplication.views.CorporaView;
21 9

  
22 10
/**
23 11
 * The default chart editor tool bar shared by every <code>ChartEditorPart</code>.
......
55 43
//		    data.horizontalSpan = 3;
56 44
//		    this.setLayoutData(data);
57 45
		
46
		//System.out.println("ChartEditorToolBar.ChartEditorToolBar()");
47
		//this.setLayout(new FormLayout());
48
		
49
//		RowLayout rl = new RowLayout();
50
//		rl.marginTop = 10;
51
//		rl.marginWidth = 5;
52
//		this.setLayout(rl);
53
		
58 54
		// permit to contribute via plugin.xml menu extension
59 55
		ToolBarManager manager = new ToolBarManager(this);
60 56
		IMenuService menuService = (IMenuService) this.editorPart.getSite().getService(IMenuService.class);
61 57
		menuService.populateContributionManager(manager, "toolbar:" + ChartEditorToolBar.ID); //$NON-NLS-1$
62 58

  
63 59
		
64
		new ToolItem(this, SWT.SEPARATOR);
65
		
66
		final ToolItem showTitle = new ToolItem(this, SWT.CHECK);
67
		//showTitle.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHOW_HIDE_TITLE);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff