<?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: ActionMessagesTool.xml,v 1.6 2005/03/20 19:59:48 nekop Exp $
-->
<document>

    <properties>
        <title>ActionMessagesTool</title>
        <author email="marino@apache.org">Marino Jonsson</author>
        <projectfile>xdocs-ja/struts/menu.xml</projectfile>
        <translator email="shinobu@ieee.org">Shinobu Kawai</translator>
        <translator email="nekop@programmers.jp">木村 貴由</translator>
        <original>ActionMessagesTool</original>
   </properties>

    <body>

    <section name="ActionMessagesTool Reference Documentation" alias="ActionMessagesTool リファレンスドキュメント">

        <primary>
        <p>
        This tool deals with Struts action messages.  A few important aspects about action
        messages are:</p>
        <ul>
            <li>Action message strings are looked up in the message resources. Support
                for internationalized messages is provided.</li>
            <li>Action messages can have up to five replacement parameters.</li>
            <li>Actions have an attribute <code>property</code> that describes the category of
                message. This allows the view designer to place action messages precisely where they are
                wanted. Several methods of this tool provide a parameter
                <code>property</code> that allows to select a specific category of messages to operate
                on. Without the <code>property</code> parameter, methods operate on all action messages.</li>
        </ul>
        </primary>
        <p>
        このツールは Struts のアクションメッセージを提供します。
        アクションメッセージについて抑えておくべき重要な点は:</p>
        <ul>
            <li>アクションメッセージはメッセージリソースから取得されます。
                国際化されたメッセージの提供がサポートされています。</li>
            <li>アクションメッセージは置換パラメータを5つまで持つことができます。</li>
            <li>アクションはメッセージカテゴリを示す <code>property</code> 属性を持ちます。
                これはビューデザイナが適切な場所にアクションメッセージを配置することを可能にします。
                このツールのいくつかのメソッドは、処理対象とする特定のメッセージカテゴリを選択できる <code>property</code> パラメータを提供します。
                <code>property</code> パラメータを指定しない場合、これらのメソッドは全てのアクションメッセージを処理します。</li>
        </ul>

        <primary>
        <p>See the Struts User's Guide, section
        <a href="http://jakarta.apache.org/struts/userGuide/building_view.html">Building View Components</a>
        for more information on this topic.</p>
        </primary>
        <p>この話題のより詳細については Struts ユーザガイドの
        <a href="http://jakarta.apache.org/struts/userGuide/building_view.html">Building View Components</a>
        の章を参照してください。</p>

        <toolinfo>
            <version>@@@version@@@, @@@date@@@</version>
            <clazz>org.apache.velocity.tools.struts.ActionMessagesTool</clazz>
            <name>$messages</name>
            <author email="sidler@teamup.com">Gabriel Sidler</author>
            <author email="nathan@esha.com">Nathan Bubna</author>
            <config-example>&lt;tool&gt;
  &lt;key&gt;messages&lt;/key&gt;
  &lt;scope&gt;request&lt;/scope&gt;
  &lt;class&gt;org.apache.velocity.tools.struts.ActionMessagesTool&lt;/class&gt;
&lt;/tool&gt;</config-example>
        </toolinfo>

        <methods/>

    </section>

    <section name="exist()">
        <primary>
        <method name="exist()">

            <abstract>
            	Returns <code>true</code> if there are action messages queued,
     		otherwise <code>false</code>.
            </abstract>

            <signature>
                boolean exist()
            </signature>

            <signature>
                boolean exist(String property)
            </signature>

            <parameters>
                <parameter name="property">
                    The category of messages to check for.
                </parameter>
            </parameters>

            <returns>
                <code>true</code> if there are action messages queued. <code>false</code> otherwise.
            </returns>

            <description>
                <p>Calling <code>exist()</code> without the <code>property</code> parameter checks for action messages of
                any category. The <code>property</code> parameter can be used to limit the check to
                action messages of a specific category.</p>

<sourcecode>$errors.exist()
$errors.exist("password")
</sourcecode>
            </description>

        </method>
        </primary>
        <method name="exist()">

            <abstract>
                アクションメッセージがある場合に<code>true</code>を返却、その他の場合<code>false</code>。
            </abstract>

            <signature>
                boolean exist()
            </signature>

            <signature>
                boolean exist(String property)
            </signature>

            <parameters>
                <parameter name="property">
                    チェックするメッセージのカテゴリ。
                </parameter>
            </parameters>

            <returns>
                アクションメッセージがある場合に<code>true</code>を返却、その他の場合<code>false</code>。
            </returns>

            <description>
                <p><code>property</code> パラメータを指定せずに <code>exist()</code> を呼び出すと全てのカテゴリのアクションメッセージがチェックされます。
                <code>property</code> パラメータは特定カテゴリのアクションメッセージのチェックに使用します。</p>

