Revision 1406

tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPLexicon.java (revision 1406)
35 35
import java.io.UnsupportedEncodingException;
36 36
import java.util.ArrayList;
37 37
import java.util.Arrays;
38
import java.util.List;
39 38
import java.util.Map;
40 39

  
41 40
import org.eclipse.core.runtime.IProgressMonitor;
42
import org.eclipse.osgi.util.NLS;
43
import org.txm.Toolbox;
44
import org.txm.core.preferences.TXMPreferences;
45
import org.txm.core.results.Parameter;
41
import org.txm.core.messages.TXMCoreMessages;
46 42
import org.txm.core.results.TXMParameters;
47 43
import org.txm.core.results.TXMResult;
48 44
import org.txm.searchengine.cqp.AbstractCqiClient;
......
546 542
			lexicon.setProperty(property);
547 543
			lexicon._compute();
548 544
		}
549
		//System.out.println("Lexicon="+lexicon+" "+lexicon.hashCode());
545
		
546
		Log.finest(TXMCoreMessages.bind("Lexicon = {0} {1}.", lexicon, lexicon.hashCode()));
547
		
550 548
		return lexicon;
551 549
	}
552 550
	
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 1406)
578 578
				strb.append(property.getName() + " ");
579 579
				try {
580 580
					//strb.append(this.getFMin() + " / " + this.getNRows());
581
					strb.append(this.fMinFilter +" / "+this.vMaxFilter);
581
					strb.append(this.fMinFilter + " / " + this.vMaxFilter);
582 582
				} catch (Exception e) {
583 583
					// TODO Auto-generated catch block
584 584
					e.printStackTrace();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/TXMResultAdapter.java (revision 1406)
36 36

  
37 37
	@Override
38 38
	public String getLabel(Object result) {
39
		if (result instanceof TXMResult) {
40
			String star = (((TXMResult) result).isInternalPersistable() || ((TXMResult) result).isUserPersistable())?"":" *";
41
			return ((TXMResult) result).getCurrentName()+star;
42
		}
43
		else {
44
			return result.toString();
45
		}
39
		return ((TXMResult) result).getCurrentName();
46 40
	}
47 41

  
48 42
	@Override
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/PropertiesSelector.java (revision 1406)
41 41
import org.eclipse.swt.widgets.Composite;
42 42
import org.eclipse.swt.widgets.Label;
43 43
import org.eclipse.swt.widgets.Listener;
44
import org.txm.objects.CorpusBuild;
44 45
import org.txm.rcp.messages.TXMUIMessages;
45 46
import org.txm.rcp.swt.dialog.ViewPropertySelectionDialog;
46 47
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
......
50 51
import org.txm.utils.logger.Log;
51 52
 
52 53
/**
53
 * Allow to choose a structural property @ author mdecorde.
54
 * Allows to choose a structural unit property.
55
 * 
56
 * @author mdecorde
54 57
 */
55 58
public class PropertiesSelector<P extends Property> extends Composite {
56 59
	
57
	protected static final int MAXLABELLENGHT = 25;
60
	protected static final int MAX_LABEL_LENGHT = 25;
58 61

  
59 62
	/** The corpus. */
60 63
	CQPCorpus corpus;
......
80 83
	/** The prop separator. */
81 84
	String propSeparator = " ; "; //$NON-NLS-1$
82 85
	
86
	ArrayList<Listener> listeners = new ArrayList<Listener>();
87
	
88

  
89
	
83 90
	/**
84 91
	 * Instantiates a new properties selector.
85 92
	 *
......
97 104

  
98 105
		// word_pos
99 106
		propertiesLabel = new Label(this, SWT.NONE);
100
		propertiesLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
101
				true));
107
		propertiesLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));
102 108

  
103 109
		openeditdialog = new Button(this, SWT.PUSH);
104
		openeditdialog.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
105
				true));
110
		openeditdialog.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));
106 111
		openeditdialog.setText(TXMUIMessages.edit);
107 112

  
108 113
		openeditdialog.addSelectionListener(new SelectionListener() {
......
156 161
		for (Property p : selectedProperties) {
157 162
			if (first) {
158 163
				first = false;
159
			} else {
164
			}
165
			else {
160 166
				buffer.append(propSeparator);
161 167
			}
162
			
168

  
163 169
			if (p instanceof StructuralUnitProperty)
164
				buffer.append(((StructuralUnitProperty)p).getFullName()); 
170
				buffer.append(((StructuralUnitProperty) p).getFullName());
165 171
			else
166
				buffer.append(p.getName()); 
172
				buffer.append(p.getName());
167 173

  
168 174
		}
169 175
		if (buffer.length() > 0) {
170 176
			int l = buffer.length();
171 177
			String s = buffer.substring(0, buffer.length());
172
			if (l > MAXLABELLENGHT) s = s.substring(0, MAXLABELLENGHT)+"...";
178
			if (l > MAX_LABEL_LENGHT) {
179
				s = s.substring(0, MAX_LABEL_LENGHT) + "...";
180
			}
173 181
			propertiesLabel.setText(s);
174 182
			propertiesLabel.getParent().layout();
175 183
			propertiesLabel.getParent().getParent().layout();
176 184
			propertiesLabel.getParent().getParent().getParent().layout();
177
			//propertiesLabel.update(); //this line cause the SWT env to go crazy with Ubuntu 14.04 !!!
185
			// propertiesLabel.update(); //this line cause the SWT env to go
186
			// crazy with Ubuntu 14.04 !!!
178 187
		}
179
		
188

  
180 189
		if (!previous.equals(propertiesLabel.getText())) { // value changed !
181 190
			for (Listener l : listeners) {
182 191
				l.handleEvent(null);
......
213 222
			
214 223
			for (int i = 0; i < availableProperties.size(); i++) {
215 224
				// remove TXM internal properties
216
				if (availableProperties.get(i).getName().equals("id")) { //$NON-NLS-1$
225
				if (availableProperties.get(i).getName().equals(CorpusBuild.ID)) {
217 226
					availableProperties.remove(i);
218 227
					i--;
219 228
				}
......
335 344
		setProperties(new ArrayList<P>(), new ArrayList<P>());
336 345
	}
337 346

  
338
	ArrayList<Listener> listeners = new ArrayList<Listener>();
339 347
	public void addValueChangeListener(Listener listener) {
340 348
		listeners.add(listener);
341 349
	}
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 1406)
92 92
	private List<String> rownames = null;
93 93

  
94 94
	/** The name. */
95
	private String name;
95
	//private String name;
96 96

  
97 97
	/** The symbol. */
98 98
	private String symbol;
......
162 162
	@Override
163 163
	public boolean loadParameters() {
164 164
		this.lexicalTable = (LexicalTable) this.parent;
165
		this.lexicalTable.setVMaxFilter(Integer.MAX_VALUE); // FIXME: useless?
165
		//this.lexicalTable.setVMaxFilter(Integer.MAX_VALUE); // FIXME: useless?
166 166
		return true;
167 167
	}
168 168

  
......
192 192
			SpecificitiesR rSpecificities = new SpecificitiesR(data);
193 193
			double[][] specIndex = rSpecificities.getScores();
194 194

  
195
			String sname = null;
196
			if (this.lexicalTable.getProperty() != null) {
197
				sname = this.lexicalTable.getProperty().getName();
198
			} else {
199
				sname = this.lexicalTable.getParent().toString();
200
			}
201
			
202 195
			if (this.lexicalTable.getPartition() != null) {
203
				init(symbol, specIndex, sname); 
196
				init(symbol, specIndex); 
204 197
			} else {
205
				init(rSpecificities.getSymbol(), specIndex, sname); //$NON-NLS-1$
198
				init(rSpecificities.getSymbol(), specIndex); //$NON-NLS-1$
206 199
			}
207 200
		//}
208 201
		
......
225 218
	 * @param maxScore if abs(score) > maxScore -> score = +/- maxScore
226 219
	 * @throws StatException the stat exception
227 220
	 */
228
	protected void init(String symbol, double[][] specIndex, String name) throws Exception {
221
	protected void init(String symbol, double[][] specIndex) throws Exception {
229 222
		
230 223
		this.symbol = symbol;
231 224

  
232 225
		if (this.lexicalTable == null) {
233 226
			throw new IllegalArgumentException(SpecificitiesCoreMessages.theLexicalTableCannotBeNull);
234 227
		}
235
		this.name = name;
228
		//this.name = name;
236 229

  
237 230
		if (specIndex == null || specIndex.length == 0) {
238 231
			throw new IllegalArgumentException(SpecificitiesCoreMessages.noSpecificitiesIndexArray);
......
678 671
//			setPartName(specificitiesResult.getName());
679 672
//		}
680 673
		// FIXME: to define
681
		if(name != null)	{
682
			return name;	
674
		try {
675
//			if (this.lexicalTable.getProperty() != null) {
676
				return this.lexicalTable.getProperty().getName();
677
//			}
678
//			else {
679
//				return this.lexicalTable.getParent().toString();
680
//			}
683 681
		}
684
		else	{
682
		catch (Exception e) {
685 683
			return this.getEmptyName();
686 684
		}
687

  
688
		
689 685
	}
690 686

  
691 687

  
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/adapters/CorpusAdapterFactory.java (revision 1406)
34 34
			return new TXMResultAdapter() {
35 35
				@Override
36 36
				public Object[] getChildren(Object corpus) {
37
					List<TXMResult> allChildren = ((CQPCorpus) corpus).getChildren();
38

  
37
					
38
					//List<TXMResult> allChildren = ((CQPCorpus) corpus).getChildren();
39
					List<TXMResult> allChildren = ((TXMResult) corpus).getChildren(!TBXPreferences.getInstance().getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES));
40
					
41
					
39 42
					ArrayList partitions = new ArrayList();
40 43
					ArrayList subcorporas = new ArrayList();
41 44
					ArrayList resultsChildren = new ArrayList();
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 1406)
69 69
			// Reopening from existing result
70 70
			if(selection instanceof Specificities)	{
71 71
				specificities = (Specificities) selection;
72
				//lexicalTable = (LexicalTable) ((Specificities) selection).getParent();
72 73
			}
73 74
			// Creating
74 75
			else	{
......
94 95
					return super.logCanNotExecuteCommand(selection);
95 96
				}
96 97
				specificities = new Specificities(lexicalTable);
98
				
99
				if(!(selection instanceof LexicalTable))	{
100
					lexicalTable.setVisible(false);
101
				}
102

  
103
				//lexicalTable.setVisible(false);
97 104
			}
98 105
			
99
			if(!(selection instanceof LexicalTable))	{
100
				lexicalTable.setVisible(false);
101
			}
106
//			if(!(selection instanceof LexicalTable))	{
107
//				lexicalTable.setVisible(false);
108
//			}
102 109

  
103 110
			TXMEditor.openEditor(specificities, SpecificitiesEditor.ID);
104 111
//			TXMEditor.openEditor(lexicalTable, LexicalTableEditor.ID);
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 1406)
102 102
			GLComposite mainParametersArea = this.getMainParametersComposite();
103 103
			mainParametersArea.getLayout().numColumns = 2;
104 104
			
105
			// unit property
106
			new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property);
107
			this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true,
108
					CQPCorpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(),
109
					this.getResult().getUnitProperty(), false);
110

  
105
			// parent parameters
106
			if (!this.getResult().getParent().isVisible())	{
107
				// unit property
108
				new Label(mainParametersArea, SWT.NONE).setText(TXMCoreMessages.common_property);
109
				this.unitPropertyComboViewer = new PropertiesComboViewer(mainParametersArea, this, true,
110
						CQPCorpus.getFirstParentCorpus(this.getResult()).getOrderedProperties(),
111
						this.getResult().getUnitProperty(), false);
112
			}
111 113
			
112 114
			// Extended parameters
113 115
			Composite extendedParametersArea = this.getExtendedParametersGroup();

Also available in: Unified diff