Révision 2951

tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Line.java (revision 2951)
49 49
 * @author jmague
50 50
 */
51 51
public class Line {
52

  
52
	
53 53
	/** The concordance. */
54 54
	private Concordance concordance;
55

  
55
	
56 56
	/** The left ctx view properties. */
57 57
	private Map<Property, List<String>> leftCtxViewPropertiesValues;
58 58
	
......
61 61
	
62 62
	/** The right ctx view properties. */
63 63
	private Map<Property, List<String>> rightCtxViewValues;
64

  
64
	
65 65
	/** The left ctx analysis property. */
66 66
	private HashMap<Property, List<String>> leftCtxAnalysisValues;
67 67
	
......
72 72
	private HashMap<Property, List<String>> rightCtxAnalysisValues;
73 73
	
74 74
	/** The proerty values separator. */
75
	public static String PROP_SEPARTOR ="_"; //$NON-NLS-1$
76

  
75
	public static String PROP_SEPARTOR = "_"; //$NON-NLS-1$
76
	
77 77
	/** The references : view and sort */
78 78
	private Reference refView;
79
	
79 80
	private Reference refAna;
80 81
	
81 82
	/** The match. */
82 83
	private Match match;
83

  
84
	
84 85
	/** the line's text. */
85 86
	private String textId;
86

  
87
	
87 88
	/** the ids of the keywords. */
88 89
	private List<String> keywordsIdValues;
89

  
90
	
90 91
	/** The keywordpos. */
91 92
	private int keywordpos;
92 93
	
......
94 95
	 * the @target corpus position of the query
95 96
	 */
96 97
	private int targetpos;
97

  
98
	
98 99
	/**
99 100
	 * Instantiates a new line.
100 101
	 *
......
117 118
			Map<Property, List<String>> rightCtxViewValues,
118 119
			HashMap<Property, List<String>> leftCtxAnalysisValues,
119 120
			HashMap<Property, List<String>> keywordsAnalysisValues,
120
			HashMap<Property, List<String>> rightCtxAnalysisValues, Reference refView,
121
			Reference refAna, Match match, int targetpos) {
121
			HashMap<Property, List<String>> rightCtxAnalysisValues,
122
			Reference refView, Reference refAna,
123
			Match match, int targetpos) {
122 124
		this.textId = textId;
123 125
		this.targetpos = targetpos;
124 126
		this.keywordsIdValues = keywordsIdValues;
......
132 134
		this.refView = refView;
133 135
		this.refAna = refAna;
134 136
		this.match = match;
135
		this.keywordpos = match.getStart();	}
136

  
137
		this.keywordpos = match.getStart();
138
	}
139
	
137 140
	/**
138 141
	 * Gets the keywords analysis property.
139 142
	 * 
......
151 154
	public HashMap<Property, List<String>> getLeftAnalysisProperty() {
152 155
		return leftCtxAnalysisValues;
153 156
	}
154

  
157
	
155 158
	/**
156 159
	 * Gets the right ctx analysis property.
157 160
	 * 
......
160 163
	public HashMap<Property, List<String>> getRightAnalysisProperty() {
161 164
		return rightCtxAnalysisValues;
162 165
	}
163

  
166
	
164 167
	/**
165 168
	 * Gets the keywords view properties.
166 169
	 * 
......
169 172
	public Map<Property, List<String>> getKeywordsViewProperties() {
170 173
		return keywordsViewValues;
171 174
	}
172

  
175
	
173 176
	/**
174 177
	 * Gets the left context view properties.
175 178
	 * 
......
178 181
	public Map<Property, List<String>> getLeftCtxViewProperties() {
179 182
		return leftCtxViewPropertiesValues;
180 183
	}
181

  
184
	
182 185
	/**
183 186
	 * Gets the right context view properties.
184 187
	 * 
......
187 190
	public Map<Property, List<String>> getRightCtxViewProperties() {
188 191
		return rightCtxViewValues;
189 192
	}
190

  
193
	
191 194
	/**
192 195
	 * Gets the reference.
193 196
	 * 
......
206 209
		return refAna;
207 210
	}
208 211
	
209

  
212
	
210 213
	/**
211 214
	 * Gets the Line left context size.
212 215
	 * 
......
216 219
		if (leftCtxViewPropertiesValues.values().size() == 0) return 0;
217 220
		return leftCtxViewPropertiesValues.values().iterator().next().size();
218 221
	}
219

  
222
	
220 223
	/**
221 224
	 * Gets the Line keywords size.
222 225
	 * 
......
226 229
		if (keywordsViewValues.values().size() == 0) return 0;
227 230
		return keywordsViewValues.values().iterator().next().size();
228 231
	}
229

  
232
	
230 233
	/**
231 234
	 * Gets the Line right context size.
232 235
	 * 
......
236 239
		if (rightCtxViewValues.values().size() == 0) return 0;
237 240
		return rightCtxViewValues.values().iterator().next().size();
238 241
	}
239

  
242
	
240 243
	/**
241 244
	 * Gets the match.
242 245
	 * 
......
250 253
	 * Returns a string representing the left context.
251 254
	 *
252 255
	 * @param propertySeparator The string used to separate the dif ferent view properties for
253
	 * each word
256
	 *            each word
254 257
	 * @param wordSeparator The string used to separate the dif ferent words
255 258
	 * @param limit the limit
256 259
	 * @return The string representation
......
261 264
	}
262 265
	
263 266
	
267
	@Override
264 268
	public String toString() {
265
		return match.toString()+"="+keywordsViewValues;
269
		return match.toString() + "=" + keywordsViewValues;
266 270
	}
271
	
267 272
	/**
268 273
	 * Returns a string representing the left context.
269 274
	 *
270 275
	 * @param propertySeparator The string used to separate the dif ferent view properties for
271
	 * each word
276
	 *            each word
272 277
	 * @param wordSeparator The string used to separate the dif ferent words
273 278
	 * @param limit the limit
274 279
	 * @return The string representation
......
280 285
		
281 286
		int currentPos = keywordpos - getLeftContextSize();
282 287
		
283
		List<String> words = new ArrayList<String>();
288
		List<String> words = new ArrayList<>();
284 289
		Map<Property, List<String>> values = getLeftCtxViewProperties();
285 290
		int max = (limit == -1) ? (values.get(concordance
286 291
				.getLeftViewProperties().get(0)).size()) : (limit);
287 292
		int start = this.getLeftContextSize() - max;
288 293
		for (int i = start; i < this.getLeftContextSize(); i++) {
289
			List<String> word = new ArrayList<String>();
294
			List<String> word = new ArrayList<>();
290 295
			for (Property property : concordance.getLeftViewProperties()) {
291 296
				List<String> ivalues = values.get(property);
292 297
				if (ivalues == null) {
293
					System.out.println("ERROR: null ivalues in "+values+" for property "+property);
294
				} else {
298
					System.out.println("ERROR: null ivalues in " + values + " for property " + property);
299
				}
300
				else {
295 301
					word.add(ivalues.get(i));
296 302
				}
297 303
			}
......
303 309
			
304 310
			currentPos++; // next position
305 311
		}
306

  
312
		
307 313
		return LangFormater.format(StringUtils.join(words, wordSeparator),
308
				concordance.getCorpus().getLang()); //$NON-NLS-1$
314
				concordance.getCorpus().getLang());
309 315
	}
310

  
316
	
311 317
	/**
312 318
	 * Returns a string representing the keywords.
313 319
	 *
314 320
	 * @param propertySeparator The string used to separate the dif ferent view properties for
315
	 * each word
321
	 *            each word
316 322
	 * @param wordSeparator The string used to separate the dif ferent words
317 323
	 * @return The string representation
318 324
	 */
......
324 330
	 * Returns a string representing the keywords.
325 331
	 *
326 332
	 * @param propertySeparator The string used to separate the dif ferent view properties for
327
	 * each word
333
	 *            each word
328 334
	 * @param wordSeparator The string used to separate the dif ferent words
329 335
	 * @return The string representation
330 336
	 */
......
332 338
		
333 339
		int currentPos = keywordpos;
334 340
		
335
		List<String> words = new ArrayList<String>();
341
		List<String> words = new ArrayList<>();
336 342
		Map<Property, List<String>> values = getKeywordsViewProperties();
337 343
		int s = values.get(concordance.getKeywordViewProperties().get(0)).size();
338 344
		int keywordEndPos = keywordpos + s - 1;
339
		//System.out.println("Build STR of currentpos="+currentPos+" length="+s);
345
		// System.out.println("Build STR of currentpos="+currentPos+" length="+s);
340 346
		for (int i = 0; i < s; i++) {
341
			List<String> word = new ArrayList<String>();
347
			List<String> word = new ArrayList<>();
342 348
			for (Property property : concordance.getKeywordViewProperties())
343 349
				word.add(values.get(property).get(i));
344 350
			
345
			if (currentPos == targetpos) { // highlight the @ target 
346
				words.add("["+StringUtils.join(word, propertySeparator)+"]");
347
			} else {
351
			if (currentPos == targetpos) { // highlight the @ target
352
				words.add("[" + StringUtils.join(word, propertySeparator) + "]");
353
			}
354
			else {
348 355
				words.add(StringUtils.join(word, propertySeparator));
349 356
			}
350 357
			
......
355 362
			currentPos++; // next position
356 363
		}
357 364
		return LangFormater.format(StringUtils.join(words, wordSeparator),
358
				concordance.getCorpus().getLang()); //$NON-NLS-1$
365
				concordance.getCorpus().getLang());
359 366
	}
