| /******************************************************************************* |
| * 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.adapters.IStyleSheetListAdapter; |
| import org.eclipse.wst.sse.core.INodeAdapter; |
| import org.eclipse.wst.xml.core.document.XMLDocument; |
| import org.eclipse.wst.xml.core.document.XMLModel; |
| 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 XMLDocument, 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(XMLModel model) { |
| super.setModel(model); |
| } |
| } |