Skip to main content
summaryrefslogtreecommitdiffstats
blob: 9e9269569fb9f3810ec29784473ae50dbe2d8250 (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
/*******************************************************************************
 * Copyright (c) 2004 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*
 * Created on Sep 2, 2003
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package org.eclipse.wst.html.core.document;

import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetListAdapter;
import org.eclipse.wst.sse.core.INodeAdapter;
import org.eclipse.wst.xml.core.document.IDOMDocument;
import org.eclipse.wst.xml.core.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.document.DocumentImpl;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.DocumentCSS;
import org.w3c.dom.stylesheets.StyleSheetList;

/**
 * @author davidw
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class DocumentStyleImpl extends DocumentImpl implements IDOMDocument, DocumentCSS {
	public DocumentStyleImpl() {
		super();
	}

	protected DocumentStyleImpl(DocumentImpl that) {
		super(that);
	}

	public CSSStyleDeclaration getOverrideStyle(Element element, String pseudoName) {
		INodeAdapter adapter = getAdapterFor(IStyleSheetListAdapter.class);
		if (adapter == null)
			return null;
		return ((IStyleSheetListAdapter) adapter).getOverrideStyle(element, pseudoName);
	}

	public StyleSheetList getStyleSheets() {
		INodeAdapter adapter = getAdapterFor(IStyleSheetListAdapter.class);
		if (adapter == null)
			return null;
		return ((IStyleSheetListAdapter) adapter).getStyleSheets();
	}

	protected void releaseStyleSheets() {
		INodeAdapter adapter = getExistingAdapter(IStyleSheetListAdapter.class);
		if (adapter == null)
			return;
		((IStyleSheetListAdapter) adapter).releaseStyleSheets();
	}

	/**
	 * createElement method
	 * @return org.w3c.dom.Element
	 * @param tagName java.lang.String
	 */
	public Element createElement(String tagName) throws DOMException {
		checkTagNameValidity(tagName);

		ElementStyleImpl element = new ElementStyleImpl();
		element.setOwnerDocument(this);
		element.setTagName(tagName);
		return element;
	}

	/**
	 * cloneNode method
	 * @return org.w3c.dom.Node
	 * @param deep boolean
	 */
	public Node cloneNode(boolean deep) {
		DocumentStyleImpl cloned = new DocumentStyleImpl(this);
		if (deep)
			cloned.importChildNodes(this, true);
		return cloned;
	}

	protected void setModel(IDOMModel model) {
		super.setModel(model);
	}
}

Back to the top