Révision 635

tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 635)
913 913
		this.lexicon = null;
914 914
	}
915 915

  
916
	/**
917
	 * Sets the query.
918
	 * @param query
919
	 */
920
	public void setQuery(Query query)	{
921
		this.pQuery = query;
922
	}
923
	
924
	/**
925
	 * Sets the properties.
926
	 * @param properties
927
	 */
928
	public void setProperties(List<Property> properties)	{
929
		this.pProperties = properties;
930
	}
931
	
932
	/**
933
	 * Sets the property.
934
	 * Clears all existing properties.
935
	 * @param property
936
	 */
937
	public void setProperty(Property property)	{
938
		List<Property> properties = new ArrayList<Property>();
939
		properties.add(property);
940
		this.setProperties(properties);
941
	}
942
	
943
	
944
	
916 945
	public void setParameters(Query query, List<Property> props, Integer filterFmin, Integer filterFmax, Integer filterVmax, Integer nLinesPerPage) {
917 946
		this.pQuery = query;
918 947
		this.pProperties = props;
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 635)
44 44
		groupBarsByLines.setToolTipText(SpecificitiesUIMessages.SpecificitiesPreferencePage_4);
45 45
		groupBarsByLines.setImage(IImageKeys.getImage(ComputeSpecifities.class, "icons/silk_group_bars_by_lines.png"));
46 46
		groupBarsByLines.addSelectionListener(new ComputeSelectionListener(this));
47

  
48 47
		
49 48
		
50 49
		// Banality
......
53 52
		
54 53
		banality = new FloatSpinner(this.getCommandParametersGroup(), SWT.BORDER);
55 54
		banality.setToolTipText("Banality threshold");
56
		banality.setDigits(1);
57 55
		banality.setIncrement(1);
58 56
		banality.setMinimum(0);
59
		banality.setMaximum(200);
57
		banality.setMaximumAsFloat(2);
60 58
		banality.addSelectionListener(new ComputeSelectionListener(this));
61 59
		
62 60
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 635)
680 680
					f.set(this, value);
681 681
				}
682 682
				// FIXME: debug
683
				System.err.println("TXMEditor.autoUpdateEditorFieldsFromResult(): setting editor parameter " + parameter.key() + " = " + value + " (" + value.getClass() + ")");
683
				System.err.println("TXMEditor.autoUpdateEditorFieldsFromResult(): setting editor parameter " + parameter.key() + " = " + value + " (" + value.getClass() + " to object " + object.getClass() + ")");
684 684
				
685 685
				// FIXME: need to extend this list of managed Widgets
686 686
			}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/FloatSpinner.java (revision 635)
21 21
	 */
22 22
	public FloatSpinner(Composite parent, int style) {
23 23
		super(parent, style);
24
		this.setDigits(1);
24 25
	}
25 26

  
26 27
	/**
......
39 40
		return (float) (super.getSelection() / Math.pow(10, this.getDigits()));
40 41
	}
41 42
	
43
	/**
44
	 * Sets the maximum that the receiver will allow.
45
	 * @param value
46
	 */
47
	public void setMaximumAsFloat(float value){
48
		this.setMaximum((int) (value * Math.pow(10, this.getDigits())));
49
	}
42 50
	
43 51
	@Override
