<?xml version="1.0" encoding="Shift_JIS"?>
<!--
  Copyright 2004 The Apache Software Foundation.

  Licensed 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.

  $Id: ValidatorTool.xml,v 1.6 2005/03/19 07:58:22 nekop Exp $
-->
<document>

    <properties>
        <title>ValidatorTool</title>
        <author email="marino@apache.org">Marino A. Jonsson</author>
        <projectfile>xdocs-ja/struts/menu.xml</projectfile>
        <translator email="shinobu@ieee.org">Shinobu Kawai</translator>
        <translator email="nekop@programmers.jp">木村 貴由</translator>
        <original>ValidatorTool</original>
        </properties>

    <body>

    <section name="ValidatorTool Reference Documentation" alias="ValidatorTool リファレンスドキュメント">

        <primary>
        <p>
        The ValidatorTool is used to interact with the Validator framework to generate
        dynamic javascript for form validation.
        </p>
        </primary>
        <p>
        ValidatorToolはValidatorフレームワークと連携してフォームバリデーション用の動的javascriptを生成するために使用されます。
        </p>

        <toolinfo>
            <version>@@@version@@@, @@@date@@@</version>
            <clazz>org.apache.velocity.tools.struts.ValidatorTool</clazz>
            <name>$validator</name>
            <author email="marinoj@centrum.is">Marino A. Jonsson</author>
            <config-example>&lt;tool&gt;
  &lt;key&gt;validator&lt;/key&gt;
  &lt;scope&gt;request&lt;/scope&gt;
  &lt;class&gt;org.apache.velocity.tools.struts.ValidatorTool&lt;/class&gt;
