org.seasar.s2click.control
クラス S2ClickForm

java.lang.Object
  上位を拡張 net.sf.click.control.AbstractControl
      上位を拡張 net.sf.click.control.Form
          上位を拡張 org.seasar.s2click.control.S2ClickForm
すべての実装されたインタフェース:
java.io.Serializable, net.sf.click.Control

public abstract class S2ClickForm
extends net.sf.click.control.Form

publicフィールドを自動的にコントロールとして登録してくれるForm拡張クラスです。 SubmitコントロールによってJavaScriptバリデーションを行うかどうかを制御する機能も備えています。

publicフィールドの自動登録

このクラスのサブクラスでsetFieldAutoRegisteration(boolean)trueが設定された場合、 S2ClickFormはサブクラスのpublicフィールドとして宣言されたコントロール群を自動的にadd(Field)します。 初期化コードでadd(Field)を呼び出す必要はありません。

 public SampleForm extends S2ClickForm {
   private TextField userId = new TextField("userId");
   private PasswordField password = new PasswordField("password");
   private Submit submit = new Submit("submit");
   
   public SampleForm(){
     setFieldAutoRegisteration(true);
   }
   
   ...
 } 

JavaScriptバリデーションを行わないSubmitコントロール

addNoJavaScriptValidateAction(String)を使用することで、 JavaScriptバリデーションを行わないSubmitコントロールを指定することができます。

 public SampleForm extends S2ClickForm {
   ...
   private Submit register = new Submit("register");
   private Submit cancel = new Submit("cancel");
   
   public SampleForm(){
     addNoJavaScriptValidateAction("register");
   }
   
   ...
 } 

copyTo()、copyFrom()のpublicフィールド対応

ClickのFormクラスはJavaBeanとフォームの値を相互変換するために copyTo()メソッド、copyFrom()メソッドを備えています。 S2ClickFormではこれらのメソッドをpublicフィールドに対応させています。 なお、S2ClickUtilsを使用することでもpublicフィールドを使用したJavaBeanと フォームの値を相互変換することができます。

作成者:
Naoki Takezoe
関連項目:
直列化された形式

フィールドの概要
protected  boolean fieldAutoRegisteration
           
protected  java.util.List<java.lang.String> noJavaScriptValidateActions
           
 
クラス net.sf.click.control.Form から継承されたフィールド
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, buttonAlign, buttonList, buttonStyle, columns, defaultFieldSize, disabled, enctype, error, errorsAlign, errorsPosition, errorsStyle, fieldList, fields, fieldStyle, fieldWidths, FOCUS_JAVASCRIPT, FORM_NAME, HTML_IMPORTS, javaScriptValidation, LABEL_NOT_REQUIRED_PREFIX, LABEL_NOT_REQUIRED_SUFFIX, LABEL_REQUIRED_PREFIX, LABEL_REQUIRED_SUFFIX, labelAlign, labelNotRequiredPrefix, labelNotRequiredSuffix, labelRequiredPrefix, labelRequiredSuffix, labelsPosition, labelStyle, listener, listenerMethod, method, MULTIPART_FORM_DATA, POSITION_BOTTOM, POSITION_LEFT, POSITION_MIDDLE, POSITION_TOP, readonly, SUBMIT_CHECK, validate
 
クラス net.sf.click.control.AbstractControl から継承されたフィールド
attributes, messages, name, parent, styles
 
インタフェース net.sf.click.Control から継承されたフィールド
CONTROL_MESSAGES
 
コンストラクタの概要
S2ClickForm()
          Create a Form with no name defined.
S2ClickForm(java.lang.String name)
          Construct the Form with the given name.
 
メソッドの概要
 void add(net.sf.click.control.Field field)
           
 void addNoJavaScriptValidateAction(java.lang.String action)
           
 void copyFrom(java.lang.Object object)
           
 void copyFrom(java.lang.Object object, boolean debug)
           
 void copyTo(java.lang.Object object)
           
 void copyTo(java.lang.Object object, boolean debug)
           
protected  void init()
          Initializes this form.
 boolean isFieldAutoRegistration()
           
 boolean onProcess()
           