360

  
367
	
361 368
	/**
362 369
	 * Returns a string representing the right context.
363 370
	 *
364 371
	 * @param propertySeparator The string used to separate the dif ferent view properties for
365
	 * each word
372
	 *            each word
366 373
	 * @param wordSeparator The string used to separate the dif ferent words
367 374
	 * @param limit the limit
368 375
	 * @return The string representation
......
376 383
	 * Returns a string representing the right context.
377 384
	 *
378 385
	 * @param propertySeparator The string used to separate the dif ferent view properties for
379
	 * each word
386
	 *            each word
380 387
	 * @param wordSeparator The string used to separate the dif ferent words
381 388
	 * @param limit the limit
382 389
	 * @return The string representation
......
386 393
		int s = getKeywordsSize();
387 394
		if (s == 0) return "";
388 395
		
389
		List<String> words = new ArrayList<String>();
396
		List<String> words = new ArrayList<>();
390 397
		Map<Property, List<String>> values = getRightCtxViewProperties();
391 398
		int max = (limit == -1) ? (values.get(concordance.getRightViewProperties().get(0)).size()) : (limit);
392 399
		
393 400
		int currentPos = keywordpos + s;
394
		//System.out.println("Line "+keywordToString()+" right context, currentpos="+currentPos+" keywordpos="+keywordpos+" keywordlength="+s);
401
		// System.out.println("Line "+keywordToString()+" right context, currentpos="+currentPos+" keywordpos="+keywordpos+" keywordlength="+s);
395 402
		for (int i = 0; i < max; i++) {
396
			List<String> word = new ArrayList<String>();
403
			List<String> word = new ArrayList<>();
397 404
			for (Property property : concordance.getRightViewProperties())
398 405
				word.add(values.get(property).get(i));
399 406
			words.add(StringUtils.join(word, propertySeparator));
......
404 411
			currentPos++;
405 412
		}
406 413
		return LangFormater.format(StringUtils.join(words, wordSeparator),
407
				concordance.getCorpus().getLang()); 
414
				concordance.getCorpus().getLang());
408 415
	}
409 416
	
410 417
	/** The properties to process. */
......
416 423
	 * @param limit the limit
417 424
	 * @return the string
418 425
	 */
419
	public String rightContextRender(int limit)
