Revision 607

tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 607)
55 55
import org.txm.statsengine.r.core.exceptions.RObjectAlreadyExist;
56 56
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
57 57
import org.txm.statsengine.r.core.messages.RCoreMessages;
58
import org.txm.statsengine.r.core.preferences.RPreferences;
58 59
import org.txm.statsengine.r.core.rcolt.RColt;
59 60
import org.txm.utils.OSDetector;
60 61
import org.txm.utils.StreamHog;
......
1074 1075
		} catch (REXPMismatchException e) {
1075 1076
			throw new RException(exp + "; " + e.getMessage(), e); //$NON-NLS-1$
1076 1077
		}
1077
		//Log.finest("EVALUATED_EXPRESSION" + exp ); //$NON-NLS-1$
1078
//		if(this.isLoggingEvalCommandLines())	{
1079
			//Log.finest("EVALUATED_EXPRESSION" + exp ); //$NON-NLS-1$
1080
	//	}
1078 1081
		return res;
1079 1082
	}
1080 1083

  
......
1406 1409
	REXPMismatchException {
1407 1410
		if (logging && inputLogger != null ) inputLogger.printMessage(expr); //$NON-NLS-1$
1408 1411
		lastSafeevalExpr = expr;
1409
		Log.finest("Reval: " + expr); //$NON-NLS-1$
1412
		
1413
		if(this.isLoggingEvalCommandLines())	{
1414
			Log.finest("Reval: " + expr); //$NON-NLS-1$
1415
		}
1410 1416
		REXP r = connection.eval("try({" + expr + "}, silent=TRUE)"); //$NON-NLS-1$ //$NON-NLS-2$
1411 1417
		if (r !=null && r.inherits("try-error")) throw new RException(expr, r.asString()); //$NON-NLS-1$
1412 1418
		return r;
1413 1419
	}
1414 1420

  
1421
	
1415 1422
	/**
1423
	 * Checks if the eval command lines must be logged.
1424
	 * @return
1425
	 */
1426
	public boolean isLoggingEvalCommandLines()	{
1427
		return RPreferences.getBoolean(RPreferences.SHOW_EVAL_LOGS, RPreferences.PREFERENCES_NODE); 
1428
	}
1429
	
1430
	/**
1416 1431
	 * Sets the log.
1417 1432
	 *
1418 1433
	 * @param start the new log
......
1512 1527
			Log.printStackTrace(e);
1513 1528
		}
1514 1529

  
1515
		Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
1530
		if(this.isLoggingEvalCommandLines())	{
1531
			Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
1532
		}
1516 1533
		return out;
1517 1534
	}
1518 1535

  
......
1538 1555
			org.txm.utils.logger.Log.printStackTrace(e);
1539 1556
		}
1540 1557

  
1541
		Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
1558
		if(this.isLoggingEvalCommandLines())	{
1559
			Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
1560
		}
1542 1561
	}
1543 1562
	
1544 1563
	
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java (revision 607)
66 66
	public static final String VERSION = "version";
67 67

  
68 68
	/**
69
	 * To show or not not the R eval command lines.
70
	 */
71
	public static final String SHOW_EVAL_LOGS = "show_eval_logs";
72
	
73
	/**
69 74
	 * 
70 75
	 */
71 76
	public RPreferences() {
......
88 93
		preferences.put(RSERVEARGS, "");
89 94
		preferences.putBoolean(FILE_TRANSFERT, false);
90 95
		preferences.put(SVG_DEVICE, "svg");
96
		preferences.putBoolean(SHOW_EVAL_LOGS, true);
91 97
		
92 98
		
93 99
		String RFRAGMENT = "org.txm.statsengine.r.core."+System.getProperty("osgi.os");
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/preferences/TextsBalancePreferences.java (revision 607)
24 24
	
25 25
	// local result preferences
26 26
	public static final String STRUCTURAL_UNIT = PREFERENCES_PREFIX + "structural_unit"; //$NON-NLS-1$
27
	public static final String STRUCTURAL_UNIT_PROPERTY = PREFERENCES_PREFIX + "structural_unit_property"; //$NON-NLS-1$
28
	
27 29
	public static final String STRUCTURAL_UNIT_PROPERTY_INDEX = PREFERENCES_PREFIX + "structural_unit_property_index"; //$NON-NLS-1$
28 30
	
29 31
	@Override
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 607)
11 11
import java.util.List;
12 12

  
13 13
import org.txm.chartsengine.core.results.ChartResult;
14
import org.txm.core.results.Parameter;
14 15
import org.txm.core.results.TXMParameters;
15 16
import org.txm.searchengine.cqp.AbstractCqiClient;
16 17
import org.txm.searchengine.cqp.CQPEngine;
......
43 44
	
44 45
	protected String name;
45 46

  
46
	private StructuralUnit structuralUnit;
47

  
47
	
48 48
	private String suPropertyName;
49 49

  
50
	private boolean groupByTexts;
50
	protected boolean groupByTexts;
51 51

  
52
	private int method;
52
	protected int method;
53

  
53 54
	
55
	
56
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT)
57
	protected StructuralUnit structuralUnit;
58

  
59
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY)
60
	protected StructuralUnitProperty structuralUnitProperty;
61

  
62
	
63
	
54 64
	/**
55 65
	 * 
56 66
	 */