protected  void renderValidationJavaScript(net.sf.click.util.HtmlStringBuffer buffer, java.util.List formFields)
           
 void setFieldAutoRegisteration(boolean fieldAutoRegisteration)
           
 java.lang.String startTag()
           
 
クラス net.sf.click.control.Form から継承されたメソッド
add, clearErrors, clearValues, endTag, getActionURL, getAttributes, getButtonAlign, getButtonList, getButtonStyle, getColumns, getDefaultFieldSize, getEnctype, getError, getErrorFields, getErrorsAlign, getErrorsPosition, getErrorsStyle, getField, getFieldList, getFields, getFieldStyle, getFieldValue, getFieldWidths, getFormSizeEst, getHtmlImports, getHtmlImportsAll, getJavaScriptValidation, getLabelAlign, getLabelNotRequiredPrefix, getLabelNotRequiredSuffix, getLabelRequiredPrefix, getLabelRequiredSuffix, getLabelsPosition, getLabelStyle, getMethod, getValidate, isDisabled, isFormSubmission, isReadonly, isValid, onDeploy, onDestroy, onInit, onRender, onSubmitCheck, onSubmitCheck, onSubmitCheck, performSubmitCheck, remove, removeField, removeFields, renderButtons, renderErrors, renderFields, renderFocusJavaScript, renderHeader, setButtonAlign, setButtonStyle, setColumns, setDefaultFieldSize, setDisabled, setEnctype, setError, setErrorsAlign, setErrorsPosition, setErrorsStyle, setFieldStyle, setJavaScriptValidation, setLabelAlign, setLabelNotRequiredPrefix, setLabelNotRequiredSuffix, setLabelRequiredPrefix, setLabelRequiredSuffix, setLabelsPosition, setLabelStyle, setListener, setMethod, setName, setReadonly, setValidate, toString
 
クラス net.sf.click.control.AbstractControl から継承されたメソッド
addStyleClass, appendAttributes, getAttribute, getContext, getId, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, removeStyleClass, setAttribute, setId, setParent, setStyle
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

noJavaScriptValidateActions

protected java.util.List<java.lang.String> noJavaScriptValidateActions

fieldAutoRegisteration

protected boolean fieldAutoRegisteration
コンストラクタの詳細

S2ClickForm

public S2ClickForm()
Create a Form with no name defined.


S2ClickForm

public S2ClickForm(java.lang.String name)
Construct the Form with the given name.

パラメータ:
name - the form name
メソッドの詳細

setFieldAutoRegisteration

public void setFieldAutoRegisteration(boolean fieldAutoRegisteration)

isFieldAutoRegistration

public boolean isFieldAutoRegistration()

addNoJavaScriptValidateAction

public void addNoJavaScriptValidateAction(java.lang.String action)

init

protected void init()
Initializes this form.

This method is called from onProcess().


add

public void add(net.sf.click.control.Field field)
オーバーライド:
クラス net.sf.click.control.Form 内の add

startTag

public java.lang.String startTag()
オーバーライド:
クラス net.sf.click.control.Form 内の startTag

renderValidationJavaScript

protected void renderValidationJavaScript(net.sf.click.util.HtmlStringBuffer buffer,
                                          java.util.List formFields)
オーバーライド:
クラス net.sf.click.control.Form 内の renderValidationJavaScript

onProcess

public boolean onProcess()
定義:
インタフェース net.sf.click.Control 内の onProcess
オーバーライド:
クラス net.sf.click.control.Form 内の onProcess

copyFrom

public void copyFrom(java.lang.Object object,
                     boolean debug)
オーバーライド:
クラス net.sf.click.control.Form 内の copyFrom

copyFrom

public void copyFrom(java.lang.Object object)
オーバーライド:
クラス net.sf.click.control.Form 内の copyFrom

copyTo

public void copyTo(java.lang.Object object,
                   boolean debug)
オーバーライド:
クラス net.sf.click.control.Form 内の copyTo

copyTo

public void copyTo(java.lang.Object object)
オーバーライド:
クラス net.sf.click.control.Form 内の copyTo