Révision 1514

tmp/org.txm.properties.core/src/org/txm/properties/core/functions/Properties.java (revision 1514)
292 292
			if (this.corpus.getCreationDate() != null) {
293 293
				buff.append(NLS.bind("<p>Created the {0}</p>", TXMResult.PRETTY_TIME_FORMAT.format(this.corpus.getCreationDate())));
294 294
			}
295
			if (this.corpus.getComputeDate() != null) {
296
				buff.append(NLS.bind("<p>Imported the {0}</p>", TXMResult.PRETTY_TIME_FORMAT.format(this.corpus.getComputeDate())));
295
			if (this.corpus.getLastComputingDate() != null) {
296
				buff.append(NLS.bind("<p>Imported the {0}</p>", TXMResult.PRETTY_TIME_FORMAT.format(this.corpus.getLastComputingDate())));
297 297
			}
298 298
		}
299 299

  
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 1514)
90 90
import org.txm.rcp.preferences.RCPPreferences;
91 91
import org.txm.rcp.swt.widget.AssistedQueryWidget;
92 92
import org.txm.rcp.swt.widget.FloatSpinner;
93
import org.txm.rcp.swt.widget.LabeledSpinner;
93 94
import org.txm.rcp.swt.widget.PropertiesSelector;
94 95
import org.txm.rcp.views.QueriesView;
95 96
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
......
239 240
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
240 241

  
241 242

  
243
		
244
		// Main parameters area
242 245
		Composite queryArea = new Composite(paramArea, SWT.NONE);
243 246

  
244 247
		FormData queryLayoutData = new FormData();
......
263 266
		layoutData.grabExcessHorizontalSpace = true;
264 267
		queryWidget.setLayoutData(layoutData);
265 268
		queryWidget.addKeyListener(computeKeyListener);
269
		queryWidget.getQueryWidget().addModifyListener(computeKeyListener);
266 270

  
271

  
267 272
//TODO add new parameter to select the cooccurrents with a CQL
268 273
//		queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
269 274
//		queryLabel.setText("Cooc");
......
305 310
		//			}
306 311
		//		});
307 312

  
313
		
314
		
315
		
316
		// Extended parameters
317
		
308 318
		// Filters
309 319
		Composite filtercontrols = new Composite(paramArea, SWT.NONE);
310 320
		FormData filtersLayoutData = new FormData();
......
325 335
		propertiesSelector.setTitle(CooccurrenceUIMessages.cooccurrentsPropertiesColon);
326 336
		propertiesSelector.addSelectionListener(computeSelectionListener);
327 337

  
328
		// FIXME: became useless?
329
		/*
330
		 * FormData propsLayoutData = new FormData(); propsLayoutData.top = new
331
		 * FormAttachment (queryArea, 0); propsLayoutData.left = new
332
		 * FormAttachment (0); propsLayoutData.right = new FormAttachment (100);
333
		 * propsArea.setLayoutData(propsLayoutData);
334
		 */
338
		// Thresholds
339
		// Fmin
340
		LabeledSpinner fMin = new LabeledSpinner(filtercontrols, this, CooccurrenceUIMessages.thresholdsColonFmin);
341
		this.fMin = fMin.getSpinner();
335 342

  
336
		/*
337
		 * GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 9;
338
		 * gridLayout.makeColumnsEqualWidth = false;
339
		 * filtercontrols.setLayout(gridLayout);
340
		 */
343
		// Cmin
344
		LabeledSpinner cMin = new LabeledSpinner(filtercontrols, this, CooccurrenceUIMessages.cmin);
345
		this.cMin = cMin.getSpinner();
341 346

  
342
		Label label = new Label(filtercontrols, SWT.NONE);
343
		label.setText(CooccurrenceUIMessages.thresholdsColonFmin);
347
		// Minimum score
348
		LabeledSpinner minimumScore = new LabeledSpinner(filtercontrols, this, new Label(filtercontrols, SWT.NONE), new FloatSpinner(filtercontrols, SWT.BORDER), CooccurrenceUIMessages.score_2);
349
		this.minScore = (FloatSpinner) minimumScore.getSpinner();
344 350

  
345
		fMin = new Spinner(filtercontrols, SWT.BORDER);
346
		fMin.setMinimum(1);
347
		fMin.setMaximum(99999);
348
		fMin.setIncrement(1);
349
		fMin.setPageIncrement(100);
350
		fMin.addSelectionListener(computeSelectionListener);
351
		fMin.addKeyListener(computeKeyListener);
352

  
353
		label = new Label(filtercontrols, SWT.NONE);
354
		label.setText(CooccurrenceUIMessages.cmin);
355
		cMin = new Spinner(filtercontrols, SWT.BORDER);
356
		cMin.setMinimum(1);
357
		cMin.setMaximum(99999);
358
		cMin.setIncrement(1);
359
		cMin.setPageIncrement(100);
360
		cMin.addSelectionListener(computeSelectionListener);
361
		cMin.addKeyListener(computeKeyListener);
362

  
363
		label = new Label(filtercontrols, SWT.NONE);
364
		label.setText(CooccurrenceUIMessages.score_2);
365
		minScore = new FloatSpinner(filtercontrols, SWT.BORDER);
366
		minScore.addSelectionListener(computeSelectionListener);
367
		minScore.addKeyListener(computeKeyListener);
368

  
369 351
		// empant
370 352
		empantPanel = new EmpantWidget(paramArea, SWT.NONE, this.getCorpus());
371 353

  
......
380 362
		
