Révision 3259

tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionLink.java (revision 3259)
1 1
package org.txm.edition.rcp.editors;
2 2

  
3
import java.util.Arrays;
3 4
import java.util.HashMap;
4 5

  
5 6
import org.eclipse.swt.browser.Browser;
......
9 10
import org.txm.edition.rcp.messages.EditionUIMessages;
10 11
import org.txm.rcp.editors.CommandLink;
11 12
import org.txm.rcp.editors.TXMEditor;
13
import org.txm.utils.logger.Log;
12 14

  
13 15
/**
14 16
 * Browser Javascript method to open a TXM edition given 1 to 4 parameters : corpusid, editionid, textid, wordid
......
32 34
	
33 35
	@Override
34 36
	public Object function(Object[] arguments) { // corpus id, edition id, text id, word id
37
		
38
		Log.finer("txmedition() called: "+Arrays.toString(arguments));
39
		
35 40
		HashMap<String, String> params = new HashMap<>();
36 41
		
37 42
		String id = BackToText.class.getName();
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java (revision 3259)
47 47
import org.txm.utils.logger.Log;
48 48

  
49 49
public class EditionPanel extends BrowserViewer implements ISelectionProvider {
50
		
50
	
51 51
	private ProgressListener progressListener;
52 52
	
53 53
	// private List<String> wordids;
......
121 121
			// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
122 122
			// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
123 123
			"} catch (e) { };"; //$NON-NLS-1$
124
			
124
	
125 125
	public static final String highlightscriptRuleFast = "sheet.insertRule(\"#%s {background-color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
126 126
	
127 127
	public static final String colorscriptRuleFast = "sheet.insertRule(\"#%s {color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
......
281 281
		super(parent, style);
282 282
		this.synopticEditionEditor = synopticEditionEditor;
283 283
		this.editionName = editionName;
284
//		this.currentEdition = edition;
285
//		this.currentText = currentEdition.getText();
284
		//		this.currentEdition = edition;
285
		//		this.currentText = currentEdition.getText();
286 286
		
287 287
		File functionsFile = null;
288 288
		try {
......
302 302
		
303 303
		progressListener = new ProgressListener() {
304 304
			
305
			private CommandLink cmdLink;
306
			private EditionLink editionLink;
307

  
305 308
			@Override
306 309
			public void changed(ProgressEvent event) {}
307 310
			
308 311
			@Override
309 312
			public void completed(ProgressEvent event) {
310 313
				
314
					cmdLink = new CommandLink(synopticEditionEditor, getBrowser());
315
					editionLink = new EditionLink(synopticEditionEditor, getBrowser());
311 316
				Log.finest("EditionPanel " + currentEdition.getName() + " reload " + getCurrentPage().getName());
312 317
				Object rez = evaluate("return typeof sheet;"); //$NON-NLS-1$
313 318
				if ("undefined".equals(rez)) { //$NON-NLS-1$
......
395 400
						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
396 401
						s = "try { document.getElementById(\"" + wordid + "\").style.backgroundColor=\"rgba(" + composite.r + "," + composite.g + "," + composite.b + "," + composite.a + ")\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
397 402
								+
398
						// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
399
						// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
400
						// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
401
						// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
403
								// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
404
								// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
405
								// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
406
								// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
402 407
								"} catch (e) { };"; //$NON-NLS-1$
403 408
					}
404 409
					else {
......
478 483
						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
479 484
						s = "try { document.getElementById(\"" + wordid + "\").style.fontWeight=\"" + fontWeightPerWordIDS.get(wordid) + "\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
480 485
								+
481
						// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
482
						// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
483
						// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
484
						// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
486
								// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
487
								// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
488
								// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
489
								// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
485 490
								"} catch (e) { };"; //$NON-NLS-1$
486 491
						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
487 492
						// s = "try { var elt = document.getElementById(\"" + wordid + "\");" + //$NON-NLS-1$ //$NON-NLS-2$
......
627 632
		getBrowser().addKeyListener(kListener);
628 633
		
629 634
		getBrowser().addProgressListener(progressListener);
630
		new CommandLink(synopticEditionEditor, getBrowser());
631
		new EditionLink(synopticEditionEditor, getBrowser());
632 635
	}
633 636
	
634 637
	/**
......
1140 1143
				+ "\n}" //$NON-NLS-1$
1141 1144
				// +"alert('result='+all)"
1142 1145
				+ "\nreturn all;"; //$NON-NLS-1$
1143
				
1146
		
1144 1147
		// System.out.println(functions);
1145 1148
		// System.out.println(SCRIPT02_getspans);
1146 1149
		
......
1436 1439
				+ "sel.addRange(range);\n" //$NON-NLS-1$
1437 1440
				+ "\n" //$NON-NLS-1$
1438 1441
				+ "return null;"; //$NON-NLS-1$
1439
				
1442
		
1440 1443
		// System.out.println("Eval...\n"+SCRIPT02_expand);
1441 1444
		evaluate(SCRIPT02_expand);
1442 1445
		return;

Formats disponibles : Unified diff