KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xslt > model > impl > StylesheetImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xslt.model.impl;
21
22 import java.math.BigDecimal JavaDoc;
23 import java.util.ArrayList JavaDoc;
24 import java.util.Collection JavaDoc;
25 import java.util.List JavaDoc;
26
27 import org.netbeans.modules.xslt.model.Import;
28 import org.netbeans.modules.xslt.model.InvalidAttributeValueException;
29 import org.netbeans.modules.xslt.model.Stylesheet;
30 import org.netbeans.modules.xslt.model.StylesheetChild;
31 import org.netbeans.modules.xslt.model.XslComponent;
32 import org.netbeans.modules.xslt.model.XslVisitor;
33 import org.netbeans.modules.xslt.model.enums.Annotaions;
34 import org.netbeans.modules.xslt.model.enums.DefaultValidation;
35 import org.w3c.dom.Element JavaDoc;
36
37
38 /**
39  * @author ads
40  *
41  */

42 class StylesheetImpl extends XslComponentImpl implements Stylesheet {
43
44     StylesheetImpl( XslModelImpl model ) {
45         this( model , null );
46     }
47
48     StylesheetImpl( XslModelImpl model , Element JavaDoc element ) {
49         super( model , element );
50     }
51
52     /* (non-Javadoc)
53      * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#accept(org.netbeans.modules.xslt.model.XslVisitor)
54      */

55     @Override JavaDoc
56     public void accept( XslVisitor visitor )
57     {
58         visitor.visit( this );
59     }
60
61     /* (non-Javadoc)
62      * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#getComponentType()
63      */

64     @Override JavaDoc
65     public Class JavaDoc<? extends XslComponent> getComponentType()
66     {
67         return Stylesheet.class;
68     }
69
70     /* (non-Javadoc)
71      * @see org.netbeans.modules.xslt.model.Stylesheet#addImport(org.netbeans.modules.xslt.model.Import, int)
72      */

73     public void addImport( Import impt, int position ) {
74         insertAtIndex( IMPORT_PROPERTY , impt, position );
75     }
76
77     /* (non-Javadoc)
78      * @see org.netbeans.modules.xslt.model.Stylesheet#appendImport(org.netbeans.modules.xslt.model.Import)
79      */

80     public void appendImport( Import impt ) {
81         addAfter( IMPORT_PROPERTY, impt , STYLESHEET_CHILDREN );
82     }
83
84     /* (non-Javadoc)
85      * @see org.netbeans.modules.xslt.model.Stylesheet#removeImport(org.netbeans.modules.xslt.model.Import)
86      */

87     public void removeImport( Import impt ) {
88         removeChild( IMPORT_PROPERTY , impt );
89     }
90
91     /* (non-Javadoc)
92      * @see org.netbeans.modules.xslt.model.Stylesheet#setID(java.lang.String)
93      */

94     public void setID( String JavaDoc id ) {
95         setAttribute( XslAttributes.ID, id );
96     }
97     
98     /* (non-Javadoc)
99      * @see org.netbeans.modules.xslt.model.Stylesheet#getID()
100      */

101     public String JavaDoc getID() {
102         return getAttribute( XslAttributes.ID );
103     }
104
105     /* (non-Javadoc)
106      * @see org.netbeans.modules.xslt.model.Stylesheet#addStylesheetChild(org.netbeans.modules.xslt.model.StylesheetChild, int)
107      */

108     public void addStylesheetChild( StylesheetChild child, int position ) {
109         insertAtIndex( STYLESHEET_TOP_LEVEL_ELEMENTS, child , position );
110     }
111
112     /* (non-Javadoc)
113      * @see org.netbeans.modules.xslt.model.Stylesheet#appendStylesheetChild(org.netbeans.modules.xslt.model.StylesheetChild)
114      */

115     public void appendStylesheetChild( StylesheetChild child ) {
116         appendChild( STYLESHEET_TOP_LEVEL_ELEMENTS, child);
117     }
118
119     /* (non-Javadoc)
120      * @see org.netbeans.modules.xslt.model.Stylesheet#getImports()
121      */

122     public List JavaDoc<Import> getImports() {
123         return getChildren( Import.class );
124     }
125
126     /* (non-Javadoc)
127      * @see org.netbeans.modules.xslt.model.Stylesheet#getStylesheetChild()
128      */

129     public List JavaDoc<StylesheetChild> getStylesheetChildren() {
130         return getChildren( StylesheetChild.class );
131     }
132
133     /* (non-Javadoc)
134      * @see org.netbeans.modules.xslt.model.Stylesheet#removeStylesheetChild(org.netbeans.modules.xslt.model.StylesheetChild)
135      */

136     public void removeStylesheetChild( StylesheetChild child ) {
137         removeChild( STYLESHEET_TOP_LEVEL_ELEMENTS, child );
138     }
139
140     /* (non-Javadoc)
141      * @see org.netbeans.modules.xslt.model.Stylesheet#getDefaultCollation()
142      */

143     @SuppressWarnings JavaDoc("unchecked")
144     public List JavaDoc<String JavaDoc> getDefaultCollation() {
145         return (List JavaDoc<String JavaDoc>) getAttributeValueOf(
146                 XslAttributes.DEFAULT_COLLATION,
147                 getAttribute( XslAttributes.DEFAULT_COLLATION ));
148     }
149
150     /* (non-Javadoc)
151      * @see org.netbeans.modules.xslt.model.Stylesheet#getDefaultValidation()
152      */

153     public DefaultValidation getDefaultValidation() {
154         return DefaultValidation.forString(
155                 getAttribute( XslAttributes.DEFAULT_VALIDATION ) );
156     }
157
158     /* (non-Javadoc)
159      * @see org.netbeans.modules.xslt.model.Stylesheet#getExcludeResultPrefixes()
160      */

161     @SuppressWarnings JavaDoc("unchecked")
162     public List JavaDoc<String JavaDoc> getExcludeResultPrefixes() {
163         return (List JavaDoc<String JavaDoc>) getAttributeValueOf(
164                 XslAttributes.EXCLUDE_RESULT_PREFIXES,
165                 getAttribute( XslAttributes.EXCLUDE_RESULT_PREFIXES ));
166     }
167
168     /* (non-Javadoc)
169      * @see org.netbeans.modules.xslt.model.Stylesheet#getExtensionElementPrefixes()
170      */

171     @SuppressWarnings JavaDoc("unchecked")
172     public List JavaDoc<String JavaDoc> getExtensionElementPrefixes() {
173         return (List JavaDoc<String JavaDoc>)getAttributeValueOf(
174                 XslAttributes.EXTENSION_ELEMENT_PREFIXES,
175                 getAttribute( XslAttributes.EXTENSION_ELEMENT_PREFIXES));
176     }
177
178     /* (non-Javadoc)
179      * @see org.netbeans.modules.xslt.model.Stylesheet#getInputTypeAnnotations()
180      */

181     public Annotaions getInputTypeAnnotations() {
182         return Annotaions.forString(
183                 getAttribute( XslAttributes.INPUT_TYPE_ANNOTAIONS ));
184     }
185
186     /* (non-Javadoc)
187      * @see org.netbeans.modules.xslt.model.Stylesheet#getVersion()
188      */

189     public BigDecimal JavaDoc getVersion() throws InvalidAttributeValueException {
190         String JavaDoc value = getAttribute( XslAttributes.VERSION );
191         BigDecimal JavaDoc ret = null;
192         try {
193             ret = new BigDecimal JavaDoc( value );
194         }
195         catch ( NumberFormatException JavaDoc exc ) {
196             throw new InvalidAttributeValueException( value , exc );
197         }
198         return ret;
199     }
200
201     /* (non-Javadoc)
202      * @see org.netbeans.modules.xslt.model.Stylesheet#getXpathDefaultNamespace()
203      */

204     public String JavaDoc getXpathDefaultNamespace() {
205         return getAttribute( XslAttributes.XPATH_DEFAULT_NAMESPACE );
206     }
207
208     /* (non-Javadoc)
209      * @see org.netbeans.modules.xslt.model.Stylesheet#setDefaultCollation(java.util.List)
210      */

211     public void setDefaultCollation( List JavaDoc<String JavaDoc> list ) {
212         setAttributeTokenList( XslAttributes.DEFAULT_COLLATION, list);
213     }
214
215     /* (non-Javadoc)
216      * @see org.netbeans.modules.xslt.model.Stylesheet#setDefaultValidation(org.netbeans.modules.xslt.model.enums.DefaultValidation)
217      */

218     public void setDefaultValidation( DefaultValidation value ) {
219         setAttribute( XslAttributes.DEFAULT_VALIDATION, value );
220     }
221
222     /* (non-Javadoc)
223      * @see org.netbeans.modules.xslt.model.Stylesheet#setExcludeResultPrefixes(java.util.List)
224      */

225     public void setExcludeResultPrefixes( List JavaDoc<String JavaDoc> list ) {
226         setAttributeTokenList( XslAttributes.EXCLUDE_RESULT_PREFIXES, list);
227     }
228
229     /* (non-Javadoc)
230      * @see org.netbeans.modules.xslt.model.Stylesheet#setExtensionElementPrefixes(java.util.List)
231      */

232     public void setExtensionElementPrefixes( List JavaDoc<String JavaDoc> list ) {
233         setAttributeTokenList( XslAttributes.EXTENSION_ELEMENT_PREFIXES, list);
234     }
235
236     /* (non-Javadoc)
237      * @see org.netbeans.modules.xslt.model.Stylesheet#setInputTypeAnnotations(org.netbeans.modules.xslt.model.enums.Annotaions)
238      */

239     public void setInputTypeAnnotations( Annotaions value ) {
240         setAttribute( XslAttributes.INPUT_TYPE_ANNOTAIONS, value );
241     }
242
243     /* (non-Javadoc)
244      * @see org.netbeans.modules.xslt.model.Stylesheet#setVersion(java.math.BigDecimal)
245      */

246     public void setVersion( BigDecimal JavaDoc value ) {
247         setAttribute( XslAttributes.VERSION , value );
248     }
249
250     /* (non-Javadoc)
251      * @see org.netbeans.modules.xslt.model.Stylesheet#setXpathDefaultNamespace(java.lang.String)
252      */

253     public void setXpathDefaultNamespace( String JavaDoc value ) {
254         setAttribute( XslAttributes.XPATH_DEFAULT_NAMESPACE, value );
255     }
256     
257     /* (non-Javadoc)
258      * @see org.netbeans.modules.xslt.model.Stylesheet#findAllDefinedChildren()
259      */

260     public Collection JavaDoc<StylesheetChild> findAllDefinedChildren() {
261         // TODO Auto-generated method stub
262
return null;
263     }
264     
265     private static final Collection JavaDoc<Class JavaDoc<? extends XslComponent>> STYLESHEET_CHILDREN = new ArrayList JavaDoc<Class JavaDoc<? extends XslComponent>>(
266             1);
267
268     static {
269         STYLESHEET_CHILDREN.add(StylesheetChild.class);
270     }
271
272 }
273
Popular Tags