44 52
	protected void checkSubclass() {
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java (revision 635)
38 38
	
39 39
	@Override
40 40
	public void _createPartControl(Composite parent) {
41
//		super.createPartControl(parent);
42 41

  
43
		//Composite paramPanel = new Composite(parent, SWT.NONE);
44

  
45
		//		FormData fdata = new FormData();
46
		//		fdata.top = new FormAttachment(0);
47
		//		fdata.left = new FormAttachment(0);
48
		//		fdata.right = new FormAttachment(100);
49
		//		this.getParametersComposite().setLayoutData(fdata);
50

  
51
		//		FormData fdata = new FormData();
52
		//		fdata.top = new FormAttachment(this.getParametersComposite());
53
		//		fdata.left = new FormAttachment(0);
54
		//		fdata.right = new FormAttachment(100);
55
		//		fdata.bottom = new FormAttachment(100);
56

  
57
		// fill param Area
58
		//		RowLayout layout = new RowLayout();
59
		//		layout.wrap = true;
60
		//		layout.center = true;
61
		//		this.getParametersComposite().setLayout(layout);
62

  
63 42
		// for group tests
64
		Composite p = this.getCommandParametersGroup();
65
		// for tab folder tests
66
		//Composite p = this.getCommandParametersComposite();
43
		Composite parametersArea = this.getCommandParametersGroup();
67 44

  
68 45
		// fmin
69
		new Label(p, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_fmin);
70
		minFreq = new Spinner(p, SWT.BORDER);
46
		new Label(parametersArea, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_fmin);
47
		minFreq = new Spinner(parametersArea, SWT.BORDER);
71 48
		minFreq.setMinimum(1);
72 49
		minFreq.setIncrement(1);
73 50
		minFreq.setMaximum(100000000);
74 51

  
75 52
		// max words / vmax
76
		new Label(p, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_vmax);
77
		maxWordsCount = new Spinner(p, SWT.BORDER);
53
		new Label(parametersArea, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_vmax);
54
		maxWordsCount = new Spinner(parametersArea, SWT.BORDER);
78 55
		maxWordsCount.setMinimum(10);
79 56
		maxWordsCount.setIncrement(1);
80 57
		maxWordsCount.setMaximum(100000);
81 58

  
82 59
		// rotation percent
83
		new Label(p, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_Percent_of_rotated_labels);
84
		rotationPercent = new Spinner(p, SWT.BORDER);
60
		new Label(parametersArea, SWT.NONE).setText(WordCloudUIMessages.EditorToolBar_Percent_of_rotated_labels);
61
		rotationPercent = new Spinner(parametersArea, SWT.BORDER);
85 62
		rotationPercent.setMinimum(0);
86 63
		rotationPercent.setIncrement(1);
87 64
		rotationPercent.setMaximum(100);
88 65

  
89 66
		// random positions
90
		randomPositions = new Button(p, SWT.CHECK);
67
		randomPositions = new Button(parametersArea, SWT.CHECK);
91 68
		randomPositions.setText(WordCloudUIMessages.EditorToolBar_Randomize_positions);
92 69
		
93 70

  
94
		p.pack();
71
		parametersArea.pack();
95 72

  
96 73
		Log.info(WordCloudUIMessages.Log_WordCloud_ready + this.getResult());
97 74

  
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/handlers/ComputeWordCloud.java (revision 635)
27 27
//
28 28
package org.txm.wordcloud.rcp.handlers;
29 29

  
30
import java.util.ArrayList;
31

  
30 32
import org.eclipse.core.commands.ExecutionEvent;
31 33
import org.eclipse.core.commands.ExecutionException;
32 34
import org.txm.chartsengine.rcp.editors.ChartEditor;
......
35 37
import org.txm.rcp.commands.OpenBrowser;
36 38
import org.txm.rcp.handlers.BaseAbstractHandler;
37 39
import org.txm.rcp.views.corpora.CorporaView;
40
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
38 41
import org.txm.searchengine.cqp.corpus.Corpus;
42
import org.txm.searchengine.cqp.corpus.Property;
43
import org.txm.searchengine.cqp.corpus.query.Query;
39 44
import org.txm.wordcloud.core.functions.WordCloud;
40 45
import org.txm.wordcloud.core.messages.WordCloudCoreMessages;
41 46

  
42 47
/**
43
 * Open the WordCloud Editor.
48
 * Computes and opens a WordCloudEditor.
44 49
 * 
45 50
 * @author mdecorde
46 51
 * @author sjacquot
......
54 59
	}
55 60
	
56 61
	
57

  
58

  
59
	/* (non-Javadoc)
60
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
61
	 */
62 62
	@Override
63 63
	public Object execute(final ExecutionEvent event) throws ExecutionException {
64 64

  
......
67 67
		}
68 68

  
69 69
		Object selection = this.getSelection(event);
70
		 WordCloud wordCloud = null;
70
		WordCloud wordCloud = null;
71 71
		
72
		
73
		// reopening an existing result
72
		// Reopening an existing result
74 73
		if (selection instanceof WordCloud) {
75 74
			wordCloud = ((WordCloud) selection);
76 75
		}
......
80 79
				OpenBrowser.openfile("https://groupes.renater.fr/wiki/txm-users/public/extensions#wordcloud"); //$NON-NLS-1$
81 80
			}
82 81

  
83
			// creates new result from Corpus
82
			// Creating from Corpus
84 83
			if (selection instanceof Corpus) {
85
				wordCloud = new WordCloud(new Index((Corpus)selection));
84
				try {
85
					Corpus corpus = (Corpus) selection; 
86
					String lang = corpus.getLang();
87
					Query query;
88
					if (corpus.getProperty(lang + "pos") != null) {
89
						query = new Query(WordCloud.getQueryForLang(lang));
90
					}
91
					else {
92
						query = new Query("[]");
93
					}
94
					
95
					System.out.println("Used query: " + query);
96

  
97
					Index index = new Index((Corpus)selection);
98
					index.setQuery(query);
99
					index.setProperty(corpus.getWordProperty());
100
					
101
					wordCloud = new WordCloud(index);
102
				}
103
				catch (CqiClientException e) {
104
					// TODO Auto-generated catch block
105
					e.printStackTrace();
106
				}
86 107
			}
87
			// creates new result from Index
108
			// Creating from Index
88 109
			else if (selection instanceof Index) {
89 110
				wordCloud = new WordCloud((Index)selection);
90 111
			}
112
			// Error
113
			else	{
114
				return super.logCanNotCompute(selection);
115
			}
116

  
91 117
		}
92 118
		