<sourcecode>$errors.exist()
$errors.exist("password")
</sourcecode>
            </description>

        </method>
    </section>

    <section name="getSize()">
        <primary>
        <method name="getSize()">

            <abstract>
                Returns the number of action messages queued.
            </abstract>

            <signature>
                int getSize()
            </signature>

            <signature>
                int getSize(String property)
            </signature>

            <parameters>
                <parameter name="property">
                    The category of action messages to operate on.
                </parameter>
            </parameters>

            <returns>
                The number of action messages.
            </returns>

            <description>
                <p>Calling <code>getSize()</code> without the <code>property</code> parameter returns the total
                number of queued action messages. The <code>property</code> parameter can be used to
                obtain the number of queued action messages for a specific category.</p>

<sourcecode>$messages.getSize()
$messages.size
$messages.getSize("password")</sourcecode>
            </description>

        </method>
        </primary>
        <method name="getSize()">

            <abstract>
                アクションメッセージの数を返却します。
            </abstract>

            <signature>
                int getSize()
            </signature>

            <signature>
                int getSize(String property)
            </signature>

            <parameters>
                <parameter name="property">
                    チェックするメッセージのカテゴリ。
                </parameter>
            </parameters>

            <returns>
                アクションメッセージの数を返却します。
            </returns>

            <description>
                <p><code>property</code> パラメータを指定せずに <code>getSize()</code> を呼び出すと全てのカテゴリのアクションメッセージの総数を返却します。
                <code>property</code> パラメータは特定カテゴリのアクションメッセージの数を取得するときに使用します。</p>

<sourcecode>$messages.getSize()
$messages.size
$messages.getSize("password")</sourcecode>
            </description>

        </method>
    </section>

    <section name="getGlobal()">
        <primary>
        <method name="getGlobal()">

            <abstract>
                This a convenience method and the equivalent of
                <code>$messages.get($messages.globalName)</code>
            </abstract>

            <signature>
                List getGlobal()
            </signature>

            <returns>
                A list of all messages stored under the "global" property.
            </returns>

            <description>
                <p>See the section on get() for more information.</p>
            </description>
        </method>
        </primary>
        <method name="getGlobal()">

            <abstract>
                これは<code>$messages.get($messages.globalName)</code>と同等の簡易メソッドです。
            </abstract>

            <signature>
                List getGlobal()
            </signature>

            <returns>
                "global"プロパティの全てのメッセージのリスト
            </returns>

            <description>
                <p>より詳細についてはget()セクションを参照してください。</p>
            </description>
        </method>
    </section>

    <section name="getAll()">
        <primary>
        <method name="getAll()">

            <abstract>
                Returns a list of localized action messages for all action messages queued.
            </abstract>

            <signature>
                List getAll()
            </signature>

            <signature>
                List getAll(String bundle)
            </signature>

            <parameters>
                <parameter name="bundle">
                    The (non-default) message-resources bundle that holds the action messages.
                </parameter>
            </parameters>

            <returns>
                If the message resources are lacking an action message message for a
                particular message key, the key itself is used as an action message
                and a warning is logged.
            </returns>

            <description>
                <p>The following example shows a macro to render the action messages:</p>

<sourcecode>&#35;macro (messagesMarkup)
    &#35;if (&#36;messages.exist)
        &lt;ul&gt;
        &#35;foreach (&#36;e in &#36;messages.all )
            &lt;li&gt;&#36;e&lt;/li&gt;
        &#35;end
        &lt;/ul&gt;
    &#35;end
&#35;end</sourcecode>

<p>This produces output similar to the following:</p>

<sourcecode>&lt;ul&gt;
    &lt;li&gt;This is the first action message in the queue.&lt;/li&gt;
    &lt;li&gt;This is the second action message in the queue.&lt;/li&gt;
&lt;/ul&gt;</sourcecode>
            </description>

        </method>
        </primary>
        <method name="getAll()">

            <abstract>
                全てのメッセージについての地域化されたアクションメッセージのリストを返却します。
            </abstract>

            <signature>
                List getAll()
            </signature>

            <signature>
                List getAll(String bundle)
            </signature>

            <parameters>
                <parameter name="bundle">
                    アクションメッセージを保持する(デフォルトではない)メッセージリソースバンドル。
                </parameter>
            </parameters>

            <returns>
                特定のメッセージキーのアクションメッセージがメッセージリソースに無かった場合、
                そのキー自体がアクションメッセージとして使用され、このとき警告がロギングされます。
            </returns>

            <description>
                <p>以下の例はアクションメッセージを表示するマクロです:</p>

