nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
nsandonato | caa0adb | 2011-06-09 19:53:00 +0000 | [diff] [blame] | 2 | * Copyright (c) 2004, 2011 IBM Corporation and others. |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 3 | * 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 |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 7 | * |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 8 | * 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_williams | 5677702 | 2005-04-11 06:21:55 +0000 | [diff] [blame] | 17 | package org.eclipse.wst.html.core.internal.document; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 18 | |
david_williams | 63219a2 | 2005-04-10 01:59:51 +0000 | [diff] [blame] | 19 | import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleDeclarationAdapter; |
| 20 | import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter; |
david_williams | 4ad020f | 2005-04-18 08:00:30 +0000 | [diff] [blame] | 21 | import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 22 | import org.eclipse.wst.xml.core.internal.document.ElementImpl; |
david_williams | 4ad020f | 2005-04-18 08:00:30 +0000 | [diff] [blame] | 23 | import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 24 | import org.w3c.dom.Document; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 25 | import org.w3c.dom.css.CSSStyleDeclaration; |
| 26 | import org.w3c.dom.css.ElementCSSInlineStyle; |
| 27 | import org.w3c.dom.stylesheets.LinkStyle; |
| 28 | import org.w3c.dom.stylesheets.StyleSheet; |
| 29 | |
david_williams | c39caaf | 2005-04-05 06:07:16 +0000 | [diff] [blame] | 30 | public class ElementStyleImpl extends ElementImpl implements IDOMElement, ElementCSSInlineStyle, LinkStyle { |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 31 | 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 | |
nsandonato | caa0adb | 2011-06-09 19:53:00 +0000 | [diff] [blame] | 65 | protected ElementImpl newInstance() { |
| 66 | return new ElementStyleImpl(this); |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 67 | } |
| 68 | |
amywu | 923ee60 | 2007-04-10 18:32:07 +0000 | [diff] [blame] | 69 | } |