&lt;/tool&gt;</config-example>
        </toolinfo>

        <methods/>

    </section>

    <section name="getPage()">
        <primary>
        <method name="getPage()">

            <abstract>
                Gets the current page number of a multi-part form.
            </abstract>

            <signature>
                int getPage()
            </signature>

            <description>
                <p>Gets the current page number of a multi-part form.
                    Only field validations with a matching page number
                    will be generated that match the current page number.</p>
            </description>
        </method>
        </primary>
        <method name="getPage()">

            <abstract>
                マルチパートフォームの現在のページ番号を取得します。
            </abstract>

            <signature>
                int getPage()
            </signature>

            <description>
                <p>マルチパートフォームの現在のページ番号を取得します。
                    現在のページ番号と同じページ番号を持つフィールドのみのバリデーションが生成されます。
                    </p>
            </description>
        </method>
    </section>

    <section name="setPage()">
        <primary>
        <method name="setPage()">

            <abstract>
                Sets the current page number of a multi-part form.
            </abstract>

            <signature>
                void setPage(int page)
            </signature>

            <parameters>
                <parameter name="page">
                    the current page number of a multi-part form.
                </parameter>
            </parameters>

            <description>
                <p>Sets the current page number of a multi-part form.
                    Only field validations with a matching page number
                    will be generated that match the current page number.</p>
            </description>
        </method>
        </primary>
        <method name="setPage()">

            <abstract>
                マルチパートフォームの現在のページ番号を設定します。
            </abstract>

            <signature>
                void setPage(int page)
            </signature>

            <parameters>
                <parameter name="page">
                    マルチパートフォームの現在のページ番号。
                </parameter>
            </parameters>

            <description>
                <p>マルチパートフォームの現在のページ番号を設定します。
                    現在のページ番号と同じページ番号を持つフィールドのみのバリデーションが生成されます。
                    </p>
            </description>
        </method>
    </section>

    <section name="getMethod()">
        <primary>
        <method name="getMethod()">

            <abstract>
                Gets the method name that will be used for the javascript
                validation method name if it has a value.
            </abstract>

            <signature>
                String getMethod()
            </signature>

            <description>
                <p>Gets the method name that will be used for the javascript
                    validation method name if it has a value.  This overrides
                    the auto-generated method name based on the key (form name)
                    passed in.</p>
            </description>
        </method>
        </primary>
        <method name="getMethod()">

            <abstract>
                このメソッドが値を返却する場合、バリデーションを行うjavascriptのメソッド名として使われます。
            </abstract>

            <signature>
                String getMethod()
            </signature>

            <description>
                <p>このメソッドが値を返却する場合、バリデーションを行うjavascriptのメソッド名として使われます。
                    これは与えられたキー(フォーム名)から自動生成されるメソッド名をオーバーライドします。
                    </p>
            </description>
        </method>
    </section>

    <section name="setMethod()">
        <primary>
        <method name="setMethod()">

            <abstract>
                Sets the method name that will be used for the javascript
                validation method name if it has a value.
            </abstract>

            <signature>
                void setMethod(String methodName)
            </signature>

            <parameters>
                <parameter name="methodName">
                    the method name that will be used for the javascript validation
                    method name.
                </parameter>
            </parameters>

            <description>
                <p>Sets the method name that will be used for the javascript
                    validation method name if it has a value.  This overrides
                    the auto-generated method name based on the key (form name)
                    passed in.</p>
            </description>
        </method>
        </primary>
        <method name="setMethod()">

            <abstract>
                このメソッドに値を設定した場合、バリデーションを行うjavascriptのメソッド名として使われます。
            </abstract>

            <signature>
                void setMethod(String methodName)
            </signature>

            <parameters>
                <parameter name="methodName">
                    バリデーションjavascriptのメソッド名
                </parameter>
            </parameters>

            <description>
                <p>このメソッドに値を設定した場合、バリデーションを行うjavascriptのメソッド名として使われます。
                    これは与えられたキー(フォーム名)から自動生成されるメソッド名をオーバーライドします。
                    </p>
            </description>
        </method>
    </section>

    <section name="getHtmlComment()">
        <primary>
        <method name="getHtmlComment()">

            <abstract>
                Gets whether or not to delimit the javascript with html comments.
            </abstract>

            <signature>
                boolean getHtmlComment()
            </signature>

            <description>
                <p>Gets whether or not to delimit the
                    javascript with html comments.  If this is set to 'true', which
                    is the default, html comments will surround the javascript.</p>
            </description>
        </method>
        </primary>
        <method name="getHtmlComment()">

            <abstract>
                javascriptをhtmlコメントで囲むかどうかを取得します。
            </abstract>

            <signature>
                boolean getHtmlComment()
            </signature>

            <description>
                <p>javascriptをhtmlコメントで囲むかどうかを取得します。
                    'true'(デフォルト)の場合、javascriptはhtmlコメントで囲まれます。</p>
            </description>
        </method>
    </section>

    <section name="setHtmlComment()">
        <primary>
        <method name="setHtmlComment()">

            <abstract>
                Sets whether or not to delimit the javascript with html comments.
            </abstract>

            <signature>
                void setHtmlComment(boolean htmlComment)
            </signature>

            <parameters>
                <parameter name="htmlComment">
                    whether or not to delimit the javascript with html comments.
                </parameter>
            </parameters>

            <description>
                <p>Sets whether or not to delimit the
                    javascript with html comments.  If this is set to 'true', which
                    is the default, html comments will surround the javascript.</p>
            </description>
        </method>
        </primary>
        <method name="setHtmlComment()">

            <abstract>
                javascriptをhtmlコメントで囲むかどうかを設定します。
            </abstract>

            <signature>
                void setHtmlComment(boolean htmlComment)
            </signature>

            <parameters>
                <parameter name="htmlComment">
                    javascriptをhtmlコメントで囲むかどうか。
                </parameter>
            </parameters>

            <description>
                <p>javascriptをhtmlコメントで囲むかどうかを設定します。
                    'true'(デフォルト)の場合、javascriptはhtmlコメントで囲まれます。</p>
            </description>
        </method>
    </section>

    <section name="getSrc()">
        <primary>
        <method name="getSrc()">

            <abstract>
                Gets the src attribute's value when defining the html script element.
            </abstract>

            <signature>
                String getSrc()
            </signature>

            <description>
                <p>Gets the src attribute's value when defining the html script element.</p>
            </description>
        </method>
        </primary>
        <method name="getSrc()">

            <abstract>
                htmlのscript要素を定義する時のsrc属性の値を取得します。
            </abstract>

            <signature>
                String getSrc()
            </signature>

            <description>
                <p>htmlのscript要素を定義する時のsrc属性の値を取得します。</p>
            </description>
        </method>
    </section>

    <section name="setSrc()">
        <primary>
        <method name="setSrc()">

            <abstract>
                Sets the src attribute's value (used to include
                an external script resource) when defining
                the html script element.
            </abstract>

            <signature>
                void setSrc(String src)
            </signature>

            <parameters>
                <parameter name="src">
                    the src attribute's value.
                </parameter>
            </parameters>

            <description>
                <p>Sets the src attribute's value (used to include
                    an external script resource) when defining
                    the html script element.</p>
            </description>
        </method>
        </primary>
        <method name="setSrc()">

            <abstract>
                htmlのscript要素を定義する時のsrc属性の値を設定します。
                これは外部スクリプトリソースを指定する時に使用します。
            </abstract>

            <signature>
                void setSrc(String src)
            </signature>

            <parameters>
                <parameter name="src">
                    src属性の値。
                </parameter>
            </parameters>

            <description>
                <p>htmlのscript要素を定義する時のsrc属性の値を設定します。
                    これは外部スクリプトリソースを指定する時に使用します。</p>
            </description>
        </method>
    </section>

    <section name="getCdata()">
        <primary>
        <method name="getCdata()">

            <abstract>
                Returns the cdata setting "true" or "false".
            </abstract>

            <signature>
                boolean getCdata()
            </signature>

            <description>
                <p>Returns the cdata setting "true" or "false".</p>
            </description>
        </method>
        </primary>
        <method name="getCdata()">

            <abstract>
                cdataの設定"true"または"false"を返却します。
            </abstract>

            <signature>
                boolean getCdata()
            </signature>

            <description>
                <p>cdataの設定"true"または"false"を返却します。</p>
            </description>
        </method>
    </section>

    <section name="setCdata()">
        <primary>
        <method name="setCdata()">

            <abstract>
                Sets the cdata status.
            </abstract>

            <signature>
                void setCdata(boolean cdata)
            </signature>

            <parameters>
                <parameter name="cdata">
                    The cdata to set
                </parameter>
            </parameters>

            <description>
                <p>Sets the cdata status.</p>
            </description>
        </method>
        </primary>
        <method name="setCdata()">

            <abstract>
                cdataステータスを設定します。
            </abstract>

            <signature>
                void setCdata(boolean cdata)
            </signature>

            <parameters>
                <parameter name="cdata">
                    設定するcdata
                </parameter>
            </parameters>

            <description>
                <p>cdataステータスを設定します。</p>
            </description>
        </method>
    </section>



    <section name="getJavascript()">
        <primary>
        <method name="getJavascript()">

            <abstract>
                Generates javascript to perform validations on a struts-defined
                form.
            </abstract>

            <signature>
                String getJavascript()
            </signature>

            <signature>
                String getJavascript(String formName)
            </signature>

            <parameters>
                <parameter name="formName">
                    The name of a struts-defined form.
                </parameter>
            </parameters>

            <description>
                <p>Generates both dynamic and static javascript to perform
                    validations on a struts-defined form. By default it
                    uses the form associated with the action. A form name can
                    also be supplied as a parameter to generate javascript
                    for a struts-defined form that is not associated with this
                    particular action.</p>