420
	{
421
//		if(propertiesToProcess == null)
422
//			propertiesToProcess = TxmRenderer.getPropertyToRender(concordance, "jsesh"); //$NON-NLS-1$
426
	public String rightContextRender(int limit) {
427
		// if(propertiesToProcess == null)
428
		// propertiesToProcess = TxmRenderer.getPropertyToRender(concordance, "jsesh"); //$NON-NLS-1$
423 429
		
424
		List<String> words = new ArrayList<String>();
430
		List<String> words = new ArrayList<>();
425 431
		Map<Property, List<String>> values = getRightCtxViewProperties();
426 432
		int max = (limit == -1) ? (values.get(concordance.getRightViewProperties().get(0)).size()) : (limit);
427 433
		
428
		for (int i = 0; i < max; i++) 
429
		{
430
			List<String> word = new ArrayList<String>();
431
			for (Property property : concordance.getRightViewProperties())
432
			{
433
//				if(propertiesToProcess.contains(property.getName()))
434
//					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
435
//				else
436
					word.add(values.get(property).get(i));
434
		for (int i = 0; i < max; i++) {
435
			List<String> word = new ArrayList<>();
436
			for (Property property : concordance.getRightViewProperties()) {
437
				// if(propertiesToProcess.contains(property.getName()))
438
				// word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
439
				// else
440
				word.add(values.get(property).get(i));
437 441
			}
438 442
			words.add(StringUtils.join(word, "_")); //$NON-NLS-1$
439 443
		}
440 444
		return LangFormater.format(StringUtils.join(words, " "), //$NON-NLS-1$
441
				concordance.getCorpus().getLang()); //$NON-NLS-1$
445
				concordance.getCorpus().getLang());
442 446
	}
443 447
	
444 448
	/**
......
448 452
	 * @return the string
449 453
	 */
450 454
	public String keywordRender(String wordSeparator) {
451
//		if(propertiesToProcess == null)
452
//			propertiesToProcess = TxmRenderer.getPropertyToRender(concordance, "jsesh"); //$NON-NLS-1$
455
		// if(propertiesToProcess == null)
456
		// propertiesToProcess = TxmRenderer.getPropertyToRender(concordance, "jsesh"); //$NON-NLS-1$
453 457
		
454
		List<String> words = new ArrayList<String>();
458
		List<String> words = new ArrayList<>();
455 459
		Map<Property, List<String>> values = getKeywordsViewProperties();
456 460
		for (int i = 0; i < values.get(
457 461
				concordance.getKeywordViewProperties().get(0)).size(); i++) {
458
			List<String> word = new ArrayList<String>();
459
			for (Property property : concordance.getKeywordViewProperties())
460
			{
461
//				if(propertiesToProcess.contains(property.getName()))
462
//					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
463
//				else
464
					word.add(values.get(property).get(i));
462
			List<String> word = new ArrayList<>();
463
			for (Property property : concordance.getKeywordViewProperties()) {
464
				// if(propertiesToProcess.contains(property.getName()))
465
				// word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
466
				// else
467
				word.add(values.get(property).get(i));
465 468
			}
466 469
			words.add(StringUtils.join(word, wordSeparator));
467 470
		}
468 471
		return LangFormater.format(StringUtils.join(words, wordSeparator),
469
				concordance.getCorpus().getLang()); //$NON-NLS-1$
472
				concordance.getCorpus().getLang());
470 473
	}
471 474
	
472 475
	/**
......
476 479
	 * @return the string
477 480
	 */
478 481
	public String leftContextRender(int limit) {
479
		List<String> words = new ArrayList<String>();
482
		List<String> words = new ArrayList<>();
480 483
		Map<Property, List<String>> values = getLeftCtxViewProperties();
481 484
		int max = (limit == -1) ? (values.get(concordance
482 485
				.getLeftViewProperties().get(0)).size()) : (limit);
483 486
		int start = this.getLeftContextSize() - max;
484 487
		for (int i = start; i < this.getLeftContextSize(); i++) {
485
			List<String> word = new ArrayList<String>();
488
			List<String> word = new ArrayList<>();
486 489
			for (Property property : concordance.getLeftViewProperties()) {
487
//				if(propertiesToProcess.contains(property.getName()))
488
//					word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
489
//				else
490
					word.add(values.get(property).get(i));
490
				// if(propertiesToProcess.contains(property.getName()))
491
				// word.add(TxmRenderer.jseshrenderer.render(values.get(property).get(i)));
492
				// else
493
				word.add(values.get(property).get(i));
491 494
			}
492 495
			words.add(StringUtils.join(word, "_")); //$NON-NLS-1$
493 496
		}
494

  
497
		
495 498
		return LangFormater.format(StringUtils.join(words, " "), //$NON-NLS-1$
496
				concordance.getCorpus().getLang()); //$NON-NLS-1$
499
				concordance.getCorpus().getLang());
497 500
	}
498

  
501
	
499 502
	/**
500 503
	 * Returns a string representing the left context. Equivalent to
501 504
	 * leftContextToString("/"," ")
......
503 506
	 * @return The string representation
504 507
	 */
505 508
	public String leftContextToString() {
506
		return leftContextToString(PROP_SEPARTOR, " ", -1); //$NON-NLS-1$ 
509
		return leftContextToString(PROP_SEPARTOR, " ", -1); //$NON-NLS-1$
507 510
	}
508

  
511
	
509 512
	/**
510 513
	 * Left context to string.
511 514
	 *
......
513 516
	 * @return the string
514 517
	 */
515 518
	public String leftContextToString(int limit) {
516
		return leftContextToString(PROP_SEPARTOR, " ", limit); //$NON-NLS-1$ 
519
		return leftContextToString(PROP_SEPARTOR, " ", limit); //$NON-NLS-1$
517 520
	}
518

  
521
	
519 522
	/**
520 523
	 * Returns a string representing the keywords. Equivalent to
521 524
	 * keywordToString("/"," ")
......
523 526
	 * @return The string representation
524 527
	 */
525 528
	public String keywordToString() {
526
		return keywordToString(PROP_SEPARTOR, " "); //$NON-NLS-1$ 
529
		return keywordToString(PROP_SEPARTOR, " "); //$NON-NLS-1$
527 530
	}
528

  
531
	
529 532
	/**
530 533
	 * Returns a string representing the right context. Equivalent to
531 534
	 * rightContextToString("/"," ")
......
533 536
	 * @return The string representation
534 537
	 */
535 538
	public String rightContextToString() {
536
		return rightContextToString(PROP_SEPARTOR, " ", -1); //$NON-NLS-1$ 
539
		return rightContextToString(PROP_SEPARTOR, " ", -1); //$NON-NLS-1$
537 540
	}
538

  
541
	
539 542
	/**
540 543
	 * Right context to string.
541 544
	 *
......
543 546
	 * @return the string
544 547
	 */
545 548
	public String rightContextToString(int limit) {
546
		return rightContextToString(PROP_SEPARTOR, " ", limit); //$NON-NLS-1$ 
549
		return rightContextToString(PROP_SEPARTOR, " ", limit); //$NON-NLS-1$
547 550
	}
548

  
551
	
549 552
	/**
550 553
	 * Match get start.
551 554
	 *
......
554 557
	public Integer matchGetStart() {
555 558
		return match.getStart();
556 559
	}
557

  
560
	
558 561
	/**
559 562
	 * Match get end.
560 563
	 *
......
563 566
	public Integer matchGetEnd() {
564 567
		return match.getEnd();
565 568
	}
566

  
569
	
567 570
	/**
568 571
	 * Match get col.
569 572
	 *
......
574 577
	public String matchGetCol(CQPCorpus corpus) throws CqiClientException {
575 578
		return org.txm.searchengine.cqp.corpus.query.Match.getValueForProperty(corpus.getProperty("col"), match.getStart()); //$NON-NLS-1$
576 579
	}
577

  
580
	
578 581
	/**
579 582
	 * Match get id.
580 583
	 *
......
585 588
	public List<String> matchGetId(CQPCorpus corpus) throws CqiClientException {
586 589
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty("id"), match); //$NON-NLS-1$
587 590
	}
588

  
591
	
589 592
	/**
590 593
	 * Match get id.
591 594
	 *
......
598 601
			throws CqiClientException {
599 602
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty("id"), positions); //$NON-NLS-1$
600 603
	}
601

  
604
	
602 605
	/**
603 606
	 * Match get propertie.
604 607
	 *
......
610 613
	 */
611 614
	public List<String> matchGetPropertie(CQPCorpus corpus, String property,
612 615
			int[] positions) throws CqiClientException {
613
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty(property), positions); //$NON-NLS-1$
616
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(corpus.getProperty(property), positions);
614 617
	}
615

  
618
	