93 119
		StatusLine.setMessage(WordCloudCoreMessages.StatusBar_Opening_result);
tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/preferences/WordCloudPreferencePage.java (revision 635)
49 49
public class WordCloudPreferencePage extends TXMPreferencePage {
50 50

  
51 51

  
52
	/**
53
	 * The Constant ID.
54
	 */
55
	public static final String ID = "org.txm.wordcloud.rcp.preferences.WordCloudPreferencePage"; //$NON-NLS-1$
56

  
57
	/**
58
	 * Instantiates a new Wordcloud preference page.
59
	 */
60
	public WordCloudPreferencePage() {
61
		super();
62
	}
63

  
64
	/**
65
	 * Creates the field editors. Field editors are abstractions of the common
66
	 * GUI blocks needed to manipulate various types of preferences. Each field
67
	 * editor knows how to save and restore itself.
68
	 */
69 52
	@Override
70 53
	public void createFieldEditors() {
71 54
		
......
83 66
	}
84 67
	
85 68
	
86
	/*
87
	 * (non-Javadoc)
88
	 * 
89
	 * @see
90
	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
91
	 */
92 69
	@Override
93 70
	public void init(IWorkbench workbench) {
94 71
		this.setPreferenceStore(new TXMPreferenceStore(WordCloudPreferences.PREFERENCES_NODE));
tmp/org.txm.wordcloud.rcp/OSGI-INF/l10n/bundle.properties (revision 635)
1
Bundle-Name=WordCloud RCP
2
command.label=WordCloud
3
command.name=WordCloud
4
editor.name=WordCloud
1
Bundle-Name = WordCloud RCP
2
command.label = WordCloud
3
command.name = WordCloud
4
editor.name = WordCloud
5 5
page.name = WordCloud
tmp/org.txm.wordcloud.rcp/META-INF/MANIFEST.MF (revision 635)
4 4
Bundle-SymbolicName: org.txm.wordcloud.rcp;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
7
Require-Bundle: org.txm.utils;bundle-version="1.0.0",
7
Require-Bundle: org.txm.rcp;bundle-version="0.7.8",
8
 org.txm.utils;bundle-version="1.0.0",
8 9
 org.eclipse.osgi;bundle-version="3.10.2",
10
 org.txm.index.rcp;bundle-version="1.0.0",
9 11
 org.eclipse.core.runtime;bundle-version="3.10.0",
10 12
 org.txm.lexicon.core;bundle-version="1.0.0",
13
 org.txm.chartsengine.core;bundle-version="1.0.0",
11 14
 org.txm.index.core;bundle-version="1.0.0",
12 15
 org.txm.searchengine.cqp.core;bundle-version="1.1.0",
13 16
 org.eclipse.ui;bundle-version="3.106.1",
14 17
 org.txm.wordcloud.core;bundle-version="1.0.0",
15 18
 org.txm.chartsengine.rcp,
16
 org.txm.core;bundle-version="0.7.0",
17
 org.txm.rcp;bundle-version="0.7.8"
19
 org.txm.core;bundle-version="0.7.0"
18 20
Bundle-Vendor: Textometrie.org
19 21
Bundle-ActivationPolicy: lazy
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 635)
1312 1312
		this.monitor = monitor;
1313 1313

  
1314 1314
		// FIXME: Debug
1315
		System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : computing result of type " + this.getClass() + "...");
1315
		System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing result of type " + this.getClass() + "...");
1316 1316

  
1317 1317
		if (!this.isDirtyFromHistory()) {
1318 1318

  
1319 1319
			// FIXME: Debug
1320
			System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : result parameters have not changed since last computing, computing skipped.");
1320
			System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped.");
1321 1321

  
1322 1322
			return true;
1323 1323
		}
......
1325 1325
		if (!this.isDirty()) {
1326 1326

  
1327 1327
			// FIXME: Debug
1328
			System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : result is not dirty, computing skipped.");
1328
			System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": result is not dirty, computing skipped.");
1329 1329

  
1330 1330
			return true;
1331 1331
		}
......
1336 1336
		// SJ: other way, test the object itself
1337 1337
		if (parent != null && !parent.getHasBeenComputedOnce()) { 
1338 1338
			if (!this.parent.compute( monitor)) {
1339
				System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : parent result could not be computed, computing stoped.");
1339
				System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": parent result could not be computed, computing stoped.");
1340 1340

  
1341 1341
				return false;
1342 1342
			}
......
1344 1344

  
1345 1345
		if (!this.canCompute()) {
1346 1346
			// FIXME: Debug
1347
			System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : missing or wrong parameters, computing aborted.");
1347
			System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": missing or wrong parameters, computing aborted.");
1348 1348

  
1349 1349
			return false;
1350 1350
		}
......
1352 1352
		if (!this._compute()) {
1353 1353

  
1354 1354
			// FIXME: Debug
1355
			System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : computing failed.");
1355
			System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing failed.");
1356 1356

  
1357 1357
			return false;
1358 1358
		}
