blob: a5f46bc712ff2e9c6fe8faf8687008883ad88514 (
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
|
/*******************************************************************************
* Copyright (c) 2009 EclipseSource and others. 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:
* EclipseSource - initial API and implementation
******************************************************************************/
package org.eclipse.e4.ui.tests.css.core.util;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.e4.ui.css.core.dom.ElementAdapter;
import org.eclipse.e4.ui.css.core.engine.CSSEngine;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* Dummy DOM Element implementation for testing.
*/
public class TestElement extends ElementAdapter {
private final String typeName;
private String className;
private String id;
private Map attrs = new HashMap();
public TestElement(String type, CSSEngine engine) {
super(null, engine);
this.typeName = type;
}
public void setClass(String className) {
this.className = className;
}
public void setId(String id) {
this.id = id;
}
public void setAttribute(String name, String value) {
attrs.put(name, value);
}
public String getAttribute(String name) {
String value = (String) attrs.get(name);
return value == null ? "" : value;
}
public String getLocalName() {
return typeName;
}
public NodeList getChildNodes() {
return null;
}
public String getNamespaceURI() {
return null;
}
public Node getParentNode() {
return null;
}
public String getCSSClass() {
return className;
}
public String getCSSId() {
return id;
}
public String getCSSStyle() {
return null;
}
}
|