616 619
	/**
617 620
	 * Match get properties.
618 621
	 *
......
624 627
	 */
625 628
	public List<String> matchGetProperties(CQPCorpus corpus, Property property,
626 629
			int[] positions) throws CqiClientException {
627
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(property, positions); //$NON-NLS-1$
630
		return org.txm.searchengine.cqp.corpus.query.Match.getValuesForProperty(property, positions);
628 631
	}
629

  
632
	
630 633
	/**
631 634
	 * Gets the text id.
632 635
	 *
......
635 638
	public String getTextId() {
636 639
		return this.textId;
637 640
	}
638

  
641
	
639 642
	/**
640 643
	 * Gets the concordance.
641 644
	 *
......
644 647
	public Concordance getConcordance() {
645 648
		return concordance;
646 649
	}
647

  
650
	
648 651
	/**
649 652
	 * Gets the keyword ids.
650 653
	 *
......
653 656
	public Collection<? extends String> getKeywordIds() {
654 657
		return this.keywordsIdValues;
655 658
	}
656

  
659
	
657 660
	/**
658 661
	 * Gets the keyword position.
659 662
	 *
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 2951)
39 39
import java.util.Comparator;
40 40
import java.util.HashMap;
41 41
import java.util.HashSet;
42
import java.util.LinkedHashMap;
42 43
import java.util.List;
43 44
import java.util.Map;
44 45

  
......
249 250
			this.availableRightSortProperties.removeAll(pAnalysisRightProperties);
250 251
			
251 252
			String refPropertyNames = this.getStringParameterValue(ConcordancePreferences.VIEW_REFERENCE_PATTERN);
253
			String refPropertyNames2 = this.getCorpus().getProject().getCommandPreferences("concordance").get(ConcordancePreferences.VIEW_REFERENCE_PATTERN);
254
			if (refPropertyNames2 != null && refPropertyNames2.length() > 0) {
255
				refPropertyNames = refPropertyNames2;
256
			}
252 257
			if ("*".equals(refPropertyNames)) {
253 258
				Property refProperty = this.getCorpus().getProperty("ref");//$NON-NLS-1$
254 259
				if (refProperty == null) {
......
801 806
					}
802 807
					
803 808
					// get the kth line reference values
804
					Map<Property, String> ref = new HashMap<>();
809
					LinkedHashMap<Property, String> ref = new LinkedHashMap<>();
805 810
					for (Property property : pViewRefPattern) {
806 811
						ref.put(property, refValues.get(property).get(k).get(0));
807 812
					}
808 813
					
809 814
					// get the kth line reference values
810
					Map<Property, String> refAna = new HashMap<>();
815
					LinkedHashMap<Property, String> refAna = new LinkedHashMap<>();
811 816
					for (Property property : pAnalysisRefPattern) {
812 817
						refAna.put(property, refSortValues.get(property).get(k).get(0));
813 818
					}
......
1820 1825
	public String getResultType() {
1821 1826
		return ConcordanceCoreMessages.RESULT_TYPE;
1822 1827
	}
1823
	
1824 1828
}
tmp/org.txm.concordance.core/src/org/txm/concordance/core/preferences/ConcordancePreferences.java (revision 2951)
12 12
 *
13 13
 */