......
1363 1363
		}
1364 1364

  
1365 1365
		if (!this.autoSaveParametersFromAnnotations()) {
1366
			System.out.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : failed to save parameters from annotations for " + this.getName() + ".");
1366
			System.out.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to save parameters from annotations for " + this.getName() + ".");
1367 1367
		}
1368 1368
		if (!this.saveParameters()) {
1369
			System.out.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : failed to save parameters for " + this.getName() + ".");
1369
			System.out.println("TXMResult.compute():" + this.getClass().getSimpleName() + ": failed to save parameters for " + this.getName() + ".");
1370 1370
		}
1371 1371

  
1372 1372

  
1373 1373
		this.dirty = false; // the computing was successful, the result is no more dirty
1374 1374
		this.hasBeenComputedOnce = true; 
1375 1375
		// FIXME: Debug
1376
		System.err.println("TXMResult.compute() "+this.getClass().getSimpleName()+" : computing of result type " + this.getClass() + " done.");
1376
		System.err.println("TXMResult.compute(): " + this.getClass().getSimpleName() + ": computing of result type " + this.getClass() + " done.");
1377 1377

  
1378 1378
		return true;
1379 1379
	}
tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java (revision 635)
19 19
public class PartitionDimensionsEditor extends ChartEditor<PartitionDimensions> {
20 20

  
21 21

  
22
	/**
23
	 * To sort or not the parts by size.
24
	 */
22 25
	@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE)
23 26
	protected ToolItem sortByPartSize;
24 27
	
tmp/org.txm.internalview.core/src/org/txm/internalview/core/functions/InternalView.java (revision 635)
293 293
		}
294 294

  
295 295
		for(List<String> list : values) {
296
			for(String value : list)
296
			for(String value : list) {
297 297
				System.out.print("\t"+value); //$NON-NLS-1$
298
			}
298 299
			System.out.println();
299 300
		}
300 301
		System.out.println();
tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/TextsBalanceEditor.java (revision 635)
24 24
public class TextsBalanceEditor extends ChartEditor<TextsBalance> {
25 25

  
26 26

  
27

  
27
	/**
28
	 * Group by words.
29
	 */
28 30
	protected Button groupByWords;
29 31

  
32

  
30 33
	
34
	/**
35
	 * Structural unit to explore.
36
	 */
31 37
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT)
32 38
	protected StructuralUnitsComboViewer structuralUnitsComboViewer;
33 39
	
40
	/**
41
	 * Structural unit property to explore.
42
	 */
34 43
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY)
35 44
	protected StructuralUnitPropertiesComboViewer structuralUnitPropertiesComboViewer;
36 45
	
46
	/**
47
	 * Group by texts or not.
48
	 */
37 49
	@Parameter(key=TextsBalancePreferences.GROUP_BY_TEXTS)
38 50
	protected Button groupByTexts;
39 51
	
......
42 54
	
43 55
	@Override
44 56
	public void _createPartControl(Composite parent) {
45
		//super._createPartControl(parent);
46 57
		
47 58
		if (((TextsBalance)this.getResult()).getCorpus() == null) {
48 59
			System.out.println("Error: no corpus");
......
56 67
		Group group = new Group(parametersArea, SWT.NONE);
57 68
		
58 69
		group.setText("Group by");
59
		//group.setLayout(new RowLayout(SWT.VERTICAL));
60 70
		group.setLayout(new RowLayout());
61 71
		
62
//		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
63
//		gridData.horizontalSpan = 2;
64
//		gridData.verticalIndent = 10;
65
//		group.setLayoutData(gridData);
66

  
67
		
68 72
		this.groupByTexts = new Button(group, SWT.RADIO);
69
		this.groupByTexts.setText("text");
73
		this.groupByTexts.setText("text"); //$NON-NLS-1$
70 74
		this.groupByTexts.setSelection(this.getResult().isGroupByTexts());	
71 75
		
72 76
		this.groupByWords = new Button(group, SWT.RADIO);
73
		this.groupByWords.setText("word");
77
		this.groupByWords.setText("word"); //$NON-NLS-1$
74 78
		this.groupByWords.setSelection(!groupByTexts.getSelection());
75 79

  
76 80
		
......
89 93

  
90 94
	}
91 95

  
92
	
93 96

  
94
	
95
//	/**
96
//	 * 
97
//	 * @param corpus
98
//	 * @param structs
99
//	 * @return
100
//	 */
101
//	public ArrayList<Integer> intersect(List<Match> corpus, List<Match> structs) {
102
//		int ai=0, bi=0;
103
//		ArrayList<Integer> result = new ArrayList<Integer>();
104
//
105
//		while (ai < corpus.size() && bi < structs.size() ) {
106
//			if (structs.get(bi).contains(corpus.get(ai))) { 
107
//				result.add(bi);
108
//				ai++; 
109
//			}
110
//			else if (corpus.get(ai).contains(structs.get(bi))) { 
111
//				result.add(bi);
112
//				bi++; 
113
//			}
114
//			else { 
115
//				if (structs.get(bi).getStart() < corpus.get(ai).getStart()) {
116
//					bi++;
117
//				}
118
//				else {
119
//					ai++;	
120
//				}
121
//			} 
122
//		}
123
//
124
//		return result;
125
//	}
126
//
127

  
128 97
}
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 635)
42 42
	protected int fMin;
