Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a2cfab51f4c0b8015898a8a325fd01472820ed16 (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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
/*****************************************************************************
 * 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 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.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.impl.ShapeStyleImpl;
import org.eclipse.papyrus.prototype.infra.gmfdiag.css.adapter.GMFCSSAdapter;
import org.eclipse.papyrus.prototype.infra.gmfdiag.css.style.CSSShapeStyle;
import org.eclipse.papyrus.prototype.infra.gmfdiag.css.style.impl.CSSShapeStyleImpl;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
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;

@SuppressWarnings("restriction")
public class GMFCSSShapeStyle extends ShapeStyleImpl implements CSSStylableElement, CSSShapeStyle {

	protected CSSEngine engine;

	private CSSStylableElement cssAdapter;

	private CSSShapeStyle shapeStyle;

	public GMFCSSShapeStyle(CSSEngine engine) {
		this.engine = engine;
		this.cssAdapter = new GMFCSSAdapter(this, engine);
		this.shapeStyle = new CSSShapeStyleImpl(this, this, engine);
	}


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

	public int getCSSFontColor() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_FontColor())) {
			return super.getFontColor();
		} else {
			return shapeStyle.getCSSFontColor();
		}
	}

	public java.lang.String getCSSFontName() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_FontName())) {
			return super.getFontName();
		} else {
			return shapeStyle.getCSSFontName();
		}
	}

	public int getCSSFontHeight() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_FontHeight())) {
			return super.getFontHeight();
		} else {
			return shapeStyle.getCSSFontHeight();
		}
	}

	public boolean isCSSBold() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_Bold())) {
			return super.isBold();
		} else {
			return shapeStyle.isCSSBold();
		}
	}

	public boolean isCSSItalic() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_Italic())) {
			return super.isItalic();
		} else {
			return shapeStyle.isCSSItalic();
		}
	}

	public boolean isCSSUnderline() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_Underline())) {
			return super.isUnderline();
		} else {
			return shapeStyle.isCSSUnderline();
		}
	}

	public boolean isCSSStrikeThrough() {
		if(eIsSet(NotationPackage.eINSTANCE.getFontStyle_StrikeThrough())) {
			return super.isStrikeThrough();
		} else {
			return shapeStyle.isCSSStrikeThrough();
		}
	}

	public java.lang.String getCSSDescription() {
		if(eIsSet(NotationPackage.eINSTANCE.getDescriptionStyle_Description())) {
			return super.getDescription();
		} else {
			return shapeStyle.getCSSDescription();
		}
	}

	public int getCSSFillColor() {
		if(eIsSet(NotationPackage.eINSTANCE.getFillStyle_FillColor())) {
			return super.getFillColor();
		} else {
			return shapeStyle.getCSSFillColor();
		}
	}

	public int getCSSTransparency() {
		if(eIsSet(NotationPackage.eINSTANCE.getFillStyle_Transparency())) {
			return super.getTransparency();
		} else {
			return shapeStyle.getCSSTransparency();
		}
	}

	public org.eclipse.gmf.runtime.notation.datatype.GradientData getCSSGradient() {
		if(eIsSet(NotationPackage.eINSTANCE.getFillStyle_Gradient())) {
			return super.getGradient();
		} else {
			return shapeStyle.getCSSGradient();
		}
	}

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

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

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

	public boolean getCSSElementIcon() {
		return shapeStyle.getCSSElementIcon();
	}

	public boolean getStereotypeDisplay() {
		return shapeStyle.getStereotypeDisplay();
	}

	public boolean getShadow() {
		return shapeStyle.getShadow();
	}

	public int getQualifiedNameDepth() {
		return shapeStyle.getQualifiedNameDepth();
	}


	@Override
	public int getFontColor() {
		//return super.getFontColor();
		return getCSSFontColor();
	}

	@Override
	public java.lang.String getFontName() {
		//return super.getFontName();
		return getCSSFontName();
	}

	@Override
	public int getFontHeight() {
		//return super.getFontHeight();
		return getCSSFontHeight();
	}

	@Override
	public boolean isBold() {
		//return super.isBold();
		return isCSSBold();
	}

	@Override
	public boolean isItalic() {
		//return super.isItalic();
		return isCSSItalic();
	}

	@Override
	public boolean isUnderline() {
		//return super.isUnderline();
		return isCSSUnderline();
	}

	@Override
	public boolean isStrikeThrough() {
		//return super.isStrikeThrough();
		return isCSSStrikeThrough();
	}

	@Override
	public java.lang.String getDescription() {
		//return super.getDescription();
		return getCSSDescription();
	}

	@Override
	public int getFillColor() {
		//return super.getFillColor();
		return getCSSFillColor();
	}

	@Override
	public int getTransparency() {
		//return super.getTransparency();
		return getCSSTransparency();
	}

	@Override
	public org.eclipse.gmf.runtime.notation.datatype.GradientData getGradient() {
		//return super.getGradient();
		return getCSSGradient();
	}

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

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

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



	//////////////////////////////////////////
	//	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