14 14
public class ConcordancePreferences extends TXMPreferences {
15

  
15
	
16 16
	// FIXME; Should be stored at an higher level, eg. "Pagination"
17 17
	@Deprecated
18 18
	public static final String N_LINES_PER_PAGE = "n_lines_per_page"; //$NON-NLS-1$
19 19
	
20 20
	public static final String LEFT_CONTEXT_SIZE = "left_context_size"; //$NON-NLS-1$
21
	
21 22
	public static final String RIGHT_CONTEXT_SIZE = "right_context_size"; //$NON-NLS-1$
22

  
23
	
23 24
	public static final String LEFT_ANALYSIS_PROPERTIES = "left_analysis_properties"; //$NON-NLS-1$
25
	
24 26
	public static final String KEYWORD_ANALYSIS_PROPERTIES = "keyword_analysis_properties"; //$NON-NLS-1$
27
	
25 28
	public static final String RIGHT_ANALYSIS_PROPERTIES = "right_analysis_properties"; //$NON-NLS-1$
29
	
26 30
	public static final String LEFT_VIEW_PROPERTIES = "left_view_properties"; //$NON-NLS-1$
31
	
27 32
	public static final String KEYWORD_VIEW_PROPERTIES = "keyword_view_properties"; //$NON-NLS-1$
33
	
28 34
	public static final String RIGHT_VIEW_PROPERTIES = "right_view_properties"; //$NON-NLS-1$
35
	
29 36
	/** The default value is "*" -> The concordance will use ref or text_id */
30 37
	public static final String ANALYSIS_REFERENCE_PATTERN = "analysis_pattern"; //$NON-NLS-1$
38
	
31 39
	/** The default value is "*" -> The concordance will use ref or text_id */
32 40
	public static final String VIEW_REFERENCE_PATTERN = "view_pattern"; //$NON-NLS-1$
41
	
33 42
	public static final String LIMIT_CQL = "limit_cql"; //$NON-NLS-1$
43
	
34 44
	public static final String TOP_INDEX = "top_index"; //$NON-NLS-1$
35 45
	
36 46
	/**
37 47
	 * Gets the instance.
48
	 * 
38 49
	 * @return the instance
39 50
	 */
40
	public static TXMPreferences getInstance()	{
51
	public static TXMPreferences getInstance() {
41 52
		if (!TXMPreferences.instances.containsKey(ConcordancePreferences.class)) {
42 53
			new ConcordancePreferences();
43 54
		}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java (revision 2951)
317 317
	protected StructuralUnit textStructuralUnit;
318 318
	
319 319
	protected WordProperty wordProperty = null;
320

  
320
	
321 321
	private List<VirtualProperty> virtualProperties;
322 322
	
323 323
	/**
......
993 993
	public List<Partition> getPartitions() {
994 994
		return getChildren(Partition.class);
995 995
	}
996
		
996
	
997 997
	/**
998 998
	 * Gets the virtual properties of this corpus.
999 999
	 * 
......
1008 1008
		if (virtualProperties == null) {
1009 1009
			virtualProperties = new ArrayList<>();
1010 1010
			virtualProperties.add(new PositionProperty(this));
1011
			virtualProperties.add(new LengthProperty(this));
1011
			// virtualProperties.add(new LengthProperty(this));
1012 1012
		}
1013 1013
		return virtualProperties;
1014 1014
	}
......
1066 1066
					return property;
1067 1067
				}
1068 1068
			}
1069
		} else {
1069
		}
1070
		else {
1070 1071
			for (WordProperty property : getProperties()) {
1071 1072
				if (property.getName().equals(name)) {
1072 1073
					return property;
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java (revision 2951)
28 28
package org.txm.searchengine.cqp;
29 29

  
30 30
import java.util.ArrayList;
31
import java.util.Collection;
31 32
import java.util.Iterator;
32 33
import java.util.List;
33 34

  
......
40 41
import org.txm.searchengine.cqp.corpus.VirtualProperty;
41 42
import org.txm.utils.logger.Log;
42 43

  
43
// TODO: Auto-generated Javadoc
44 44
/**
45
 * how to display the references.
45
 * References configuration : a list of properties and optionally a sprintf like pattern
46 46
 *
47 47
 * @author mdecorde
48 48
 */
......
51 51
	/** The properties. */
52 52
	private List<Property> properties = new ArrayList<>();
53 53
	
54
	private String pattern;
55
	
54 56
	/**
55 57
	 * 
56 58
	 * @param corpus
......
59 61
	 */
60 62
	public static ReferencePattern stringToReferencePattern(CQPCorpus corpus, String v) {
61 63
		try {
62
			ReferencePattern props = new ReferencePattern();
64
			
65
			String pattern = null;
66
			if (v.contains("\t\t")) {
67
				pattern = v.substring(v.indexOf("\t\t") + 2);
68
				v = v.substring(0, v.indexOf("\t\t"));
69
			}
70
			
71
			ReferencePattern props = new ReferencePattern(pattern);
63 72
			if (v == null) return props;
64 73
			if (v.length() == 0) return props;
65 74
			
......
82 91
					}
83 92
				}
84 93
			}
94
			
95
			
96
			
85 97
			return props;
86 98
		}
87 99
		catch (Exception e) {
......
103 115
	 * @param parameters the properties
104 116
	 */
105 117
	public ReferencePattern(Property prop) {
106
		List<Property> properties = new ArrayList<>();
107 118
		properties.add(prop);
108 119
		this.properties = properties;
109 120
	}
......
114 125
	 * @param parameters the properties
115 126
	 */
116 127
	public ReferencePattern(StructuralUnitProperty prop) {
117
		List<Property> properties = new ArrayList<>();
118 128
		properties.add(prop);
119
		this.properties = properties;
129
		this.pattern = null;
120 130
	}
121 131
	
122 132
	/**
......
126 136
	 */
127 137
	public ReferencePattern(List<Property> properties) {
128 138
		this.properties = properties;
139
		this.pattern = null;
129 140
	}
130 141
	
131 142
	/**
143
	 * Instantiates a new reference pattern.
144
	 *
145
	 * @param properties the properties
146
	 */
147
	public ReferencePattern(List<Property> properties, String pattern) {
148
		this.properties = properties;
149
		this.pattern = pattern;
150
	}
151
	
152
	public ReferencePattern(Property property, String pattern) {
153
		this.properties.add(property);
154
		this.pattern = pattern;
155
	}
156
	
157
	/**
158
	 * Don't forget to set the properties latter
159
	 * 
160
	 * @param pattern the sprintf pattern
161
	 */
162
	public ReferencePattern(String pattern) {
163
		this.pattern = pattern;
164
	}
165
	
166
	/**
132 167
	 * Adds the property.
133 168
	 *
134 169
	 * @param property the property
......
139 174
		return this;
140 175
	}
141 176
	
177
	public String format(Collection<String> collection) {
178
		return String.format(pattern, collection.toArray()).toString();
179
	}
180
	
181
	public String format(String[] values) {
182
		return String.format(pattern, values).toString();
183
	}
184
	
142 185
	/*
143 186
	 * (non-Javadoc)
144 187
	 * @see java.lang.Iterable#iterator()
......
157 200
		return properties;
158 201
	}
159 202
	
203
	public String getPattern() {
204
		return pattern;
205
	}
206
	
207
	public void setPattern(String pattern) {
208
		this.pattern = pattern;
209
	}
210
	
160 211
	/*
161 212
	 * (non-Javadoc)
162 213
	 * @see java.lang.Object#toString()
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/Reference.java (revision 2951)
28 28
package org.txm.searchengine.cqp;
29 29

  
30 30
import java.util.HashMap;
31
import java.util.LinkedHashMap;
31 32
import java.util.List;
32 33
import java.util.Map;
33 34

  
......
37 38

  
38 39
// TODO: Auto-generated Javadoc
39 40
/**
40
 * The Class Reference: 
41
 * The Class Reference:
41 42
 * defines a pattern of word and/or structure properties
42 43
 *
43 44
 * @author mdecorde
44 45
 */
45 46
public class Reference {
46

  
47
	
47 48
	/** The values. */
48
	Map<Property, String> values;
49
	LinkedHashMap<Property, String> values;
49 50
	
50 51
	/** The reference pattern. */
51 52
	private ReferencePattern referencePattern = new ReferencePattern();
52

  
53
	
53 54
	/**
54 55
	 * Instantiates a new reference.
55 56
	 *
56 57
	 * @param values the values
57 58
	 * @param referencePattern the reference pattern
58 59
	 */
59
	public Reference(Map<Property, String> values, ReferencePattern referencePattern) {
60
	public Reference(LinkedHashMap<Property, String> values, ReferencePattern referencePattern) {
60 61
		this.values = values;
61 62
		this.referencePattern = referencePattern;
62 63
	}
63

  
64
	
64 65
	/**
65 66
	 * Instantiates a new reference.
66 67
	 *
......
71 72
	public Reference(Match match, ReferencePattern referencePattern)
72 73
			throws CqiClientException {
73 74
		this.referencePattern = referencePattern;
74
		this.values = new HashMap<Property, String>();
75
		for (Property property : referencePattern)
75
		this.values = new LinkedHashMap<>();
76
		for (Property property : referencePattern) {
76 77
			values.put(property, match.getValueForProperty(property));
78
		}
77 79
	}
78

  
80
	
79 81
	/**
80 82
	 * Gets the reference pattern.
81 83
	 *
......
84 86
	public ReferencePattern getReferencePattern() {
85 87
		return referencePattern;
86 88
	}
87

  
89
	
88 90
	/**
89 91
	 * Gets the properties.
90 92
	 *
......
93 95
	public List<Property> getProperties() {
94 96
		return referencePattern.getProperties();
95 97
	}
96

  
98
	
97 99
	/**
100
	 * Gets the properties.
101
	 *
102
	 * @return the properties
103
	 */
104
	public String format() {
105
		if (referencePattern.getPattern() != null && referencePattern.getPattern().length() > 0) {
106
			return referencePattern.format(values.values());
107
		}
108
		else {
109
			return toString();
110
		}
111
	}
112
	
113
	/**
98 114
	 * Gets the value.
99 115
	 *
100 116
	 * @param property the property
......
103 119
	public String getValue(Property property) {
104 120
		return values.get(property);
105 121
	}
106

  
122
	
107 123
	/**
108 124
	 * Checks if is oK.
109 125
	 *
......
112 128
	public boolean isOK() {
113 129
		return (referencePattern != null && !values.isEmpty());
114 130
	}
115

  
116
	/* (non-Javadoc)
131
	
132
	/*
133
	 * (non-Javadoc)
117 134
	 * @see java.lang.Object#toString()
118 135
	 */
119 136
	@Override
120 137
	public String toString() {
121 138
		if (values.isEmpty())
122 139
			return ""; //$NON-NLS-1$
123
		//Iterator<Entry<Property, String>> iter = values.entrySet().iterator();
124
		//Entry<Property, String> entry = iter.next();
140
		// Iterator<Entry<Property, String>> iter = values.entrySet().iterator();
141
		// Entry<Property, String> entry = iter.next();
125 142
		StringBuffer buffer = new StringBuffer(""); //$NON-NLS-1$
126 143
		/*
127
		 * 
128
		 if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
129
			StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
130
			//buffer.append(sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
131
			buffer.append(entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
132
		} else {
133
			//buffer.append(entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$
134
			buffer.append(entry.getValue()); //$NON-NLS-1$
144
		 * if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
145
		 * StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
146
		 * //buffer.append(sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
147
		 * buffer.append(entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
148
		 * } else {
149
		 * //buffer.append(entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$
150
		 * buffer.append(entry.getValue()); //$NON-NLS-1$
151
		 * }
152
		 * while (iter.hasNext()) {
153
		 * entry = iter.next();
154
		 * if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
155
		 * StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
156
		 * //buffer.append(", " + sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
157
		 * buffer.append(", " +entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
158
		 * } else {
159
		 * //buffer.append(", " + entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
160
		 * buffer.append(", " + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
161
		 * }
162
		 * }
163
		 */
164
		for (Property p : this.getProperties()) {
165
			buffer.append(values.get(p) + ", "); //$NON-NLS-1$
135 166
		}
136

  
137
		while (iter.hasNext()) {
138
			entry = iter.next();
139
			if (StructuralUnitProperty.class.isInstance(entry.getKey())) {
140
				StructuralUnitProperty sProperty = (StructuralUnitProperty) entry.getKey();
141
				//buffer.append(", " + sProperty.getStructuralUnit() + "(" + entry.getKey().toString() + "):" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
142
				buffer.append(", " +entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
143
			} else {
144
				//buffer.append(", " + entry.getKey().toString() + ":" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
145
				buffer.append(", " + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
146
			}
147
		}*/
148
		for(Property p : this.getProperties())
149
		{
150
			buffer.append(values.get(p)+", "); //$NON-NLS-1$
151
		}
152 167
		if (buffer.length() > 0)
153
			return buffer.substring(0, buffer.length()-2); 
168
			return buffer.substring(0, buffer.length() - 2);
154 169
		else
155 170
			return ""; //$NON-NLS-1$
156 171
	}
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/projects/antract/FixINATRSMacro.groovy (revision 2951)
19 19
	if (!trsFile.getName().endsWith(".trs")) {
20 20
		continue;
21 21
	}
22
	String content = trsFile.getText("UTF-8")
22
	String content = trsFile.getText("ISO-8859-1")
23 23
	content = content.replaceAll("punct=\"([^\"]+)\"\">", "punct=\"\$1\">")
24 24
	content = content.replaceAll("<unk>", "???")
25 25
	content = content.replaceAll(" Time=\"", " time=\"")
26 26
	content = content.replaceAll("<w startTime=\"0.00\" endTime=\"0\" conf=\"\" pos=\"\" punct=\"\" case=\"\" ne=\"\"></w>\n", "")
27 27
	content = content.replaceAll("<Turn startTime=\"<o,o,o>\" endTime=\"\" speaker=\"0\">\n<Sync time=\"<o,o,o>\"/>\n</Turn>\n", "")
28 28
	content = content.replaceAll("<Section type=\"report\" startTime=\"<o,o,o>\" endTime=\"\">", "<Section type=\"report\" startTime=\"0.0\" endTime=\"\">")
29
	trsFile.setText(content, "UTF-8")
29
	trsFile.setText(content, "ISO-8859-1")
30 30
}
31 31
cpb.done()
32 32
println "Done"
tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/alceste/compiler.groovy (revision 2951)
164 164
			corpus.setID(project.getName());
165 165
			corpus.setName(project.getName());
166 166
		}
167
		corpus.setDescription("Build the Alceste import module");
167
		corpus.setDescription("Built by the Alceste import module");
168 168

  
169 169
		File cqpFile = new File(binDir,"cqp/"+corpusname+".cqp");
170 170
cqpFile.delete()
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineViewReferencePattern.java (revision 2951)
48 48
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
49 49
import org.txm.concordance.rcp.editors.ConcordanceEditor;
50 50
import org.txm.rcp.messages.TXMUIMessages;
51
import org.txm.rcp.swt.dialog.ReferencePatternSelectionDialog;
51 52
import org.txm.searchengine.cqp.ReferencePattern;
52 53
import org.txm.searchengine.cqp.corpus.Property;
53 54
import org.txm.searchengine.cqp.corpus.StructuralUnit;
......
119 120
		availableReferenceItems.removeAll(concordanceEditor.getSelectedViewReferences());
120 121
		
121 122
		// System.out.println("after avail"+availableReferenceItems);
122
		DefineReferencePatternDialog d = null;
123
		d = new DefineReferencePatternDialog(window.getShell(),
123
		ReferencePatternSelectionDialog d = null;
124
		d = new ReferencePatternSelectionDialog(window.getShell(),
124 125
				availableReferenceItems, concordanceEditor
125
						.getSelectedViewReferences());
126
						.getSelectedViewReferences(), concordanceEditor.getConcordance().getRefViewPattern().getPattern());
126 127
		
127 128
		if (d.open() == Window.OK) {
128
			concordanceEditor.setRefViewPattern(new ReferencePattern(d
129
					.getSelectesdReferenceItems()));
129
			concordanceEditor.setRefViewPattern(new ReferencePattern(d.getSelectedProperties(), d.getPattern()));
130 130
			// System.out.println(concordanceEditor.getViewReferencePattern());
131
			
132 131
		}
133 132
	}
134
	
135
	/**
136
	 * The Class DefineReferencePatternDialog.
137
	 */
138
	private class DefineReferencePatternDialog extends Dialog {
139
		
140
		/** The available reference items. */
141
		private List<Property> availableReferenceItems;
142
		
143
		/** The selected reference items. */
144
		private List<Property> selectedReferenceItems;
145
		
146
		/**
147
		 * Instantiates a new define reference pattern dialog.
148
		 *
149
		 * @param parentShell the parent shell
150
		 * @param availableReferenceItems the available reference items
151
		 * @param selectedReferences the selected references
152
		 */
153
		protected DefineReferencePatternDialog(Shell parentShell,
154
				List<Property> availableReferenceItems,
155
				List<Property> selectedReferences) {
156
			super(parentShell);
157
			
158
			this.availableReferenceItems = availableReferenceItems;
159
			this.selectedReferenceItems = selectedReferences;
160
			this.availableReferenceItems.removeAll(selectedReferences);
161
			this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
162
		}
163
		
164
		/**
165
		 * Gets the selectesd reference items.
166
		 *
167
		 * @return the selectesd reference items
168
		 */
169
		public List<Property> getSelectesdReferenceItems() {
170
			return selectedReferenceItems;
171
		}
172
		
173
		/*
174
		 * (non-Javadoc)
175
		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
176
		 */
177
		@Override
178
		protected void configureShell(Shell shell) {
179
			super.configureShell(shell);
180
			shell.setText(TXMUIMessages.referencesDisplayOptions);
181
			
182
			shell.setSize(400, 500);
183
			shell.setLocation(shell.getParent().getLocation());
184
		}
185
		
186
		/*
187
		 * (non-Javadoc)
188
		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
189
		 */
190
		@Override
191
		protected Control createDialogArea(Composite parent) {
192
			
193
			Composite mainArea = new Composite(parent, SWT.NONE);
194
			mainArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
195
					true, true));
196
			mainArea.setLayout(new GridLayout(4, false));
197
			
198
			final org.eclipse.swt.widgets.List availbleItems = new org.eclipse.swt.widgets.List(
199
					mainArea, SWT.BORDER | SWT.V_SCROLL);
200
			for (Property property : availableReferenceItems) {
201
				if (property instanceof VirtualProperty) {
202
					VirtualProperty sProperty = (VirtualProperty) property;
203
					availbleItems.add(sProperty.getFullName());
204
				}
205
				else if (property instanceof StructuralUnitProperty) {
206
					StructuralUnitProperty sProperty = (StructuralUnitProperty) property;
207
					availbleItems.add(sProperty.getStructuralUnit().getName()
208
							+ ": " + property.getName()); //$NON-NLS-1$
209
				}
210
				else {
211
					availbleItems.add(property.getName());
212
				}
213
			}
214
			
215
			GridData gridData = new GridData(GridData.FILL, GridData.FILL,
216
					true, true);
217
			// Point size = availbleItems.computeSize(SWT.DEFAULT, SWT.DEFAULT);
218
			// gridData.widthHint = size.x;
219
			availbleItems.setLayoutData(gridData);
220
			
221
			Composite selectionButtons = new Composite(mainArea, SWT.NONE);
222
			selectionButtons.setLayout(new GridLayout(1, false));
223
			Button select = new Button(selectionButtons, SWT.ARROW | SWT.RIGHT);
224
			Button unselect = new Button(selectionButtons, SWT.ARROW | SWT.LEFT);
225
			
226
			final org.eclipse.swt.widgets.List selectedItems = new org.eclipse.swt.widgets.List(
227
					mainArea, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
228
			selectedItems.setLayoutData(gridData);
229
			for (Property property : selectedReferenceItems) {
230
				if (property instanceof VirtualProperty) {
231
					VirtualProperty sProperty = (VirtualProperty) property;
232
					selectedItems.add(sProperty.getFullName());
233
				}
234
				else if (property instanceof StructuralUnitProperty) {
235
					StructuralUnitProperty sProperty = (StructuralUnitProperty) property;
236
					selectedItems.add(sProperty.getStructuralUnit().getName()
237
							+ ": " + property.getName()); //$NON-NLS-1$
238
				}
239
				else {
240
					selectedItems.add(property.getName());
241
				}
242
			}
243
			
244
			// DBL CLICK Listeners
245
			selectedItems.addMouseListener(new MouseListener() {
246
				
247
				@Override
248
				public void mouseUp(MouseEvent e) {}
249
				
250
				@Override
251
				public void mouseDown(MouseEvent e) {}
252
				
253
				@Override
254
				public void mouseDoubleClick(MouseEvent e) {
255
					int ind = selectedItems.getSelectionIndex();
256
					availbleItems.add(selectedItems.getItem(ind));
257
					selectedItems.remove(ind);
258
					availableReferenceItems
259
							.add(selectedReferenceItems.get(ind));
260
					selectedReferenceItems.remove(ind);
261
					selectedItems.setSelection(ind);
262
				}
263
			});
264
			availbleItems.addMouseListener(new MouseListener() {
265
				
266
				@Override
267
				public void mouseUp(MouseEvent e) {}
268
				
269
				@Override
270
				public void mouseDown(MouseEvent e) {}
271
				
272
				@Override
273
				public void mouseDoubleClick(MouseEvent e) {
274
					int ind = availbleItems.getSelectionIndex();
275
					selectedItems.add(availbleItems.getItem(ind));
276
					availbleItems.remove(ind);
277
					selectedReferenceItems
278
							.add(availableReferenceItems.get(ind));
279
					availableReferenceItems.remove(ind);
280
					availbleItems.setSelection(ind);
281
				}
282
			});
283
			
284
			Composite orderButtons = new Composite(mainArea, SWT.NONE);
285
			orderButtons.setLayout(new GridLayout(1, false));
286
			Button up = new Button(orderButtons, SWT.ARROW | SWT.UP);
287
			Button down = new Button(orderButtons, SWT.ARROW | SWT.DOWN);
288
			
289
			select.addSelectionListener(new SelectionAdapter() {
290
				
291
				@Override
292
				public void widgetSelected(SelectionEvent e) {
293
					int ind = availbleItems.getSelectionIndex();
294
					selectedItems.add(availbleItems.getItem(ind));
295
					availbleItems.remove(ind);
296
					selectedReferenceItems
297
							.add(availableReferenceItems.get(ind));
298
					availableReferenceItems.remove(ind);
299
					availbleItems.setSelection(ind);
300
				}
301
			});
302
			
303
			unselect.addSelectionListener(new SelectionAdapter() {
304
				
305
				@Override
306
				public void widgetSelected(SelectionEvent e) {
307
					int ind = selectedItems.getSelectionIndex();
308
					availbleItems.add(selectedItems.getItem(ind));
309
					selectedItems.remove(ind);
310
					availableReferenceItems
311
							.add(selectedReferenceItems.get(ind));
312
					selectedReferenceItems.remove(ind);
313
					selectedItems.setSelection(ind);
314
				}
315
			});
316
			
317
			up.addSelectionListener(new SelectionAdapter() {
318
				
319
				@Override
320
				public void widgetSelected(SelectionEvent e) {
321
					int ind = selectedItems.getSelectionIndex();
322
					if (ind > 0) {
323
						String value = selectedItems.getItem(ind);
324
						selectedItems.remove(ind);
325
						selectedItems.add(value, ind - 1);
326
						
327
						Property prop = selectedReferenceItems.get(ind);
328
						selectedReferenceItems.remove(ind);
329
						selectedReferenceItems.add(ind - 1, prop);
330
						
331
						selectedItems.setSelection(ind - 1);
332
					}
333
				}
334
			});
335
			
336
			down.addSelectionListener(new SelectionAdapter() {
337
				
338
				@Override
339
				public void widgetSelected(SelectionEvent e) {
340
					int ind = selectedItems.getSelectionIndex();
341
					if (ind < selectedItems.getItemCount() - 1) {
342
						String value = selectedItems.getItem(ind);
343
						selectedItems.remove(ind);
344
						selectedItems.add(value, ind + 1);
345
						
346
						Property prop = selectedReferenceItems.get(ind);
347
						selectedReferenceItems.remove(ind);
348
						selectedReferenceItems.add(ind + 1, prop);
349
						
350
						selectedItems.setSelection(ind + 1);
351
					}
352
				}
353
			});
354
			
355
			return mainArea;
356
		}
357
	}
358 133
}
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 2951)
83 83
import org.eclipse.swt.widgets.Table;
84 84
import org.eclipse.swt.widgets.TableColumn;
85 85
import org.eclipse.swt.widgets.TableItem;
86
import org.eclipse.swt.widgets.Text;
86 87
import org.eclipse.ui.IEditorInput;
87 88
import org.eclipse.ui.IEditorSite;
88 89
import org.eclipse.ui.IWorkbenchPartSite;
......
127 128
import org.txm.rcp.swt.widget.AssistedQueryWidget;
128 129
import org.txm.rcp.swt.widget.NavigationWidget;
129 130
import org.txm.rcp.swt.widget.PropertiesSelector;
131
import org.txm.rcp.swt.widget.ReferencePatternSelector;
130 132
import org.txm.rcp.utils.JobHandler;
131 133
import org.txm.rcp.views.QueriesView;
132 134
import org.txm.searchengine.cqp.CQPSearchEngine;
......
306 308
	private PropertiesSelector<WordProperty> leftViewProperties;
