Révision 2744

tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartsEngine.java (revision 2744)
5 5
import java.util.ArrayList;
6 6

  
7 7
import org.eclipse.core.runtime.IProgressMonitor;
8
import org.eclipse.osgi.util.NLS;
9 8
import org.txm.chartsengine.core.ChartsEngine;
10 9
import org.txm.chartsengine.core.results.ChartResult;
11 10
import org.txm.chartsengine.r.core.preferences.RChartsEnginePreferences;
......
72 71
	
73 72
	@Override
74 73
	public File exportChart(ChartResult result, File file, int imageWidth, int imageHeight, String outputFormat) {
75
		Object chart = result.getChart();
76
		if (chart == null) {
77
			Log.warning("Error: null chart");
78
			return null;
79
		}
80
		if (!(chart instanceof File)) {
81
			Log.warning("Error: RChartEngine only manage File charts: " + chart);
82
			return null;
83
		}
74
		return this.exportChart(result.getChart(), file, outputFormat, imageWidth, imageHeight, -1, -1, -1, -1);
75
	}
76
	
77
	
78
	@Override
79
	public File exportChart(Object chart, File file, String outputFormat, int imageWidth, int imageHeight, int drawingAreaX, int drawingAreaY, int drawingAreaWidth, int drawingAreaHeight) {
80
		// FIXME: Not yet implemented
81
		Log.finest(this.getClass() + ".exportChart(): Not fully implemented. Output format, Image dimensions and cropping are not implemented.");
84 82
		
85
		if (this.getOutputFormat().equals(outputFormat)) {//
86
			if (file == null || file.equals(chart)) {
87
				return (File) chart; // no need to redraw the chart
83
		if (file.equals(chart)) {
84
			return (File) chart; // no need to redraw the chart
85
		}
86
		else {
87
			try {
88
				FileCopy.copy((File) chart, file);
89
				return file;
88 90
			}
89
			else {
90
				try {
91
					FileCopy.copy((File) chart, file);
92
					return file;
93
				}
94
				catch (IOException e) {
95
					// TODO Auto-generated catch block
96
					e.printStackTrace();
97
				}
91
			catch (IOException e) {
92
				// TODO Auto-generated catch block
93
				e.printStackTrace();
98 94
			}
95
			return null;
99 96
		}
100
		else {
101
			Log.warning(NLS.bind("Error: RChartEngine export format ({0}) cannot differ from the current display format ({1})", outputFormat, this.getOutputFormat()));
102
		}
103
		return null;
104 97
	}
105 98
	
99
	
106 100
	/**
107 101
	 * Plots the specified expression using R workspace instance and current charts engine output format.
108 102
	 * 
......
306 300
	
307 301
	
308 302
	
309
	
310
	
311 303
	@Override
312
	public File exportChart(Object chart, File file, String outputFormat, int imageWidth, int imageHeight, int drawingAreaX, int drawingAreaY, int drawingAreaWidth, int drawingAreaHeight) {
313
		// FIXME: Not yet implemented
314
		Log.severe(this.getClass() + ".exportChart(): Not yet implemented.");
315
		return null;
316
	}
317
	
318
	@Override
319 304
	public boolean isRunning() {
320 305
		// TODO Auto-generated method stub
321 306
		return false;
tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartCreator.java (revision 2744)
13 13
/**
14 14
 * R base chart creator.
15 15
 * 
16
 * Currently the R chart creator can't update a chart. It is always recreated in the updateChart method
17
 * 
18
 * An empty file is created in the createChart method
19
 * 
20 16
 * @author sjacquot
21 17
 *
22 18
 */
23 19
public abstract class RChartCreator<R extends ChartResult> extends ChartCreator<RChartsEngine, R> {
24 20
	
25
	/**
26
	 * creates an empty file. the chart will be written after in the updateChart method
27
	 */
21
	
28 22
	@Override
29 23
	public Object createChart(R result) {
30
		return this.getChartsEngine().createTmpFile(this.getFileNamePrefix()); 
31
	}
32
	
33
	/**
34
	 * Effectively writes the R chart in the given file
35
	 * 
36
	 * @param result
37
	 * @param file the file to write. not null
38
	 * @return
39
	 */
40
	public abstract File createChart(R result, File file);
41
	
42
	@Override
43
	public void updateChart(R result) {
44
		
45
		Object chart = result.getChart();
46
		
47
		if (chart instanceof File) { // The RChartCreators can't update a chart -> the chart is always recreated
48
			createChart(result, (File) chart);
24
		// creates a new chart file if not exist
25
		if (result.getChart() == null) {
26
			File chart = this.getChartsEngine().createTmpFile(this.getFileNamePrefix());
27
			result.setChart(chart);
28
			return chart;
49 29
		}
50 30
		else {
51
			Log.warning("Error: R chart was null in: " + result);
31
			return result.getChart();
52 32
		}
53 33
	}
54 34
	
35
	
55 36
	@Override
56 37
	public ArrayList<Color> getSeriesShapesColors(Object chart) {
57 38
		Log.severe(this.getClass() + ".getSeriesShapesColors(): Not yet implemented."); //$NON-NLS-1$
......
62 43
	public Class<RChartsEngine> getChartsEngineClass() {
63 44
		return RChartsEngine.class;
64 45
	}
46
	
47
	
48
	
49
	
50
	// @Override
51
	// public Object createChart(ChartResult result) {
52
	// //return this.createChartFile(result);
53
	// // FIXME: SJ: tests. No need to return the chart now? it will be done in updateChart()
54
	// return null;
55
	// }
56
	//
57
	//
58
	// @Override
59
	// public void updateChart(ChartResult result) {
60
	//
61
	// Object chart = result.getChart();
62
	//
63
	// // creates a new chart but using the same file
64
	// // FIXME: SJ to MD: this case should never happen, if it happens then a bug must fixed at another location
65
	// // TODO: find the bug then just keep: this.createChartFile(result, (File)chart);
66
	// if (chart instanceof File) {
67
	// this.createChartFile(result, (File)chart);
68
	// }
69
	// // creates a new chart using a new file
70
	// else {
71
	// result.setChart(this.createChartFile(result));
72
	// }
73
	// }
65 74
}
tmp/org.txm.chartsengine.r.core/src/org/txm/stat/engine/r/RWorkspaceRenderer.java (revision 2744)
1 1
package org.txm.stat.engine.r;
2 2
// Copyright © 2010-2013 ENS de Lyon.
3

  
3 4
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
5

  
4 6
// Lyon 2, University of Franche-Comté, University of Nice
5 7
// Sophia Antipolis, University of Paris 3.
6 8
// 
......
46 48

  
47 49
// TODO: Auto-generated Javadoc
48 50
/**
49
 * Wrap R plot methods 
51
 * Wrap R plot methods
50 52
 * 
51 53
 * @author mdecorde
52 54
 */
53 55

  
54 56
public final class RWorkspaceRenderer {
55

  
57
	
56 58
	/** The workspace. */
57 59
	private static RWorkspace workspace = null;
58

  
59

  
60
	
61
	
60 62
	private static RWorkspaceRenderer instance;
61

  
62

  
63
	
64
	
63 65
	/** The default device. */
64 66
	private RDevice defaultDevice = RDevice.SVG;
65

  
67
	
66 68
	/**
67 69
	 * protected on purpose. See {@link #getInstance()}.
68 70
	 *
......
75 77
			throws RWorkspaceException {
76 78
		this.workspace = workspace;
77 79
	}
78

  
79

  
80
	
81
	
80 82
	/**
81 83
	 * Plot.
82 84
	 *
......
86 88
	 * @throws StatException the stat exception
87 89
	 */
88 90
	public File plot(File file, String expr) {
89
		return plot(file, expr, defaultDevice );
91
		return plot(file, expr, defaultDevice);
90 92
	}
91

  
93
	
92 94
	/**
93 95
	 * Plot.
94 96
	 *
......
110 112
			Log.severe(TXMCoreMessages.bind("** Error: can not write in file {0}.", file));
111 113
		}
112 114
		String devicename = device.getName();
113

  
115
		
114 116
		String name;
115 117
		Log.info(RCoreMessages.bind(RCoreMessages.info_savingChartToFile, file.getAbsolutePath()));
116 118
		if (OSDetector.isFamilyWindows()) {
......
125 127
		else {
126 128
			name = file.getAbsolutePath();
127 129
		}
128

  
130
		
129 131
		try {
130
			if (devicename.equals("devSVG"))	{
132
			if (devicename.equals("devSVG")) {
131 133
				workspace.voidEval("library(RSvgDevice);");
132 134
			}
133

  
134

  
135

  
135
			
136
			
137
			
136 138
			// FIXME : test for window dimensions so the large plots can be entirely displayed. Need to pass width and height to RWorkspace.plot() so
137 139
			// RChartsEngine will be able to dynamically compute the width from the number of bars in a barplot for example.
138
			//REXP xp = workspace.eval("try("+devicename+"(\"" + name + "\", width=20, height=10))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
139

  
140
			// REXP xp = workspace.eval("try("+devicename+"(\"" + name + "\", width=20, height=10))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
140 141
			
141
			//workspace.voidEval("par(family = \"mono\")");
142
					
143
			//REXP xp = workspace.eval("try("+devicename+"(\"" + name + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
144

  
142
			
143
			// workspace.voidEval("par(family = \"mono\")");
144
			
145
			// REXP xp = workspace.eval("try("+devicename+"(\"" + name + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
146
			
145 147
			// FIXME: tests: Unicode and charts engine font preference
146
			//REXP xp = workspace.eval("try("+devicename+"(\"" + name + "\", family = \"Lucida Sans Unicode\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
148
			// REXP xp = workspace.eval("try("+devicename+"(\"" + name + "\", family = \"Lucida Sans Unicode\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
147 149
			Font font = ChartsEngine.createFont();
148
			REXP xp = workspace.safeEval(devicename+"(\"" + name + "\", family = \"" + font.getFontName() + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
149
			//REXP xp = workspace.safeEval(devicename+"(\"" + name + "\", family = \"" + font.getFamily() + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
150
			REXP xp = workspace.safeEval(devicename + "(\"" + name + "\", family = \"" + font.getFontName() + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
151
			// REXP xp = workspace.safeEval(devicename+"(\"" + name + "\", family = \"" + font.getFamily() + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
152
			// FIXME: SJ: later, add the width and height to use when exporting
153
			// REXP xp = workspace.safeEval(devicename + "(\"" + name + "\", family = \"" + font.getFontName() + "\", width = 1024, height = 1024)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
150 154
			
151 155
			
156
			
152 157
			if (xp.isString() && xp.asString() != null) { // if there's a string
153 158
				// then we have a
154 159
				// problem, R sent an
......
160 165
				// if (w.asString()!=null) System.out.println(w.asString());
161 166
				Log.severe(w.asString());
162 167
			}
163

  
168
			
164 169
			// ok, so the device should be fine - let's plot
165 170
			boolean state = workspace.voidEval(expr);
166 171
			workspace.voidEval("dev.off()"); //$NON-NLS-1$
167 172
			
168
			if(!state)	{
173
			if (!state) {
169 174
				file.delete();
170 175
				return null;
171 176
			}
172
			else	{
177
			else {
173 178
				return file;
174 179
			}
175 180
		}
......
178 183
			return null;
179 184
		}
180 185
	}
181

  
186
	
182 187
	/**
183 188
	 * Sets the default graphic device.
184 189
	 *
......
187 192
	public void setDefaultGraphicDevice(RDevice device) {
188 193
		this.defaultDevice = device;
189 194
	}
190

  
195
	
191 196
	/**
192 197
	 * Sets the default graphic device.
193 198
	 *
......
198 203
		if (device != null)
199 204
			this.defaultDevice = device;
200 205
	}
201

  
202

  
206
	
207
	
203 208
	public static RWorkspaceRenderer getInstance() throws RWorkspaceException {
204
		if (instance == null) 
209
		if (instance == null)
205 210
			instance = new RWorkspaceRenderer(RWorkspace.getRWorkspaceInstance());
206 211
		return instance;
207 212
	}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 2744)
17 17
import org.eclipse.ui.contexts.IContextService;
18 18
import org.eclipse.ui.part.MultiPageEditorPart;
19 19
import org.txm.chartsengine.core.ChartsEngine;
20
import org.txm.chartsengine.core.ChartsEnginesManager;
20 21
import org.txm.chartsengine.core.results.ChartResult;
21 22
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
22 23
import org.txm.chartsengine.rcp.messages.ChartsUIMessages;
......
285 286
	public final void updateEditorFromResult(boolean update) {
286 287
		
287 288
		// check that the charts engine used for the result matches the SWT components provider otherwise find a suitable components provider
288
		// and recreate new ChartCoomposite and ChartComponent
289
		// and recreate new ChartComposite and ChartComponent
289 290
		if (this.getResult().getChartsEngine() != this.swtChartsComponentsProvider.getChartsEngine()) {
291
			// if (this.getResult().getChartsEngine() != ChartsEnginesManager.getInstance().getCurrentEngine()) {
290 292
			
291 293
			Log.finest("ChartEditor.updateEditorFromResult(): result charts engine  = " + this.getResult().getChartsEngine().getName() + " / Editor charts engine = " + this.swtChartsComponentsProvider //$NON-NLS-1$ //$NON-NLS-2$
292 294
					.getChartsEngine().getName() + ".");  //$NON-NLS-1$
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java (revision 2744)
243 243
					String[] data = StringUtils.split(chartTypeCombo.getItem(chartTypeCombo.getSelectionIndex()), '/');
244 244
					data[0] = StringUtils.trim(data[0]);
245 245
					data[1] = StringUtils.trim(data[1]);
246
					getEditorPart().getResult().setChart(null);
246 247
					getEditorPart().getResult().setChartType(data[1]);
247 248
					getEditorPart().getResult().setChartsEngine((ChartsEngine) Toolbox.getEngineManager(EngineType.CHARTS).getEngine(data[0]));
248 249
					update = false;
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartComposite.java (revision 2744)
82 82
	
83 83
	/**
84 84
	 * Loads or reloads the chart from the chart object stored in the linked editor input.
85
	 * This method is especially used for file based implementations of charts engine for reloading a file that has been externally modified.
86 85
	 */
87 86
	public abstract void loadChart();
88 87
	
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/SwingChartComposite.java (revision 2744)
539 539
			// creates components if they not exist
540 540
			if (this.chartComponent == null) {
541 541
				
542
				// recreates the chart if not of right type
542
				// recreates the chart if needed
543 543
				if (this.chartEditor.getResult().isChartDirty()) {
544 544
					try {
545 545
						// this.chartEditor.getResult().clearLastRenderingParameters(); // FIXME: SJ: seems to became useless
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsPieChartCreator.java (revision 2744)
68 68
				List<Part> parts = partitionDimensions.getParts(sortPartsBySize);
69 69
				
70 70
				for (int i = 0; i < parts.size(); i++) {
71
					dataset.setValue(parts.get(i).getName(), parts.get(i).getSize());
71
					dataset.setValue(parts.get(i).getSimpleName(), parts.get(i).getSize());
72 72
				}
73 73
				
74 74
				if (sortPartsBySize) {
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java (revision 2744)
81 81
					series.add(i, parts.get(i).getSize());
82 82
					
83 83
					// Add X axis symbol
84
					xAxisSymbols[i] = parts.get(i).getName();
84
					xAxisSymbols[i] = parts.get(i).getSimpleName();
85 85
				}
86 86
			}
87 87
			catch (CqiClientException e) {
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsPieChartCreator.java (revision 2744)
21 21
	
22 22
	
23 23
	@Override
24
	public File createChart(PartitionDimensions result, File file) {
24
	public void updateChart(PartitionDimensions result) {
25 25
		
26 26
		try {
27 27
			
28 28
			PartitionDimensions partitionDimensions = result;
29
			File chart = (File) result.getChart();
29 30
			
31
			
30 32
			// parameters
31 33
			boolean sortPartsBySize = partitionDimensions.isSortingBySize();
32 34
			boolean displayPartsCountInTitle = partitionDimensions.isDisplayingPartCountInTitle();
......
36 38
			// Create parts names command string
37 39
			String snames = "c("; //$NON-NLS-1$
38 40
			for (int i = 0; i < parts.size(); i++) {
39
				String name = parts.get(i).getName();
41
				String name = parts.get(i).getSimpleName();
40 42
				if (name.trim().length() == 0)
41 43
					name = "N/A"; //$NON-NLS-1$
42 44
				snames += "\"" + name + "\""; //$NON-NLS-1$ //$NON-NLS-2$
......
68 70
			String cmd = String.format("pie(%s, col=colors, labels=%s, horiz=F, las=2, ylab=\"%s\");\n", ssizes, snames, ylab); //$NON-NLS-1$
69 71
			
70 72
			// plot the chart
71
			this.getChartsEngine().plot(file, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions,
73
			this.getChartsEngine().plot(chart, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions,
72 74
					sortPartsBySize, displayPartsCountInTitle));
73 75
			
74 76
		}
75 77
		catch (Exception e) {
76 78
			Log.severe(PartitionCoreMessages.bind(PartitionCoreMessages.cantCreateDimensionsPartitionChartFileChartsEngineColonP0, RChartsEngine.DESCRIPTION) + e);
77 79
		}
78
		
79
		return file;
80 80
	}
81 81
	
82 82
	
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java (revision 2744)
21 21

  
22 22
	
23 23
	@Override
24
	public File createChart(PartitionDimensions result, File file) {
24
	public void updateChart(PartitionDimensions result) {
25 25

  
26 26
		try {
27 27
			
28 28
			PartitionDimensions partitionDimensions = (PartitionDimensions) result;
29
			File chart = (File) result.getChart();
29 30
			
31
			
30 32
			// parameters
31 33
			boolean sortPartsBySize = partitionDimensions.isSortingBySize();
32 34
			boolean displayPartsCountInTitle = partitionDimensions.isDisplayingPartCountInTitle();
......
36 38
			// Create parts names command string
37 39
			String snames = "c("; //$NON-NLS-1$
38 40
			for(int i = 0; i < parts.size(); i++) {
39
				String name = parts.get(i).getName();
41
				String name = parts.get(i).getSimpleName();
40 42
				if(name.trim().length() == 0)
41 43
					name = "N/A"; //$NON-NLS-1$
42 44
				snames += "\"" + name + "\""; //$NON-NLS-1$ //$NON-NLS-2$
......
69 71
			String cmd = String.format("barplot(%s, col=colors, names.arg=%s, horiz=F, las=2, ylab=\"%s\", xlab=\"%s\");\n", ssizes, snames, PartitionCoreMessages.numberOfWords, PartitionCoreMessages.part); //$NON-NLS-1$
70 72
			
71 73
			// plot the chart
72
			this.getChartsEngine().plot(file, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle));
74
			this.getChartsEngine().plot(chart, cmd, result, Utils.createPartitionDimensionsChartTitle(partitionDimensions), Utils.createPartitionDimensionsChartSubtitle(partitionDimensions, sortPartsBySize, displayPartsCountInTitle));
73 75
			
74 76
		}
75 77
		catch(Exception e) {
......
77 79
			Log.printStackTrace(e);
78 80
		}
79 81

  
80
		return file;
81 82
	}
82 83

  
83 84
	
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGChartComposite.java (revision 2744)
19 19
import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
20 20
import org.eclipse.swt.SWT;
21 21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Display;
22 23
import org.txm.chartsengine.core.ChartsEngine;
23 24
import org.txm.chartsengine.core.results.ChartResult;
24 25
import org.txm.chartsengine.rcp.IChartComponent;
......
46 47
	
47 48
	
48 49
	/**
49
	 * The displayed chart SVG file. Null while loadChart(chart) is not called
50
	 * The displayed chart SVG file. Null while loadChart(chart) is not called.
50 51
	 */
51 52
	protected File file;
52 53
	
......
66 67
	@Override
67 68
	public void loadChart(Object chart) {
68 69
		
69
		// recreates the chart if not of right type
70
//		if (!(chart instanceof File)) {
71
//			this.file = this.chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(this.chartEditor.getResult()).createChartFile(this.chartEditor.getResult());
72
//		}
73
//		else {
74
//			this.file = (File) chart;
75
//		}
76
//		
77
//		
78
//		this.loadSVGDocument(this.file);
70
		// need to be async (the composite needs to be realized before using its size in export)
71
		Display.getDefault().asyncExec(new Runnable() {
72
			
73
			@Override
74
			public void run() {
75
				
76
				// create the chart file if not of the right type
77
				if (!(chart instanceof File)) {
78
					ChartResult result = chartEditor.getResult();
79
					// result.setChart(null);
80
					file = chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(result).createChartFile(result, file, getSize().x, getSize().y);
81
					// System.out.println("SVGChartComposite.loadChart() get size: " + chartEditor.getResultArea().getSize());
82
					// result.setChart(this.file);
83
				}
84
				else {
85
					file = (File) chart;
86
				}
87
				
88
				
89
				loadSVGDocument(file);
90
				
91
				// ChartsEngine engine = chartEditor.getChartsEngine();
92
				// ChartResult result = chartEditor.getResult();
93
				// int w = this.getSize().x;
94
				// int h = this.getSize().y;
95
				// if (w == 0 || h == 0) { // if the composite is not drawn (editor is opening), the chart file size is set to 600*400 by default, TODO resetView() should show-zoom the chart
96
				// w = 600;
97
				// h = 400;
98
				// }
99
				// File file = engine.exportChart(result, w, h, ChartsEngine.OUTPUT_FORMAT_SVG);
100
				//
101
				// this.loadSVGDocument(file);
102
				
103
				
104
			}
105
		});
79 106
		
80
		ChartsEngine engine = chartEditor.getChartsEngine();
81
		ChartResult result = chartEditor.getResult();
82
		int w = this.getSize().x;
83
		int h = this.getSize().y;
84
		if (w == 0 | h == 0) { // if the composite is not drawn (editor is opening), the chart file size is set to 600*400 by default, TODO resetView() should show-zoom the chart
85
			w = 600;
86
			h = 400;
87
		}
88
		File file = engine.exportChart(result, w, h, ChartsEngine.OUTPUT_FORMAT_SVG);
89
		
90
		this.loadSVGDocument(file);
91 107
	}
92 108
	
93 109
	
......
118 134
				
119 135
				try {
120 136
					Log.fine(TXMCoreMessages.bind("Loading SVG document from file: {0}...", file.getAbsolutePath()));
137
					Log.finest("SVGChartComposite.loadSVGDocument(...).new Runnable() {...}.run() SVGCanvas size = " + getSVGCanvas().getSize());
121 138
					
122 139
					getSVGCanvas().loadSVGDocument(file.toURL().toExternalForm());
123 140
					
124
					// FIXME: SJ: temporary fix for a bug where sometimes the SVG doesn't appear in the component (e.g. create or reopen AHC multiple times to reproduce the bug)
125
					// resetView();
126
					
127 141
					Log.fine(TXMCoreMessages.bind("File {0} loaded.", file.getAbsolutePath()));
128 142
					
129 143
				}
tmp/org.txm.ahc.core/src/org/txm/ahc/core/chartsengine/r/RAHCChartCreator.java (revision 2744)
15 15
public class RAHCChartCreator extends RChartCreator<AHC> {
16 16
	
17 17
	@Override
18
	public File createChart(AHC result, File file) {
18
	public void updateChart(AHC result) {
19 19
		
20 20
		AHC ahc = result;
21
		File chart = (File) result.getChart();
21 22
		
22 23
		String cmd = null;
23 24
		// 2D
......
36 37
			cmd = "plot.HCPC(" + ahc.getRSymbol() + ", new.plot=FALSE)";
37 38
		}
38 39
		
39
		return this.getChartsEngine().plot(file, cmd);
40
		this.getChartsEngine().plot(chart, cmd);
40 41
	}
41 42
	
42 43
	
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/chartsengine/r/RWordCloudChartCreator.java (revision 2744)
12 12
	
13 13
	
14 14
	@Override
15
	public File createChart(WordCloud result, File file) {
15
	public void updateChart(WordCloud result) {
16 16
		
17 17
		try {
18 18
			WordCloud wordCloud = result;
19
			File chart = (File) result.getChart();
19 20
			
20 21
			
21 22
			// parameters
......
66 67
			// System.out.println("ploting...");
67 68
			// rw.plot(svgFile, cmd, device);
68 69
			
69
			this.chartsEngine.plot(file, cmd);
70
			this.chartsEngine.plot(chart, cmd);
70 71
			
71 72
			
72 73
			// System.out.println("cleaning");
......
81 82
			// TODO Auto-generated catch block
82 83
			e.printStackTrace();
83 84
		}
84
		
85
		return file;
86 85
	}
87 86
	
88 87
	@Override
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 2744)
275 275
				@Override
276 276
				public void widgetSelected(SelectionEvent e) {
277 277
					bandeField.setEnabled(densityButton.getSelection());
278
					// to force the recreation of the chart as file
279
					if (!(getResult().getChart() instanceof File)) {
280
						getResult().setChart(null);
281
					}
278 282
					getResult().setChartType(Progression.DENSITY_CHART_TYPE);
279 283
					super.widgetSelected(e);
280 284
				}
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RCAChartCreator.java (revision 2744)
122 122
	
123 123
	
124 124
	@Override
125
	public File createChart(CA ca, File file) {
125
	public void updateChart(CA ca) {
126 126
		
127
		File chart = (File) ca.getChart();
128
		
127 129
		// FactoMineR R package
128 130
		if (ca.useFactoMineR()) {
129
			return this.createFactorialMapChart((FactoMineRCA) ca.getCA(), file, ca.isShowIndividuals(), ca.isShowVariables(), ca.getFirstDimension(), ca.getSecondDimension(), Utils
131
			this.createFactorialMapChart((FactoMineRCA) ca.getCA(), chart, ca.isShowIndividuals(), ca.isShowVariables(), ca.getFirstDimension(), ca.getSecondDimension(), Utils
130 132
					.createCAFactorialMapChartTitle(ca));
131 133
		}
132 134
		// CA R package
133 135
		else {
134
			return this.createFactorialMapChart((org.txm.ca.core.statsengine.r.functions.CA) ca.getCA(), file, ca.isShowIndividuals(), ca.isShowVariables(), ca.getFirstDimension(), ca
136
			this.createFactorialMapChart((org.txm.ca.core.statsengine.r.functions.CA) ca.getCA(), chart, ca.isShowIndividuals(), ca.isShowVariables(), ca.getFirstDimension(), ca
135 137
					.getSecondDimension());
136 138
		}
137 139
	}
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/REigenvaluesChartCreator.java (revision 2744)
22 22
public class REigenvaluesChartCreator extends RChartCreator<Eigenvalues> {
23 23
	
24 24
	@Override
25
	public File createChart(Eigenvalues result, File file) {
25
	public void updateChart(Eigenvalues result) {
26 26
		
27 27
		CA ca = result.getCA();
28
		File chart = (File) result.getChart();
28 29
		
30
		
29 31
		// FactoMineR R package
30 32
		if (ca.useFactoMineR()) {
31
			return this.createSingularValuesBarPlot((FactoMineRCA) ca.getCA(), file);
33
			this.createSingularValuesBarPlot((FactoMineRCA) ca.getCA(), chart);
32 34
		}
33 35
		// CA R package
34 36
		else {
35
			return this.createSingularValuesBarPlot((org.txm.ca.core.statsengine.r.functions.CA) ca.getCA(), file);
37
			this.createSingularValuesBarPlot((org.txm.ca.core.statsengine.r.functions.CA) ca.getCA(), chart);
36 38
		}
37 39
	}
38 40
	
tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java (revision 2744)
24 24
	
25 25
	
26 26
	@Override
27
	public File createChart(SpecificitiesSelection result, File file) {
27
	public void updateChart(SpecificitiesSelection result) {
28 28
		
29 29
		try {
30 30
			
31 31
			SpecificitiesSelection specificitiesSelection = result;
32
			File chart = (File) result.getChart();
32 33
			
33 34
			// parameters
34 35
			boolean transpose = specificitiesSelection.isGroupingByLines();
......
160 161
			}
161 162
			
162 163
			// Plot all
163
			this.getChartsEngine().plot(file, cmd);
164
			this.getChartsEngine().plot(chart, cmd);
164 165
			
165 166
			
166 167
		}
167 168
		catch (Exception e) {
168 169
			Log.severe(SpecificitiesCoreMessages.bind(SpecificitiesCoreMessages.cantCreateSpecificitiesChartFileChartsEngineColonP0, this.getChartsEngine().getName()) + e);
169 170
		}
170
		
171
		return file;
172 171
	}
173 172
	
174 173
	
tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/swt/RasterComposite.java (revision 2744)
1 1
package org.txm.chartsengine.raster.rcp.swt;
2 2

  
3
import java.awt.Component;
3 4
import java.io.File;
4 5
import java.util.ArrayList;
5 6

  
......
12 13
import org.eclipse.swt.widgets.Display;
13 14
import org.eclipse.swt.widgets.Label;
14 15
import org.txm.chartsengine.core.ChartsEngine;
16
import org.txm.chartsengine.core.results.ChartResult;
15 17
import org.txm.chartsengine.rcp.IChartComponent;
16 18
import org.txm.chartsengine.rcp.editors.ChartEditor;
17 19
import org.txm.chartsengine.rcp.editors.ChartEditorInput;
......
48 50
	public RasterComposite(ChartEditor chartEditor, Composite parent, int style) {
49 51
		super(chartEditor, parent, style);
50 52
		
51
		this.setLayout(new GridLayout(1, false));
53
		// this.setLayout(new GridLayout(1, false));
52 54
		
53 55
		this.file = null;
54 56
		
......
60 62
		//
61 63
		
62 64
		this.imageLabel = new Label(this, SWT.NONE);
63
		this.imageLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
64
		this.imageLabel.setText("Nothing loaded yet.");
65
		
66
		// FIXME: SJ: for debugging purpose
67
		this.imageLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
68
		
69
		// this.imageLabel = new Label(this, SWT.NONE);
70
		// this.imageLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
71
		// this.imageLabel.setText("Nothing loaded yet.");
65 72
		// // imgLabel.setImage( image );
66
		// this.imageLabel.setSize( this.imageLabel.computeSize( SWT.DEFAULT, SWT.DEFAULT ));
73
		// this.imageLabel.setSize(this.imageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
67 74
		// sc.setContent( this.imageLabel );
68 75
		
69 76
		// Label l = new Label( shell, SWT.NONE );
......
87 94
		// rootPanel.add(this.getPanel());
88 95
		// frame.add(rootPanel);
89 96
		// frame.pack();
97
		
98
		parent.layout();
90 99
	}
91 100
	
92 101
	
......
95 104
		
96 105
		Object chart = this.chartEditor.getChart();
97 106
		
98
		if (chart != null) {
99
			// chartEditorInput.setChartComponent(chart);
100
			
101
			// sets and updates the local preferences node qualifier from the result data
102
			// chartEditorInput.syncLocalPreferencesNode();
103
			
107
		if (chart == null) {
104 108
			// FIXME: temporary solution
105 109
			try {
106 110
				this.chartEditor.getResult().compute();
......
110 114
				e.printStackTrace();
111 115
			}
112 116
			
113
			
114 117
			return (IChartComponent) chart;
115 118
		}
116 119
		
117
		
118 120
		return null;
119 121
	}
120 122
	
121 123
	
122 124
	
125
	@Override
126
	public void loadChart(Object chart) {
127
		
128
		// need to be async (the composite needs to be realized before using its size in export)
129
		Display.getDefault().asyncExec(new Runnable() {
130
			
131
			@Override
132
			public void run() {
133
				// create the chart file if not of the right type
134
				if (!(chart instanceof File)) {
135
					ChartResult result = chartEditor.getResult();
136
					// result.setChart(null);
137
					file = chartEditor.getSWTChartsComponentsProvider().getChartsEngine().getChartCreator(result).createChartFile(result, file, getParent().getSize().x, getParent().getSize().y);
138
					// result.setChart(this.file);
139
				}
140
				else {
141
					file = (File) chart;
142
				}
143
				
144
				loadRasterFile(file);
145
				
146
			}
147
		});
148
		
149
	}
150
	
151
	
152
	
153
	@Override
154
	public void loadChart() {
155
		
156
		this.loadChart(this.chartEditor.getChart());
157
		
158
		// // loads the chart from the result
159
		// Object chart = this.chartEditor.getChart();
160
		//
161
		// if (chart != null) {
162
		//
163
		// // creates components if they not exist
164
		// if (this.chartComponent == null) {
165
		//
166
		// // recreates the chart if needed
167
		// if (this.chartEditor.getResult().isChartDirty()) {
168
		// try {
169
		// // this.chartEditor.getResult().clearLastRenderingParameters(); // FIXME: SJ: seems to became useless
170
		// this.chartEditor.getResult().compute();
171
		// }
172
		// catch (Exception e) {
173
		// e.printStackTrace();
174
		// }
175
		// }
176
		//
177
		// this.createChartComponent();
178
		//
179
		// this.loadChart(this.chartEditor.getChart());
180
		// }
181
		// }
182
		
183
	}
184
	
185
	
186
	
123 187
	/**
124 188
	 * Loads a raster image from the specified file.
125 189
	 * 
......
127 191
	 */
128 192
	public void loadRasterFile(File file) {
129 193
		
130
		Log.info(TXMCoreMessages.bind("Loading Raster image from file: {0}...", file));
194
		Log.info(TXMCoreMessages.bind("Loading raster image from file: {0}...", file));
131 195
		
132 196
		this.file = file;
133 197
		if (this.image != null) {
......
137 201
		ImageData imgData = new ImageData(file.getAbsolutePath());
138 202
		this.image = new Image(Display.getCurrent(), imgData);
139 203
		this.imageLabel.setImage(this.image);
140
		// this.imageLabel.setSize(this.imageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
204
		this.imageLabel.setSize(this.imageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
205
		// this.imageLabel.setSize(this.imageLabel.computeSize(this.getSize().x, this.getSize().y));
141 206
		
142
		imageLabel.getParent().layout();
207
		// this.imageLabel.getParent().layout();
143 208
	}
144 209
	
145 210
	
146 211
	
147 212
	
148
	
149
	// @Override
150
	// public void requestFocusInChartComponent() {
151
	// // FIXME: to check
152
	//// EventQueue.invokeLater(new Runnable () {
153
	//// public void run () {
154
	//// getPanel().requestFocusInWindow();
155
	//// }
156
	//// });
157
	// }
158
	
159
	
160 213
	@Override
161
	public void loadChart() {
162
		// this.file = (File) this.chartComponent;
163
		
164
		this.file = this.getChartsEngine().exportChart(this.getChartResult(), 600, 400, this.getChartsEngine().getOutputFormat());
165
		
166
		this.loadRasterFile(this.file);
167
	}
168
	
169
	
170
	@Override
171
	public void loadChart(Object data) {
172
		this.loadRasterFile((File) data);
173
	}
174
	
175
	
176
	
177
	@Override
178 214
	public void copyChartViewToClipboard() {
179 215
		// TODO Auto-generated method stub
180 216
		System.err.println("RasterComposite.copyChartViewToClipboard(): not implemented.");
......
224 260
		
225 261
	}
226 262
	
227
	
228 263
}
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java (revision 2744)
14 14
	
15 15
	
16 16
	@Override
17
	public File createChart(TextsBalance result, File file) {
17
	public void updateChart(TextsBalance result) {
18 18
		
19
		
20
		File chart = (File) result.getChart();
21
		
19 22
		// try {
20 23
		
21 24
		
......
46 49
		
47 50
		
48 51
		// rw.plot(file, cmd, ((RChartsEngine) this.chartsEngine).getRDevice());
49
		this.chartsEngine.plot(file, cmd);
52
		this.chartsEngine.plot(chart, cmd);
50 53
		
51 54
		// System.out.println("cleaning");
52 55
		// rw.eval("rm(tmplabels)"); //$NON-NLS-1$
......
64 67
		// // TODO Auto-generated catch block
65 68
		// e.printStackTrace();
66 69
		// }
67
		
68
		return file;
69 70
	}
70 71
	
71 72
	@Override
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartCreator.java (revision 2744)
61 61
	 */
62 62
	public abstract Object createChart(R result);
63 63
	
64
	
64 65
	/**
66
	 * Creates a chart file using the current ChartCreator prefix for the file name.
67
	 *
68
	 * @param result
69
	 * @param fileNamePrefix
70
	 * @return
71
	 */
72
	public File createChartFile(R result, File file, int imageWidth, int imageHeight) {
73
		// this.createChartFile(result, this.chartsEngine.createTmpFile(fileNamePrefix));
74
		if (file == null) {
75
			file = this.chartsEngine.createTmpFile(this.fileNamePrefix);
76
		}
77
		// this.createChart(result);
78
		// this.updateChart(result);
79
		this.chartsEngine.exportChart(result.getChart(), file, this.chartsEngine.getOutputFormat(), imageWidth, imageHeight);
80
		// result.setChart(file);
81
		
82
		return file;
83
	}
84
	
85
	// /**
86
	// * Creates a chart file according to the specified result data and parameters.
87
	// * @param result
88
	// * @param file
89
	// * @return
90
	// */
91
	// public File createChartFile(ChartResult result, File file) {
92
	// Object chart = this.createChart(result);
93
	// // FIXME: SJ: became useless?
94
	// // Synchronizes the chart with the shared preferences as show title, show legend, rendering colors mode, etc.
95
	// //this.updateChart(result);
96
	// return this.chartsEngine.createChartFile(chart, file);
97
	// }
98
	//
99
	// /**
100
	// * Creates a chart file according to the specified result data using the specified prefix for the file name.
101
	// * @param result
102
	// * @param fileNamePrefix
103
	// * @return
104
	// */
105
	// public File createChartFile(ChartResult result, String fileNamePrefix) {
106
	// return this.createChartFile(result, this.chartsEngine.createTmpFile(fileNamePrefix));
107
	// }
108
	//
109
	
110
	
111
	
112
	
113
	
114
	/**
65 115
	 * Updates an existing chart.
66 116
	 * By default this method does nothing.
67 117
	 * Subclasses should override this method to update a chart without recreating one.
......
70 120
	 * 
71 121
	 * @param result
72 122
	 * @param preferencesNode
123
	 * @return
73 124
	 */
74 125
	public void updateChart(R result) {
75 126
		Log.severe("ChartCreator.updateChart(): not implemented. This method is intended to be overridden in subclasses."); //$NON-NLS-1$
......
129 180
	public void setChartType(String chartType) {
130 181
		this.chartType = chartType;
131 182
	}
183
	
184
	
185
	
186
	// /**
187
	// * Creates a chart file according to the specified result data and parameters.
188
	// *
189
	// * @param result
190
	// * @param file
191
	// * @return
192
	// */
193
	// public File createChartFile(ChartResult result, File file) {
194
	// Object chart = this.createChart(result);
195
	// // FIXME: SJ: became useless?
196
	// // Synchronizes the chart with the shared preferences as show title, show legend, rendering colors mode, etc.
197
	// this.updateChart(result);
198
	// return this.chartsEngine.createChartFile(chart, file);
199
	// }
200
	//
201
	// /**
202
	// * Creates a chart file according to the specified result data using the specified prefix for the file name.
203
	// *
204
	// * @param result
205
	// * @param fileNamePrefix
206
	// * @return
207
	// */
208
	// public File createChartFile(ChartResult result, String fileNamePrefix) {
209
	// return this.createChartFile(result, this.chartsEngine.createTmpFile(fileNamePrefix));
210
	// }
211
	//
212
	//
213
	// /**
214
	// * Creates a chart file according to the specified result data.
215
	// *
216
	// * @param result
217
	// * @return
218
	// */
219
	// public File createChartFile(ChartResult result) {
220
	// return this.createChartFile(result, this.fileNamePrefix);
221
	// }
222
	//
132 223
}
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 2744)
6 6
import java.util.ArrayList;
7 7
import java.util.HashMap;
8 8

  
9
import org.eclipse.osgi.util.NLS;
9 10
import org.txm.chartsengine.core.ChartCreator;
10 11
import org.txm.chartsengine.core.ChartsEngine;
11 12
import org.txm.chartsengine.core.ChartsEnginesManager;
......
313 314
			// )
314 315
			
315 316
			) {
316
				Log.finest("+++ ChartResult.renderChart(): creating chart (output format = " + this.chartsEngine.getOutputFormat() + ")..."); //$NON-NLS-1$
317
				Log.finest("+++ ChartResult.renderChart(): creating chart (charts engine = " + this.chartsEngine + ", output format = " + this.chartsEngine.getOutputFormat() + ")..."); //$NON-NLS-1$
317 318
				
318 319
				this.chart = chartCreator.createChart(this);
319 320
			}
......
347 348
			this.chartDirty = false;
348 349
			
349 350
			// Debug
350
			Log.finest("ChartResult.renderChart(): chart rendering done."); //$NON-NLS-1$
351
			Log.finest(NLS.bind("ChartResult.renderChart(): chart rendering done ({0}).", this.chart)); //$NON-NLS-1$
351 352
			
352 353
			return true;
353 354
			
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEnginesManager.java (revision 2744)
126 126
	public void setCurrentEngine(ChartsEngine engine) {
127 127
		super.setCurrentEngine(engine);
128 128
		
129
		this.sortEngines();
129
		// this.sortEngines();
130 130
		// ChartsEngine.chartsEngines.
131 131
		
132 132
		// String[] enginesNames = this.getEnginesOrder();
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 2744)
312 312
				if (chartsEngineClass.equals(chartCreator.getChartsEngineClass())) {
313 313
					chartCreator.setFileNamePrefix(contributions[i].getAttribute("fileNamePrefix")); //$NON-NLS-1$
314 314
					chartCreator.setChartType(contributions[i].getAttribute("chartType")); //$NON-NLS-1$
315
					this.addChartCreator(chartCreator.getResultDataClass(), chartCreator); // $NON-NLS-1$
315
					this.addChartCreator(chartCreator.getResultDataClass(), chartCreator);
316 316
				}
317 317
			}
318 318
			catch (CoreException e) {
......
330 330
	}
331 331
	
332 332
	/**
333
	 * Creates a font from the specified encoded String in JFace format (eg.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;")
333
	 * Creates a font from the specified encoded String in JFace format (e.g.: "1|Lucida Sans Unicode|12.0|0|WINDOWS|1|-16|0|0|0|400|0|0|0|0|3|2|1|34|Lucida Sans Unicode;")
334 334
	 * 
335 335
	 * @param encodedStr
336 336
	 * @return the decoded font
......
499 499
	 * @return
500 500
	 */
501 501
	public File exportChart(ChartResult result, int imageWidth, int imageHeight, String outputFormat) {
502
		return exportChart(result, createTmpFile("export"), imageWidth, imageHeight, outputFormat);
502
		return exportChart(result, createTmpFile("export"), imageWidth, imageHeight, outputFormat); // $NON-NLS-1$
503 503
	}
504 504
	
505 505
	/**
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionCumulativeChartCreator.java (revision 2744)
1 1
package org.txm.progression.core.chartsengine.r;
2 2

  
3
import java.io.File;
4

  
5
import org.txm.chartsengine.core.results.ChartResult;
6 3
import org.txm.progression.core.functions.Progression;
7 4

  
8 5
// FIXME: SJ: this chart creator has been disabled in extension definition to force JFC mode for Cumulative chart and R mode for Density chart since the Density chart is not yet implemented in JFC charts engine  
......
16 13
	
17 14
	
18 15
	@Override
19
	public File createChart(Progression result, File file) {
20
		return super.createChart(result, file, true);
16
	public void updateChart(Progression result) {
17
		super.updateChart(result, true);
21 18
	}
22 19
	
23 20
}
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionDensityChartCreator.java (revision 2744)
1 1
package org.txm.progression.core.chartsengine.r;
2 2

  
3
import java.io.File;
4

  
5 3
import org.txm.progression.core.functions.Progression;
6 4

  
7 5
/**
......
14 12
	
15 13
	
16 14
	@Override
17
	public File createChart(Progression result, File file) {
18
		return super.createChart(result, file, false);
15
	public void updateChart(Progression result) {
16
		super.updateChart(result, false);
19 17
	}
20 18
	
21 19
	
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionBaseChartCreator.java (revision 2744)
37 37
	 * @param cumulative
38 38
	 * @return
39 39
	 */
40
	public File createChart(Progression result, File file, boolean cumulative) {
40
	public void updateChart(Progression result, boolean cumulative) {
41 41
		
42 42
		try {
43 43
			
44 44
			Progression progression = result;
45
			File chart = (File) result.getChart();
45 46
			
46 47
			// boolean cumulative = result.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE);
47 48
			
......
134 135
			String cmd = "progression(positions, names, colors, styles, widths, \"" + name + "\"," + progression.getXminCorpus() + "," + progression.getXmaxCorpus() + ",\"" + cumulative //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
135 136
					+ "\",structurepositions,structurenames, \"\", " + progression.getBande() + ");\n";  //$NON-NLS-1$ //$NON-NLS-2$
136 137
			
137
			this.getChartsEngine().plot(file, cmd, result, StringEscapeUtils.escapeJava(Utils.createProgressionChartTitle(progression, cumulative)), null);
138
			this.getChartsEngine().plot(chart, cmd, result, StringEscapeUtils.escapeJava(Utils.createProgressionChartTitle(progression, cumulative)), null);
138 139
			
139 140
			RWorkspace.getRWorkspaceInstance().eval(Progression.prefixR + Progression.norep + " <- list(positions=positions, names=names, xmin=" + progression.getXminCorpus() + ",xmax=" + progression //$NON-NLS-1$ //$NON-NLS-2$
140 141
					.getXmaxCorpus() + ", structpositions=structurepositions, structnames=structurenames)");  //$NON-NLS-1$
......
144 145
			// TODO Auto-generated catch block
145 146
			org.txm.utils.logger.Log.printStackTrace(e);
146 147
		}
147
		
148
		return file;
149 148
	}
150 149
	
151 150
	
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 2744)
25 25
 */
26 26
public abstract class JFCChartCreator<R extends ChartResult> extends ChartCreator<JFCChartsEngine, R> {
27 27
	
28
	// @Override
29
	// public final Object createChart(ChartResult result) {
30
	// if ("java".equals(this.getChartsEngine().getOutputFormat())) {
31
	// return _createJFreeChart(result);
32
	// }
33
	// else {
34
	// return createChartFile(result);
35
	// }
36
	// }
37 28
	
38 29
	@Override
39 30
	public abstract JFreeChart createChart(R result);

Formats disponibles : Unified diff