Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 2961bb0ef5b879b39566b60ca190b1f5631a90c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
/*****************************************************************************
 * Copyright (c) 2012 CEA LIST.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.prototype.infra.gmfdiag.css;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.emf.common.util.EList;
import org.eclipse.e4.ui.css.core.dom.CSSExtendedProperties;
import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.eclipse.e4.ui.css.core.impl.dom.CSSExtendedPropertiesImpl;
import org.eclipse.gmf.runtime.notation.*;
import org.eclipse.gmf.runtime.notation.impl.ConnectorImpl;
import org.eclipse.papyrus.prototype.infra.gmfdiag.css.style.CSSConnectorStyle;
import org.eclipse.papyrus.prototype.infra.gmfdiag.css.style.impl.CSSConnectorStyleImpl;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.TypeInfo;
import org.w3c.dom.UserDataHandler;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.eclipse.papyrus.prototype.infra.gmfdiag.css.adapter.GMFCSSAdapter;

@SuppressWarnings("restriction")
public class GMFCSSConnector extends ConnectorImpl implements CSSStylableElement, CSSConnectorStyle {

	protected CSSEngine engine;

	private CSSStylableElement cssAdapter;

	private CSSConnectorStyle connectorStyle;
	
	public GMFCSSConnector(CSSEngine engine) {
		this.engine = engine;
		this.cssAdapter = new GMFCSSAdapter(this, engine);
		this.connectorStyle = new CSSConnectorStyleImpl(this, this, engine);
	}


	//////////////////////////////////////////
	//	Forwards accesses to CSS properties	//
	//////////////////////////////////////////

	public int getCSSRoundedBendpointsRadius(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoundedCornersStyle_RoundedBendpointsRadius())){
			return super.getRoundedBendpointsRadius();
		} else {
			return connectorStyle.getCSSRoundedBendpointsRadius();
		}
	}

	public Routing getCSSRouting(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_Routing())){
			return super.getRouting();
		} else {
			return connectorStyle.getCSSRouting();
		}
	}

	public Smoothness getCSSSmoothness(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_Smoothness())){
			return super.getSmoothness();
		} else {
			return connectorStyle.getCSSSmoothness();
		}
	}

	public boolean isCSSAvoidObstructions(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_AvoidObstructions())){
			return super.isAvoidObstructions();
		} else {
			return connectorStyle.isCSSAvoidObstructions();
		}
	}

	public boolean isCSSClosestDistance(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_ClosestDistance())){
			return super.isClosestDistance();
		} else {
			return connectorStyle.isCSSClosestDistance();
		}
	}

	public JumpLinkStatus getCSSJumpLinkStatus(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_JumpLinkStatus())){
			return super.getJumpLinkStatus();
		} else {
			return connectorStyle.getCSSJumpLinkStatus();
		}
	}

	public JumpLinkType getCSSJumpLinkType(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_JumpLinkType())){
			return super.getJumpLinkType();
		} else {
			return connectorStyle.getCSSJumpLinkType();
		}
	}

	public boolean isCSSJumpLinksReverse(){
		if (eIsSet(NotationPackage.eINSTANCE.getRoutingStyle_JumpLinksReverse())){
			return super.isJumpLinksReverse();
		} else {
			return connectorStyle.isCSSJumpLinksReverse();
		}
	}

	public int getCSSLineColor(){
		if (eIsSet(NotationPackage.eINSTANCE.getLineStyle_LineColor())){
			return super.getLineColor();
		} else {
			return connectorStyle.getCSSLineColor();
		}
	}

	public int getCSSLineWidth(){
		if (eIsSet(NotationPackage.eINSTANCE.getLineStyle_LineWidth())){
			return super.getLineWidth();
		} else {
			return connectorStyle.getCSSLineWidth();
		}
	}


	@Override
	public int getRoundedBendpointsRadius(){
		//return super.getRoundedBendpointsRadius();
		return getCSSRoundedBendpointsRadius();
	}

	@Override
	public Routing getRouting(){
		//return super.getRouting();
		return getCSSRouting();
	}

	@Override
	public Smoothness getSmoothness(){
		//return super.getSmoothness();
		return getCSSSmoothness();
	}

	@Override
	public boolean isAvoidObstructions(){
		//return super.isAvoidObstructions();
		return isCSSAvoidObstructions();
	}

	@Override
	public boolean isClosestDistance(){
		//return super.isClosestDistance();
		return isCSSClosestDistance();
	}

	@Override
	public JumpLinkStatus getJumpLinkStatus(){
		//return super.getJumpLinkStatus();
		return getCSSJumpLinkStatus();
	}

	@Override
	public JumpLinkType getJumpLinkType(){
		//return super.getJumpLinkType();
		return getCSSJumpLinkType();
	}

	@Override
	public boolean isJumpLinksReverse(){
		//return super.isJumpLinksReverse();
		return isCSSJumpLinksReverse();
	}

	@Override
	public int getLineColor(){
		//return super.getLineColor();
		return getCSSLineColor();
	}

	@Override
	public int getLineWidth(){
		//return super.getLineWidth();
		return getCSSLineWidth();
	}



	//////////////////////////////////////////
	//	Forwards all calls to cssAdapter	//
	//////////////////////////////////////////

	public String getTagName() {
		return cssAdapter.getTagName();
	}
	
	public String getAttribute(String name) {
		return cssAdapter.getAttribute(name);
	}
	
	public void setAttribute(String name, String value) throws DOMException {
		setAttribute(name, value);
	}
	
	public void removeAttribute(String name) throws DOMException {
		removeAttribute(name);
	}
	
	public Attr getAttributeNode(String name) {
		return cssAdapter.getAttributeNode(name);
	}
	
	public Attr setAttributeNode(Attr newAttr) throws DOMException {
		return cssAdapter.setAttributeNode(newAttr);
	}
	
	public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
		return cssAdapter.removeAttributeNode(oldAttr);
	}
	
	public NodeList getElementsByTagName(String name) {
		return cssAdapter.getElementsByTagName(name);
	}
	
	public String getAttributeNS(String namespaceURI, String localName) throws DOMException {
		return cssAdapter.getAttributeNS(namespaceURI, localName);
	}
	
	public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException {
		setAttributeNS(namespaceURI, qualifiedName, value);
	}
	
	public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
		removeAttributeNS(namespaceURI, localName);
	}
	
	public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException {
		return cssAdapter.getAttributeNodeNS(namespaceURI, localName);
	}
	
	public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
		return cssAdapter.setAttributeNodeNS(newAttr);
	}
	
	public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
		return cssAdapter.getElementsByTagNameNS(namespaceURI, localName);
	}
	
	public boolean hasAttribute(String name) {
		return cssAdapter.hasAttribute(name);
	}
	
	public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException {
		return cssAdapter.hasAttributeNS(namespaceURI, localName);
	}
	
	public TypeInfo getSchemaTypeInfo() {
		return cssAdapter.getSchemaTypeInfo();
	}
	
	public void setIdAttribute(String name, boolean isId) throws DOMException {
		setIdAttribute(name, isId);
	}
	
	public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
		setIdAttributeNS(namespaceURI, localName, isId);
	}
	
	public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
		setIdAttributeNode(idAttr, isId);
	}
	
	public String getNodeName() {
		return cssAdapter.getNodeName();
	}
	
	public String getNodeValue() throws DOMException {
		return cssAdapter.getNodeValue();
	}
	
	public void setNodeValue(String nodeValue) throws DOMException {
		setNodeValue(nodeValue);
	}
	
	public short getNodeType() {
		return cssAdapter.getNodeType();
	}
	
	public Node getParentNode() {
		return cssAdapter.getParentNode();
	}
	
	public NodeList getChildNodes() {
		return cssAdapter.getChildNodes();
	}
	
	public Node getFirstChild() {
		return cssAdapter.getFirstChild();
	}
	
	public Node getLastChild() {
		return cssAdapter.getLastChild();
	}
	
	public Node getPreviousSibling() {
		return cssAdapter.getPreviousSibling();
	}
	
	public Node getNextSibling() {
		return cssAdapter.getNextSibling();
	}
	
	public NamedNodeMap getAttributes() {
		return cssAdapter.getAttributes();
	}
	
	public Document getOwnerDocument() {
		return cssAdapter.getOwnerDocument();
	}
	
	public Node insertBefore(Node newChild, Node refChild) throws DOMException {
		return cssAdapter.insertBefore(newChild, refChild);
	}
	
	public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
		return cssAdapter.replaceChild(newChild, oldChild);
	}
	
	public Node removeChild(Node oldChild) throws DOMException {
		return cssAdapter.removeChild(oldChild);
	}
	
	public Node appendChild(Node newChild) throws DOMException {
		return cssAdapter.appendChild(newChild);
	}
	
	public boolean hasChildNodes() {
		return cssAdapter.hasChildNodes();
	}
	
	public Node cloneNode(boolean deep) {
		return cssAdapter.cloneNode(deep);
	}
	
	public void normalize() {
		normalize();
	}
	
	public boolean isSupported(String feature, String version) {
		return cssAdapter.isSupported(feature, version);
	}
	
	public String getNamespaceURI() {
		return cssAdapter.getNamespaceURI();
	}
	
	public String getPrefix() {
		return cssAdapter.getPrefix();
	}
	
	public void setPrefix(String prefix) throws DOMException {
		setPrefix(prefix);
	}
	
	public String getLocalName() {
		return cssAdapter.getLocalName();
	}
	
	public boolean hasAttributes() {
		return cssAdapter.hasAttributes();
	}
	
	public String getBaseURI() {
		return cssAdapter.getBaseURI();
	}
	
	public short compareDocumentPosition(Node other) throws DOMException {
		return cssAdapter.compareDocumentPosition(other);
	}
	
	public String getTextContent() throws DOMException {
		return cssAdapter.getTextContent();
	}
	
	public void setTextContent(String textContent) throws DOMException {
		setTextContent(textContent);
	}
	
	public boolean isSameNode(Node other) {
		return cssAdapter.isSameNode(other);
	}
	
	public String lookupPrefix(String namespaceURI) {
		return cssAdapter.lookupPrefix(namespaceURI);
	}
	
	public boolean isDefaultNamespace(String namespaceURI) {
		return cssAdapter.isDefaultNamespace(namespaceURI);
	}
	
	public String lookupNamespaceURI(String prefix) {
		return cssAdapter.lookupNamespaceURI(prefix);
	}
	
	public boolean isEqualNode(Node arg) {
		return cssAdapter.isEqualNode(arg);
	}
	
	public Object getFeature(String feature, String version) {
		return cssAdapter.getFeature(feature, version);
	}
	
	public Object setUserData(String key, Object data, UserDataHandler handler) {
		return cssAdapter.setUserData(key, data, handler);
	}
	
	public Object getUserData(String key) {
		return cssAdapter.getUserData(key);
	}
	
	public Object getNativeWidget() {
		return cssAdapter.getNativeWidget();
	}
	
	public String getCSSId() {
		return cssAdapter.getCSSId();
	}
	
	public String getCSSClass() {
		return cssAdapter.getCSSClass();
	}
	
	public String getCSSStyle() {
		return cssAdapter.getCSSStyle();
	}
	
	public CSSStyleDeclaration getDefaultStyleDeclaration(String pseudoE) {
		return cssAdapter.getDefaultStyleDeclaration(pseudoE);
	}
	
	public void copyDefaultStyleDeclarations(CSSStylableElement stylableElement) {
		copyDefaultStyleDeclarations(stylableElement);
	}
	
	public void setDefaultStyleDeclaration(String pseudoE, CSSStyleDeclaration defaultStyleDeclaration) {
		setDefaultStyleDeclaration(pseudoE, defaultStyleDeclaration);
	}
	
	public boolean isPseudoInstanceOf(String s) {
		return cssAdapter.isPseudoInstanceOf(s);
	}
	
	public String[] getStaticPseudoInstances() {
		return cssAdapter.getStaticPseudoInstances();
	}
	
	public boolean isStaticPseudoInstance(String s) {
		return cssAdapter.isStaticPseudoInstance(s);
	}
	
	public void onStylesApplied(NodeList nodes) {
		onStylesApplied(nodes);
	}
	
	public CSSExtendedProperties getStyle() {
		return cssAdapter.getStyle();
	}
	
	public void initialize() {
		initialize();
	}
	
	public void dispose() {
		dispose();
	}
}

Back to the top