KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.netbeans.modules.xslt.model.impl;
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.List JavaDoc;
24
25 import org.netbeans.modules.xslt.model.Attribute;
26 import org.netbeans.modules.xslt.model.Choose;
27 import org.netbeans.modules.xslt.model.Otherwise;
28 import org.netbeans.modules.xslt.model.When;
29 import org.netbeans.modules.xslt.model.XslComponent;
30 import org.netbeans.modules.xslt.model.XslVisitor;
31 import org.w3c.dom.Element JavaDoc;
32
33
34 /**
35  * @author ads
36  *
37  */

38 class ChooseImpl extends SequenceElementImpl implements Choose {
39
40     ChooseImpl( XslModelImpl model, Element JavaDoc element ) {
41         super( model , element );
42     }
43     
44     ChooseImpl( XslModelImpl model ){
45         super( model , XslElements.CHOOSE );
46     }
47     
48
49     /* (non-Javadoc)
50      * @see org.netbeans.modules.xslt.model.impl.XslComponentImpl#accept(org.netbeans.modules.xslt.model.XslVisitor)
51      */

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

61     @Override JavaDoc
62     public Class JavaDoc<? extends XslComponent> getComponentType()
63     {
64         return Choose.class;
65     }
66
67     /* (non-Javadoc)
68      * @see org.netbeans.modules.xslt.model.Choose#addWhen(org.netbeans.modules.xslt.model.When, int)
69      */

70     public void addWhen( When when, int position ) {
71         insertAtIndex( WHEN_PROPERTY, when, position,
72                 Attribute.class );
73     }
74
75     /* (non-Javadoc)
76      * @see org.netbeans.modules.xslt.model.Choose#appendWhen(org.netbeans.modules.xslt.model.When)
77      */

78     public void appendWhen( When when ) {
79         addBefore( WHEN_PROPERTY, when, OTHERWISE_COLLECTION );
80     }
81
82     /* (non-Javadoc)
83      * @see org.netbeans.modules.xslt.model.Choose#getOtherwise()
84      */

85     public Otherwise getOtherwise() {
86         return getChild( Otherwise.class );
87     }
88
89     /* (non-Javadoc)
90      * @see org.netbeans.modules.xslt.model.Choose#getWhens()
91      */

92     public List JavaDoc<When> getWhens() {
93         return getChildren( When.class );
94     }
95
96     /* (non-Javadoc)
97      * @see org.netbeans.modules.xslt.model.Choose#removeWhen(org.netbeans.modules.xslt.model.When)
98      */

99     public void removeWhen( When when ) {
100         removeChild( WHEN_PROPERTY , when);
101     }
102
103     /* (non-Javadoc)
104      * @see org.netbeans.modules.xslt.model.Choose#setOtherwise(org.netbeans.modules.xslt.model.Otherwise)
105      */

106     public void setOtherwise( Otherwise otherwise ) {
107         setChildBefore( Otherwise.class , OTHERWISE_PROPERTY , otherwise , EMPTY );
108     }
109
110     private static final Collection JavaDoc<Class JavaDoc<? extends XslComponent>>
111         OTHERWISE_COLLECTION = new ArrayList JavaDoc<Class JavaDoc<? extends XslComponent>>(1);
112     
113     static {
114         OTHERWISE_COLLECTION.add( Otherwise.class );
115     }
116 }
117
Popular Tags