43 43
	protected int fMax;
44 44
	
45
	protected String name;
45
	//protected String name;
46 46

  
47 47

  
48 48
	protected int method;
49 49

  
50 50
	
51
	
51
	/**
52
	 * Structural unit to explore.
53
	 */
52 54
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT)
53 55
	protected StructuralUnit structuralUnit;
54 56

  
57
	/**
58
	 * Structural unit property to explore.
59
	 */
55 60
	@Parameter(key=TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY)
56 61
	protected StructuralUnitProperty structuralUnitProperty;
57 62

  
63
	/**
64
	 * Group by texts or not.
65
	 */
58 66
	@Parameter(key=TextsBalancePreferences.GROUP_BY_TEXTS)
59 67
	protected boolean groupByTexts;
60 68
	
......
75 83
		// TODO Auto-generated method stub
76 84
		try {
77 85
			StructuralUnit su = this.getCorpus().getStructuralUnit(this.getStringParameterValue(TextsBalancePreferences.STRUCTURAL_UNIT));
78
			this.setParameters(
79
					this.getIntParameterValue(TextsBalancePreferences.METHOD),
80
					su, 
81
					su.getProperty(this.getStringParameterValue(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY)),
82
					this.getBooleanParameterValue(TextsBalancePreferences.GROUP_BY_TEXTS));
86
			this.setParameters(su, su.getProperty(this.getStringParameterValue(TextsBalancePreferences.STRUCTURAL_UNIT_PROPERTY)));
83 87
		}
