/*----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Fever Framework code. The Initial Developer of the Original Code is Romain Ecarnot. Portions created by Initial Developer are Copyright (C) 2006 the Initial Developer. All Rights Reserved. Contributor(s): 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. -----------------------------------------------------------------------------*/ import org.aswing.JPanel; import org.aswing.SoftBoxLayout; import com.bourre.data.collections.Map; import com.bourre.data.iterator.Iterator; import fever.exception.RuntimeException; import fever.Fever; import fever.log.FeverDebug; import fever.utils.Stringifier; import fever.utils.StringUtil; import fvaswing.components.forms.FvFormField; /** * Builds data forms. * *

Take a look at fvaswing.components.forms package to see * built-in form field alvailable in Fever. * *

All fields must be added before appending form onto other component.
* Otherwise, {@link #addField()} method throws a {@link fever.exception.RuntimeException} * exceptions. * *

In case that a field is not valid, tooltip text is available in label object to * notice user where is his error.
* Same technic for required field. * *

Form's data can be saved onto client's computer using the Fever application dedicated * sharedobject. ( see {@link #save()} method. * *

Example * {@code * var container : Container = new JPanel( new BorderLayout( 5,5 ) ); * var nameField : FvStringField = new FvStringField( "Name", 1 ); * var surnameField : FvStringField = new FvStringField( "Surname", 1, 4 ); * var messageField : FvStringAreaField = new FvStringAreaField( "Message" ); * var emailField : FvEmailField = new FvEmailField( "Email" ); * var agreeField : FvCheckboxField = new FvCheckboxField( "I agree", true ); * * var pollBox : FvCheckPollField = new FvCheckPollField( "Your hobbies" ); * pollBox.addChoice( "basket-ball" ); * pollBox.addChoice( "actionscript" ); * * var passField : FvPasswordField = new FvPasswordField( "Password", 6, 10 ); * * var pollRadio : FvRadioPollField = new FvRadioPollField( "Your opinion", true ); * pollRadio.addChoice( "bad" ); * pollRadio.addChoice( "execellent" ); * * var form : FvForm = new FvForm( "myForm" ); * form.addField( nameField ); * form.addField( surnameField ); * form.addField( messageField ); * * container.append( form, BorderLayout.CENTER ); * } * *

You can customize render validation state using {@link #setRenderStateHandler()} method.
* 2 ways to the job : *