<?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: TilesTool.xml,v 1.5 2005/03/19 07:58:22 nekop Exp $
-->
<document>

    <properties>
        <title>TilesTool</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>TilesTool</original>
        </properties>

    <body>

    <section name="TilesTool Reference Documentation" alias="TilesTool リファレンスドキュメント">

        <primary>
        <p>
        The TilesTool is used to interact with the Tiles framework that is now part
        of Struts (since v. 1.1).
        </p>
        </primary>
        <p>
        TilesToolはTilesフレームワークと連携するために使用されます。
        Tilesフレームワークはv. 1.1よりStrutsの一部となりました。
        </p>

        <toolinfo>
            <version>@@@version@@@, @@@date@@@</version>
            <clazz>org.apache.velocity.tools.struts.TilesTool</clazz>
            <name>$tiles</name>
            <author email="marinoj@centrum.is">Marino A. Jonsson</author>
            <config-example>&lt;tool&gt;
  &lt;key&gt;tiles&lt;/key&gt;
  &lt;scope&gt;request&lt;/scope&gt;
  &lt;class&gt;org.apache.velocity.tools.struts.TilesTool&lt;/class&gt;
&lt;/tool&gt;</config-example>
        </toolinfo>

        <methods/>

    </section>

    <section name="importAttributes()">
        <primary>
        <method name="importAttributes()">

            <abstract>
                Imports all attributes in the current tiles definition into the named context
            </abstract>

            <signature>
                void importAttributes()
            </signature>

            <signature>
                void importAttributes(String scope)
            </signature>

            <parameters>
                <parameter name="scope">
                    The named context scope to put the attributes into. Possible values
                    are <code>page</code> (velocity-context), <code>request</code>,
                    <code>session</code>, and <code>application</code>.
                </parameter>
            </parameters>

            <description>
                <p>This method makes it possible to import all attributes, defined in the
                current tiles definition, into any scope, to be accessed i.e. by
                other tiles.</p>

<p>Assuming that the tiles config contains the following definition(and ".tilename"
is the current tiles definition):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="attr1" value="This is one attribute."/&gt;
    &lt;put name="attr2" value="and this is a another."/&gt;
&lt;/definition&gt;</sourcecode>

<p>then the following Velocity script:</p>
<sourcecode>$tiles.importAttributes()
$attr1
$attr2</sourcecode>

<p>produces this output:</p>
<sourcecode>This is one attribute
and this is another one</sourcecode>
            </description>

        </method>
        </primary>
        <method name="importAttributes()">

            <abstract>
                指定されたコンテキストにカレントのtiles定義にある全ての属性をインポートします。
            </abstract>

            <signature>
                void importAttributes()
            </signature>

            <signature>
                void importAttributes(String scope)
            </signature>

            <parameters>
                <parameter name="scope">
                    指定された、属性をインポートするコンテキストのスコープ。
                    <code>page</code>(velocityコンテキスト)、<code>request</code>、
                    <code>session</code>、<code>application</code>が指定できます。
                </parameter>
            </parameters>

            <description>
                <p>このメソッドはカレントのtiles定義にある全ての属性を任意のスコープにインポートすることを可能にします。
                インポートされた属性は他のtileよりアクセスできるようになります。
                </p>

<p>tilesの設定に次の定義が含まれているとして
(カレントのtiles定義が".tilename"として):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="attr1" value="これはある属性です。"/&gt;
    &lt;put name="attr2" value="そしてこれは別のです。"/&gt;
&lt;/definition&gt;</sourcecode>

<p>次のVelocityスクリプト:</p>
<sourcecode>$tiles.importAttributes()
$attr1
$attr2</sourcecode>

<p>は以下を出力します:</p>
<sourcecode>これはある属性です。
そしてこれは別のです。</sourcecode>
            </description>

        </method>
    </section>

    <section name="getAttribute()">
        <primary>
        <method name="getAttribute()">

            <abstract>
                Returns a named tiles attribute from the current tiles definition
            </abstract>

            <signature>
                String getAttribute(String attributeName)
            </signature>

            <parameters>
                <parameter name="attributeName">
                    The name of the tiles-definition attribute.
                </parameter>
            </parameters>

            <returns>
                Returns the named tiles attribute from the current tiles definition
            </returns>

            <description>
                <p>This method makes it possible to fetch any attribute defined in the
                current tiles definition.</p>

<p>Assuming that the tiles config contains the following definition (and ".tilename"
is the current tiles definition):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="attr1" value="This is one attribute."/&gt;
    &lt;put name="attr2" value="and this is a another."/&gt;
&lt;/definition&gt;</sourcecode>

<p>then the following Velocity script:</p>
<sourcecode>$tiles.getAttribute("attr1")</sourcecode>

<p>produces this output:</p>
<sourcecode>This is one attribute</sourcecode>
            </description>

        </method>
        </primary>
        <method name="getAttribute()">

            <abstract>
                カレントのtiles定義から指定された属性を返却します。
            </abstract>

            <signature>
                String getAttribute(String attributeName)
            </signature>

            <parameters>
                <parameter name="attributeName">
                    tiles定義の属性の名前。
                </parameter>
            </parameters>

            <returns>
                カレントのtiles定義から指定された属性を返却します。
            </returns>

            <description>
                <p>このメソッドはカレントのtiles定義にある任意の属性を取得することを可能にします。
                </p>

<p>tilesの設定に次の定義が含まれているとして
(カレントのtiles定義が".tilename"として):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="attr1" value="これはある属性です。"/&gt;
    &lt;put name="attr2" value="そしてこれは別のです。"/&gt;
&lt;/definition&gt;</sourcecode>