<p>Assuming that the name of a form associated with a given action is myForm, the
    following Velocity script:</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

$validator.getJavascript()</sourcecode>

<p>produces something like this output (heavily abbreviated):</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

&lt;script type="text/javascript" language="Javascript1.1"&gt;
&lt;!-- Begin

var bCancel = false;

function validateMyForm(form) {
	// call the relevant static methods to validate this form
	...
}

// some more dynamic functions dependent on which validations to perform.
...
...

// finally come all the static validator methods defined in validator-rules.xml
...
...

//End --&gt;
&lt;/script&gt;</sourcecode>
            </description>

        </method>
        </primary>
        <method name="getJavascript()">

            <abstract>
                strutsで定義されたフォームのバリデーションを行うjavascriptを生成します。
            </abstract>

            <signature>
                String getJavascript()
            </signature>

            <signature>
                String getJavascript(String formName)
            </signature>

            <parameters>
                <parameter name="formName">
                    strutsで定義されたフォームの名前。
                </parameter>
            </parameters>

            <description>
                <p>strutsで定義されたフォームのバリデーションを行う動的、
                    静的両方のjavascriptを生成します。
                    デフォルトではアクションと関連付けられたフォームを使用します。
                    フォーム名を与えることによって、
                    このアクションと関連付けられていないフォームのためのjavascriptを生成することもできます。</p>

<p>アクションと関連付けられたフォーム名がmyFormとして、
    次のVelocityスクリプト:</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

$validator.getJavascript()</sourcecode>

<p>は以下のような出力を生成します(かなり短縮されています):</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

&lt;script type="text/javascript" language="Javascript1.1"&gt;
&lt;!-- Begin

var bCancel = false;

function validateMyForm(form) {
	// フォームのバリデーションに必要な静的メソッドを呼び出します
	...
}

// どのバリデーションを行うかに依存する動的function。
...
...

// 最後に、validator-rules.xmlに定義されたバリデーションの静的メソッドが来ます。
...
...

//End --&gt;
&lt;/script&gt;</sourcecode>
            </description>

        </method>
    </section>

    <section name="getDynamicJavascript()">
        <primary>
        <method name="getDynamicJavascript()">

            <abstract>
                Generates the dynamic javascript methods to perform validation
                on a struts-defined form.
            </abstract>

            <signature>
                String getDynamicJavascript()
            </signature>

            <signature>
                String getDynamicJavascript(String formName)
            </signature>

            <parameters>
                <parameter name="formName">
                    The name of a struts-defined form.
                </parameter>
            </parameters>

            <description>
                <p>Generates the dynamic javascript to perform validations on
                    a struts-defined form. By default it uses the form associated
                    with the action. A form name can also be supplied as a parameter
                    to generate javascript for a struts-defined form that is not
                    associated with this particular action. This method does not
                    work by itself - it requires that the relevant static methods
                    be accessible i.e. in a seperate .js file.</p>