......
87 97
	public void setParameters(int method, StructuralUnit su, String suPropertyName, boolean groupByTexts) {
88 98
		this.structuralUnit = su;
89 99
		this.suPropertyName = suPropertyName;
100
		this.structuralUnitProperty = su.getProperty(suPropertyName);
90 101
		this.groupByTexts = groupByTexts;
91 102
		this.method = method;
92 103
		
......
114 125
		try {
115 126
			this.dataset = new HashMap<Integer, Comparable[]>();
116 127
			
117
			StructuralUnitProperty p = structuralUnit.getProperty(suPropertyName);
128
			//StructuralUnitProperty p = structuralUnit.getProperty(suPropertyName);
129
			StructuralUnitProperty p = this.structuralUnitProperty;
118 130
			this.values = p.getValues();
119 131
			Collections.sort(values);
120 132

  
......
378 390
	}
379 391

  
380 392

  
393
	/**
394
	 * @return the structuralUnitProperty
395
	 */
396
	public StructuralUnitProperty getStructuralUnitProperty() {
397
		return structuralUnitProperty;
398
	}
399

  
400

  
401
	/**
402
	 * @return the groupByTexts
403
	 */
404
	public boolean isGroupByTexts() {
405
		return groupByTexts;
406
	}
407

  
408

  
409
	/**
410
	 * @param groupByTexts the groupByTexts to set
411
	 */
412
	public void setGroupByTexts(boolean groupByTexts) {
413
		this.groupByTexts = groupByTexts;
414
	}
415

  
416

  
417
	/**
418
	 * @return the method
419
	 */
420
	public int getMethod() {
421
		return method;
422
	}
423

  
424

  
425
	/**
426
	 * @param method the method to set
427
	 */
428
	public void setMethod(int method) {
429
		this.method = method;
430
	}
431

  
432

  
381 433
}
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCTextsBalanceSpiderChartCreator.java (revision 607)
22 22
		TextsBalance textsBalance = (TextsBalance) result;
23 23
		JFreeChart chart = null;
24 24

  
25
		// Creates an empty dataset
25 26
		HashMap<Integer, Comparable[]> data = textsBalance.getDataset();
26 27
		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
27 28
		
......
44 45

  
45 46
		chart = new JFreeChart(plot);
46 47
		
47
		this.updateChart(result);
48
		
49 48
		return chart;
50 49
	}
51 50

  
......
56 55
		TextsBalance textsBalance = (TextsBalance) result;
57 56
		
58 57
		JFreeChart chart = (JFreeChart) result.getChart();
58
		
59
		// freeze rendering while computing
60
		chart.setNotify(false);
59 61

  
60 62
		// updating data set
61 63
		HashMap<Integer, Comparable[]> data = textsBalance.getDataset();
......
64 66
		
65 67
		Set<Integer> keys = data.keySet();
66 68
		Iterator<Integer> it = keys.iterator();
67
		while (it.hasNext()){
69
		while (it.hasNext()) {
68 70
		   int key = it.next();
69 71
		   Comparable[] value = data.get(key);
70 72
		   dataset.addValue(key, value[0], value[1]);
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAFactorialMapChartEditor.java (revision 607)
175 175
						((ToolItem) e.getSource()).setSelection(true);
176 176
						return;
177 177
					}
178

  
179
					getResultData().saveParameter(CAPreferences.SHOW_INDIVIDUALS, ((ToolItem) e.getSource()).getSelection());
178
					getResultData().setShowIndividuals(((ToolItem) e.getSource()).getSelection());
180 179
				}
181 180
				//Show/hide rows
182 181
				else if(e.getSource() == showVariables)	{
......
187 186
						return;
188 187
					}
189 188

  
190
					getResultData().saveParameter(CAPreferences.SHOW_VARIABLES, ((ToolItem) e.getSource()).getSelection());
189
					getResultData().setShowVariables(((ToolItem) e.getSource()).getSelection());
191 190
				}
192 191
				//Show/hide rows
193 192
				else if(e.getSource() == showPointShapes)	{
194
					getResultData().setChartDirty();
195
					getResultData().saveParameter(CAPreferences.SHOW_POINT_SHAPES, ((ToolItem) e.getSource()).getSelection());
193
					getResultData().setShowPointShapes(((ToolItem) e.getSource()).getSelection());
196 194
				}
197 195
				// Change factors
198 196
				else if(e.getSource() == plansCombo)	{
......
214 212
					dimension2 = Integer.parseInt(split[1]);
215 213

  
216 214
					// FIXME: persistence
217
					getResultData().saveParameter(CAPreferences.FIRST_DIMENSION, dimension1);
218
					getResultData().saveParameter(CAPreferences.SECOND_DIMENSION, dimension2);
215
					getResultData().setFirstDimension(dimension1);
216
					getResultData().setSecondDimension(dimension2);
219 217

  
220 218
					resetView = true;
221 219
				}
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 607)
132 132
	@Override
133 133
	protected boolean _compute(boolean update) throws Exception {
134 134
		
135
		// compute the lexical table
136
		parent.compute(update);
137
		
138
		if (lexicalTable.getNColumns() < 2) {
139
			Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS);
140
			return false;
141
		}
142
		
143 135
		SpecificitiesR si = new SpecificitiesR(lexicalTable.getData());
144 136

  
145 137
		double[][] specIndex = si.getScores();
......
585 577
	@Override
