| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| /** |
| * This generated bean class FieldGroup matches the schema element field-group |
| * |
| * Generated on Thu Sep 25 15:18:26 PDT 2003 |
| */ |
| |
| package org.netbeans.modules.j2ee.sun.sunresources.beans; |
| |
| import org.w3c.dom.*; |
| import org.netbeans.modules.schema2beans.*; |
| import java.beans.*; |
| import java.util.*; |
| |
| // BEGIN_NOI18N |
| |
| public class FieldGroup extends org.netbeans.modules.schema2beans.BaseBean |
| { |
| |
| static Vector comparators = new Vector(); |
| |
| static public final String NAME = "Name"; // NOI18N |
| static public final String FIELD = "Field"; // NOI18N |
| |
| public FieldGroup() { |
| this(Common.USE_DEFAULT_VALUES); |
| } |
| |
| public FieldGroup(int options) |
| { |
| super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); |
| // Properties (see root bean comments for the bean graph) |
| this.createProperty("name", // NOI18N |
| NAME, |
| Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, |
| String.class); |
| this.createProperty("field", // NOI18N |
| FIELD, |
| Common.TYPE_1_N | Common.TYPE_BEAN | Common.TYPE_KEY, |
| Field.class); |
| this.createAttribute(FIELD, "field-type", "FieldType", |
| AttrProp.CDATA, |
| null, "string"); |
| this.createAttribute(FIELD, "required", "Required", |
| AttrProp.CDATA, |
| null, "true"); |
| this.initialize(options); |
| } |
| |
| // Setting the default values of the properties |
| void initialize(int options) |
| { |
| |
| } |
| |
| // This attribute is mandatory |
| public void setName(String value) { |
| this.setValue(NAME, value); |
| } |
| |
| // |
| public String getName() { |
| return (String)this.getValue(NAME); |
| } |
| |
| // This attribute is an array containing at least one element |
| public void setField(int index, Field value) { |
| this.setValue(FIELD, index, value); |
| } |
| |
| // |
| public Field getField(int index) { |
| return (Field)this.getValue(FIELD, index); |
| } |
| |
| // This attribute is an array containing at least one element |
| public void setField(Field[] value) { |
| this.setValue(FIELD, value); |
| } |
| |
| // |
| public Field[] getField() { |
| return (Field[])this.getValues(FIELD); |
| } |
| |
| // Return the number of properties |
| public int sizeField() { |
| return this.size(FIELD); |
| } |
| |
| // Add a new element returning its index in the list |
| public int addField(org.netbeans.modules.j2ee.sun.sunresources.beans.Field value) { |
| return this.addValue(FIELD, value); |
| } |
| |
| // |
| // Remove an element using its reference |
| // Returns the index the element had in the list |
| // |
| public int removeField(org.netbeans.modules.j2ee.sun.sunresources.beans.Field value) { |
| return this.removeValue(FIELD, value); |
| } |
| |
| // |
| public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { |
| comparators.add(c); |
| } |
| |
| // |
| public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { |
| comparators.remove(c); |
| } |
| public void validate() throws org.netbeans.modules.schema2beans.ValidateException { |
| // Validating property name |
| if (getName() == null) { |
| throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); // NOI18N |
| } |
| // Validating property field |
| if (sizeField() == 0) { |
| throw new org.netbeans.modules.schema2beans.ValidateException("sizeField() == 0", "field", this); // NOI18N |
| } |
| for (int _index = 0; _index < sizeField(); ++_index) { |
| org.netbeans.modules.j2ee.sun.sunresources.beans.Field element = getField(_index); |
| if (element != null) { |
| element.validate(); |
| } |
| } |
| } |
| |
| // Dump the content of this bean returning it as a String |
| public void dump(StringBuffer str, String indent){ |
| String s; |
| org.netbeans.modules.schema2beans.BaseBean n; |
| str.append(indent); |
| str.append("Name"); // NOI18N |
| str.append(indent+"\t"); // NOI18N |
| str.append("<"); // NOI18N |
| s = this.getName(); |
| str.append((s==null?"null":s.trim())); // NOI18N |
| str.append(">\n"); // NOI18N |
| this.dumpAttributes(NAME, 0, str, indent); |
| |
| str.append(indent); |
| str.append("Field["+this.sizeField()+"]"); // NOI18N |
| for(int i=0; i<this.sizeField(); i++) |
| { |
| str.append(indent+"\t"); |
| str.append("#"+i+":"); |
| n = (org.netbeans.modules.schema2beans.BaseBean) this.getField(i); |
| if (n != null) |
| n.dump(str, indent + "\t"); // NOI18N |
| else |
| str.append(indent+"\tnull"); // NOI18N |
| this.dumpAttributes(FIELD, i, str, indent); |
| } |
| |
| } |
| public String dumpBeanNode(){ |
| StringBuffer str = new StringBuffer(); |
| str.append("FieldGroup\n"); // NOI18N |
| this.dump(str, "\n "); // NOI18N |
| return str.toString(); |
| }} |
| |
| // END_NOI18N |
| |
| |
| /* |
| The following schema file has been used for generation: |
| |
| <!ELEMENT wizard (name, field-group+)> |
| <!ELEMENT field-group (name, field+)> |
| <!ELEMENT field (name, field-value, tag?)> |
| <!ATTLIST field field-type CDATA "string" |
| required CDATA "true"> |
| <!ELEMENT field-value (default-field-value, option-value-pair*)> |
| <!ELEMENT option-value-pair (option-name, conditional-value)> |
| <!ELEMENT name (#PCDATA)> |
| <!ELEMENT default-field-value (#PCDATA)> |
| <!ELEMENT option-name (#PCDATA)> |
| <!ELEMENT conditional-value (#PCDATA)> |
| <!ELEMENT tag (tag-item*)> |
| <!ELEMENT tag-item (#PCDATA)> |
| |
| |
| |
| */ |