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 org.netbeans.modules.xslt.model.Attribute;
024: import org.netbeans.modules.xslt.model.AttributeSet;
025: import org.netbeans.modules.xslt.model.XslComponent;
026: import org.netbeans.modules.xslt.model.XslReference;
027: import org.netbeans.modules.xslt.model.XslVisitor;
028: import org.w3c.dom.Element;
029:
030: /**
031: * @author ads
032: *
033: */
034: class AttributeSetImpl extends QNameableImpl implements AttributeSet {
035:
036: AttributeSetImpl(XslModelImpl model, Element element) {
037: super (model, element);
038: }
039:
040: AttributeSetImpl(XslModelImpl model) {
041: super (model, XslElements.ATTRIBUTE_SET);
042: }
043:
044: /* (non-Javadoc)
045: * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#accept(org.netbeans.modules.xslt.model.XslVisitor)
046: */
047: @Override
048: public void accept(XslVisitor visitor) {
049: visitor.visit(this );
050: }
051:
052: /* (non-Javadoc)
053: * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#getComponentType()
054: */
055: @Override
056: public Class<? extends XslComponent> getComponentType() {
057: return AttributeSet.class;
058: }
059:
060: /* (non-Javadoc)
061: * @see org.netbeans.modules.xslt.model.AttributeSet#addAttribute(org.netbeans.modules.xslt.model.Attribute, int)
062: */
063: public void addAttribute(Attribute attr, int position) {
064: insertAtIndex(ATTRIBUTE_PROPERTY, attr, position,
065: Attribute.class);
066: }
067:
068: /* (non-Javadoc)
069: * @see org.netbeans.modules.xslt.model.AttributeSet#appendAttribute(org.netbeans.modules.xslt.model.Attribute)
070: */
071: public void appendAttribute(Attribute attr) {
072: appendChild(ATTRIBUTE_PROPERTY, attr);
073: }
074:
075: /* (non-Javadoc)
076: * @see org.netbeans.modules.xslt.model.AttributeSet#getAttributes()
077: */
078: public List<Attribute> getAttributes() {
079: return getChildren(Attribute.class);
080: }
081:
082: /* (non-Javadoc)
083: * @see org.netbeans.modules.xslt.model.AttributeSet#removeAttribute(org.netbeans.modules.xslt.model.Attribute)
084: */
085: public void removeAttribute(Attribute attr) {
086: removeChild(ATTRIBUTE_PROPERTY, attr);
087: }
088:
089: /* (non-Javadoc)
090: * @see org.netbeans.modules.xslt.model.UseAttributesSetsSpec#getUseAttributeSets()
091: */
092: public List<XslReference<AttributeSet>> getUseAttributeSets() {
093: return resolveGlobalReferenceList(AttributeSet.class,
094: XslAttributes.USE_ATTRIBUTE_SETS);
095: }
096:
097: /* (non-Javadoc)
098: * @see org.netbeans.modules.xslt.model.UseAttributesSetsSpec#setUseAttributeSets(java.util.Collection)
099: */
100: public void setUseAttributeSets(
101: List<XslReference<AttributeSet>> collection) {
102: setAttributeList(XslAttributes.USE_ATTRIBUTE_SETS, collection);
103: }
104:
105: }
|