381 363
		infoLine = new Label(this.getBottomToolBarContainer(), SWT.NONE);
382 364
		infoLine.setLayoutData(new RowData(600, SWT.DEFAULT));
365
		
366
		
367
		
383 368
		// result area
384 369
		Composite resultArea = this.getResultArea();
385
		// FIXME: became useless?
386
		// FormData resultLayoutData = new FormData();
387
		// resultLayoutData.top = new FormAttachment(scrollComposite, 0);
388
		// resultLayoutData.left = new FormAttachment(0);
389
		// resultLayoutData.right = new FormAttachment(100);
390
		// resultLayoutData.bottom = new FormAttachment(100);
391
		// resultArea.setLayoutData(resultLayoutData);
392 370

  
393 371
		viewer = new TableViewer(resultArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
394 372
		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1514)
3 3
import java.io.ByteArrayInputStream;
4 4
import java.io.ByteArrayOutputStream;
5 5
import java.io.File;
6
import java.io.FileOutputStream;
6 7
import java.io.IOException;
7 8
import java.io.ObjectInputStream;
8 9
import java.io.ObjectOutputStream;
......
15 16
import java.util.HashMap;
16 17
import java.util.Map;
17 18

  
18
import org.eclipse.core.resources.IFile;
19 19
import org.eclipse.core.runtime.Platform;
20 20
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
21 21
import org.eclipse.core.runtime.preferences.DefaultScope;
22 22
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
23
import org.eclipse.core.runtime.preferences.IPreferencesService;
23 24
import org.eclipse.core.runtime.preferences.IScopeContext;
24 25
import org.eclipse.core.runtime.preferences.InstanceScope;
25 26
import org.eclipse.osgi.util.NLS;
26 27
import org.osgi.framework.FrameworkUtil;
27 28
import org.osgi.service.prefs.BackingStoreException;
28 29
import org.osgi.service.prefs.Preferences;
29
import org.txm.Toolbox;
30 30
import org.txm.core.results.TXMParameters;
31 31
import org.txm.core.results.TXMResult;
32 32
import org.txm.objects.Project;
......
51 51
 * (We can also define a custom Scope to do that, for example to change the saved object location or the filename)
52 52
 *
53 53
 *
54
 * @author mdecorde
54 55
 * @author sjacquot
55 56
 *
56 57
 */
......
76 77

  
77 78
	// TXMResult internal parameters, essentially for Links and Persistence
78 79
	public final static String RESULT_PARAMETERS_NODE_PATH = "result_parameters_node_path"; //$NON-NLS-1$
79
	//public final static String RESULT_UUID = "result_uuid"; //$NON-NLS-1$
80 80
	public final static String PARENT_PARAMETERS_NODE_PATH = "parent_parameters_node_path"; //$NON-NLS-1$
81 81
	public final static String BUNDLE_ID = "bundle_id"; //$NON-NLS-1$
82 82
	public final static String USER_NAME = "user_name"; //$NON-NLS-1$
83 83
	public final static String LAZY_NAME = "lazy_name"; //$NON-NLS-1$
84 84
	public final static String VISIBLE = "visible"; //$NON-NLS-1$
85 85
	public static final String LOCK = "locked_result"; //$NON-NLS-1$
86
	
86 87
	/**
87 88
	 * Result creation date.
88 89
	 */
......
1723 1724
	 * @throws IOException 
1724 1725
	 */
1725 1726
	public static boolean flush(TXMResult result, File parametersFile) throws IOException	{
1727
		
1728
		// FIXME: less wtf version...
1729
		IPreferencesService service = org.eclipse.core.runtime.Platform.getPreferencesService();
1726 1730
		try {
1731
			service.exportPreferences((IEclipsePreferences) preferencesRootNode.node(result.getParametersNodePath()), new FileOutputStream(parametersFile), null);
1732
		}
1733
		catch (Exception e1) {
1734
			// TODO Auto-generated catch block
1735
			e1.printStackTrace();
1736
		}
1737
		
1738
		
1739
		// FIXME: wtf version...
1740
		try {
1727 1741
			preferencesRootNode.node(result.getParametersNodePath()).flush();
1728 1742
			
1729 1743
			Project p = result.getProject();
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1514)
77 77
	public static final Pattern FILE_NAME_PATTERN = Pattern.compile("[^a-zA-Z0-9\\.-]+"); //$NON-NLS-1$
78 78
	public static final String UNDERSCORE = "_";
79 79

  
80
	/**
81
	 * Results counter to create unique ids.
82
	 */
80 83
	private static int next = 0;
81 84
	
82

  
83
	
84
//	/**
85
//	 * Unique ID of the result.
86
//	 */
87
//	protected String uniqueID;
88

  
89 85
	/**
90 86
	 * Editor can use this to test if the result has been computed once.
91 87
	 */
......
103 99
	protected boolean dirty = true;
104 100
	
105 101
	/**
106
	 * If locked, the result is not updated when computed.
107
	 */
108
	@Parameter(key=TXMPreferences.LOCK, type=Parameter.INTERNAL)
109
	protected boolean locked = false;
110
	
111
	/**
112 102
	 * if a method changed the internal data without **recomputing** the result, the result must be marked "altered"
113 103
	 */
114 104
	protected boolean altered = false;
115 105

  
116 106
	/**
117
	 * The result parent. Should not be null except for roots TXMResult
107
	 * The result parent. Should not be null except for roots TXMResult.
118 108
	 */
119 109
	protected TXMResult parent;
120 110

  
......
176 166
	protected String userName;
177 167

  
178 168
	/**
179
	 *  To store the simple name for unserialization and lazy loading.
180
	 *  This string can be used, for example, to display some infos in UI even if the result has not yet been recomputed.
169
	 * To store the simple name for unserialization and lazy loading.
170
	 * This string can be used, for example, to display some information in UI even if the result has not yet been recomputed.
181 171
	 */
182 172
	@Parameter(key=TXMPreferences.LAZY_NAME, type=Parameter.INTERNAL)
183 173
	private String lazyName;
184 174

  
185 175
	/**
186
	 * Last compute date.
176
	 * Last computing date.
187 177
	 */
188 178
	@Parameter(key=TBXPreferences.LAST_COMPUTING_DATE, type=Parameter.INTERNAL)
189 179
	private Date lastComputingDate;
......
194 184
	@Parameter(key=TBXPreferences.CREATION_DATE, type=Parameter.INTERNAL)
195 185
	private Date creationDate;
196 186
	
197
	// true if the result is computing = in compute(,) method
187
	/**
188
	 * If locked, the result is not updated when computed.
189
	 */
190
	@Parameter(key=TXMPreferences.LOCK, type=Parameter.INTERNAL)
191
	protected boolean locked = false;
192
	
193

  
194
	/**
195
	 * Current computing state.
196
	 * true if the result is computing = in compute(,) method
197
	 * 
198
	 */
198 199
	protected boolean computing = false;
199 200

  
200 201

  
......
312 313
		}
