001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.xslt.model.impl;
020:
021: import java.util.List;
022:
023: import javax.xml.namespace.QName;
024:
025: import org.netbeans.modules.xslt.model.Param;
026: import org.netbeans.modules.xslt.model.Template;
027: import org.netbeans.modules.xslt.model.XslComponent;
028: import org.netbeans.modules.xslt.model.XslVisitor;
029: import org.w3c.dom.Element;
030:
031: /**
032: * @author ads
033: *
034: */
035: class TemplateImpl extends MatchableQNameableSeqCtorImpl implements
036: Template {
037:
038: TemplateImpl(XslModelImpl model, Element element) {
039: super (model, element);
040: }
041:
042: TemplateImpl(XslModelImpl model) {
043: super (model, XslElements.TEMPLATE);
044: }
045:
046: /* (non-Javadoc)
047: * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#accept(org.netbeans.modules.xslt.model.XslVisitor)
048: */
049: @Override
050: public void accept(XslVisitor visitor) {
051: visitor.visit(this );
052: }
053:
054: /* (non-Javadoc)
055: * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#getComponentType()
056: */
057: @Override
058: public Class<? extends XslComponent> getComponentType() {
059: return Template.class;
060: }
061:
062: /* (non-Javadoc)
063: * @see org.netbeans.modules.xslt.model.Template#getPriority()
064: */
065: public Double getPriority() {
066: String value = getAttribute(XslAttributes.PRIORITY);
067: Double numValue = Double.parseDouble(value);
068: return numValue;
069: }
070:
071: /* (non-Javadoc)
072: * @see org.netbeans.modules.xslt.model.Template#setPriority(java.lang.Double)
073: */
074: public void setPriority(Double priority) {
075: setAttribute(XslAttributes.PRIORITY, priority);
076: }
077:
078: /* (non-Javadoc)
079: * @see org.netbeans.modules.xslt.model.ParamContainer#addParam(org.netbeans.modules.xslt.model.Param, int)
080: */
081: public void addParam(Param param, int position) {
082: insertAtIndex(PARAM_PROPERTY, param, position);
083: }
084:
085: /* (non-Javadoc)
086: * @see org.netbeans.modules.xslt.model.ParamContainer#appendParam(org.netbeans.modules.xslt.model.Param)
087: */
088: public void appendParam(Param param) {
089: addBefore(PARAM_PROPERTY, param, SEQUENCE_ELEMENTS);
090: }
091:
092: /* (non-Javadoc)
093: * @see org.netbeans.modules.xslt.model.ParamContainer#getParams()
094: */
095: public List<Param> getParams() {
096: return getChildren(Param.class);
097: }
098:
099: /* (non-Javadoc)
100: * @see org.netbeans.modules.xslt.model.ParamContainer#removeParam(org.netbeans.modules.xslt.model.Param)
101: */
102: public void removeParam(Param param) {
103: removeChild(PARAM_PROPERTY, param);
104: }
105:
106: /* (non-Javadoc)
107: * @see org.netbeans.modules.xslt.model.Template#getMode()
108: */
109: public List<QName> getMode() {
110: return getQNameList(getAttribute(XslAttributes.MODES));
111: }
112:
113: /* (non-Javadoc)
114: * @see org.netbeans.modules.xslt.model.Template#setMode(java.util.List)
115: */
116: public void setMode(List<QName> mode) {
117: setAttribute(XslAttributes.MODES, mode);
118: }
119:
120: /* (non-Javadoc)
121: * @see org.netbeans.modules.xslt.model.AsSpec#getAs()
122: */
123: public String getAs() {
124: return getAttribute(XslAttributes.AS);
125: }
126:
127: /* (non-Javadoc)
128: * @see org.netbeans.modules.xslt.model.AsSpec#setAs(java.lang.String)
129: */
130: public void setAs(String value) {
131: setAttribute(XslAttributes.AS, value);
132: }
133:
134: }
|