<p>次のVelocityスクリプト:</p>
<sourcecode>$tiles.getAttribute("attr1")</sourcecode>

<p>は以下を出力します:</p>
<sourcecode>これはある属性です。</sourcecode>
            </description>

        </method>
    </section>

    <section name="importAttribute()">
        <primary>
        <method name="importAttribute()">

            <abstract>
                Imports a named attribute in the current tiles definition into the
                named context.
            </abstract>

            <signature>
                void importAttribute(String attributeName)
            </signature>

            <signature>
                void importAttribute(String attributeName, String scope)
            </signature>

            <parameters>
                <parameter name="attributeName">
                    The name of the tiles-definition attribute.
                </parameter>
                <parameter name="scope">
                    The named context scope to put the attributes into. Possible values
                    are <code>page</code> (velocity-context), <code>request</code>,
                    <code>session</code>, and <code>application</code>.
                </parameter>
            </parameters>

            <description>
                <p>This method makes it possible to import a named attribute, defined
                in the current tiles definition, into any scope, to be accessed i.e. by
                other tiles.</p>

<p>Assuming that the tiles config contains the following definition(and ".tilename"
is the current tiles definition):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="attr1" value="This is one attribute."/&gt;
    &lt;put name="attr2" value="and this is a another."/&gt;
&lt;/definition&gt;</sourcecode>

<p>then the following Velocity script:</p>
<sourcecode>$tiles.importAttribute("attr1")
$attr1</sourcecode>

<p>produces this output:</p>
<sourcecode>This is one attribute</sourcecode>
            </description>

        </method>
        </primary>
        <method name="importAttribute()">

            <abstract>
                指定されたコンテキストにカレントのtiles定義にある指定された属性をインポートします。
            </abstract>

            <signature>
                void importAttribute(String attributeName)
            </signature>

            <signature>
                void importAttribute(String attributeName, String scope)
            </signature>

            <parameters>
                <parameter name="attributeName">
                    tiles定義の属性の名前。
                </parameter>
                <parameter name="scope">
                    指定された、属性をインポートするコンテキストのスコープ。
                    <code>page</code>(velocityコンテキスト)、<code>request</code>、
                    <code>session</code>、<code>application</code>が指定できます。
                </parameter>
            </parameters>

            <description>
                <p>このメソッドはカレントのtiles定義にある任意の属性を任意のスコープにインポートすることを可能にします。
                インポートされた属性は他のtileよりアクセスできるようになります。
                </p>

<p>tilesの設定に次の定義が含まれているとして
(カレントのtiles定義が".tilename"として):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="attr1" value="これはある属性です。"/&gt;
    &lt;put name="attr2" value="そしてこれは別のです。"/&gt;
&lt;/definition&gt;</sourcecode>

<p>次のVelocityスクリプト:</p>
<sourcecode>$tiles.importAttribute("attr1")
$attr1</sourcecode>

<p>は以下を出力します:</p>
<sourcecode>これはある属性です。</sourcecode>
            </description>

        </method>
    </section>

    <section name="get()">
        <primary>
        <method name="get()">

            <abstract>
                Inserts the named tile into the current tile.
            </abstract>

            <signature>
                void get(Object attr)
            </signature>

            <parameters>
                <parameter name="attr">
                    The name of the tile to insert.
                </parameter>
            </parameters>

            <description>
                <p>This method makes it possible to insert a named tile, defined
                in the current tiles definition, into the velocity template.</p>

<p>Assuming that the tiles config contains the following definition(and ".tilename"
is the current tiles definition):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="header" value="/header.vm"/&gt;
&lt;/definition&gt;</sourcecode>

<p>then the following two Velocity scripts:</p>

<sourcecode>&lt;!-- layout.vm --&gt;
&lt;html&gt;
$tiles.header
&lt;body&gt;
    World
&lt;/body&gt;
&lt;/html&gt;</sourcecode>
<p/>
<sourcecode>&lt;!-- header.vm --&gt;
&lt;head&gt;
    &lt;title&gt;Hello&lt;/title&gt;
&lt;/head&gt;</sourcecode>

<p>produce this output:</p>
<sourcecode>&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Hello&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    World
&lt;/body&gt;
&lt;/html&gt;</sourcecode>
            </description>

        </method>
        </primary>
        <method name="get()">

            <abstract>
                カレントのtileに指定されたtileを挿入します。
            </abstract>

            <signature>
                void get(Object attr)
            </signature>

            <parameters>
                <parameter name="attr">
                    挿入するtileの名前。
                </parameter>
            </parameters>

            <description>
                <p>このメソッドはカレントのtiles定義にある、
                指定されたtileをvelocityテンプレートに挿入することを可能にします。
                </p>

<p>tilesの設定に次の定義が含まれているとして
(カレントのtiles定義が".tilename"として):</p>
<sourcecode>&lt;definition name=".tilename" path="/layout.vm"&gt;
    &lt;put name="header" value="/header.vm"/&gt;
&lt;/definition&gt;</sourcecode>

<p>次のVelocityスクリプト:</p>

<sourcecode>&lt;!-- layout.vm --&gt;
&lt;html&gt;
$tiles.header
&lt;body&gt;
    World
&lt;/body&gt;
&lt;/html&gt;</sourcecode>
<p/>
<sourcecode>&lt;!-- header.vm --&gt;
&lt;head&gt;
    &lt;title&gt;Hello&lt;/title&gt;
&lt;/head&gt;</sourcecode>

<p>は以下を出力します:</p>
<sourcecode>&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Hello&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    World
&lt;/body&gt;
&lt;/html&gt;</sourcecode>
            </description>

        </method>
    </section>

 </body>
</document>