586 578
	public boolean canCompute() {
587 579
		
588
		if(this.lexicalTable == null) {
589
			System.err.println("Specificities.canCompute(): Can not compute without a lexical table.");
580
		if (this.lexicalTable == null) {
581
			Log.severe("Specificities.canCompute(): Can not compute without a lexical table.");
590 582
			return false;
591 583
		}
592 584
		
585
		if (this.lexicalTable.getNColumns() < 2) {
586
			Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS);
587
			return false;
588
		}
589
		
593 590
		return true;
594 591
	}
595 592

  
tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/jfreechart/JFCSpecificitiesBarChartCreator.java (revision 607)
71 71
		float banality = specificitiesSelection.getBanality();
72 72

  
73 73
		
74
		// freeze rendering
74
		// freeze rendering while computing
75 75
		chart.setNotify(false);
76 76

  
77 77
		
tmp/org.txm.core/src/java/org/txm/core/results/Parameter.java (revision 607)
9 9
import java.lang.annotation.Target;
10 10

  
11 11
/**
12
 * An annotation to identify The TXMResult parameters.
12
 * An annotation to identify The TXMResult parameters and automate some tasks ad: loading, saving, transfer, etc.
13 13
 * 
14 14
 * @author mdecorde
15 15
 *
......
30 30
	
31 31
	/**
32 32
	 * The parameter key name. If filled with some preference key, it can be used to automatically load or save parameters from and to the preferences nodes.
33
	 * Can also automate the copy of parameters from Widgets to result and from result to Widgets. 
33 34
	 * @return
34 35
	 */
35 36
	public String key() default "";
36 37

  
37 38
	
38 39
	/**
39
	 * To determine what kind of parameters has been changed between to computing/rendering and do only computing, rendering or both.
40
	 * To determine what kind of parameters has been changed between tWo computing/rendering and do only computing, rendering or both.
40 41
	 * @return
41 42
	 */
42 43
	public int type() default Parameter.COMPUTING;
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 607)
22 22
import org.osgi.service.prefs.BackingStoreException;
23 23
import org.txm.core.preferences.TXMPreferences;
24 24
import org.txm.objects.Base;
25
import org.txm.objects.Corpus;
25 26
import org.txm.utils.logger.Log;
26 27

  
27 28
/**
......
130 131

  
131 132
		// loads parameters from local result node, current command preferences or default command preferences
132 133
		try {
133
			this.loadParametersFromAnnotations(); // auto fill from Parameter annotations
134
			this.autoLoadParametersFromAnnotations(); // auto fill from Parameter annotations
134 135
			this.loadParameters();  // subclasses manual settings
135 136
		}
136 137
		catch (Exception e) {
......
570 571
	 * @return
571 572
	 * @throws Exception
572 573
	 */
573
	public boolean saveParametersFromAnnotations() throws Exception {
574
	public boolean autoSaveParametersFromAnnotations() throws Exception {
574 575

  
575 576
		List<Field> fields = this.getAllFields();
576 577
		
......
620 621
	 * @return
621 622
	 * @throws Exception
622 623
	 */
623
	protected boolean loadParametersFromAnnotations() throws Exception {
624
		return this.loadParametersFromAnnotations(Parameter.COMPUTING);
624
	protected boolean autoLoadParametersFromAnnotations() throws Exception {
625
		return this.autoLoadParametersFromAnnotations(Parameter.COMPUTING);
625 626
	}
626 627

  
627 628
	/**
......
632 633
	 * @throws Exception 
633 634
	 * @throws Exception 
634 635
	 */
635
	protected boolean loadParametersFromAnnotations(int parameterType) throws Exception {
636
	protected boolean autoLoadParametersFromAnnotations(int parameterType) throws Exception {
636 637

  
637 638
		List<Field> fields = this.getAllFields();
638 639

  
......
668 669
				else if (f.getType().isAssignableFrom(boolean.class) || f.getType().isAssignableFrom(Boolean.class)) {
669 670
					value = this.getBooleanParameterValue(key);
670 671
				}
672
				// FIXME: test to automate other type creation as Property => problem here is that org.txm.core doesn't know the plug-in org.txm.searchengine.cqp.core
673
//				else if (f.getType().isAssignableFrom(Property.class)) {
674
//					value = new Property(this.getStringParameterValue(key), Corpus.getCorpus(this));
675
//				}
671 676
				f.set(this, value);
672 677
				
673 678
				// FIXME: Debug
......
1346 1351
			this.updateLastParameters();
1347 1352
		}
1348 1353

  
1349
		if (!this.saveParametersFromAnnotations()) {
1354
		if (!this.autoSaveParametersFromAnnotations()) {
1350 1355
			System.out.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : failed to save parameters from annotations for " + this.getName() + ".");
1351 1356
		}
1352 1357
		if (!this.saveParameters()) {
tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/TextsBalanceEditor.java (revision 607)
1 1
package org.txm.textsbalance.rcp.editors;
2 2

  
3 3
import java.util.ArrayList;
4
import java.util.Arrays;
5 4
import java.util.List;
6 5

  
7
import org.eclipse.core.runtime.IProgressMonitor;
8
import org.eclipse.core.runtime.IStatus;
9
import org.eclipse.core.runtime.Status;
10
import org.eclipse.core.runtime.jobs.Job;
6
import org.eclipse.jface.viewers.ComboViewer;
11 7
import org.eclipse.swt.SWT;
12 8
import org.eclipse.swt.events.SelectionEvent;
13 9
import org.eclipse.swt.events.SelectionListener;
......
17 13
import org.eclipse.swt.widgets.Composite;
18 14
import org.eclipse.swt.widgets.Group;
19 15
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
20
import org.txm.core.preferences.TXMPreferences;
21
import org.txm.rcp.views.corpora.CorporaView;
16
import org.txm.core.results.Parameter;
17
import org.txm.rcp.swt.widget.StructuralUnitsGroup;
22 18
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
23 19
import org.txm.searchengine.cqp.corpus.StructuralUnit;
24 20
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
25 21
import org.txm.searchengine.cqp.corpus.query.Match;
26 22
import org.txm.textsbalance.core.functions.TextsBalance;
27 23
import org.txm.textsbalance.core.preferences.TextsBalancePreferences;
28
import org.txm.utils.logger.Log;
29 24

  
30 25
/**
31 26
 * Texts balance editor.
......
34 29
 * @author sjacquot
35 30
 *
36 31
 */
37
public class TextsBalanceEditor extends ChartEditorPart {
32
public class TextsBalanceEditor extends ChartEditorPart<TextsBalance> {
38 33

  
39 34
	private Combo supCombo;
40 35

  
......
45 40
	private Combo suCombo;
46 41

  
47 42
	
43
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT)
44
	protected ComboViewer structuralUnitsComboViewer;
45
	
46
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY)
47
	protected ComboViewer structuralUnitPropertiesComboViewer;
48
	
49
	
48 50
	@Override
49 51
	public void createPartControl(Composite parent) {
50 52
		super.createPartControl(parent);
......
56 58

  
57 59
		
58 60
		// for group tests
59
		Composite p = this.getCommandParametersGroup();
61
		Composite parametersArea = this.getCommandParametersGroup();
60 62
		
61
		Group group = new Group(p, SWT.NONE);
63
		Group group = new Group(parametersArea, SWT.NONE);
62 64
		
63 65
		group.setText("Group by:");
64 66
		//group.setLayout(new RowLayout(SWT.VERTICAL));
......
80 82
		groupByWords.setSelection(!groupByTexts.getSelection());
81 83

  
82 84
		
83
		suCombo = new Combo(p, SWT.READ_ONLY);
84
		supCombo = new Combo(p, SWT.READ_ONLY);
85
		
86
		
87
		// Structural units and properties combo viewers
88
		StructuralUnitsGroup structuration = new StructuralUnitsGroup(this, true, this.getResultData().getStructuralUnit(), this.getResultData().getStructuralUnitProperty(), parametersArea, SWT.NONE);
89
		
90
		// Structural Unit
91
		structuralUnitsComboViewer = structuration.getStructuralUnitsComboViewer();
92
		
93
		// Structural Unit Property
94
		structuralUnitPropertiesComboViewer = structuration.getStructuralUnitPropertiesComboViewer();
85 95

  
96
		
97
		
98
		
99
		
100
		suCombo = new Combo(parametersArea, SWT.READ_ONLY);
101
		supCombo = new Combo(parametersArea, SWT.READ_ONLY);
102

  
86 103
		try {
87 104
			loadSU();
88 105
		}
......
125 142
			public void widgetSelected(SelectionEvent e) {
126 143
				
127 144
			
128
				// persistence
129
				getResultData().saveParameter(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX, supCombo.getSelectionIndex());
130
				getResultData().saveParameter(TextsBalancePreferences.GROUP_BY_TEXTS, groupByTexts.getSelection());
145
				//getResultData().saveParameter(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY_INDEX, supCombo.getSelectionIndex());
146
				getResultData().setGroupByTexts(groupByTexts.getSelection());
131 147
				getResultData().setDirty();
132 148
				compute(true);
133 149
			}
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 607)
95 95
		this.chartDirty = true;
96 96
		this.needsToResetView = false;
97 97
		this.needsToClearItemsSelection = false;
98
		try {
99
			this.loadInternalParameters();
100
		}
101
		catch (Exception e) {
102
			// TODO Auto-generated catch block
103
			e.printStackTrace();
104
		}
105 98
	}
106 99
	
107 100
	
108
	/**
109
	 * Loads internal parameters from local node or default preferences.
110
	 * @return
111
	 * @throws Exception
112
	 */
113
	// FIXME: became useless, the parameters seems to be now well loaded with loadGenericParameters();
114
	private final boolean loadInternalParameters() throws Exception {
115
		
116
		// FIXME: Debug
117
		System.err.println("ChartResult.loadInternalParameters(): loading shared parameters into fields.");
118
		
119
//		this.titleVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_TITLE);
120
//		this.legendVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_LEGEND);
121
//		this.gridVisible = this.getBooleanParameterValue(ChartsEnginePreferences.SHOW_GRID);
122
//		this.renderingColorsMode = this.getIntParameterValue(ChartsEnginePreferences.RENDERING_COLORS_MODE);
123
//		this.font = this.getStringParameterValue(ChartsEnginePreferences.FONT);
124
//		this.chartType = this.getStringParameterValue(ChartsEnginePreferences.CHART_TYPE);
125
		return true;
126
	}
127
	
128 101
	@Override
129
	protected boolean loadParametersFromAnnotations() throws Exception {
130
		return (super.loadParametersFromAnnotations()
131
				&& super.loadParametersFromAnnotations(Parameter.RENDERING));
102
	protected boolean autoLoadParametersFromAnnotations() throws Exception {
103
		return (super.autoLoadParametersFromAnnotations()
104
				&& super.autoLoadParametersFromAnnotations(Parameter.RENDERING));
132 105
	}
133 106

  
134

  
135

  
136 107
	
137 108
	
138 109
	@Override
......
171 142
			System.err.println("ChartResult.renderChart(): chart rendering parameters have not changed since last rendering, rendering skipped.");
172 143
			return true;
173 144
		}
174
		else if(!this.chartDirty)	{
145
		else if (!this.chartDirty) {
175 146
			
176 147
			// FIXME: Debug
177 148
			System.err.println("ChartResult.renderChart(): chart is not dirty, rendering skipped.");
......
184 155
		if(chartCreator != null)	{
185 156
			
186 157

  
187
			// Creating, if needed
188
			if(this.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE))	{
158
			// Creating, if needed.
159
			// The change of the chart type parameter can occur if:
160
			// - the chart has never been created
161
			// - the chart type has been changed, e.g. to dynamically change the type of chart
162
			if (this.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE)) {
189 163
				// FIXME: debug
190 164
				System.err.println("ChartResult.renderChart(): creating chart.");
191
				
165

  
192 166
				this.chart = chartCreator.createChart(this);
193 167
			}
194 168
			
......
197 171
			System.err.println("ChartResult.renderChart(): updating chart.");
198 172
			
199 173
			// FIXME: the update must be done here (BEFORE the call of this.updateLastRenderingParameters()) rather than in the SWTChartComponentsProvider => the problem is that for File based Engine, the file may be created twice, need to check this
174
			// also before the call of this.updateLastParameters() to be able to check if a computing parameter has changed in the chart creators 
200 175
			chartCreator.updateChart(this);
201 176
			
202 177
			this.updateLastParameters();
......
238 213
	}
239 214
	
240 215
	
241
	
216
	/**
217
	 * 
218
	 * @return
219
	 * @throws Exception
220
	 */
242 221
	public final boolean isChartDirtyFromHistory() throws Exception {
243 222
		
244 223
		List<Field> fields = this.getAllFields();
......
293 272
			clone.chart = null;
294 273
			// FIXME: would be nice to clone the chart if possible instead of clearing the last rendering parameters?
295 274
			//clone.chart = this.chart.clone();
296
			clone.clearLastRenderingParameters();
275
			clone.clearLastRenderingParameters(); // to force recreation of the chart at next computing
297 276
			clone.chartDirty = true;
298 277
		}
299 278
		catch(Exception e) {
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java (revision 607)
1397 1397
	 * Returns the object itself if its class is one of the the three listed below.
1398 1398
	 * @return
1399 1399
	 */
1400
	synchronized public static TXMResult getFirstParentCorpus(TXMResult result) {
1400
	synchronized public static Corpus getFirstParentCorpus(TXMResult result) {
1401 1401
		
1402 1402
		// FIXME: need to validate/prove this method
1403 1403
		System.err.println("Corpus.getFirstCorpusParent(): need to validate/prove this method.");
1404 1404
		
1405
		TXMResult corpus = result.getFirstParent(Subcorpus.class);
1405
		Corpus corpus = (Corpus) result.getFirstParent(Subcorpus.class);
1406 1406
		if(corpus == null)	{
1407
			corpus = result.getFirstParent(Corpus.class);
1407
			corpus = (Corpus) result.getFirstParent(Corpus.class);
1408 1408
		}
1409 1409
		if(corpus == null)	{
1410
			corpus = getParentMainCorpus(result);
1410
			corpus = (Corpus) getParentMainCorpus(result);
1411 1411
		}
1412 1412
		return corpus;
1413 1413
	}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Property.java (revision 607)
27 27
//
28 28
package org.txm.searchengine.cqp.corpus;
29 29

  
30
import java.util.ArrayList;
31
import java.util.List;
32 30

  
33
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
34
import org.txm.utils.logger.Log;
35

  
36 31
/**
37 32
 * An abstract CQP corpus property. Represents a <strong>type</strong>, not a the value for a specific unit.
38 33
 * 
......
69 64
	 * @return the qualified name
70 65
	 */
71 66
	public String getQualifiedName() {
72
		return this.corpus.getCqpId()+"."+this.getFullName(); //$NON-NLS-1$
67
		return this.corpus.getCqpId() + "." + this.getFullName(); //$NON-NLS-1$
73 68
	}
74 69

  
75 70
	/**
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 607)
149 149

  
150 150
	private ArrayList<Property> availableRightSortProperties;
151 151

  
152
	
153
	/**
154
	 * 
155
	 * @param corpus
156
	 */
152 157
	public Concordance(Corpus corpus) {
153 158

  
154 159
		super(corpus);
tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/preferences/RPreferencePage.java (revision 607)
141 141

  
142 142
		
143 143
		changeFieldStates(TXMPreferences.getBoolean(RPreferences.REMOTE, RPreferences.PREFERENCES_NODE));
144
		
145
		
146
		addField(new BooleanFieldEditor(RPreferences.SHOW_EVAL_LOGS, "Log the R eval command lines.", getFieldEditorParent()));
147
		
144 148
	}
145 149
	
146 150
	
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 607)
91 91
	/**
92 92
	 * First dimension.
93 93
	 */
94
	@Parameter(key=CAPreferences.FIRST_DIMENSION)
94
	@Parameter(key=CAPreferences.FIRST_DIMENSION, type=Parameter.RENDERING)
95 95
	protected int firstDimension = 1;
96 96

  
97 97
	/**
98 98
	 * Second dimension.
99 99
	 */
100
	@Parameter(key=CAPreferences.SECOND_DIMENSION)
100
	@Parameter(key=CAPreferences.SECOND_DIMENSION, type=Parameter.RENDERING)
101 101
	protected int secondDimension = 2;
102 102
	
103

  
104 103
	/**
105 104
	 * To show/hide individuals.
106 105
	 */
107
	@Parameter(key=CAPreferences.SHOW_INDIVIDUALS)
106
	@Parameter(key=CAPreferences.SHOW_INDIVIDUALS, type=Parameter.RENDERING)
108 107
	protected boolean showIndividuals;
109 108

  
110 109
	/**
111 110
	 * To show/hide variables.
112 111
	 */
113
	@Parameter(key=CAPreferences.SHOW_VARIABLES)
112
	@Parameter(key=CAPreferences.SHOW_VARIABLES, type=Parameter.RENDERING)
114 113
	protected boolean showVariables;
115 114

  
116 115
	/**
117 116
	 * To show/hide the point shapes or only the labels.
118 117
	 */
119
	@Parameter(key=CAPreferences.SHOW_POINT_SHAPES)
118
	@Parameter(key=CAPreferences.SHOW_POINT_SHAPES, type=Parameter.RENDERING)
120 119
	protected boolean showPointShapes;
121 120
	
122 121
	
......
678 677

  
679 678
	@Override
680 679
	public String getSimpleName() {
681
		return getParent().getName() + " " + this.firstDimension + "," + this.secondDimension + ")";
680
		return getParent().getSimpleName() + " (" + this.firstDimension + "," + this.secondDimension + ")";
682 681
	}
683 682

  
684 683
	@Override
......
864 863
		// nothing to do
865 864
		return true;
866 865
	}
866

  
867
	/**
868
	 * @return the showIndividuals
869
	 */
870
	public boolean isShowIndividuals() {
871
		return showIndividuals;
872
	}
873

  
874
	/**
875
	 * @param showIndividuals the showIndividuals to set
876
	 */
877
	public void setShowIndividuals(boolean showIndividuals) {
878
		this.showIndividuals = showIndividuals;
879
	}
880

  
881
	/**
882
	 * @return the showVariables
883
	 */
884
	public boolean isShowVariables() {
885
		return showVariables;
886
	}
887

  
888
	/**
889
	 * @param showVariables the showVariables to set
890
	 */
891
	public void setShowVariables(boolean showVariables) {
892
		this.showVariables = showVariables;
893
	}
894

  
895
	/**
896
	 * @return the showPointShapes
897
	 */
898
	public boolean isShowPointShapes() {
899
		return showPointShapes;
900
	}
901

  
902
	/**
903
	 * @param showPointShapes the showPointShapes to set
904
	 */
905
	public void setShowPointShapes(boolean showPointShapes) {
906
		this.showPointShapes = showPointShapes;
907
	}
908

  
909
	/**
910
	 * @param firstDimension the firstDimension to set
911
	 */
912
	public void setFirstDimension(int firstDimension) {
913
		this.firstDimension = firstDimension;
914
	}
915

  
916
	/**
917
	 * @param secondDimension the secondDimension to set
918
	 */
919
	public void setSecondDimension(int secondDimension) {
920
		this.secondDimension = secondDimension;
921
	}
867 922
}
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/Eigenvalues.java (revision 607)
40 40
	@Override
41 41
	public String getSimpleName() {
42 42
		// TODO Auto-generated method stub
43
		return "";
43
		return "Eigenvalues";
44 44
	}
45 45

  
46 46
	@Override
......
51 51

  
52 52
	@Override
53 53
	public void clean() {
54
		// TODO Auto-generated method stub
55

  
54
		// nothing to do
56 55
	}
57 56

  
58 57
	/* (non-Javadoc)
......
65 64
	
66 65
	@Override
67 66
	public boolean saveParameters() {
68
		// TODO Auto-generated method stub
69
		System.err.println("Eigenvalues.saveParameters(): not yet implemented.");
67
		// nothing to do
70 68
		return true;
71 69
	}
72 70

  
......
79 77

  
80 78
	@Override
81 79
	public boolean loadParameters() {
82
		// TODO Auto-generated method stub
83
		System.err.println("Eigenvalues.loadParameters(): not yet implemented.");
80
		// nothing to do
84 81
		return true;
85 82
	}
86 83

  
87 84
	
88

  
89
	/* (non-Javadoc)
90
	 * @see org.txm.core.results.TXMResult#_compute(boolean)
91
	 */
92 85
	@Override
93 86
	protected boolean _compute(boolean update) throws Exception {
94
		// does nothing
87
		// nothing to do
95 88
		return true;
96 89
	}
97 90

  
98
	/* (non-Javadoc)
99
	 * @see org.txm.core.results.TXMResult#toTxt(java.io.File, java.lang.String, java.lang.String, java.lang.String)
100
	 */
101 91
	@Override
102 92
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
103 93
		// TODO Auto-generated method stub
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/jfreechart/themes/highcharts/chartcreators/JFCCAChartCreator.java (revision 607)
84 84
		}
85 85

  
86 86
		
87
		//this.updateChart(result);
88
		
89 87
		return chart;		
90 88
		
91 89
	}
......
96 94
		CA ca = (CA) result;
97 95
		JFreeChart chart = (JFreeChart)result.getChart();
98 96
		
97
		// freeze rendering while computing
98
		chart.setNotify(false);
99
		
100
		
99 101
		FCAItemSelectionRenderer renderer = (FCAItemSelectionRenderer) chart.getXYPlot().getRenderer(); 
100 102
   	 	XYPlot plot = chart.getXYPlot();
101 103
		
102 104
		
103
		renderer.setSeriesVisible(0, result.getBooleanParameterValue(CAPreferences.SHOW_VARIABLES));
104
		renderer.setSeriesVisible(1, result.getBooleanParameterValue(CAPreferences.SHOW_INDIVIDUALS));
105
		renderer.setSeriesVisible(0, ca.isShowVariables());
106
		renderer.setSeriesVisible(1, ca.isShowIndividuals());
105 107
		
106 108
		// Create the limits border
107 109
		this.createCAFactorialMapChartLimitsBorder(chart);
......
145 147
		
146 148
  
147 149
        
148
        renderer.setShapesVisible(result.getBooleanParameterValue(CAPreferences.SHOW_POINT_SHAPES));
150
        renderer.setShapesVisible(ca.isShowPointShapes());
149 151
        renderer.setBaseLinesVisible(false);
150 152
        
151 153
        // Draw the point shapes and the item labels
152
        if(result.getBooleanParameterValue(CAPreferences.SHOW_POINT_SHAPES))	{
154
        if(ca.isShowPointShapes())	{
153 155
            
154 156
        	renderer.setSeriesItemLabelPaint(0, renderer.getBaseItemLabelPaint());
155 157
            renderer.setSeriesItemLabelPaint(1, renderer.getBaseItemLabelPaint());
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 607)
13 13
import org.eclipse.core.runtime.Status;
14 14
import org.eclipse.core.runtime.jobs.Job;
15 15
import org.eclipse.jface.action.MenuManager;
16
import org.eclipse.jface.viewers.ComboViewer;
16 17
import org.eclipse.jface.viewers.ISelectionProvider;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.jface.viewers.StructuredSelection;
17 20
import org.eclipse.jface.viewers.TableViewer;
18 21
import org.eclipse.swt.SWT;
19 22
import org.eclipse.swt.layout.GridData;
......
565 568

  
566 569
	/**
567 570
	 * Updates the editor fields from result and declared parameters annotations.
568
	 * Manages these widgets at this moment: ToolItem, Spinner, Text, Button.
571
	 * Manages these widgets at this moment: ToolItem, Spinner, Text, Button, ComboViewer.
569 572
	 */
570 573
	public void autoUpdateEditorFieldsFromResult()	{
571 574

  
......
593 596
				else if(object instanceof Button)	{
594 597
					((Button)object).setSelection((Boolean) value);
595 598
				}
599
				else if(object instanceof ComboViewer)	{
600
					//((ComboViewer)object).getCombo().select(1);
601
					// FIXME: fire a new selection changed event leading to a cyclic recursion...
602
					((ComboViewer)object).setData("ignore", true);
603
					((ComboViewer)object).setSelection(new StructuredSelection(value), true);
604
					((ComboViewer)object).setData("ignore", false);
605
				}
606
				
607
				
596 608
				// FIXME: need to extend this list of managed Widgets
597 609
			}
598 610
			catch (Exception e) {
......
605 617

  
606 618
	/**
607 619
	 * Updates the result parameters from the editor declared parameters annotations.
608
	 * Manages these widgets at this moment: ToolItem, Spinner, Text, Button.
620
	 * Manages these widgets at this moment: ToolItem, Spinner, Text, Button, ComboViewer.
609 621
	 */
610 622
	public void autoUpdateResultFromEditorParameters()	{
611 623

  
......
633 645
				else if(object instanceof Button)	{
634 646
					value = ((Button)object).getSelection(); 
635 647
				}
648
				else if(object instanceof ComboViewer)	{
649
					value = ((IStructuredSelection)((ComboViewer)object).getSelection()).getFirstElement(); 
650
				}
651

  
636 652
				// FIXME: need to extend this list of managed Widgets
637 653

  
638 654
				this.getResultData().setParameter(parameter.key(), value);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeSelectionListener.java (revision 607)
3 3
 */
4 4
package org.txm.rcp.editors.listeners;
5 5

  
6
import org.eclipse.jface.viewers.ComboViewer;
7
import org.eclipse.jface.viewers.ISelectionChangedListener;
8
import org.eclipse.jface.viewers.SelectionChangedEvent;
6 9
import org.eclipse.swt.events.SelectionEvent;
7 10
import org.eclipse.swt.events.SelectionListener;
8 11
import org.txm.rcp.editors.TXMEditorPart;
......
12 15
 * @author sjacquot
13 16
 *
14 17
 */
15
public class ComputeSelectionListener implements SelectionListener {
18
public class ComputeSelectionListener implements SelectionListener, ISelectionChangedListener {
16 19

  
17 20

  
18 21
	/**
......
38 41

  
39 42
	}
40 43

  
44
	@Override
45
	public void selectionChanged(SelectionChangedEvent event) {
46
		// to skip programmatically setSelection() call
47
		if(event.getSource() instanceof ComboViewer)	{
48
			if((Boolean)((ComboViewer)event.getSource()).getData("ignore") == true)	{
49
				return;
50
			}
51
		}
52
		this.editor.compute(false);
53
	}
54

  
41 55
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/StructuralUnitsGroup.java (revision 607)
1
package org.txm.rcp.swt.widget;
2

  
3
import org.eclipse.jface.viewers.ArrayContentProvider;
4
import org.eclipse.jface.viewers.ComboViewer;
5
import org.eclipse.jface.viewers.ISelectionChangedListener;
6
import org.eclipse.jface.viewers.IStructuredSelection;
7
import org.eclipse.jface.viewers.SelectionChangedEvent;
8
import org.eclipse.jface.viewers.StructuredSelection;
9
import org.eclipse.swt.SWT;
10
import org.eclipse.swt.layout.RowLayout;
11
import org.eclipse.swt.widgets.Composite;
12
import org.eclipse.swt.widgets.Group;
13
import org.txm.rcp.editors.TXMEditorPart;
14
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
15
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
16
import org.txm.searchengine.cqp.corpus.Corpus;
17
import org.txm.searchengine.cqp.corpus.StructuralUnit;
18
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
19

  
20
/**
21
 * A group Widget that manages the Structural Unit and Structural Unit Property with two linked combo viewers.
22
 * 
23
 * @author sjacquot
24
 *
25
 */
26
public class StructuralUnitsGroup extends Group {
27

  
28
	
29
	/**
30
	 * Structural Units.
31
	 */
32
	protected ComboViewer structuralUnitsComboViewer;
33
	
34
	/**
35
	 * Structural Unit Properties.
36
	 */
37
	protected ComboViewer structuralUnitPropertiesComboViewer;
38

  
39
	
40
	/**
41
	 * 
42
	 * @param editor
43
	 * @param autoCompute
44
	 * @param parent
45
	 * @param style
46
	 */
47
	public StructuralUnitsGroup(final TXMEditorPart editor, final boolean autoCompute, StructuralUnit selectedSU, StructuralUnitProperty selectedSUP, Composite parent, int style) {
48
		super(parent, style);
49
		
50
		this.setLayout(new RowLayout());
51
		this.setText("Structural unit and property");
52

  
53
		
54
		
55
		// Structural Unit combo box
56
		this.structuralUnitsComboViewer = new ComboViewer(this, SWT.READ_ONLY);
57
		this.structuralUnitsComboViewer.setContentProvider(ArrayContentProvider.getInstance());
58
		
59
		// Input
60
		try {
61
			this.structuralUnitsComboViewer.setInput(Corpus.getFirstParentCorpus(editor.getResultData()).getOrderedStructuralUnits().toArray());
62
		}
63
		catch (CqiClientException e) {
64
			// TODO Auto-generated catch block
65
			e.printStackTrace();
66
		}
67
		this.structuralUnitsComboViewer.setSelection(new StructuredSelection(selectedSU), true);
68

  
69

  
70
		
71
		// Listeners
72
//		if(autoCompute)	{
73
//			//this.structuralUnitsComboViewer.addSelectionChangedListener(new ComputeSelectionListener(editor));
74
//		}
75
		this.structuralUnitsComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
76
			@Override
77
			public void selectionChanged(SelectionChangedEvent event) {
78
				structuralUnitPropertiesComboViewer.setInput(((StructuralUnit)((IStructuredSelection)structuralUnitsComboViewer.getSelection()).getFirstElement()).getUserDefinedProperties().toArray());
79
			}
80
		});
81
		
82
		
83
		// Structural Unit Property combo box
84
		this.structuralUnitPropertiesComboViewer = new ComboViewer(this, SWT.READ_ONLY);
85
		this.structuralUnitPropertiesComboViewer.setContentProvider(ArrayContentProvider.getInstance());
86
		
87
		// Input
88
		this.structuralUnitPropertiesComboViewer.setInput(((StructuralUnit)((IStructuredSelection)this.structuralUnitsComboViewer.getSelection()).getFirstElement()).getUserDefinedProperties().toArray());
89
		this.structuralUnitPropertiesComboViewer.setSelection(new StructuredSelection(selectedSUP), true);
90
		
91
		// Listener
92
		if(autoCompute)	{
93
			this.structuralUnitPropertiesComboViewer.addSelectionChangedListener(new ComputeSelectionListener(editor));
94
		}
95

  
96
		
97
//		this.structuralUnitPropertiesComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
98
//			
99
//			@Override
100
//			public void selectionChanged(SelectionChangedEvent event) {
101
//				// TODO Auto-generated method stub
102
//				System.out.println("StructuralUnitsGroup.StructuralUnitsGroup(...).new ISelectionChangedListener() {...}.selectionChanged()");
103
//
104
//			}
105
//		});
106
	}
107

  
108

  
109
	/**
110
	 * @return the structuralUnitsComboViewer
111
	 */
112
	public ComboViewer getStructuralUnitsComboViewer() {
113
		return structuralUnitsComboViewer;
114
	}
115

  
116

  
117
	/**
118
	 * @return the structuralUnitPropertiesComboViewer
119
	 */
120
	public ComboViewer getStructuralUnitPropertiesComboViewer() {
121
		return structuralUnitPropertiesComboViewer;
122
	}
123

  
124
	@Override
125
	protected void checkSubclass() {
126
	}
127
	
128
	
129
	
130
}
0 131

  

Also available in: Unified diff