307 309
	
308 310
	@Parameter(key = ConcordancePreferences.VIEW_REFERENCE_PATTERN)
309
	private PropertiesSelector<Property> refViewProperties;
311
	private ReferencePatternSelector refViewProperties;
310 312
	
311 313
	@Parameter(key = ConcordancePreferences.RIGHT_ANALYSIS_PROPERTIES)
312 314
	private PropertiesSelector<WordProperty> rightSortProperties;
......
378 380
			public String getColumnText(Object element, int columnIndex) {
379 381
				
380 382
				Line line = (Line) element;
381
				return line.getViewRef().toString();
383
				return line.getViewRef().format();
382 384
			}
383 385
		});
384 386
		viewerLeft.setContentProvider(new ConcordancesProvider());
......
396 398
			@Override
397 399
			public void widgetSelected(SelectionEvent e) {
398 400
				
399
				
400
				
401
				
402 401
				StatusLine.setMessage(ConcordanceUIMessages.sortingReferenceColumn);
403 402
				LineComparator comparator = new PropertiesReferenceComparator();
404 403
				comparator.initialize(concordance.getCorpus());
......
420 419
				}
421 420
				
422 421
				currentComparator = cComparator;
423

  
422
				
424 423
				complexsorter.setKey(4);// set ref key
