KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > websphere6 > dd > beans > MarkupLanguagesType


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.j2ee.websphere6.dd.beans;
20
21 import org.w3c.dom.*;
22 import org.netbeans.modules.schema2beans.*;
23 import java.beans.*;
24 import java.util.*;
25
26 // BEGIN_NOI18N
27

28 public class MarkupLanguagesType extends org.netbeans.modules.schema2beans.BaseBean implements DDXmiConstants {
29
30     static Vector comparators = new Vector();
31     private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0);
32
33
34     static public final String JavaDoc [] AVALIABLE_NAMES={"WML","HTML","VXML"};
35     static public final String JavaDoc [] AVALIABLE_MIME_TYPES={"vnd.wap.wml","text/html","text/x-vxml"};
36     
37     static public final String JavaDoc URI = "Uri";
38     
39     public MarkupLanguagesType() {
40         this(Common.USE_DEFAULT_VALUES);
41     }
42     
43     public MarkupLanguagesType(int options) {
44         super(comparators, runtimeVersion);
45         // Properties (see root bean comments for the bean graph)
46
initPropertyTables(1);
47         
48         this.createProperty(PAGES_ID,
49                 PAGES,
50                 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
51                 PageType.class);
52         
53         this.createAttribute(PAGES, XMI_ID_ID, PAGES_XMI_ID,
54                 AttrProp.CDATA | AttrProp.IMPLIED,
55                 null, null);
56         this.createAttribute(PAGES, NAME_ID, PAGES_NAME,
57                 AttrProp.CDATA | AttrProp.IMPLIED,
58                 null, null);
59         this.createAttribute(PAGES,URI_ID,PAGES_URI,
60                 AttrProp.CDATA | AttrProp.IMPLIED,
61                 null, null);
62         
63         
64         this.initialize(options);
65     }
66     
67     // Setting the default values of the properties
68
public void initialize(int options) {
69         //setDefaults();
70
}
71     
72     public void setDefaults() {
73         setXmiId("");
74         setName(AVALIABLE_NAMES[0]);
75         setMimeType(AVALIABLE_MIME_TYPES[0]);
76         setDefaultPage("");
77         setErrorPage("");
78         
79     }
80     
81     
82     // functions for manupulation ResRefBindings
83
public void setPages(int index,PageType value) {
84         this.setValue(PAGES, index,value);
85     }
86     
87     public void setPages(PageType []value) {
88         this.setValue(PAGES, value);
89     }
90     
91     public PageType [] getPages() {
92         return (PageType []) this.getValues(PAGES);
93     }
94     public PageType getPages(int index) {
95         return (PageType )this.getValue(PAGES,index);
96     }
97     public int sizePages() {
98         return this.size(PAGES);
99     }
100     public int addPages(PageType value) {
101         int positionOfNewItem = this.addValue(PAGES, value);
102         return positionOfNewItem;
103     }
104     
105     public int removePages(PageType value) {
106         return this.removeValue(PAGES, value);
107     }
108        
109     public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
110         comparators.add(c);
111     }
112     public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
113         comparators.remove(c);
114     }
115     public void setXmiId(String JavaDoc value) {
116         this.setAttributeValue(MARKUP_LANGUAGES_XMI_ID,value);
117     }
118     public String JavaDoc getXmiId() {
119         return this.getAttributeValue(MARKUP_LANGUAGES_XMI_ID);
120     }
121     public void setName(String JavaDoc value) {
122         this.setAttributeValue(MARKUP_LANGUAGES_NAME,value);
123     }
124     public String JavaDoc getName() {
125         return this.getAttributeValue(MARKUP_LANGUAGES_NAME);
126     }
127     public void setMimeType(String JavaDoc value) {
128         this.setAttributeValue(MARKUP_LANGUAGES_MIME_TYPE,value);
129     }
130     
131     public String JavaDoc getMimeType() {
132         return this.getAttributeValue(MARKUP_LANGUAGES_MIME_TYPE);
133     }
134     
135     public void setErrorPage(String JavaDoc value) {
136         this.setAttributeValue(MARKUP_LANGUAGES_ERROR_PAGE,value);
137     }
138     public String JavaDoc getErrorPage() {
139         return this.getAttributeValue(MARKUP_LANGUAGES_ERROR_PAGE);
140     }
141     
142     public void setDefaultPage(String JavaDoc value) {
143         this.setAttributeValue(MARKUP_LANGUAGES_DEFAULT_PAGE,value);
144     }
145     public String JavaDoc getDefaultPage() {
146         return this.getAttributeValue(MARKUP_LANGUAGES_DEFAULT_PAGE);
147     }
148     
149     
150     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
151         
152         if (getPages()!= null) {
153             for (int _index = 0; _index < sizePages(); ++_index) {
154                 PageType element = getPages(_index);
155                 element.validate();
156             }
157         }
158         if(getXmiId()==null){
159             throw new org.netbeans.modules.schema2beans.ValidateException("getXmiIde() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "MarkupLanguages", this); // NOI18N
160
}
161         if(getName()==null){
162             throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "MarkupLanguages", this); // NOI18N
163
}
164         if(getMimeType()==null){
165             throw new org.netbeans.modules.schema2beans.ValidateException("getMimeType() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "MarkupLanguages", this); // NOI18N
166
}
167         if(getErrorPage()==null){
168             throw new org.netbeans.modules.schema2beans.ValidateException("getErrorPage() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "MarkupLanguages", this); // NOI18N
169
}
170         if(getDefaultPage()==null){
171             throw new org.netbeans.modules.schema2beans.ValidateException("getDefaultPage() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "MarkupLanguages", this); // NOI18N
172
}
173     }
174     
175     
176     
177     // Dump the content of this bean returning it as a String
178
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
179         String JavaDoc s;
180         Object JavaDoc o;
181         org.netbeans.modules.schema2beans.BaseBean n;
182         str.append(indent);
183         str.append(PAGES+"["+this.sizePages()+"]"); // NOI18N
184
for(int i=0; i<this.sizePages(); i++) {
185             str.append(indent+"\t");
186             str.append("#"+i+":");
187             str.append(indent+"\tnull"); // NOI18N
188
this.dumpAttributes(PAGES, i, str, indent);
189         }
190         
191     }
192     public String JavaDoc dumpBeanNode(){
193         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
194         str.append(getClass().getName()); // NOI18N
195
this.dump(str, "\n "); // NOI18N
196
return str.toString();
197     }
198 }
199
200 // END_NOI18N
201

202
Popular Tags