<p>Assuming that the name of a form associated with a given action is myForm, the
    following Velocity script:</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

$validator.getDynamicJavascript()</sourcecode>

<p>produces something like this output (heavily abbreviated):</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

&lt;script type="text/javascript" language="Javascript1.1"&gt;
&lt;!-- Begin

var bCancel = false;

function validateMyForm(form) {
	// call the relevant static methods to validate this form
	...
}

// some more dynamic functions dependent on which validations to perform.
...
...

//End --&gt;
&lt;/script&gt;</sourcecode>
            </description>

        </method>
        </primary>
        <method name="getDynamicJavascript()">

            <abstract>
                strutsで定義されたフォームのバリデーションを行う動的javascriptを生成します。
            </abstract>

            <signature>
                String getDynamicJavascript()
            </signature>

            <signature>
                String getDynamicJavascript(String formName)
            </signature>

            <parameters>
                <parameter name="formName">
                    strutsで定義されたフォームの名前。
                </parameter>
            </parameters>

            <description>
                <p>strutsで定義されたフォームのバリデーションを行う動的javascriptを生成します。
                    デフォルトではアクションと関連付けられたフォームを使用します。
                    フォーム名を与えることによって、
                    このアクションと関連付けられていないフォームのためのjavascriptを生成することもできます。
                    このメソッドが単独では動きません。
                    必要な静的メソッドがアクセスできること(i.e. 別の.jsファイルにて)を要求します。
                    </p>

<p>アクションと関連付けられたフォーム名がmyFormとして、
    次のVelocityスクリプト:</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

$validator.getDynamicJavascript()</sourcecode>

<p>は以下のような出力を生成します(かなり短縮されています):</p>
<sourcecode>&lt;form action="/someAction.do" onsubmit="return validateMyForm(this)"&gt;
...
...
&lt;/form&gt;

&lt;script type="text/javascript" language="Javascript1.1"&gt;
&lt;!-- Begin

var bCancel = false;

function validateMyForm(form) {
	// フォームのバリデーションに必要な静的メソッドを呼び出します
	...
}

// どのバリデーションを行うかに依存する動的function。
...
...

//End --&gt;
&lt;/script&gt;</sourcecode>
            </description>

        </method>
    </section>

    <section name="getStaticJavascript()">
        <primary>
        <method name="getStaticJavascript()">

            <abstract>
                Generates all the static javascript methods from validator-rules.xml.
            </abstract>

            <signature>
                String getStaticJavascript()
            </signature>

            <description>
                <p>Generates the static javascript methods from validator-rules.xml
                    to perform validations on a any form. Useful i.e. if the static
                    methods should be located in a seperate .js file.</p>

<p>The following Velocity script:</p>
<sourcecode>$validator.getStaticJavascript()</sourcecode>

<p>produces something like this output (heavily abbreviated):</p>
<sourcecode>&lt;script type="text/javascript" language="Javascript1.1"&gt;
&lt;!-- Begin

function validateFloatRange(form) {
	...
    	...
}

function validateByte(form) {
	...
    	...
}

// and a bunch more ...
...

//End --&gt;
&lt;/script&gt;</sourcecode>
            </description>

        </method>
        </primary>
        <method name="getStaticJavascript()">

            <abstract>
                validator-rules.xmlからすべての静的javascriptメソッドを生成します。
            </abstract>

            <signature>
                String getStaticJavascript()
            </signature>

            <description>
                <p>どのフォームに対してもバリデーションを行えるよう、
                    validator-rules.xmlからすべての静的javascriptメソッドを生成します。
                    静的メソッドが別の.jsファイルに置かれるべき場合に便利です。</p>

<p>次のVelocityスクリプト:</p>
<sourcecode>$validator.getStaticJavascript()</sourcecode>

<p>は以下のような出力を生成します(かなり短縮されています):</p>
<sourcecode>&lt;script type="text/javascript" language="Javascript1.1"&gt;
&lt;!-- Begin

function validateFloatRange(form) {
	...
    	...
}

function validateByte(form) {
	...
    	...
}

// そしてもっとたくさん ...
...

//End --&gt;
&lt;/script&gt;</sourcecode>
            </description>

        </method>
    </section>

 </body>
</document>