425 424
				sort();
426 425
				StatusLine.setMessage(""); //$NON-NLS-1$
......
1094 1093
			l = new Label(propertiesPanel, SWT.NONE);
1095 1094
			l.setText(ConcordanceUIMessages.view);
1096 1095
			l.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
1097
			refViewProperties = new PropertiesSelector<>(propertiesPanel, SWT.NONE);
1096
			refViewProperties = new ReferencePatternSelector(propertiesPanel, SWT.NONE);
1098 1097
			refViewProperties.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
1099 1098
			refViewProperties.setTitle(ConcordanceUIMessages.editor_21);
1100 1099
			refViewProperties.setButtonText(ConcordanceUIMessages.editor_19);
1101 1100
			refViewProperties.setProperties(ReferencePattern.getPossibleValues(getCorpus()));
1101
			refViewProperties.setPattern(null);
1102 1102
			refViewProperties.addSelectionListener(new ComputeSelectionListener(this) {
1103 1103
				
1104 1104
				@Override
1105 1105
				public void widgetSelected(SelectionEvent e) {
1106 1106
					
1107
					concordance.setRefViewPattern(new ReferencePattern(refViewProperties.getSelectedProperties()));
1107
					concordance.setRefViewPattern(new ReferencePattern(refViewProperties.getSelectedProperties(), refViewProperties.getPattern()));
1108 1108
					super.widgetSelected(e);
1109 1109
				}
1110 1110
			});
