blob: 7acc0fbfe808002ff7d2d63c8d93d8f7fe024dcf [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
nsandonatocaa0adb2011-06-09 19:53:00 +00002 * Copyright (c) 2004, 2011 IBM Corporation and others.
nitind958d79a2004-11-23 19:23:00 +00003 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
amywu923ee602007-04-10 18:32:07 +00007 *
nitind958d79a2004-11-23 19:23:00 +00008 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11/*
12 * Created on Sep 2, 2003
13 *
14 * To change the template for this generated file go to
15 * Window>Preferences>Java>Code Generation>Code and Comments
16 */
david_williams56777022005-04-11 06:21:55 +000017package org.eclipse.wst.html.core.internal.document;
nitind958d79a2004-11-23 19:23:00 +000018
david_williams63219a22005-04-10 01:59:51 +000019import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleDeclarationAdapter;
20import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter;
david_williams4ad020f2005-04-18 08:00:30 +000021import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
nitind958d79a2004-11-23 19:23:00 +000022import org.eclipse.wst.xml.core.internal.document.ElementImpl;
david_williams4ad020f2005-04-18 08:00:30 +000023import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
nitind958d79a2004-11-23 19:23:00 +000024import org.w3c.dom.Document;
nitind958d79a2004-11-23 19:23:00 +000025import org.w3c.dom.css.CSSStyleDeclaration;
26import org.w3c.dom.css.ElementCSSInlineStyle;
27import org.w3c.dom.stylesheets.LinkStyle;
28import org.w3c.dom.stylesheets.StyleSheet;
29
david_williamsc39caaf2005-04-05 06:07:16 +000030public class ElementStyleImpl extends ElementImpl implements IDOMElement, ElementCSSInlineStyle, LinkStyle {
nitind958d79a2004-11-23 19:23:00 +000031 public ElementStyleImpl() {
32 super();
33 }
34
35 public ElementStyleImpl(ElementImpl that) {
36 super(that);
37 }
38
39 public StyleSheet getSheet() {
40 INodeAdapter adapter = getAdapterFor(IStyleSheetAdapter.class);
41 if (adapter == null)
42 return null;
43 if (!(adapter instanceof IStyleSheetAdapter))
44 return null;
45 return ((IStyleSheetAdapter) adapter).getSheet();
46 }
47
48 public CSSStyleDeclaration getStyle() {
49 INodeAdapter adapter = getAdapterFor(IStyleDeclarationAdapter.class);
50 if (adapter == null)
51 return null;
52 if (!(adapter instanceof IStyleDeclarationAdapter))
53 return null;
54 return ((IStyleDeclarationAdapter) adapter).getStyle();
55 }
56
57 protected void setOwnerDocument(Document ownerDocument) {
58 super.setOwnerDocument(ownerDocument);
59 }
60
61 protected void setTagName(String tagName) {
62 super.setTagName(tagName);
63 }
64
nsandonatocaa0adb2011-06-09 19:53:00 +000065 protected ElementImpl newInstance() {
66 return new ElementStyleImpl(this);
nitind958d79a2004-11-23 19:23:00 +000067 }
68
amywu923ee602007-04-10 18:32:07 +000069}