313 314
	}
314 315

  
315
	public Date getComputeDate() {
316
		return this.lastComputingDate;
317
	}
318

  
319
	public Date getCreationDate() {
320
		return this.creationDate;
321
	}
322
	
323
	
324 316
	/**
325 317
	 * Sets the user name.
326 318
	 * @param name
......
2579 2571
	public ArrayList<HashMap<String, Object>> getParametersHistory() {
2580 2572
		return parametersHistory;
2581 2573
	}
2574
	
2575
	/**
2576
	 * Gets the last computing date.
2577
	 * @return the last computing date
2578
	 */
2579
	public Date getLastComputingDate() {
2580
		return this.lastComputingDate;
2581
	}
2582 2582

  
2583
	/**
2584
	 * Gets the creation date.
2585
	 * @return the creation date
2586
	 */
2587
	public Date getCreationDate() {
2588
		return this.creationDate;
2589
	}
2590
	
2591

  
2583 2592
	public boolean toParametersFile(File outfile) throws IOException {
2584 2593
		return TXMPreferences.flush(this, outfile);
2585 2594
	}
2595

  
2596
	
2586 2597
}
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 1514)
670 670
		//			return false;
671 671
		//		}
672 672

  
673
		return true;
673
		return this.lexicalTable.getProperty() != null;
674 674
	}
675 675

  
676 676

  
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 1514)
235 235
			this.vMaxSpinner.setMinimum(1);
236 236
			thresholdsGroup.getVMaxLabel().setText(TXMCoreMessages.common_numberOfLines);
237 237
			
238
//			// Number of lines
239
//			Label nLines = new Label(extendedParametersArea, SWT.NONE);
240
//			nLines.setText(TXMCoreMessages.common_numberOfLines);
241
//			vMaxSpinner = new Spinner(extendedParametersArea, SWT.BORDER);
242
//			vMaxSpinner.setMinimum(1);
243
//			vMaxSpinner.setMaximum(9999999);
244
//			
245
//			// Fmin
246
//			Label fmin = new Label(extendedParametersArea, SWT.NONE);
247
//			fmin.setText(TXMCoreMessages.common_fMin);
248
//			fMinSpinner = new Spinner(extendedParametersArea, SWT.BORDER);
249
//			fMinSpinner.setMinimum(1);
250
//			fMinSpinner.setMaximum(9999999);
251
			
252
			
253 238
			// Merge or delete columns button
254 239
			mergeDeleteColumnsButton = new Button(extendedParametersArea, SWT.PUSH);
255 240
			mergeDeleteColumnsButton.setText(LexicalTableUIMessages.mergeOrDeleteColumns);
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1514)
848 848
	 * @param controlArea the control area
849 849
	 */
850 850
	private void composeControlArea(final Composite controlArea) {
851
		
852
		
853
		// Computing listeners
854
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
855

  
856
		
851 857
		GridLayout controlLayout = new GridLayout(1, false);
852 858
		controlLayout.verticalSpacing = 0;
853 859
		controlLayout.marginWidth = 0;
......
883 889
		queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
884 890

  
885 891
		// [ (v)]
886
		// queryWidget = new QueryWidget(queryArea, SWT.DROP_DOWN);
887
		queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN, concordance.getCorpus());
892
		queryWidget = new AssistedQueryWidget(this.getMainParametersComposite(), SWT.DROP_DOWN, concordance.getCorpus());
888 893
		queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
889
		queryWidget.addKeyListener(new ComputeKeyListener(this));
890
		// FIXME: to compute when changing the query from history combo box
891
		// FIXME: commented because it doesn't work, the computing is launched as soon as we clic on the arrow of the combo box
894
		queryWidget.addKeyListener(computeKeyListener);
895
		queryWidget.getQueryWidget().addModifyListener(computeKeyListener);
896
		
897
		// FIXME: SJ: for computing when changing the query from history combo box
898
		// FIXME: SJ: commented because it doesn't work, the computing is launched as soon as we clic on the arrow of the combo box
892 899
		//queryWidget.getQueryWidget().addSelectionListener(new ComputeSelectionListener(this));
