Révision 636

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 636)
88 88
		super();
89 89
	}
90 90

  
91
	/**
92
	 * Returns the result object associated with the editor through its editor input.
93
	 * @return
94
	 */
95
	public T getResult()	{
96
		return (T) this.getEditorInput().getResult();
97
	}
98
	
99 91

  
100 92
	/**
101 93
	 * 
......
139 131
		
140 132
		// Chart composite
141 133
		this.chartComposite = this.getSWTChartsComponentsProvider().createComposite(this, parent);
134
		
142 135
		GridData gd = new GridData(GridData.FILL_BOTH);
143 136
//		gd.grabExcessVerticalSpace = true;
144 137
//		gd.grabExcessHorizontalSpace = true;
......
725 718
		// does nothing by default
726 719
	}
727 720
	
721
	
728 722
	@Override
723
	public T getResult()	{
724
		return (T) this.getEditorInput().getResult();
725
	}
726
	
727

  
728
	
729
	@Override
729 730
	public Composite getToolBarContainer(String toolbarLocalId) {
730 731
		if (ChartEditorToolBar.ID.equals(toolbarLocalId)) {
731 732
			return this.getTopToolBarContainer();
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java (revision 636)
69 69
		super(result);
70 70
		this.swtChartsComponentsProvider = swtComponentsProvider;
71 71
		this.chartContainer = chartContainer;
72
		
73
		// check that the charts engine used for the result matches the SWT components provider otherwise fin a suitable components provider
74
		ChartsEngine chartsEngine = ChartsEngine.getChartsEngine(result); 
75
		if(chartsEngine != swtComponentsProvider.getChartsEngine())	{
76
			this.swtChartsComponentsProvider = SWTChartsComponentsProvider.getComponentsProvider(chartsEngine);
77
			System.err.println("ChartEditorInput.ChartEditorInput(): charts engine used to create the chart is not the current one. The SWT components provider has been changed to match it: " + this.swtChartsComponentsProvider + ".");
78
		}
79
		
72 80
	}
73 81

  
74 82
	
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 636)
158 158

  
159 159
		
160 160
		ChartCreator chartCreator = ChartsEngine.getCurrent().getChartCreator(this);
161
		
162
		// try to find a chart creator in other charts engines
163
		if(chartCreator == null)	{
164
			for (int i = 0; i < ChartsEngine.getChartsEngines().size(); i++) {
165
				if(ChartsEngine.getChartsEngines().get(i) == ChartsEngine.getCurrent())	{
166
					continue;
167
				}
168
				chartCreator = ChartsEngine.getChartsEngines().get(i).getChartCreator(this);
169
				if(chartCreator != null)	{
170
					System.out.println("ChartResult.renderChart(): another suitable chart creator has been found in charts engine: " + ChartsEngine.getChartsEngines().get(i) + ".");
171
					break;
172
				}
173
			}
174
		}
175
		
176
		
161 177
		if(chartCreator != null)	{
162 178
			
163 179

  
......
188 204
			this.needsToResetView = false;
189 205
			
190 206
			this.chartDirty = false;
207
			
208
			// FIXME: debug
209
			System.err.println("ChartResult.renderChart(): chart rendering done.");
210

  
191 211
			return true;
192 212
			
193 213
		}
194
		return false;
214
		else	{
215
			// FIXME: debug
216
			System.err.println("ChartResult.renderChart(): can not find any suitable chart creator for result: " + this.getClass() + ".");
217
			return false;
218
		}
195 219
	}
196 220
	
197 221
	
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java (revision 636)
297 297
		return chartsEngine;
298 298
	}
299 299
	
300
	
300 301
	/**
302
	 * Gets the first charts engine that can render the specified result.
303
	 * @param result
304
	 * @return
305
	 */
306
	public static ChartsEngine getChartsEngine(ChartResult result)	{
307
		ChartsEngine chartsEngine = null;
308
		for (int i = 0; i < ChartsEngine.chartsEngines.size(); i++) {
309
			if(ChartsEngine.chartsEngines.get(i).canCreateChart(result))	{
310
				chartsEngine = ChartsEngine.chartsEngines.get(i);
311
				break;
312
			}
313
		}
314
		return chartsEngine;
315
	}
316
	
317
	
318
	/**
301 319
	 * Returns the installed charts engine contributions.
302 320
	 * @return
303 321
	 */
304
	public static  ArrayList<ChartsEngine> getChartsEngines()	{
322
	public static ArrayList<ChartsEngine> getChartsEngines()	{
305 323
		return ChartsEngine.chartsEngines;
306 324
	}
307 325

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 636)
453 453

  
454 454
					