<sourcecode>&#35;macro (messagesMarkup)
    &#35;if (&#36;messages.exist)
        &lt;ul&gt;
        &#35;foreach (&#36;e in &#36;messages.all )
            &lt;li&gt;&#36;e&lt;/li&gt;
        &#35;end
        &lt;/ul&gt;
    &#35;end
&#35;end</sourcecode>

<p>これは以下のような出力を生成します:</p>

<sourcecode>&lt;ul&gt;
    &lt;li&gt;これは最初のアクションメッセージです。&lt;/li&gt;
    &lt;li&gt;これは二番目のアクションメッセージです。&lt;/li&gt;
&lt;/ul&gt;</sourcecode>
            </description>

        </method>
    </section>


    <section name="get()">
        <primary>
        <method name="get()">

            <abstract>
                Returns a list of localized action messages for a particular category
                of action messages.
            </abstract>

            <signature>
                List get(String property)
            </signature>

            <signature>
                List get(String property, String bundle)
            </signature>

            <parameters>
                <parameter name="property">
                    The category of action messages to return.
                </parameter>

                <parameter name="bundle">
                    The (non-default) message-resources bundle that holds the action messages.
                </parameter>
            </parameters>

            <returns>
                A <code>java.util.List</code> of <code>java.lang.String</code>.
                If no action messages exist for the specified category,
                <code>null</code> is returned.
                If the message resources are lacking an error message for a
                particular message key, the key itself is used as an action message
                and a warning is logged.
            </returns>

            <description>
                <p>The following example shows a macro to render the action messages for a
                particular category of action messages:</p>

<sourcecode>&#35;macro (messagesMarkup &#36;property)
    &#35;if (&#36;messages.exist(&#36;property))
        &lt;ul&gt;
        &#35;foreach (&#36;er in &#36;messages.get(&#36;property) )
            &lt;li&gt;&#36;er&lt;/li&gt;
        &#35;end
        &lt;/ul&gt;
    &#35;end
&#35;end</sourcecode>

<p>This produces output similar to the following:</p>

<sourcecode>&lt;ul&gt;
    &lt;li&gt;This is the first action message in the queue.&lt;/li&gt;
    &lt;li&gt;TThis is the second action message in the queue.&lt;/li&gt;
&lt;/ul&gt;</sourcecode>
            </description>

        </method>
        </primary>
        <method name="get()">

            <abstract>
                指定されたカテゴリのメッセージについての地域化されたアクションメッセージのリストを返却します。
            </abstract>

            <signature>
                List get(String property)
            </signature>

            <signature>
                List get(String property, String bundle)
            </signature>

            <parameters>
                <parameter name="property">
                    返却するメッセージのカテゴリ。
                </parameter>

                <parameter name="bundle">
                    アクションメッセージを保持する(デフォルトではない)メッセージリソースバンドル。
                </parameter>
            </parameters>

            <returns>
                <code>java.lang.String</code> の <code>java.util.ArrayList</code> 。
                指定されたカテゴリにアクションメッセージが無い場合には、
                <code>null</code> を返却します。
                特定のメッセージキーのアクションメッセージがメッセージリソースに無かった場合、
                そのキー自体がアクションメッセージとして使用され、このとき警告がロギングされます。
            </returns>

            <description>
                <p>以下の例は特定のメッセージカテゴリのアクションメッセージを表示するマクロです:</p>

<sourcecode>&#35;macro (messagesMarkup &#36;property)
    &#35;if (&#36;messages.exist(&#36;property))
        &lt;ul&gt;
        &#35;foreach (&#36;er in &#36;messages.get(&#36;property) )
            &lt;li&gt;&#36;er&lt;/li&gt;
        &#35;end
        &lt;/ul&gt;
    &#35;end
&#35;end</sourcecode>

<p>これは以下のような出力を生成します:</p>

<sourcecode>&lt;ul&gt;
    &lt;li&gt;これは最初のアクションメッセージです。&lt;/li&gt;
    &lt;li&gt;これは二番目のアクションメッセージです。&lt;/li&gt;
&lt;/ul&gt;</sourcecode>
            </description>

        </method>
    </section>

 </body>
</document>