893 900

  
894 901
		// hide the parameters panel
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 1514)
49 49
import org.txm.rcp.editors.listeners.ComputeKeyListener;
50 50
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
51 51
import org.txm.rcp.swt.GLComposite;
52
import org.txm.rcp.swt.widget.LabeledSpinner;
52 53
import org.txm.rcp.swt.widget.ThresholdsGroup;
53 54
import org.txm.rcp.swt.widget.structures.PropertiesComboViewer;
54 55
import org.txm.searchengine.cqp.corpus.CQPCorpus;
......
129 130

  
130 131
			// Extended parameters
131 132
			Composite extendedParametersArea = this.getExtendedParametersGroup();
132
			//((GridLayout)extendedParametersArea.getLayout()).numColumns = 3;
133 133
			
134
//			GridLayout gridLayout = new GridLayout();
135
//			gridLayout.numColumns = 3;
136
//			extendedParametersArea.setLayout(gridLayout);
137
			
138
			// Computing listeners
139
			ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this);
140
			ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
141
			
142 134
			// max score
143
			Label maxScoreLabel = new Label(extendedParametersArea, SWT.NONE);
144
			maxScoreLabel.setText("Maximum score");
145
			
146
			this.maxScoreFilter = new Spinner(extendedParametersArea, SWT.BORDER);
147
			this.maxScoreFilter.setToolTipText("The maximum score to display");
135
			LabeledSpinner maxScore = new LabeledSpinner(extendedParametersArea, this, "Maximum score", "The maximum score to display");
136
			this.maxScoreFilter = maxScore.getSpinner();
148 137
			this.maxScoreFilter.setMinimum(0);
149 138
			this.maxScoreFilter.setMaximum(100000);
150
			
151
			this.maxScoreFilter.addKeyListener(computeKeyListener);
152
			this.maxScoreFilter.addSelectionListener(computeSelectionListener);
153 139

  
154
			
155
			
156 140
			// Result area
157 141
			GLComposite resultArea = this.getResultArea();
158 142

  
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 1514)
1 1
package org.txm.specificities.rcp.editors;
2 2

  
3 3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.layout.GridLayout;
5 4
import org.eclipse.swt.widgets.Composite;
6 5
import org.eclipse.swt.widgets.Label;
7 6
import org.eclipse.swt.widgets.ToolItem;
8 7
import org.txm.chartsengine.rcp.editors.ChartEditor;
9 8
import org.txm.core.results.Parameter;
10 9
import org.txm.rcp.IImageKeys;
11
import org.txm.rcp.editors.listeners.ComputeKeyListener;
12 10
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
13 11
import org.txm.rcp.swt.widget.FloatSpinner;
12
import org.txm.rcp.swt.widget.LabeledSpinner;
14 13
import org.txm.specificities.core.functions.SpecificitiesSelection;
15 14
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
16 15
import org.txm.specificities.rcp.handlers.ComputeSpecifities;
......
35 34
	 * Banality threshold.
36 35
	 */
37 36
	@Parameter(key=SpecificitiesPreferences.CHART_BANALITY, type=Parameter.RENDERING)
38
	protected FloatSpinner banality;
37
	protected FloatSpinner banalitySpinner;
39 38

  
40 39
	
41 40
	@Override
42 41
	public void __createPartControl() {
43 42
		
44
		
45 43
		// Computing listeners
46 44
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(this, true);
47
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(this);
48

  
49 45
		
50 46
		// Group bars by lines
51
		groupBarsByLines = new ToolItem(this.getToolBar(), SWT.CHECK);
52
		groupBarsByLines.setToolTipText(SpecificitiesUIMessages.groupBarsByLines);
53
		groupBarsByLines.setImage(IImageKeys.getImage(ComputeSpecifities.class, "icons/silk_group_bars_by_lines.png"));
54
		groupBarsByLines.addSelectionListener(computeSelectionListener);
47
		this.groupBarsByLines = new ToolItem(this.getToolBar(), SWT.CHECK);
48
		this.groupBarsByLines.setToolTipText(SpecificitiesUIMessages.groupBarsByLines);
49
		this.groupBarsByLines.setImage(IImageKeys.getImage(ComputeSpecifities.class, "icons/silk_group_bars_by_lines.png"));
50
		this.groupBarsByLines.addSelectionListener(computeSelectionListener);
55 51
		
56
		
57 52
		// Banality
58 53
		Composite extendedParametersArea = this.getExtendedParametersGroup();
59
		GridLayout gridLayout = new GridLayout();
60
		gridLayout.numColumns = 2;
61
		extendedParametersArea.setLayout(gridLayout);
62
		
63
		
64
        Label label = new Label(extendedParametersArea, SWT.NONE);
65
        label.setText("Banality");
66
		
67
		banality = new FloatSpinner(extendedParametersArea, SWT.BORDER);
68
		banality.setToolTipText("Banality threshold");
69
		banality.setMaximumAsFloat(200);
70
		banality.addSelectionListener(computeSelectionListener);
71
		banality.addKeyListener(computeKeyListener);
72
		
54

  
55
		LabeledSpinner banality = new LabeledSpinner(extendedParametersArea, this, new Label(extendedParametersArea, SWT.NONE), new FloatSpinner(extendedParametersArea, SWT.BORDER), "Banality", "Banality threshold", true);
56
		this.banalitySpinner = (FloatSpinner) banality.getSpinner();
57
		this.banalitySpinner.setMaximumAsFloat(200);
58
		this.banalitySpinner.addSelectionListener(computeSelectionListener);
73 59
	}