1111
			refViewProperties.addSelectionListener(new ComputeSelectionListener(this) {
1112
				
1113
				@Override
1114
				public void widgetSelected(SelectionEvent e) {
1115
					
1116
					concordance.setRefViewPattern(new ReferencePattern(refViewProperties.getSelectedProperties(), refViewProperties.getPattern()));
1117
					super.widgetSelected(e);
1118
				}
1119
			});
1111 1120
			leftViewProperties = new PropertiesSelector<>(propertiesPanel, SWT.NONE);
1112 1121
			leftViewProperties.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false));
1113 1122
			leftViewProperties.setTitle(ConcordanceUIMessages.editor_21);
......
2203 2212
	}
2204 2213
	
2205 2214
	public static int MAX_CHARS_LENGTH_TO_SHOW = 75;
2215
	
2206 2216
	public void resetLeftTableColumnWidths() {
2207 2217
		
2208 2218
		int refMax = referenceColumn.getText().length();
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ReferenceLabelProvider.java (revision 2951)
43 43
@Deprecated
44 44
public class ReferenceLabelProvider extends LabelProvider implements
45 45
		ITableLabelProvider {
46

  
47
	/* (non-Javadoc)
46
	
47
	/*
48
	 * (non-Javadoc)
48 49
	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
49 50
	 */
50 51
	@Override
51 52
	public Image getColumnImage(Object element, int columnIndex) {
52 53
		return null;
53 54
	}
54

  
55
	/* (non-Javadoc)
55
	
56
	/*
57
	 * (non-Javadoc)
56 58
	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
57 59
	 */
58 60
	@Override
......
60 62
		if (columnIndex != 0)
61 63
			throw new RuntimeException(TXMUIMessages.shouldNotHappen);
62 64
		Line line = (Line) element;
63
		return line.getViewRef().toString();
65
		return line.getViewRef().format();
64 66
	}
65

  
66
	/* (non-Javadoc)
67
	
68
	/*
69
	 * (non-Javadoc)
67 70
	 * @see org.eclipse.jface.viewers.BaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
68 71
	 */
69 72
	@Override
70 73
	public void addListener(ILabelProviderListener listener) {
71 74
		// TODO Auto-generated method stub
72

  
75
		
73 76
	}
74

  
75
	/* (non-Javadoc)
77
	
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff