Revision 1159

tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 1159)
240 240

  
241 241
			String refPropertyNames = this.getStringParameterValue(ConcordancePreferences.VIEW_REFERENCE_PATTERN);
242 242
			if ("*".equals(refPropertyNames)) {
243
				Property refProperty = getCorpus().getProperty("ref");//$NON-NLS-1$
243
				Property refProperty = this.getCorpus().getProperty("ref");//$NON-NLS-1$
244 244
				if (refProperty == null) {
245
					StructuralUnitProperty sup_textid = getCorpus().getTextIdStructuralUnitProperty();
245
					StructuralUnitProperty sup_textid = this.getCorpus().getTextIdStructuralUnitProperty();
246 246
					this.pViewRefPattern = new ReferencePattern(sup_textid);
247 247
				} else {
248 248
					this.pViewRefPattern = new ReferencePattern(refProperty);
249 249
				}
250 250
			} else {
251
				this.pViewRefPattern = ReferencePattern.stringToReferencePattern(getCorpus(), refPropertyNames);
251
				this.pViewRefPattern = ReferencePattern.stringToReferencePattern(this.getCorpus(), refPropertyNames);
252 252
			}
253 253

  
254 254
			refPropertyNames = this.getStringParameterValue(ConcordancePreferences.ANALYSIS_REFERENCE_PATTERN);
255 255
			if ("*".equals(refPropertyNames)) { //$NON-NLS-1$
256 256
				Property refProperty = getCorpus().getProperty("ref");//$NON-NLS-1$
257 257
				if (refProperty == null) {
258
					StructuralUnitProperty sup_textid = getCorpus().getTextIdStructuralUnitProperty();
258
					StructuralUnitProperty sup_textid = this.getCorpus().getTextIdStructuralUnitProperty();
259 259
					this.pAnalysisRefPattern = new ReferencePattern(sup_textid);
260 260
				} else {
261 261
					this.pAnalysisRefPattern = new ReferencePattern(refProperty);
......
301 301
	protected boolean _compute() throws Exception {
302 302
		if (pQueryResult != null) {
303 303
			this.queryResult = pQueryResult;
304
		} else {
304
		}
305
		else {
305 306
			this.queryResult = this.getCorpus().query(pQuery, pQuery.getQueryString().replace(" ", "_") + "_concordance", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
306 307
		}
307 308

  
tmp/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 1159)
232 232
	}
233 233

  
234 234
	@Override
235
	public boolean compute(IProgressMonitor watcher) throws Exception {
235
	public boolean compute(IProgressMonitor watcher) {
236 236
		// TODO Auto-generated method stub
237
		System.err.println("TIGERSearch.compute(): not yet implemnted.");
237 238
		return false;
238 239
	}
239 240

  
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ExpI.java (revision 1159)
375 375
	};
376 376

  
377 377
	@Override
378
	public boolean compute(IProgressMonitor watcher) throws Exception {
378
	public boolean compute(IProgressMonitor watcher) {
379 379
		System.out.println("ExpI.compute(monitor): not implemented.");
380 380
		return false;
381 381
	}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ContextSubcorpus.java (revision 1159)
3 3
import java.io.BufferedReader;
4 4
import java.io.File;
5 5
import java.io.FileInputStream;
6
import java.io.FileNotFoundException;
6 7
import java.io.IOException;
7 8
import java.io.InputStreamReader;
9
import java.io.UnsupportedEncodingException;
8 10
import java.util.ArrayList;
9 11
import java.util.HashMap;
10 12

  
......
15 17
import org.txm.searchengine.cqp.MemCqiClient;
16 18
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
17 19
import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
20
import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
18 21
import org.txm.searchengine.cqp.corpus.CQPCorpus;
19 22
import org.txm.searchengine.cqp.corpus.QueryResult;
20 23
import org.txm.searchengine.cqp.corpus.Subcorpus;
......
66 69
	}
67 70

  
68 71
	@Override
69
	public boolean compute(IProgressMonitor monitor) throws IOException, CqiClientException, CqiServerError, InvalidCqpIdException {
72
	public boolean compute(IProgressMonitor monitor) {
70 73
		
71
		if (!(CQPSearchEngine.getCqiClient() instanceof MemCqiClient));
74
		try {
75
			if (!(CQPSearchEngine.getCqiClient() instanceof MemCqiClient));
72 76

  
73
		MemCqiClient CQI = (MemCqiClient) CQPSearchEngine.getCqiClient();
77
			MemCqiClient CQI = (MemCqiClient) CQPSearchEngine.getCqiClient();
74 78

  
75
		BufferedReader keywordFileReader = new BufferedReader(new InputStreamReader(
76
				new FileInputStream(keywordsFile), "UTF-8")); //$NON-NLS-1$
77
		ArrayList<String> keywordLines = new ArrayList<String>();
78
		String l = keywordFileReader.readLine();
79
		while (l != null) {
80
			keywordLines.add(l);
81
			l = keywordFileReader.readLine();
82
		}
83
		keywordFileReader.close();
84
		System.out.println("Number of keywords lines: "+keywordLines.size());
85
		System.out.println("context left and right size is: "+contextSize);
86
		monitor.beginTask("Querying keywords...", keywordLines.size());
79
			BufferedReader keywordFileReader = new BufferedReader(new InputStreamReader(
80
					new FileInputStream(keywordsFile), "UTF-8")); //$NON-NLS-1$
81
			ArrayList<String> keywordLines = new ArrayList<String>();
82
			String l = keywordFileReader.readLine();
83
			while (l != null) {
84
				keywordLines.add(l);
85
				l = keywordFileReader.readLine();
86
			}
87
			keywordFileReader.close();
88
			System.out.println("Number of keywords lines: "+keywordLines.size());
89
			System.out.println("context left and right size is: "+contextSize);
90
			monitor.beginTask("Querying keywords...", keywordLines.size());
87 91

  
88
		int nkeyword = 0;
89
		for (String line : keywordLines) {
90
			String[] split = line.split("=", 2); //$NON-NLS-1$
91
			if (split.length == 2) {
92
				CQLQuery q = new CQLQuery(split[1]+" expand to "+contextSize);
93
				keywordQueriestoName.put(split[1], split[0]);
94
				results.add(corpus.query(q, "K"+nkeyword++, false));
92
			int nkeyword = 0;
93
			for (String line : keywordLines) {
94
				String[] split = line.split("=", 2); //$NON-NLS-1$
95
				if (split.length == 2) {
96
					CQLQuery q = new CQLQuery(split[1]+" expand to "+contextSize);
97
					keywordQueriestoName.put(split[1], split[0]);
98
					results.add(corpus.query(q, "K"+nkeyword++, false));
95 99

  
100
				}
96 101
			}
97
		}
98
		keywordFileReader.close();
102
			keywordFileReader.close();
99 103

  
100
		// Loop over QueryResult to Merge them into one subcorpus
101
		int n = 0;
102
		monitor.beginTask("Creating subcorpus...", results.size());
103
		while(results.size() > 1) {
104
			// Loop over QueryResult to Merge them into one subcorpus
105
			int n = 0;
106
			monitor.beginTask("Creating subcorpus...", results.size());
107
			while(results.size() > 1) {
104 108

  
105
			QueryResult q1 = results.get(0);
106
			QueryResult q2 = results.get(1);
107
			//System.out.println("Mergin... "+q1+" "+q2);
108
			//System.out.println("match sizes "+q1.getNMatch()+" "+q2.getNMatch());
109
				QueryResult q1 = results.get(0);
110
				QueryResult q2 = results.get(1);
111
				//System.out.println("Mergin... "+q1+" "+q2);
112
				//System.out.println("match sizes "+q1.getNMatch()+" "+q2.getNMatch());
109 113

  
110
			String merge_name = "Merge"+(n++);
111
			CQI.query(merge_name+"= union "+q1.getQualifiedCqpId()+" "+q2.getQualifiedCqpId()+";");
112
			results.remove(0);
113
			results.remove(0);
114
			results.add(new QueryResult(merge_name, merge_name, corpus, null));
115
			monitor.worked(1);
114
				String merge_name = "Merge"+(n++);
115
				CQI.query(merge_name+"= union "+q1.getQualifiedCqpId()+" "+q2.getQualifiedCqpId()+";");
116
				results.remove(0);
117
				results.remove(0);
118
				results.add(new QueryResult(merge_name, merge_name, corpus, null));
119
				monitor.worked(1);
120
			}
121

  
122
			System.out.println("Done.");
123
			return true;
116 124
		}
117

  
118
		System.out.println("Done.");
119
		return true;
125
		catch (Exception e) {
126
			// TODO Auto-generated catch block
127
			e.printStackTrace();
128
			return false;
129
		}
120 130
	}
121 131

  
122 132
	@Override
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ValuesOfQuery.java (revision 1159)
187 187
	}
188 188

  
189 189
	@Override
190
	public boolean compute(IProgressMonitor watcher) throws Exception {
190
	public boolean compute(IProgressMonitor watcher) {
191 191
		// TODO Auto-generated method stub
192
		System.err.println("ValuesOfQuery.compute(): not yet implemented.");
192 193
		return false;
193 194
	}
194 195

  
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ExpII.java (revision 1159)
675 675
	}
676 676

  
677 677
	@Override
678
	public boolean compute(IProgressMonitor watcher) throws Exception {
678
	public boolean compute(IProgressMonitor watcher) {
679 679
		System.out.println("ExpII.compute(monitor): not implemented.");
680 680
		return false;
681 681
	}
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 1159)
6 6
import org.txm.chartsengine.rcp.editors.ChartEditor;
7 7
import org.txm.core.results.Parameter;
8 8
import org.txm.rcp.IImageKeys;
9
import org.txm.rcp.editors.listeners.ComputeKeyListener;
9 10
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
10 11
import org.txm.rcp.swt.widget.FloatSpinner;
11 12
import org.txm.specificities.core.functions.SpecificitiesSelection;
......
38 39
	@Override
39 40
	public void __createPartControl() {
40 41
		
42
		
43
		// Computing listeners
44
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
45
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
46

  
47
		
41 48
		// Group bars by lines
42 49
		groupBarsByLines = new ToolItem(this.getToolBar(), SWT.CHECK);
43 50
		groupBarsByLines.setToolTipText(SpecificitiesUIMessages.SpecificitiesPreferencePage_4);
44 51
		groupBarsByLines.setImage(IImageKeys.getImage(ComputeSpecifities.class, "icons/silk_group_bars_by_lines.png"));
45
		groupBarsByLines.addSelectionListener(new ComputeSelectionListener(this));
52
		groupBarsByLines.addSelectionListener(computeSelectionListener);
46 53
		
47 54
		
48 55
		// Banality
......
51 58
		
52 59
		banality = new FloatSpinner(this.getExtendedParametersComposite(), SWT.BORDER);
53 60
		banality.setToolTipText("Banality threshold");
54
		banality.setMaximumAsFloat(2);
55
		banality.addSelectionListener(new ComputeSelectionListener(this));
61
		banality.setMaximumAsFloat(200);
62
		banality.addSelectionListener(computeSelectionListener);
63
		banality.addKeyListener(computeKeyListener);
56 64
		
57 65
	}
58 66

  
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 1159)
24 24
public class SpecificitiesSelection extends ChartResult {
25 25

  
26 26
	/**
27
	 * The selected specificities indices to focus on.
28
	 */
29
	protected double[][] selectedSpecificitiesIndex;
30

  
31
	
32
	/**
27 33
	 * Banality threshold.
28 34
	 */
29 35
	@Parameter(key=SpecificitiesPreferences.CHART_BANALITY, type=Parameter.RENDERING)
30
	protected Float pBanality;
36
	protected Float banality;
31 37

  
32 38
	/**
33 39
	 * To draw bars or not.
34 40
	 */
35 41
	@Parameter(key=SpecificitiesPreferences.CHART_DRAW_BARS, type=Parameter.RENDERING)
36
	protected Boolean pDrawBars;
42
	protected Boolean drawBars;
37 43

  
38 44
	/**
39 45
	 * To draw lines or not.
40 46
	 */
41 47
	@Parameter(key=SpecificitiesPreferences.CHART_DRAW_LINES, type=Parameter.RENDERING)
42
	protected Boolean pDrawLines;
48
	protected Boolean drawLines;
43 49

  
44 50
	/**
45 51
	 * Group by lines / transpose matrix.
46 52
	 */
47 53
	@Parameter(key=SpecificitiesPreferences.CHART_GROUP_BY_LINES, type=Parameter.RENDERING)
48
	protected Boolean pGroupByLines;
54
	protected Boolean groupByLines;
49 55

  
50 56
	/**
51 57
	 * The selected type names to focus on.
52 58
	 */
53 59
	@Parameter(key=SpecificitiesPreferences.VALUES, type=Parameter.RENDERING)
54
	protected List<String> pSelectedTypeNames;
60
	protected List<String> selectedTypeNames;
55 61
	
56
	/**
57
	 * The selected specificities indices to focus on.
58
	 */
59
	protected double[][] selectedSpecificitiesIndex;
60

  
61 62
	
62 63
	
63 64
	/**
......
73 74
	 * @param parametersNodePath
74 75
	 */
75 76
	public SpecificitiesSelection(String parametersNodePath)	{
76
		this(parametersNodePath, null);
77
		super(parametersNodePath);
77 78
	}
78

  
79
	/**
80
	 * 
81
	 * @param parametersNodePath
82
	 * @param parent
83
	 */
84
	public SpecificitiesSelection(String parametersNodePath, Specificities parent)	{
85
		super(parametersNodePath, parent);
86
	}
87

  
88
	// FIXME: SJ: why?!
89 79
	@Override
90
	public Specificities getParent() {
91
		return (Specificities)super.getParent();
92
	}
93

  
94
	@Override
95 80
	protected boolean _compute() throws Exception {
96
		Specificities specificities = getParent();
81
		Specificities specificities = this.getParent();
97 82
		double[][] tableLines = specificities.getSpecificitesIndex();
98 83
		String[] partNames = specificities.getPartShortNames();
99 84
		String[] rowNames = specificities.getTypeNames();
100 85

  
101
		selectedSpecificitiesIndex = new double[pSelectedTypeNames.size()][partNames.length];
86
		selectedSpecificitiesIndex = new double[selectedTypeNames.size()][partNames.length];
102 87
		int n = 0;
103 88
		for (int i = 0; i < rowNames.length; i++) {
104 89
			double[] line = tableLines[i];
105 90
			String rowName = rowNames[i];
106
			if (pSelectedTypeNames.contains(rowName)) {
91
			if (selectedTypeNames.contains(rowName)) {
107 92
				selectedSpecificitiesIndex[n++] = line;
108 93
			}
109 94
		}
......
125 110
	 * @return the banality
126 111
	 */
127 112
	public float getBanality() {
128
		return pBanality;
113
		return banality;
129 114
	}
130 115

  
131 116
	@Override
......
133 118
		StringBuilder sb = new StringBuilder();
134 119
		sb.append(this.getName());
135 120

  
136
		if (pBanality != null) {
137
			sb.append("\n\t"+"banality: "+this.pBanality);
121
		if (banality != null) {
122
			sb.append("\n\t"+"banality: "+this.banality);
138 123
		}
139
		if (pDrawBars != null) {
140
			sb.append("\n\t"+"draw bars: "+this.pDrawBars);
124
		if (drawBars != null) {
125
			sb.append("\n\t"+"draw bars: "+this.drawBars);
141 126
		}
142
		if (pDrawLines != null) {
143
			sb.append("\n\t"+"draw lines: "+this.pDrawLines);
127
		if (drawLines != null) {
128
			sb.append("\n\t"+"draw lines: "+this.drawLines);
144 129
		}
145
		if (pGroupByLines != null) {
146
			sb.append("\n\t"+"group lines: "+this.pGroupByLines);
130
		if (groupByLines != null) {
131
			sb.append("\n\t"+"group lines: "+this.groupByLines);
147 132
		}
148 133
		return sb.toString();
149 134
	}
150 135

  
151 136
	@Override
152 137
	public String getName() {
153
		String name = "[" + StringUtils.join(this.pSelectedTypeNames, ", ") + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
138
		String name = "[" + StringUtils.join(this.selectedTypeNames, ", ") + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
154 139
		if (name.length() > 80) {
155 140
			name = name.substring(0, 79) + "...";
156 141
		}
......
188 173
	 * @return the selectedTypeNames
189 174
	 */
190 175
	public List<String> getSelectedTypeNames() {
191
		return pSelectedTypeNames;
176
		return selectedTypeNames;
192 177
	}
193 178

  
194 179
	@Override
......
200 185
	 * @return the drawBars
201 186
	 */
202 187
	public boolean isDrawingBars() {
203
		return pDrawBars;
188
		return drawBars;
204 189
	}
205 190

  
206 191
	/**
207 192
	 * @return the drawLines
208 193
	 */
209 194
	public boolean isDrawingLines() {
210
		return pDrawLines;
195
		return drawLines;
211 196
	}
212 197

  
213 198
	/**
214 199
	 * @return the groupByLines
215 200
	 */
216 201
	public boolean isGroupingByLines() {
217
		return pGroupByLines;
202
		return groupByLines;
218 203
	}
219 204

  
220 205
	@Override
221 206
	public boolean loadParameters() {
222 207
		String str = this.getStringParameterValue(SpecificitiesPreferences.VALUES);
223 208
		if (!str.isEmpty()) {
224
			pSelectedTypeNames = Arrays.asList(str.split("\t"));
209
			selectedTypeNames = Arrays.asList(str.split("\t"));
225 210
		}
226 211
		return true;
227 212
	}
228 213

  
229 214
	@Override
230 215
	public boolean saveParameters() {
231
		if (pSelectedTypeNames != null) {
232
			this.saveParameter(SpecificitiesPreferences.VALUES, StringUtils.join(pSelectedTypeNames, "\t"));
216
		if (selectedTypeNames != null) {
217
			this.saveParameter(SpecificitiesPreferences.VALUES, StringUtils.join(selectedTypeNames, "\t"));
233 218
		}
234 219
		return true;
235 220
	}
......
238 223
	 * @param banality the banality to set
239 224
	 */
240 225
	public void setBanality(float banality) {
241
		this.pBanality = banality;
226
		this.banality = banality;
242 227
	}
243 228

  
244 229
	/**
245 230
	 * @param groupByLines the groupByLines to set
246 231
	 */
247 232
	public void setGroupByLines(boolean groupByLines) {
248
		this.pGroupByLines = groupByLines;
233
		this.groupByLines = groupByLines;
249 234
	}
250 235

  
251 236
	@Override
......
264 249
	 * @param selectedTypeNames the selectedTypeNames to set
265 250
	 */
266 251
	public void setSelectedTypeNames(List<String> selectedTypeNames) {
267
		this.pSelectedTypeNames = selectedTypeNames;
252
		this.selectedTypeNames = selectedTypeNames;
268 253
	}
269 254

  
270 255
	@Override
256
	@Deprecated
271 257
	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
272 258
		// TODO Auto-generated method stub
273 259
		return false;
274 260
	}
275 261

  
262

  
263
	@Override
264
	public Specificities getParent() {
265
		return (Specificities)this.parent;
266
	}
267

  
268

  
276 269
}
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 1159)
176 176

  
177 177
		try {
178 178
			// Query:
179
			getMainParametersComposite().getLayout().numColumns = 4;
179
			this.getMainParametersComposite().getLayout().numColumns = 4;
180 180
			// make
181
			getMainParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
181
			this.getMainParametersComposite().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
182 182
			
183
			
184
			// Computing listeners
185
			ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
186
			ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
187
			
188
			
183 189
			miniInfoLabel = new Label(getMainParametersComposite(), SWT.NONE);
184 190
			miniInfoLabel.setText(ProgressionUIMessages.ProgressionEditor_no_query);
185 191
			miniInfoLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
......
243 249
			cumulativeButton = new Button(paramPanel, SWT.RADIO);
244 250
			cumulativeButton.setText(ProgressionUIMessages.ProgressionDialog_2);
245 251
			// listeners
246
			cumulativeButton.addSelectionListener(new ComputeSelectionListener(this));
247
			cumulativeButton.addSelectionListener(new SelectionListener() {
252
			cumulativeButton.addSelectionListener(new ComputeSelectionListener(this) {
248 253
				@Override
249 254
				public void widgetSelected(SelectionEvent e) {
250 255
					bandeField.setEnabled(densityButton.getSelection());
251 256
					getResult().setDefaultChartType();
257
					super.widgetSelected(e);
252 258
				}
253

  
254
				@Override
255
				public void widgetDefaultSelected(SelectionEvent e) { }
256 259
			});
257 260

  
258 261
			densityButton = new Button(paramPanel, SWT.RADIO);
259 262
			densityButton.setText(ProgressionUIMessages.ProgressionDialog_3);
260 263
			// listener
261
			densityButton.addSelectionListener(new SelectionListener() {
262

  
264
			densityButton.addSelectionListener(new ComputeSelectionListener(this) {
263 265
				@Override
264 266
				public void widgetSelected(SelectionEvent e) {
265 267
					bandeField.setEnabled(densityButton.getSelection());
266
					getResult().setChartType(Progression.DENSITY_CHART_TYPE);					
268
					getResult().setChartType(Progression.DENSITY_CHART_TYPE);
269
					super.widgetSelected(e);
267 270
				}
268

  
269
				@Override
270
				public void widgetDefaultSelected(SelectionEvent e) { }
271 271
			});
272 272

  
273 273
			// Bande size
......
300 300
			propertyRegex = new Text(structuration, SWT.SINGLE | SWT.BORDER);
301 301
			// FIXME: layout
302 302
			//propertyRegex.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
303
			propertyRegex.addKeyListener(new ComputeKeyListener(this));
303
			propertyRegex.addKeyListener(computeKeyListener);
304 304

  
305 305

  
306 306
			// Repeat same values in part markers
307 307
			repeatSameValues = new Button(paramPanel, SWT.CHECK);
308 308
			repeatSameValues.setText(ProgressionUIMessages.ProgressionDialog_15);
309
			repeatSameValues.addSelectionListener(new ComputeSelectionListener(this));
309
			repeatSameValues.addSelectionListener(computeSelectionListener);
310 310

  
311 311

  
312 312
			// Lines styles
313 313
			multipleLineStrokes = new Button(paramPanel, SWT.CHECK);
314 314
			multipleLineStrokes.setText(SWTComponentsProviderMessages.preferences_multipleLineStrokeStyles);
315
			multipleLineStrokes.addSelectionListener(new ComputeSelectionListener(this));
315
			multipleLineStrokes.addSelectionListener(computeSelectionListener);
316 316

  
317 317

  
318 318
			// Queries
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1159)
259 259

  
260 260
	private Listener tableResizeListener;
261 261

  
262
	private Table leftTable;
263

  
264
	private Table rightTable;
265

  
266
	private ScrollBar vBarLeft;
267

  
268
	private ScrollBar vBarRight;
269

  
270
	private Label queryLabel;
271

  
272
	private Composite navigationArea;
273
	
274
	
262 275
	/** The query widget. */
263 276
	@Parameter(key=ConcordancePreferences.QUERY)
264 277
	protected AssistedQueryWidget queryWidget;
265 278

  
266
	/**
267
	 * Sets the standard comparators.
268
	 */
269
	private void setStandardComparators() {
270
		for (int i = 0; i < standardComparatorClassName.length; i++)
271
			standardComparators.add(standardComparatorClassName[i]);
272
	}
279
	@Parameter(key=ConcordancePreferences.LEFT_ANALYSIS_PROPERTIES)
280
	private PropertiesSelector<WordProperty> leftSortProperties;
281
	@Parameter(key=ConcordancePreferences.ANALYSIS_REFERENCE_PATTERN)
282
	private PropertiesSelector<Property> refSortProperties;
283
	@Parameter(key=ConcordancePreferences.KEYWORD_ANALYSIS_PROPERTIES)
284
	private PropertiesSelector<WordProperty> keywordSortProperties;
285
	@Parameter(key=ConcordancePreferences.RIGHT_VIEW_PROPERTIES)
286
	private PropertiesSelector<WordProperty> rightViewProperties;
287
	@Parameter(key=ConcordancePreferences.KEYWORD_ANALYSIS_PROPERTIES)
288
	private PropertiesSelector<WordProperty> keywordViewProperties;
289
	@Parameter(key=ConcordancePreferences.LEFT_VIEW_PROPERTIES)
290
	private PropertiesSelector<WordProperty> leftViewProperties;
291
	@Parameter(key=ConcordancePreferences.VIEW_REFERENCE_PATTERN)
292
	private PropertiesSelector<Property> refViewProperties;
293
	@Parameter(key=ConcordancePreferences.RIGHT_ANALYSIS_PROPERTIES)
294
	private PropertiesSelector<WordProperty> rightSortProperties;
295
	@Parameter(key=ConcordancePreferences.LEFT_CONTEXT_SIZE)
296
	private Spinner leftSizeSpinner;
297
	@Parameter(key=ConcordancePreferences.RIGHT_CONTEXT_SIZE)
298
	private Spinner rightSizeSpinner;
273 299

  
300
	//	private PropertiesSelector<Property> propsArea;
301
	
302
	
303
	
304
	
305
	
274 306
	@Override
275 307
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
276 308
		super.init(site, input);
......
785 817
		viewer2.getControl().setRedraw(true);
786 818
	}
787 819

  
788

  
789
	private Table leftTable;
790

  
791
	private Table rightTable;
792

  
793
	private ScrollBar vBarLeft;
794

  
795
	private ScrollBar vBarRight;
796

  
797
	private Label queryLabel;
798

  
799
	private Composite navigationArea;
800

  
801
	@Parameter(key=ConcordancePreferences.LEFT_ANALYSIS_PROPERTIES)
802
	private PropertiesSelector<WordProperty> leftSortProperties;
803
	@Parameter(key=ConcordancePreferences.ANALYSIS_REFERENCE_PATTERN)
804
	private PropertiesSelector<Property> refSortProperties;
805
	@Parameter(key=ConcordancePreferences.KEYWORD_ANALYSIS_PROPERTIES)
806
	private PropertiesSelector<WordProperty> keywordSortProperties;
807
	@Parameter(key=ConcordancePreferences.RIGHT_VIEW_PROPERTIES)
808
	private PropertiesSelector<WordProperty> rightViewProperties;
809
	@Parameter(key=ConcordancePreferences.KEYWORD_ANALYSIS_PROPERTIES)
810
	private PropertiesSelector<WordProperty> keywordViewProperties;
811
	@Parameter(key=ConcordancePreferences.LEFT_VIEW_PROPERTIES)
812
	private PropertiesSelector<WordProperty> leftViewProperties;
813
	@Parameter(key=ConcordancePreferences.VIEW_REFERENCE_PATTERN)
814
	private PropertiesSelector<Property> refViewProperties;
815
	@Parameter(key=ConcordancePreferences.RIGHT_ANALYSIS_PROPERTIES)
816
	private PropertiesSelector<WordProperty> rightSortProperties;
817
	@Parameter(key=ConcordancePreferences.LEFT_CONTEXT_SIZE)
818
	private Spinner leftSizeSpinner;
819
	@Parameter(key=ConcordancePreferences.RIGHT_CONTEXT_SIZE)
820
	private Spinner rightSizeSpinner;
821

  
822
	//	private PropertiesSelector<Property> propsArea;
823

  
824 820
	/**
825 821
	 * Get the Composite that contains the query and sort forms
826 822
	 * 
......
2010 2006
	public void updateResultFromEditor() {
2011 2007
		// TODO
2012 2008
	}
2009
	
2010
	
2011
	/**
2012
	 * Sets the standard comparators.
2013
	 */
2014
	private void setStandardComparators() {
2015
		for (int i = 0; i < standardComparatorClassName.length; i++)
2016
			standardComparators.add(standardComparatorClassName[i]);
2017
	}
2018

  
2019

  
2013 2020
}
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/jfreechart/themes/highcharts/renderers/CAItemSelectionRenderer.java (revision 1159)
223 223
			String label = ((CAXYDataset) this.getPlot().getDataset()).getLabel(series, item);
224 224

  
225 225
			Font font = this.getItemLabelFont(series, item);
226
			Rectangle2D bounds = font.getStringBounds(label, ((Graphics2D) this.multipleItemsSelector.getChartPanel().getGraphics()).getFontRenderContext());
226
			Rectangle2D bounds = font.
227
					getStringBounds(label
228
							, ((Graphics2D) this.multipleItemsSelector.getChartPanel().getGraphics()).getFontRenderContext());
227 229
			s = new RoundRectangle2D.Double(-(bounds.getWidth()) / 2, -bounds.getHeight() / 2, bounds.getWidth(), bounds.getHeight() - 2 , 5, 5);
228 230
			
229 231
			// Highlight selected item
tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/jfreechart/themes/highcharts/chartcreators/JFCCAChartCreator.java (revision 1159)
2 2

  
3 3
import java.awt.BasicStroke;
4 4
import java.awt.Color;
5
import java.text.Collator;
6 5
import java.text.DecimalFormat;
7 6
import java.util.ArrayList;
8
import java.util.HashMap;
9 7
import java.util.TreeMap;
10 8

  
11 9
import org.jfree.chart.ChartFactory;
......
15 13
import org.jfree.chart.labels.ItemLabelPosition;
16 14
import org.jfree.chart.plot.PlotOrientation;
17 15
import org.jfree.chart.plot.XYPlot;
18
import org.jfree.data.xy.XYDataset;
19 16
import org.jfree.ui.TextAnchor;
20 17
import org.txm.ca.core.chartsengine.base.CAChartCreator;
21 18
import org.txm.ca.core.chartsengine.base.Utils;
......
28 25
import org.txm.chartsengine.core.results.ChartResult;
29 26
import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
30 27
import org.txm.chartsengine.jfreechart.core.renderers.MultipleItemsSelector;
31
import org.txm.core.preferences.TXMPreferences;
32 28
import org.txm.statsengine.core.StatException;
33 29
import org.txm.utils.logger.Log;
34 30

  
......
49 45
		try {
50 46
			CAXYDataset dataset = new CAXYDataset(ca);
51 47

  
52
//			DecimalFormat f = new DecimalFormat("###.00"); //$NON-NLS-1$
53
//			double singularValuesSum = ca.getValeursPropresSum();
54
//
55
//			String percent1 = f.format(100 * ca.getValeursPropres()[ca.getFirstDimension() - 1] / singularValuesSum);
56
//			String xAxisLabel = CACoreMessages.ChartsEngine_CA_FACTORIAL_MAP_AXIS_LABEL_PREFIX + " " + ca.getFirstDimension() + " (" + percent1 + "%)";
57
//			String percent2 = f.format(100 * ca.getValeursPropres()[ca.getSecondDimension() - 1] / singularValuesSum);
58
//			String yAxisLabel = CACoreMessages.ChartsEngine_CA_FACTORIAL_MAP_AXIS_LABEL_PREFIX  + " " + ca.getSecondDimension() + " (" + percent2 + "%)";
59
			
60
			
61 48
			chart = ChartFactory.createScatterPlot(Utils.createCAFactorialMapChartTitle(ca), 
62 49
					"", "", dataset, PlotOrientation.VERTICAL, 
63 50
					CAPreferences.getInstance().getBoolean(ChartsEnginePreferences.SHOW_LEGEND), false, false);
......
85 72
		// freeze rendering while computing
86 73
		chart.setNotify(false);
87 74

  
88
		
89
		// recreate the dataset if the unit property has changed
90
		if(ca.getLexicalTable().hasParameterChanged(TXMPreferences.UNIT_PROPERTY, true))	{
91
			try {
92
				chart.getXYPlot().setDataset(new CAXYDataset(ca));
93
			}
94
			catch (Exception e) {
95
				// TODO Auto-generated catch block
96
				e.printStackTrace();
97
			} 
98
		}
99

  
100
		
101 75
		CAItemSelectionRenderer renderer = (CAItemSelectionRenderer) chart.getXYPlot().getRenderer(); 
102
   	 //	XYPlot plot = chart.getXYPlot();
103 76
		
104
		
105 77
		renderer.setSeriesVisible(0, ca.isShowVariables());
106 78
		renderer.setSeriesVisible(1, ca.isShowIndividuals());
107 79
		
......
122 94
        	renderer.setBasePositiveItemLabelPosition(position);
123 95
        	renderer.setBaseNegativeItemLabelPosition(position);
124 96

  
125
            renderer.setItemLabelAnchorOffset(1);
97
        	renderer.setItemLabelAnchorOffset(1);
126 98
            
127
            //renderer.setBaseItemLabelFont(renderer.getBaseItemLabelFont().deriveFont(Font.NORMAL, renderer.getBaseItemLabelFont().getSize()));
128
            
129 99
        }
130 100
        // Draw only the item labels
131 101
        else	{
......
137 107
        	colsColor = new Color(colsColor.getRed(), colsColor.getGreen(), colsColor.getBlue(), 235);
138 108
            renderer.setSeriesItemLabelPaint(0, rowsColor);
139 109
            renderer.setSeriesItemLabelPaint(1, colsColor);
140

  
141
            //renderer.setBaseItemLabelFont(renderer.getBaseItemLabelFont().deriveFont(Font.BOLD, renderer.getBaseItemLabelFont().getSize()));
142 110
            
143
            
144 111
        	// Labels position
145 112
        	ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0);
146 113
        	renderer.setBasePositiveItemLabelPosition(position);
147 114
        	renderer.setBaseNegativeItemLabelPosition(position);
148

  
149 115
            
150 116
            renderer.setItemLabelAnchorOffset(0);
151 117
        }
152
        
153
        
154 118

  
155 119
		super.updateChart(result);
156
		//this.getChartsEngine().getJFCTheme().apply(chart);
157 120
    	
158 121
    	// FIXME
159 122
    //	this.getChartsEngine().squareOffGraph((JFreeChart) chart, 200, 200d);
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1159)
673 673
			return;
674 674
		}
675 675
		if (lastValue == null || !lastValue.equals(newValue)) {
676
			Log.info("Setting dirty to true: last = "+ lastValue + " / new = " + newValue);
676
			Log.info("TXMResult.updateDirty(): " + this.getClass().getSimpleName() + ": setting dirty to true: last = "+ lastValue + " / new = " + newValue);
677 677
			this.setDirty();
678 678
		}
679 679
	}
......
728 728
			
729 729
			Object newValue = f.get(this);
730 730

  
731
			// FIXME: debug
732
			//System.err.println("TXMResult.isDirtyFromHistory(): checking parameter: " + name);
731
//			// FIXME: debug
732
//			Log.finest("TXMResult.isDirtyFromHistory(): checking parameter: " + name);
733 733

  
734 734
			this.updateDirty(previousValue, newValue);
735 735
			if (this.dirty) {
736
				// FIXME: debug
737
				Log.finest("TXMResult.isDirtyFromHistory(): parameter " + name + " has changed.");
736 738
				return this.dirty; // no need to go further
737 739
			}
738 740
		}
......
1807 1809
	protected boolean compute(IProgressMonitor monitor, boolean deepComputing) {
1808 1810

  
1809 1811
		try {
1812
			
1813
			
1814
			Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": starting computing process...");
1815
			
1810 1816
			// FIXME: see if this skipComputing tests is still useful? is it possible to directly return instead?
1811 1817
			// en fait voir ChartResult.compute() if(super.compute(monitor, true, false)), je pense que le prob vient du fait que si on retourne false dans TXMResult.compute() alors renderChart() ne sera pas appelé 
1812 1818
			boolean skipComputing = false;
......
1817 1823
			// TODO where do we put this parent compute ? :o
1818 1824
			//		if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time
1819 1825
			// SJ: other way, test the object itself
1826
			// FIXME: this code shoud be moved back in the !skipComputing section ?
1820 1827
			if (this.parent != null && !(this.parent instanceof Project)) {
1828
				
1829
				Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": starting parent (" + this.parent.getClass().getSimpleName() + ") computing process...");
1830
				
1821 1831
				if (!this.parent.compute(monitor, true)) {
1822 1832
					Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result.");
1823 1833

  
......
1825 1835
				}
1826 1836
			}
1827 1837
			
1828
			boolean d0 = this.isDirty();
1829
			boolean d1 = this.needsFullRecomputing;
1838
			//boolean d0 = this.isDirty();
1839
			boolean d1 = this.needsFullRecomputing; // FIXME: SJ: need to try again to stop to use this parameter
1830 1840
			boolean d2 = this.isDirtyFromHistory();
1831 1841
			boolean d3 = this.isDirty();
1832
			if (!d1 && 
1842
			if (
1843
					//!d1 && 
1833 1844
					!d2 && !d3) {
1834 1845
				// needsFullRecomputing == true && isDirtyFromHistory == true && isDirty == true
1835 1846
				Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
......
1841 1852
				// FIXME: Debug
1842 1853
				Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
1843 1854

  
1855
				// TODO THIS IS FUCKING LAZY LINE CODES OH YEAH YOU MAD BRO
1856
				// TODO where do we put this parent compute ? :o
1857
				//		if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time
1858
				// SJ: other way, test the object itself
1859
//				if (this.parent != null && !(this.parent instanceof Project)) {
1860
//					if (!this.parent.compute(monitor, true)) {
1861
//						Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result.");
1862
//
1863
//						//return false;
1864
//					}
1865
//				}
1844 1866

  
1867
				
1845 1868
				// Computing requirements test
1846 1869
				if (!this.canCompute()) {
1847
					Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": missing or wrong parameters, computing aborted.");
1870
					Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": can not compute, missing or wrong parameters or error with parent computing, computing aborted.");
1848 1871
					return false;
1849 1872
				}
1850 1873

  
......
1858 1881
			// clear the lazy name, no more needed since the object has been computed and getSimpleName() can now work
1859 1882
			this.lazyName = null;
1860 1883

  
1861
//		// store last used parameters
1862
//		if (updateLastParameters)	{
1863
//			this.updateLastParameters();
1864
//		}
1865
//
1866
//		if (!this.autoSaveParametersFromAnnotations()) {
1867
//			Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to save parameters from annotations for " + this.getName() + ".");
1868
//		}
1869
//		if (!this.saveParameters()) {
1870
//			Log.severe("TXMResult.compute():" + this.getClass().getSimpleName() + ": failed to save parameters for " + this.getName() + ".");
1871
//		}
1872
//
1873
//		// file persistence flush
1874
//		// FIXME: to do only if !skipComputing?
1875
//		if (this.mustBePersisted()) {
1876
//			TXMPreferences.flush(this);
1877
//		}
1878

  
1879 1884
			if(!skipComputing)	{
1880 1885
				
1881 1886
				// store last used parameters
......
1908 1913
				// Children cascade computing ; if parent == null this is the Workspace
1909 1914
				if (deepComputing && parent != null) {
1910 1915

  
1911
					Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " children.");
1916
					Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": cascade computing of " + this.children.size() + " child(ren).");
1912 1917

  
1913 1918
					
1914 1919
					for (int i = 0; i < this.children.size(); i++) {
1915 1920
						// FIXME: may be better to add a member needFullRecomputing in TXMResult?
1916 1921
//					this.getChild(i).setDirty(); // force recomputing even if some parameters of the result itself have not changed
1922
						
1923
						 // FIXME: SJ: need to try again to stop to use this parameter
1917 1924
						this.children.get(i).setNeedsFullRecomputing(true); // force recomputing even if some parameters of the result itself have not changed
1918 1925
						
1919 1926
						// recompute only children that has been opened once
......
1922 1929
						//}
1923 1930
					}
1924 1931
					
1925
					// FIXME: SJ: this code generates concurrent modification excpetions when deep computing
1932
					// FIXME: SJ: this code generates concurrent modification exceptions when deep computing
1926 1933
					// here for tests purpose
1927 1934
//				for (TXMResult child : this.getChildren()) {
1928 1935
//					child.setNeedsFullRecomputing(true); // force recomputing even if some parameters of the result itself have not changed
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 1159)
182 182
		}
183 183
	}
184 184
	
185
	
186
	@Override
187
	public boolean hasParameterChanged(String key) {
188
		if (key.isEmpty()) {
189
			return false;
190
		}
191
		if (this.isChartDirty()) {
192
			return true;
193
		}
194
		
195
		return super.hasParameterChanged(key);
196
	}
197
	
198 185
	/**
199 186
	 * Renders the chart using the right chart creator.
200 187
	 * The chart is created if needed then it is updated.
......
206 193

  
207 194
		this.subTask("Rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + ".");
208 195

  
209
		Log.finest("ChartResult.renderChart(): rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + "...");
196
		Log.finest("ChartResult.renderChart(): rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + "..."); //$NON-NLS-1$
210 197

  
211 198
		if (!this.chartDirty && !this.isChartDirtyFromHistory()) {
212
			Log.finest("ChartResult.renderChart(): chart rendering parameters have not changed since last rendering, rendering skipped.");
199
			Log.finest("ChartResult.renderChart(): chart rendering parameters have not changed since last rendering, rendering skipped."); //$NON-NLS-1$
213 200
			return true;
214 201
		}
215 202
		else if (!this.chartDirty) {
216
			Log.finest("ChartResult.renderChart(): chart is not dirty, rendering skipped.");
203
			Log.finest("ChartResult.renderChart(): chart is not dirty, rendering skipped."); //$NON-NLS-1$
217 204
			return true;
218 205
		}
219 206

  
......
228 215
				}
229 216
				chartCreator = ChartsEngine.getChartsEngines().get(i).getChartCreator(this);
230 217
				if(chartCreator != null)	{
231
					Log.finest("ChartResult.renderChart(): another suitable chart creator has been found in charts engine: " + ChartsEngine.getChartsEngines().get(i) + ".");
218
					Log.finest("ChartResult.renderChart(): another suitable chart creator has been found in charts engine: " + ChartsEngine.getChartsEngines().get(i) + "."); //$NON-NLS-1$
232 219
					this.chartsEngine = ChartsEngine.getChartsEngines().get(i);
233 220
					break;
234 221
				}
......
244 231
			// - the chart has never been created
245 232
			// - the chart type has been changed, e.g. to dynamically change the type of chart or the current charts engine
246 233
			if (this.chart == null || this.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE)) {
247
				Log.finest("ChartResult.renderChart(): creating chart.");
234
				Log.finest("ChartResult.renderChart(): creating chart."); //$NON-NLS-1$
248 235

  
249 236
				this.chart = chartCreator.createChart(this);
250 237
			}
......
264 251
			this.chartDirty = false;
265 252
			
266 253
			// Debug
267
			Log.finest("ChartResult.renderChart(): chart rendering done.");
254
			Log.finest("ChartResult.renderChart(): chart rendering done."); //$NON-NLS-1$
268 255

  
269 256
			return true;
270 257
			
271 258
		}
272 259
		else	{
273
			Log.severe("ChartResult.renderChart(): can not find any suitable chart creator for result: " + this.getClass() + ".");
260
			Log.severe("ChartResult.renderChart(): can not find any suitable chart creator for result: " + this.getClass() + "."); //$NON-NLS-1$
274 261
			return false;
275 262
		}
276 263
	}
277 264
	
278 265
	
279 266
	@Override
267
	public boolean hasParameterChanged(String key) {
268
		if (key.isEmpty()) {
269
			return false;
270
		}
271
//		if (this.isChartDirty()) {
272
//			return true;
273
//		}
274
		
275
		return super.hasParameterChanged(key);
276
	}
277
	
278

  
279
	
280
	@Override
280 281
	public String dumpParameters() {
281 282
		return super.dumpParameters() + "\n" + this.dumpParameters(Parameter.RENDERING); //$NON-NLS-1$
282 283
	}
......
334 335
			Object newValue = f.get(this);
335 336
			this.updateChartDirty(previousValue, newValue);
336 337
			if (this.chartDirty) {
338
				// FIXME: debug
339
				Log.finest("ChartResult.isChartDirtyFromHistory(): parameter " + name + " has changed.");
337 340
				return this.chartDirty; // no need to go further
338 341
			}
339 342
		}
......
352 355
			return;
353 356
		}
354 357
		if (lastValue == null || !lastValue.equals(newValue)) {
355
			Log.info("Setting chart dirty to true: old = "+ lastValue + " / new = " + newValue);
358
			Log.info("ChartResult.updateChartDirty(): " + this.getClass().getSimpleName() + ": setting chart dirty to true: last = "+ lastValue + " / new = " + newValue);
356 359
			this.chartDirty = true;
357 360
		}
358 361
	}

Also available in: Unified diff