74 60

  
75 61

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/corpuswizard/ImportWizard.java (revision 1514)
47 47
					}
48 48
					
49 49
					// get the more recent one
50
					if (project != null && p.getComputeDate().compareTo(project.getComputeDate()) > 0) {
50
					if (project != null && p.getLastComputingDate().compareTo(project.getLastComputingDate()) > 0) {
51 51
						project = p;
52 52
					} else {
53 53
						project = p;
......
64 64
					project.setLang(Locale.getDefault().getCountry());
65 65
					System.out.println(NLS.bind("The {0} corpus will be created.", project));
66 66
				} else {
67
					System.out.println(NLS.bind("The {0} ({1}) corpus will be replaced.", project, project.getComputeDate()));
67
					System.out.println(NLS.bind("The {0} ({1}) corpus will be replaced.", project, project.getLastComputingDate()));
68 68
				}
69 69
				
70 70
				//project.compute(); // create/update files
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/debug/TXMResultDebugView.java (revision 1514)
97 97
	public void refresh()	{
98 98
		
99 99
		if(this.currentResult == null)	{
100
			this.displayArea.setText("");
100
			this.displayArea.setText(""); //$NON-NLS-1$
101 101
			return;
102 102
		}
103 103
		
104 104
		StringBuffer buffer = new StringBuffer();
105 105
		buffer.append("Class: " + this.currentResult.getClass() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
106
		//buffer.append("UUID: " + this.currentResult.getUUID() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
107 106
		buffer.append("Node path: " + this.currentResult.getParametersNodePath() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
108 107
		buffer.append("Simple name: " + this.currentResult.getSimpleName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
109 108
		buffer.append("User name: " + this.currentResult.getUserName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
110 109
		buffer.append("Lazy name: " + this.currentResult.getLazyName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
111 110
		buffer.append("Name: " + this.currentResult.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
112 111
		buffer.append("Creation date: " + this.currentResult.getCreationDate() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
113
		buffer.append("Compute date: " + this.currentResult.getComputeDate() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
112
		buffer.append("Last computing date: " + this.currentResult.getLastComputingDate() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
114 113
		buffer.append("Valid filename: " + this.currentResult.getValidFileName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
115 114
		buffer.append("Empty name: " + this.currentResult.getEmptyName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
116 115
		buffer.append("toString(): " + this.currentResult.toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1514)
67 67
import org.txm.rcp.JobsTimer;
68 68
import org.txm.rcp.StatusLine;
69 69
import org.txm.rcp.TXMWindows;
70
import org.txm.rcp.editors.listeners.BaseAbstractComputeListener;
70 71
import org.txm.rcp.handlers.BaseAbstractHandler;
71 72
import org.txm.rcp.messages.TXMUIMessages;
72 73
import org.txm.rcp.swt.GLComposite;
......
440 441
			}
441 442

  
442 443
			if (this.getResult().isLocked()) {
443
				setLocked(true);
444
				this.setLocked(true);
444 445
			}
445 446

  
446 447
			// disable the compute button, it will be re-enable or not later when the UI will check if the editor is dirty or not
447
			ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
448
			if (computeButton != null) {
449
				computeButton.setEnabled(false);
450
			}
448
//			ToolItem computeButton = this.topToolBar.getItemByContributionId(TOP_TOOLBAR_COMPUTE_BUTTON_ID);
449
//			if (computeButton != null) {
450
//				computeButton.setEnabled(false);
451
//			}
451 452
			
452 453
		} catch(Throwable e) {
453 454
			Log.severe(TXMCoreMessages.bind("TXMEditor.createPartControl(): can not create the editor for result {0}.", this.getResult())); //$NON-NLS-1$
454 455
			e.printStackTrace();
455 456
			createPartControlDoneSucessfully = false;
456 457
		}
458
		
459
		this.setDirty(false);
457 460
	}
458 461

  
459 462
	public void setLocked(boolean b) {
......
630 633
	public void setDirty(boolean dirty) {
631 634
		this.dirty = dirty;
632 635

  
636
		// FIXME: SJ: future version that enable the button ONLY if the result can compute
637
		// need to check all canCompute() result method before enabling it
638
//		try {
639
//			// enable/disable the compute button according to dirty state of the editor
640
//			if (this.computeButton != null && !this.computeButton.isDisposed()) {
641
//				this.computeButton.setEnabled(this.getResult().canCompute() && dirty && !this.getResult().isLocked());
642
//			}
643
//		}
644
//		catch (Exception e) {
645
//			// TODO Auto-generated catch block
646
//			e.printStackTrace();
647
//		}
648

  
649
		// FIXME: old version
633 650
		// enable/disable the compute button according to dirty state of the editor
634 651
		if (this.computeButton != null && !this.computeButton.isDisposed()) {
635
			this.computeButton.setEnabled(dirty && !getResult().isLocked());
652
			this.computeButton.setEnabled(this.dirty && !this.getResult().isLocked());
636 653
		}
637 654

  
638 655
		firePropertyChange(IEditorPart.PROP_DIRTY);
......
1101 1118
					((ToolItem)object).setSelection((Boolean) value); 
1102 1119
				}
1103 1120
				else if(object instanceof FloatSpinner)	{
1121
					
1122
					((FloatSpinner)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, true);
1123
					
1104 1124
					if(value instanceof Double) {
1105 1125
						((FloatSpinner)object).setSelection((Double) value);	
1106 1126
					}
1107 1127
					else {
1108 1128
						((FloatSpinner)object).setSelection((Float) value);
1109 1129
					}
1130
					
1131
					((FloatSpinner)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, false);
1110 1132
				}
1111 1133
				else if(object instanceof Spinner)	{
1134
					((Spinner)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, true);
1112 1135
					((Spinner)object).setSelection((Integer) value); 
1136
					((Spinner)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, false);
1113 1137
				}
1114 1138
				else if(object instanceof Text)	{
1115 1139
					((Text)object).setText(String.valueOf(value)); 
......
1121 1145
					if(value != null)	{
1122 1146
						// FIXME: fire a new selection changed event leading to a cyclic recursion...
1123 1147
						// FIXME: became useless? since there is now a test above on  !this.getResult().hasParameterChanged(parameter.key(), this.lastComputingParameters) 
1124
						((Viewer)object).setData("ignore", true); //$NON-NLS-1$
1148
						((Viewer)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, true);
1125 1149
						if (value instanceof StructuredSelection) { // no need to create a new StructuredSelection
1126 1150
							((Viewer)object).setSelection((StructuredSelection)value, true);
1127 1151
						}
1128 1152
						else {
1129 1153
							((Viewer)object).setSelection(new StructuredSelection(value), true);
1130 1154
						}
1131
						((Viewer)object).setData("ignore", false); //$NON-NLS-1$
1155
						((Viewer)object).setData(BaseAbstractComputeListener.IGNORE_EVENT, false);
1132 1156
					}
1133 1157
				}
1134 1158
				else if(object instanceof PropertiesSelector)	{
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeListener.java (revision 1514)
12 12
 *
13 13
 */
14 14
// FIXME: became useless?
15
// actually this could be useful to pass it all events
15 16
@Deprecated
16 17
public class ComputeListener extends BaseAbstractComputeListener implements Listener {
17 18

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeSelectionListener.java (revision 1514)
44 44
		if((this.autoCompute
45 45
				|| RCPPreferences.getInstance().getBoolean(RCPPreferences.AUTO_UPDATE_EDITOR))
46 46
				
47
				&& (!(e.getSource() instanceof Spinner))
47
				//&& (!(e.getSource() instanceof Spinner))
48 48
				
49
				//&& (!(e.getSource() instanceof Spinner) || (e.stateMask & SWT.BUTTON_MASK) != 0)
49
				&& (!(e.getSource() instanceof Spinner) || (e.stateMask & SWT.BUTTON_MASK) != 0)
50 50
				)	{
51 51
			this.editor.compute(true);
52 52
		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/ComputeKeyListener.java (revision 1514)
6 6
import org.eclipse.swt.SWT;
7 7
import org.eclipse.swt.events.KeyEvent;
8 8
import org.eclipse.swt.events.KeyListener;
9
import org.eclipse.swt.events.ModifyEvent;
10
import org.eclipse.swt.events.ModifyListener;
9 11
import org.txm.core.results.TXMResult;
10 12
import org.txm.rcp.editors.TXMEditor;
11 13

  
12 14
/**
13
 * Key listener that calls TXMEditor.compute() when the Enter key is pressed.
15
 * Key and text Modify listener that calls TXMEditor.compute() when the Enter key is pressed.
16
 * Also manage the dirty editor state when the text of the widget has changed. 
14 17
 * 
15 18
 * @author mdecorde
16 19
 * @author sjacquot
17 20
 *
18 21
 */
19
public class ComputeKeyListener extends BaseAbstractComputeListener implements KeyListener {
22
public class ComputeKeyListener extends BaseAbstractComputeListener implements KeyListener, ModifyListener {
20 23

  
21 24

  
22 25
	/**
23 26
	 * @param editor
24 27
	 */
25 28
	public ComputeKeyListener(TXMEditor<? extends TXMResult> editor) {
26
		super(editor);
29
		this(editor, false);
27 30
	}
28 31

  
32
	/**
33
	 * 
34
	 * @param editor
35
	 * @param autoCompute
36
	 */
37
	public ComputeKeyListener(TXMEditor<? extends TXMResult> editor, boolean autoCompute) {
38
		super(editor, autoCompute);
39
	}
40

  
41
	
29 42
	@Override
30 43
	public void keyPressed(KeyEvent e) {
31 44
		if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
32 45
			this.editor.compute(true);
33 46
		}
34 47
		// if other key than Return is pressed then makes the editor dirty
35
		else	{
36
			this.editor.setDirty(true);
37
		}
48
//		else	{
49
//			this.editor.setDirty(true);
50
//		}
38 51
		// FIXME: update the result from the widget
39 52
		// purpose here is, for example, to enable the compute command button when a query is typed
40 53
		// the code below doesn't work as expected
......
50 63
		
51 64
	}
52 65

  
66
	@Override
67
	public void modifyText(ModifyEvent e) {
68
		if(!mustIgnoreEvent(e) && !this.autoCompute) {
69
			this.editor.setDirty(true);
70
		}
71
	}
72

  
53 73
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/listeners/BaseAbstractComputeListener.java (revision 1514)
6 6
import java.util.EventObject;
7 7

  
8 8
import org.eclipse.jface.viewers.Viewer;
9
import org.eclipse.swt.widgets.Widget;
9 10
import org.txm.core.results.TXMResult;
10 11
import org.txm.rcp.editors.TXMEditor;
11 12

  
......
18 19
 */
19 20
public abstract class BaseAbstractComputeListener {
20 21

  
22
	
23
	public final static String IGNORE_EVENT = "ignoreEvent";
24
	
25
	
21 26
	/**
22 27
	 * Linked editor.
23 28
	 */
......
56 61
	public static boolean mustIgnoreEvent(EventObject event)	{
57 62
		// to skip programmatically setSelection() call, especially for the auto-updating editor Widgets from result methods
58 63
		if(event.getSource() instanceof Viewer)	{
59
			if(((Viewer)event.getSource()).getData("ignore") != null && (Boolean)((Viewer)event.getSource()).getData("ignore") == true)	{
64
			if(((Viewer)event.getSource()).getData(IGNORE_EVENT) != null && (Boolean)((Viewer)event.getSource()).getData(IGNORE_EVENT) == true)	{
60 65
				return true;
61 66
			}
62 67
		}
68
		else if(event.getSource() instanceof Widget)	{
69
			if(((Widget)event.getSource()).getData(IGNORE_EVENT) != null && (Boolean)((Widget)event.getSource()).getData(IGNORE_EVENT) == true)	{
70
				return true;
71
			}
72
		}
73

  
63 74
		return false;
64 75
	}
65 76

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/LabeledSpinner.java (revision 1514)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.swt.widget;
5

  
6
import org.eclipse.swt.SWT;
7
import org.eclipse.swt.widgets.Composite;
8
import org.eclipse.swt.widgets.Label;
9
import org.eclipse.swt.widgets.Spinner;
10
import org.txm.rcp.editors.TXMEditor;
11
import org.txm.rcp.editors.listeners.ComputeKeyListener;
12

  
13
/**
14
 * Convenience class to create a labeled Spinner dedicated to editor parameters areas.
15
 * This class also adds all the needed computing listeners.  
16
 * 
17
 * @author sjacquot
18
 *
19
 */
20
public class LabeledSpinner {
21
	
22
	/**
23
	 * The label.
24
	 */
25
	protected Label label;
26
	
27

  
28
	/**
29
	 * The spinner
30
	 */
31
	protected Spinner spinner;
32
	
33
	
34
	
35
	/**
36
	 * 
37
	 */
38
	public LabeledSpinner(Composite parent, TXMEditor editor, Label label, Spinner spinner, String labelText, String spinnerTooltip, boolean autoCompute) {
39
		this.label = label;
40
		this.spinner = spinner;
41
		
42
		
43
		if(this.label == null)	{
44
			this.label = new Label(parent, SWT.NONE);
45
		}
46
		
47
		if(this.spinner == null)	{
48
			this.spinner = new Spinner(parent, SWT.BORDER);
49
		}
50

  
51
		this.label.setText(labelText);
52
		
53
		if(spinnerTooltip != null)	{
54
			this.spinner.setToolTipText(spinnerTooltip);
55
		}
56
		
57
		// default parameters and range
58
		this.spinner.setMinimum(0);
59
		this.spinner.setMaximum(9999999);
60
		this.spinner.setIncrement(1);
61
		this.spinner.setPageIncrement(100);
62
		
63
		// add computing listeners
64
		ComputeKeyListener listener = new ComputeKeyListener(editor, autoCompute);
65
		this.spinner.addKeyListener(listener);
66
		this.spinner.addModifyListener(listener);
67
	}
68
	
69
	public LabeledSpinner(Composite parent, TXMEditor editor, Label label, Spinner spinner, String labelText) {
70
		this(parent, editor, label, spinner, labelText, null, false);
71
	}
72
	
73
	
74
	public LabeledSpinner(Composite parent, TXMEditor editor, String labelText, String spinnerTooltip) {
75
		this(parent, editor, null, null, labelText, spinnerTooltip, false);
76
	}
77

  
78

  
79
	public LabeledSpinner(Composite parent, TXMEditor editor, String labelText) {
80
		this(parent, editor, labelText, null);
81
	}
82
	
83
	/**
84
	 * @return the label
85
	 */
86
	public Label getLabel() {
87
		return label;
88
	}
89

  
90

  
91
	/**
92
	 * @return the spinner
93
	 */
94
	public Spinner getSpinner() {
95
		return spinner;
96
	}
97

  
98
}
0 99

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/ThresholdsGroup.java (revision 1514)
42 42
	protected Spinner fMaxSpinner;
43 43

  
44 44
	/**
45
	 * Maximum number of lines filtering.
45
	 * Maximum number of lines filtering spinner.
46 46
	 */
47 47
	protected Spinner vMaxSpinner;
48 48

  
......
99 99
		
100 100
		this.setText(TXMCoreMessages.common_thresholds);
101 101
		
102
		// Computing listeners
103
		ComputeSelectionListener computeSelectionListener = new ComputeSelectionListener(editor, autoCompute);
104
		ComputeKeyListener computeKeyListener = new ComputeKeyListener(editor);
105

  
106 102
		GridLayout gridLayout = new GridLayout();
107 103
		
108 104
		if(displayFMax)	{
......
120 116
		fieldsGridData.minimumWidth = 100;
121 117
		
122 118
		// Fmin
123
		this.fMinLabel = new Label(this, SWT.NONE);
124
		this.fMinLabel.setText(TXMCoreMessages.common_fMin);
125
		this.fMinLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
126

  
127
		fMinSpinner = new Spinner(this, SWT.BORDER);
128
		fMinSpinner.setMinimum(0);
129
		fMinSpinner.setMaximum(9999999);
130
		fMinSpinner.setIncrement(1);
131
		fMinSpinner.setPageIncrement(100);
132
		fMinSpinner.setLayoutData(fieldsGridData);
133

  
119
		LabeledSpinner fMin = new LabeledSpinner(this, editor, TXMCoreMessages.common_fMin);
120
		this.fMinLabel = fMin.getLabel();
121
		this.fMinSpinner = fMin.getSpinner();
122
		
134 123
		// Fmax
135 124
		if(displayFMax)	{
136
			this.fMaxLabel = new Label(this, SWT.NONE);
137
			this.fMaxLabel.setText(TXMCoreMessages.common_fMax);
138
			this.fMaxLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
139
	
140
			fMaxSpinner = new Spinner(this, SWT.BORDER);
141
			fMaxSpinner.setMinimum(0);
142
			fMaxSpinner.setMaximum(9999999);
143
			fMaxSpinner.setIncrement(1);
144
			fMaxSpinner.setPageIncrement(100);
145
			fMaxSpinner.setLayoutData(fieldsGridData);
125
			LabeledSpinner fMax = new LabeledSpinner(this, editor, TXMCoreMessages.common_fMax);
126
			this.fMaxLabel = fMax.getLabel();
127
			this.fMaxSpinner = fMax.getSpinner();
146 128
		}
147 129
		
148 130
		// Vmax
149
		this.vMaxLabel = new Label(this, SWT.NONE);
150
		this.vMaxLabel.setText(TXMCoreMessages.common_vMax);
151
		this.vMaxLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
152

  
153
		vMaxSpinner = new Spinner(this, SWT.BORDER);
154
		vMaxSpinner.setMinimum(0);
155
		vMaxSpinner.setMaximum(9999999);
156
		vMaxSpinner.setIncrement(1);
157
		vMaxSpinner.setPageIncrement(100);
158
		vMaxSpinner.setLayoutData(fieldsGridData);
131
		LabeledSpinner vMax = new LabeledSpinner(this, editor, TXMCoreMessages.common_vMax);
132
		this.vMaxLabel = vMax.getLabel();
133
		this.vMaxSpinner = vMax.getSpinner();
159 134
		
160
		fMinSpinner.addKeyListener(computeKeyListener);
161
		fMinSpinner.addSelectionListener(computeSelectionListener);
162
		
163
		if(displayFMax)	{
164
			fMaxSpinner.addKeyListener(computeKeyListener);
165
			fMaxSpinner.addSelectionListener(computeSelectionListener);
166
		}
167
		
168
		vMaxSpinner.addKeyListener(computeKeyListener);
169
		vMaxSpinner.addSelectionListener(computeSelectionListener);
170 135
	}
171 136

  
172 137
	/**
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 1514)
59 59
import org.txm.rcp.messages.TXMUIMessages;
60 60
import org.txm.rcp.swt.GLComposite;
61 61
import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
62
import org.txm.rcp.swt.widget.LabeledSpinner;
62 63
import org.txm.rcp.swt.widget.NavigationWidget;
63 64
import org.txm.rcp.swt.widget.PropertiesSelector;
64 65
import org.txm.rcp.swt.widget.ThresholdsGroup;
......
236 237
		this.vMaxSpinner = thresholdsGroup.getVMaxSpinner();
237 238
		
238 239
		
239
		Label lNLigneppage = new Label(this.getExtendedParametersGroup(), SWT.NONE);
240
		lNLigneppage.setText(IndexUIMessages.pageSize);
240
		// FIXME: SJ: we should create a widget class for the number of results per page 
241
		// Number of results per page 
242
		LabeledSpinner numberOfResultsPerPage = new LabeledSpinner(this.getExtendedParametersGroup(), this, IndexUIMessages.pageSize);
243
		this.nLinesPerPageSpinner = numberOfResultsPerPage.getSpinner();
244
		this.nLinesPerPageSpinner.setMinimum(0);
245
		this.nLinesPerPageSpinner.setMaximum(99999);
246
		this.nLinesPerPageSpinner.setIncrement(1);
247
		this.nLinesPerPageSpinner.setPageIncrement(100);
241 248
		
242
		nLinesPerPageSpinner = new Spinner(this.getExtendedParametersGroup(), SWT.BORDER);
243
		nLinesPerPageSpinner.setMinimum(0);
244
		nLinesPerPageSpinner.setMaximum(99999);
245
		nLinesPerPageSpinner.setIncrement(1);
246
		nLinesPerPageSpinner.setPageIncrement(100);
249

  
247 250
		
248
		// FIXME; became useless?
249
//		nLinesPerPageSpinner.addSelectionListener(new SelectionListener() {
250
//			@Override
251
//			public void widgetSelected(SelectionEvent e) { }
252
//
253
//			@Override
254
//			public void widgetDefaultSelected(SelectionEvent e) {
255
//				index.setTopLine(0);
256
//				index.setNLinesPerPage(nLinesPerPageSpinner.getSelection());
257
//				fillResultArea();
258
//				viewer.getTable().select(0);
259
//				viewer.getTable().showSelection();
260
//			}
261
//		});
262
		
263
		nLinesPerPageSpinner.addSelectionListener(computeSelectionListener);
264
		nLinesPerPageSpinner.addKeyListener(computeKeyListener);
265
		
266
		
267
		
251
		// Bottom toolbar
268 252
		navigationArea = new NavigationWidget(infosArea, SWT.NONE);
269 253
		navigationArea.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true,	false));
270 254

  
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/LexiconEditor.java (revision 1514)
23 23
		this.queryWidget.setVisible(false);
24 24
		this.queryWidget.setSize(0, 0);
25 25
		this.queryWidget.setLayoutData(new GridData(0, 0));
26
		//this.queryWidget.dispose();
27 26
		this.queryLabel.setVisible(false);
28 27
		this.queryLabel.dispose();
29 28
		

Formats disponibles : Unified diff