455 455
					if (!editorInput.getResult().compute(monitor)) {
456
						Log.info("TXMEditor.compute(): compute failed.");
456
						Log.info("TXMEditor.compute(): computing failed.");
457 457
					}
458 458

  
459 459
					monitor.worked(50);
......
465 465
							public void run() {
466 466
								try {
467 467

  
468
									Log.info("TXMEditor.compute(): opening editor with id " + editorId);
468
									Log.info("TXMEditor.compute(): opening editor with id: " + editorId);
469 469

  
470 470
									IWorkbenchWindow window = TXMWindows.getActiveWindow();
471 471
									IWorkbenchPage page = window.getActivePage();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/FloatSpinner.java (revision 636)
22 22
	public FloatSpinner(Composite parent, int style) {
23 23
		super(parent, style);
24 24
		this.setDigits(1);
25
		this.setMinimum(0);
26
		this.setIncrement(1);
25 27
	}
26 28

  
27 29
	/**
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 636)
52 52
		
53 53
		banality = new FloatSpinner(this.getCommandParametersGroup(), SWT.BORDER);
54 54
		banality.setToolTipText("Banality threshold");
55
		banality.setIncrement(1);
56
		banality.setMinimum(0);
57 55
		banality.setMaximumAsFloat(2);
58 56
		banality.addSelectionListener(new ComputeSelectionListener(this));
59 57
		
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java (revision 636)
7 7
import org.eclipse.swt.widgets.Spinner;
8 8
import org.txm.chartsengine.rcp.editors.ChartEditor;
9 9
import org.txm.core.results.Parameter;
10
import org.txm.rcp.swt.widget.FloatSpinner;
10 11
import org.txm.utils.logger.Log;
11 12
import org.txm.wordcloud.core.functions.WordCloud;
12 13
import org.txm.wordcloud.core.preferences.WordCloudPreferences;
......
29 30
	protected Spinner maxWordsCount; 
30 31
	
31 32
	@Parameter(key=WordCloudPreferences.ROTATION_PERCENT)
32
	protected Spinner rotationPercent; 
33
	protected FloatSpinner rotationPercent; 
33 34
	
34 35
	@Parameter(key=WordCloudPreferences.RANDOM_POSITIONS)
35 36
	protected Button randomPositions;
......
58 59

  
59 60
		// rotation percent
60 61
		new Label(parametersArea, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_Percent_of_rotated_labels);
61
		rotationPercent = new Spinner(parametersArea, SWT.BORDER);
62
		rotationPercent.setMinimum(0);
63
		rotationPercent.setIncrement(1);
64
		rotationPercent.setMaximum(100);
62
		rotationPercent = new FloatSpinner(parametersArea, SWT.BORDER);
63
		rotationPercent.setMaximumAsFloat(100);
65 64

  
66 65
		// random positions
67 66
		randomPositions = new Button(parametersArea, SWT.CHECK);
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/handlers/ComputeWordCloud.java (revision 636)
27 27
//
28 28
package org.txm.wordcloud.rcp.handlers;
29 29

  
30
import java.util.ArrayList;
31

  
32 30
import org.eclipse.core.commands.ExecutionEvent;
33 31
import org.eclipse.core.commands.ExecutionException;
34 32
import org.txm.chartsengine.rcp.editors.ChartEditor;
......
39 37
import org.txm.rcp.views.corpora.CorporaView;
40 38
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
41 39
import org.txm.searchengine.cqp.corpus.Corpus;
42
import org.txm.searchengine.cqp.corpus.Property;
43 40
import org.txm.searchengine.cqp.corpus.query.Query;
44 41
import org.txm.wordcloud.core.functions.WordCloud;
45 42
import org.txm.wordcloud.core.messages.WordCloudCoreMessages;
......
85 82
					Corpus corpus = (Corpus) selection; 
86 83
					String lang = corpus.getLang();
87 84
					Query query;
88
					if (corpus.getProperty(lang + "pos") != null) {
85
					if (corpus.getProperty(lang + "pos") != null) { //$NON-NLS-1$
89 86
						query = new Query(WordCloud.getQueryForLang(lang));
90 87
					}
91 88
					else {
92
						query = new Query("[]");
89
						query = new Query("[]"); //$NON-NLS-1$
93 90
					}
94 91
					
95
					System.out.println("Used query: " + query);
92
					System.out.println("Used query: " + query); //$NON-NLS-1$
96 93

  
97 94
					Index index = new Index((Corpus)selection);
98 95
					index.setQuery(query);
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/preferences/WordCloudPreferences.java (revision 636)
4 4
import org.eclipse.core.runtime.preferences.DefaultScope;
5 5
import org.osgi.framework.FrameworkUtil;
6 6
import org.osgi.service.prefs.Preferences;
7
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
7 8
import org.txm.core.preferences.TXMPreferences;
8 9

  
9 10
/**
......
24 25
	public static final String F_MIN = PREFERENCES_PREFIX + "f_min"; //$NON-NLS-1$
25 26
	public static final String ROTATION_PERCENT = PREFERENCES_PREFIX + "rotation_percent"; //$NON-NLS-1$
26 27
	public static final String RANDOM_POSITIONS = PREFERENCES_PREFIX + "random_positions"; //$NON-NLS-1$
28

  
27 29
	
28 30
	@Override
29 31
	public void initializeDefaultPreferences() {
......
34 36
		preferences.putInt(ROTATION_PERCENT, 10);
35 37
		preferences.putBoolean(RANDOM_POSITIONS, false);
36 38

  
37
		// FIXME: shared charts rendering preferences
38
		//ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
39
		// shared charts rendering preferences
40
		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
39 41
	}
40 42
}
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 636)
145 145
	 */
146 146
	// FIXME: to factorize and move to RWorkspace 
147 147
	public static boolean initPackages()	{
148
		String[] packages = {"Rcpp", "RColorBrewer", "wordcloud"}; //$NON-NLS-1$ //$NON-NLS-2$
148
		String[] packages = {"Rcpp", "RColorBrewer", "wordcloud"}; //$NON-NLS-1$ //$NON-NLS-2$  //$NON-NLS-3$
149 149
			if (!loadAndInstallNeededPackages(packages)) {
150 150
				System.out.println(WordCloudCoreMessages.Log_Aborting);
151 151
				return false;
......
211 211
	}
212 212

  
213 213
	@Override
214
	@Deprecated
215 214
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
216 215
		// TODO Auto-generated method stub
217 216
		return false;
......
222 221
		// TODO Auto-generated method stub
223 222
	}
224 223

  
225
	/**
226
	 * 
227
	 * @return
228
	 */
224
	@Override
229 225
	public String getName() {
230 226
		return this.getSimpleName();
231 227
	}
......
277 273
	 * @return
278 274
	 */
279 275
	public static String getQueryForLang(String lang) {
280
		if ("fr".equals(lang)) {
281
			return "[frpos=\"NOM|NAM|ADJ|VER.*\"  & frlemma!=\"être|avoir|faire|pouvoir|devoir|vouloir|falloir|aller|dire|savoir\"]"; // requete de Serge pour le français TT
276
		if ("fr".equals(lang)) { //$NON-NLS-1$
277
			return "[frpos=\"NOM|NAM|ADJ|VER.*\"  & frlemma!=\"être|avoir|faire|pouvoir|devoir|vouloir|falloir|aller|dire|savoir\"]"; // requete de Serge pour le français TT //$NON-NLS-1$
282 278
		}
283 279
		else if ("en".equals(lang)) {
284
			return "[enpos=\"N.*|JJ.*|V.*\"  & enlemma!=\"be|have|do|say|go|make|other\"]"; // requete de Serge pour l'anglais TT
280
			return "[enpos=\"N.*|JJ.*|V.*\"  & enlemma!=\"be|have|do|say|go|make|other\"]"; // requete de Serge pour l'anglais TT //$NON-NLS-1$
285 281
		}
286 282
		else {
287
			return ".*";
283
			return ".*";//$NON-NLS-1$
288 284
		}
289 285
	}
290 286
	
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 636)
1208 1208
			clone.createUUID();
1209 1209
			this.parent.addChild(clone);
1210 1210
			TXMPreferences.cloneNode(this, clone);
1211
			clone.dirty = true;
1211 1212
		} catch (Exception e) {
1213
			Log.printStackTrace(e);
1212 1214
		}
1213 1215
		return clone;
1214 1216
	}
......
1434 1436
		return true;
1435 1437
	}
1436 1438

  
1437
	// public abstract boolean toTxt(File file, String encoding) throws
1438
	// Exception;
1439
	// public abstract boolean toTxt(File file, String encoding) throws Exception;
1439 1440
	@Deprecated
1440 1441
	// FIXME: should be moved in an exporter extension
1441 1442
	public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception;

Formats disponibles : Unified diff