84 88
		catch(CqiClientException e) {
85 89
			// TODO Auto-generated catch block
......
96 100
	 * @param suPropertyName
97 101
	 * @param groupByTexts
98 102
	 */
99
	public void setParameters(int method, StructuralUnit su, StructuralUnitProperty sup, boolean groupByTexts) {
103
	public void setParameters(StructuralUnit su, StructuralUnitProperty sup) {
100 104
		this.structuralUnit = su;
101 105
		this.structuralUnitProperty = sup;
102 106
		
......
105 109
			this.structuralUnitProperty = this.structuralUnit.getUserDefinedOrderedProperties().get(0);
106 110
		}
107 111
		
108
		
109
		this.groupByTexts = groupByTexts;
110
		this.method = method;
111
		
112 112
		this.setDirty();
113 113
	}
114 114
	
......
123 123
	 */
124 124
	protected boolean _compute() {
125 125
		
126
		this.name = this.structuralUnit.getName() + "@" + this.structuralUnitProperty + " (group by texts = " + this.groupByTexts + ")";
127
		
128
		Log.warning("Computing balance with metadata propertyName = " + this.structuralUnitProperty + ", structural unit = " + this.structuralUnit.getName() + " and groupByTexts = " + this.groupByTexts);
126
		this.subTask("Computing balance with metadata propertyName = " + this.structuralUnitProperty + ", structural unit = " + this.structuralUnit.getName() + " and groupByTexts = " + this.groupByTexts); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
129 127
		try {
130 128
			this.dataset = new HashMap<Integer, Comparable[]>();
131 129
			
132
			//StructuralUnitProperty p = structuralUnit.getProperty(suPropertyName);
133 130
			StructuralUnitProperty p = this.structuralUnitProperty;
134 131
			this.values = p.getValues();
135
			Collections.sort(values);
132
			Collections.sort(this.values);
136 133

  
137
			//this.method = 2;
138
			//System.out.println("Method: "+method);
139
			//long time = System.currentTimeMillis();
140
			if (this.method == 1) { // using CQL to solve matches
134
			 // using CQL to solve matches
135
			if (this.method == 1) {
141 136
				for (String value : this.values) {
142 137
					int v = 0;
143 138
					if (this.groupByTexts) {
......
148 143
					else {
149 144
						QueryResult r = this.getCorpus().query(new Query("[_."+p.getFullName()+"=\""+value+"\"] expand to text"), "tmp", false);
150 145
						int t = 0;
151
						for (Match m : r.getMatches()) t += m.getLength();
146
						for (Match m : r.getMatches()) {
147
							t += m.getLength();
148
						}
152 149
						v = t;
153 150
						r.drop();
154 151
					}
......
160 157
					}
161 158
					this.dataset.put(v, new Comparable[]{p.getName(), value});
162 159
				}
163
			} else {
160
			}
161
			else {
164 162
				AbstractCqiClient CQI = CQPEngine.getCqiClient();
165 163
				if (CQI instanceof NetCqiClient) {
166 164
					System.out.println("Error: CQP eval method only available with CQP memory mode");
......
170 168
				String supqn = p.getQualifiedName();
171 169
				int nsup = CQI.attributeSize(supqn);
172 170

  
173
				ArrayList<Match> sup_limits = new ArrayList<Match>(nsup);
171
				ArrayList<Match> supLimits = new ArrayList<Match>(nsup);
174 172
				for (int i = 0 ; i < nsup ; i++) {
175 173
					int[] l = CQI.struc2Cpos(supqn, i);
176
					sup_limits.add(new Match(l[0], l[1]));
174
					supLimits.add(new Match(l[0], l[1]));
177 175
				}
178 176
				//System.out.println("All sup limits are "+sup_limits);
179 177
				List<Match> corpus_matches = this.getCorpus().getMatches();
180 178
				//System.out.println("corpus matches: "+corpus_matches);
181
				ArrayList<Integer> inter = intersect(corpus_matches, sup_limits);
179
				ArrayList<Integer> inter = intersect(corpus_matches, supLimits);
182 180
				//System.out.println( "No of $sup that covers $corpus: "+inter);
183
				int[] structid = new int[inter.size()];
184
				for (int i = 0 ; i < structid.length ; i++) structid[i] = inter.get(i);
181
				int[] structId = new int[inter.size()];
182
				for (int i = 0 ; i < structId.length ; i++) {
183
					structId[i] = inter.get(i);
184
				}
185 185

  
186
				String[] inter_values = CQI.struc2Str(supqn, structid);
186
				String[] interValues = CQI.struc2Str(supqn, structId);
187 187
				//System.out.println( " with values: "+Arrays.toString(inter_values));
188
				HashMap<String, Integer> inter_uniq = new HashMap<String, Integer>();
188
				HashMap<String, Integer> interUniq = new HashMap<String, Integer>();
189 189

  
190 190
				if (this.groupByTexts) {
191
					for (String o : inter_values) {
192
						if (!inter_uniq.containsKey(o)) {
193
							inter_uniq.put(o, 0);
191
					for (String o : interValues) {
192
						if (!interUniq.containsKey(o)) {
193
							interUniq.put(o, 0);
194 194
						}
195
						inter_uniq.put(o, inter_uniq.get(o) +1);
195
						interUniq.put(o, interUniq.get(o) +1);
196 196
					}
197 197
				} else {
198
					for (int imatch = 0 ; imatch < inter.size() ; imatch++) {
199
						String o = inter_values[imatch];
200
						if (!inter_uniq.containsKey(o)) {
201
							inter_uniq.put(o, 0);
198
					for (int iMatch = 0 ; iMatch < inter.size() ; iMatch++) {
199
						String o = interValues[iMatch];
200
						if (!interUniq.containsKey(o)) {
201
							interUniq.put(o, 0);
202 202
						}
203
						int s = sup_limits.get(inter.get(imatch)).getLength();
204
						inter_uniq.put(o, inter_uniq.get(o) + s);
203
						int s = supLimits.get(inter.get(iMatch)).getLength();
204
						interUniq.put(o, interUniq.get(o) + s);
205 205

  
206 206
					}
207 207
				}
208
				Object[] sortedkeys = inter_uniq.keySet().toArray();
208
				Object[] sortedkeys = interUniq.keySet().toArray();
209 209
				Arrays.sort(sortedkeys);
210 210
				for (Object k : sortedkeys) {
211
					int v = inter_uniq.get(k);
211
					int v = interUniq.get(k);
212 212
					if (v < this.fMin) {
213 213
						this.fMin = v;
214 214
					}
......
216 216
						this.fMax = v;
217 217
					}
218 218
					this.dataset.put(v, new Comparable[]{p.getName(), k.toString()});
219
					
220 219
				}
221 220
			}
222 221
		}
223 222
		catch(Exception e) {
224
			System.out.println("Error while computing text informations: "+e);
223
			System.out.println("Error while computing text information: " + e);
225 224
			e.printStackTrace();
226 225
			return false;
227 226
		}
......
333 332

  
334 333
	@Override
335 334
	public String getSimpleName() {
336
		return this.name;
335
		return 	this.structuralUnit.getName() + "@" + this.structuralUnitProperty + " (group by texts = " + this.groupByTexts + ")";
337 336
	}
338 337

  
339 338
	@Override
340 339
	public String getDetails() {
341
		return name;
340
		return this.getName();
342 341
	}
343 342

  
344 343
	@Override
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/jfreechart/JFCTextsBalanceSpiderChartCreator.java (revision 635)
9 9
import org.jfree.chart.plot.SpiderWebPlot;
10 10
import org.jfree.data.category.CategoryDataset;
11 11
import org.jfree.data.category.DefaultCategoryDataset;
12
import org.jfree.util.Log;
12 13
import org.txm.chartsengine.core.results.ChartResult;
13 14
import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
14 15
import org.txm.textsbalance.core.functions.TextsBalance;
......
67 68
		Set<Integer> keys = data.keySet();
68 69
		Iterator<Integer> it = keys.iterator();
69 70
		while (it.hasNext()) {
70
		   int key = it.next();
71
		   Comparable[] value = data.get(key);
72
		   dataset.addValue(key, value[0], value[1]);
71
			int key = it.next();
72
			Comparable[] value = data.get(key);
73
			System.out.println("JFCTextsBalanceSpiderChartCreator.updateChart(): adding " + key + ", " + value[0] + ", " + value[1] + " to dataset."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
74
			dataset.addValue(key, value[0], value[1]);
73 75
		}
74 76
		
75 77
		chart.setTitle("metadata = " + textsBalance.getStructuralUnitProperty() + ", N = " +  textsBalance.getValues().size() + ", fmin = " + textsBalance.getFMin() + ", fmax = " + textsBalance.getFMax() + ", group by texts = " + textsBalance.groupingByTexts());
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 635)
22 22
 */
23 23
public class WordCloud extends ChartResult {
24 24
	
25
	//TODO: test rw.setStringEncoding("UTF-8"); // or connection
25
	
26 26
	private int[] freqs;
27 27
	private String[] labels;
28 28
	
29 29
	
30
	
30
	/**
31
	 * Minimum frequency.
32
	 */
31 33
	@Parameter(key=WordCloudPreferences.F_MIN)
32 34
	protected int fMin;
33 35
	
36
	/**
37
	 * 
38
	 */
34 39
	@Parameter(key=WordCloudPreferences.MAX_WORDS_COUNT)
35 40
	protected int maxWordsCount;
36 41

  
42
	/**
43
	 * 
44
	 */
37 45
	@Parameter(key=WordCloudPreferences.ROTATION_PERCENT)
38 46
	protected float rotationPercent;
39 47
	
48
	/**
49
	 * 
50
	 */
40 51
	@Parameter(key=WordCloudPreferences.RANDOM_POSITIONS)
41 52
	protected boolean randomPositions;
42 53

  
43 54
	
44 55
	/**
45
	 * 
56
	 * Creates a WordCloud.
46 57
	 * @param index
47 58
	 */
48 59
	public WordCloud(Index index) {
......
66 77
		}
67 78
	}
68 79

  
80
	
81
	@Override
82
	protected boolean _compute() {
83
//		// FIXME: source must always be an Index because the corpus source produces an Index
84
//		// from corpus
85
//		if (source instanceof Corpus)	{ 
86
//			try {
87
//				Corpus corpus = (Corpus) source;
88
//				Query query;
89
//				String lang = corpus.getLang();
90
//				if (corpus.getProperty(lang + "pos") != null) {
91
//					query = new Query(getQueryForLang(lang));
92
//				}
93
//				else {
94
//					query = new Query("[]");
95
//				}
96
//				
97
//				System.out.println("Used query: " + query);
98
//				
99
//				ArrayList<Property> props = new ArrayList<Property>();
100
//				props.add(corpus.getWordProperty());
101
//				Index index = new Index(corpus);
102
//				index.setParameters(query, props, null, null, null, null);
103
//				if (!query.toString().equals("[]")) {
104
//					corpus.addChild(index);
105
//				}
106
//
107
//				index.compute(false, monitor);
108
//				
109
//				index.addChild(this);
110
//					
111
//				List<Line> lines = index.getAllLines();
112
//				if (lines != null && lines.size() > 0) {
113
//					this.initWith(index);
114
//				}
115
//				else {
116
//					Log.severe("Error: Could not build a word selection with this corpus");
117
//					throw new IllegalArgumentException("Error: Index failed with corpus " + corpus + " with lang " + lang + " and query " + query);
118
//				}
119
//			}
120
//			catch(Exception e) {
121
//				System.out.println("Error: "+e.getLocalizedMessage());
122
//				Log.printStackTrace(e);
123
//				return false;
124
//			}
125
			this.initWith((Index)parent);
126
//		}
127
//		// from index
128
//		else if(this.source instanceof Index)	{
129
//			this.initWith((Index) this.source);
130
//			return true;
131
//		}
132
//		
133
		return true;
134
	}
135
	
69 136
	// FIXME: to remove?
70 137
	private void removeDiacritics() {
71 138
		//for (int i = 0; i < labels.length ; i++)
......
165 232
	
166 233
	@Override
167 234
	public String getSimpleName() {
168
		return WordCloudCoreMessages.RESULT_TYPE + " (" + this.fMin
169
				+ " / "
170
				+ this.maxWordsCount
171
				+ ")";
235
		return WordCloudCoreMessages.RESULT_TYPE + " (" + this.fMin + " / " + this.maxWordsCount + ")"; //$NON-NLS-1$  //$NON-NLS-2$  //$NON-NLS-3$
172 236
	}
173 237

  
174 238
	@Override
......
212 276
	 * @param lang
213 277
	 * @return
214 278
	 */
215
	private String getQueryForLang(String lang) {
279
	public static String getQueryForLang(String lang) {
216 280
		if ("fr".equals(lang)) {
217 281
			return "[frpos=\"NOM|NAM|ADJ|VER.*\"  & frlemma!=\"être|avoir|faire|pouvoir|devoir|vouloir|falloir|aller|dire|savoir\"]"; // requete de Serge pour le français TT
218 282
		}
......
224 288
		}
225 289
	}
226 290
	
227
	@Override
228
	protected boolean _compute() {
229
//		// FIXME: source must always be an Index because the corpus source produces an Index
230
//		// from corpus
231
//		if (source instanceof Corpus)	{ 
232
//			try {
233
//				Corpus corpus = (Corpus) source;
234
//				Query query;
235
//				String lang = corpus.getLang();
236
//				if (corpus.getProperty(lang + "pos") != null) {
237
//					query = new Query(getQueryForLang(lang));
238
//				}
239
//				else {
240
//					query = new Query("[]");
241
//				}
242
//				
243
//				System.out.println("Used query: " + query);
244
//				
245
//				ArrayList<Property> props = new ArrayList<Property>();
246
//				props.add(corpus.getWordProperty());
247
//				Index index = new Index(corpus);
248
//				index.setParameters(query, props, null, null, null, null);
249
//				if (!query.toString().equals("[]")) {
250
//					corpus.addChild(index);
251
//				}
252
//
253
//				index.compute(false, monitor);
254
//				
255
//				index.addChild(this);
256
//					
257
//				List<Line> lines = index.getAllLines();
258
//				if (lines != null && lines.size() > 0) {
259
//					this.initWith(index);
260
//				}
261
//				else {
262
//					Log.severe("Error: Could not build a word selection with this corpus");
263
//					throw new IllegalArgumentException("Error: Index failed with corpus " + corpus + " with lang " + lang + " and query " + query);
264
//				}
265
//			}
266
//			catch(Exception e) {
267
//				System.out.println("Error: "+e.getLocalizedMessage());
268
//				Log.printStackTrace(e);
269
//				return false;
270
//			}
271
			this.initWith((Index)parent);
272
//		}
273
//		// from index
274
//		else if(this.source instanceof Index)	{
275
//			this.initWith((Index) this.source);
276
//			return true;
277
//		}
278
//		
279
		return true;
280
	}
281 291

  
292

  
282 293
	@Override
283 294
	public boolean loadParameters() throws Exception {
284 295
		// nothing to do
......
291 302
		return true;
292 303
	}
293 304

  
294
	
305
	/**
306
	 * 
307
	 * @return
308
	 */
295 309
	public int getFMin() {
296 310
		return fMin;
297 311
	}
tmp/org.txm.wordcloud.core/META-INF/MANIFEST.MF (revision 635)
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
7 7
Require-Bundle: org.txm.utils;bundle-version="1.0.0",
8
 org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
8
 org.eclipse.core.runtime;bundle-version="3.10.0",
9
 org.txm.core;bundle-version="0.7.0",
9 10
 org.txm.chartsengine.core;bundle-version="1.0.0",
10 11
 org.txm.searchengine.cqp.core;bundle-version="1.1.0",
12
 org.txm.statsengine.r.core;bundle-version="1.0.0",
13
 org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
11 14
 org.txm.statsengine.core;bundle-version="1.0.0",
12 15
 org.txm.chartsengine.r.core;bundle-version="1.0.0",
13
 org.txm.statsengine.r.core;bundle-version="1.0.0",
14
 org.eclipse.core.runtime;bundle-version="3.10.0",
15
 org.txm.core;bundle-version="0.7.0",
16
 org.txm.index.core;bundle-version="1.0.0",
17
 org.txm.lexicon.core
16
 org.txm.index.core;bundle-version="1.0.0"
18 17
Export-Package: org.txm.wordcloud.core.chartsengine.jfreechart,
19 18
 org.txm.wordcloud.core.chartsengine.r,
20 19
 org.txm.wordcloud.core.functions,
21 20
 org.txm.wordcloud.core.messages,
22 21
 org.txm.wordcloud.core.preferences
23
Import-Package: org.txm.chartsengine.core
24 22
Bundle-Vendor: Textometrie.org
tmp/org.txm.index.rcp/plugin.xml (revision 635)
178 178
            </iterate>
179 179
         </with>
180 180
      </definition>
181
      <definition
182
            id="OneLexiconSelected">
183
         <with
184
               variable="selection">
185
            <iterate
186
                  ifEmpty="false"
187
                  operator="and">
188
               <instanceof
189
                     value="org.txm.lexicon.core.functions.Lexicon">
190
               </instanceof>
191
            </iterate>
192
         </with>
193
      </definition>
181 194
   </extension>
182 195
   <extension
183 196
         point="org.txm.statengine.r.rcp.sendtor">

Formats disponibles : Unified diff