[Jetspeed-japan-trans] CVS-Update: jetspeed-2-trans/ja/xdocs/guides committed by shinsuke

Back to archive index

shins****@users***** shins****@users*****
2006年 1月 9日 (月) 09:53:46 JST


Update of /cvsroot/jetspeed-japan/jetspeed-2-trans/ja/xdocs/guides
In directory sf-cvs:/tmp/cvs-serv2316/ja/xdocs/guides

Modified Files:
	guide-decorators.xml 
Log Message:
submitted by Masashi Nakane

jetspeed-2-trans/ja/xdocs/guides/guide-decorators.xml 1.1.1.1 -> 1.2 (modified)
http://cvs.sourceforge.jp/cgi-bin/viewcvs.cgi/jetspeed-japan/jetspeed-2-trans/ja/xdocs/guides/guide-decorators.xml.diff?r1=1.1.1.1&r2=1.2

===================================================================
RCS file: jetspeed-2-trans/ja/xdocs/guides/guide-decorators.xml,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- guide-decorators.xml	2005/12/16 03:43:36	1.1.1.1
+++ guide-decorators.xml	2006/01/09 00:53:46	1.2
@@ -1,306 +1,527 @@
-<?xml version="1.0"?>
-<!--
-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.
--->
-<document>
-  <properties>
-    <title>Guide to Jetspeed Decoration</title>
-    <subtitle>Documentation for Designers working with Jetspeed Decorations</subtitle>
-    <authors>
-      <person name="Scott T Weaver" email="weave****@apach*****"/>
-      <person name="David Sean Taylor" email="taylo****@apach*****"/>
-    </authors>
-  </properties>
-  <body>
-<section name="Introduction to Decorators">
-<p>
-Decorators are defined as any static or semi-static markup surrounding a dynamically generated Fragment. 
-Decorators are usually written with either Velocity or JSP templates.  This guide will focus primarily
-on using the Velocity scripting language to build decoration.  However, most of the standards and 
-approaches described here can be applied to writing decroations in other scripting languages.
-</p>
-<p>
-    There are two different types of decorations that are used when building a page; Portlet and Layout (or page).
-    <p>
-    Portlet decorations are the "window dressings" of Jetspeed.  They wrap each indivual portlet fragment's
-    rendered content with HTML (XHTML, VXML, etc).  Portlet decoration's are responsible for displaying the
-    appropriate title and any buttons associated with changing window states or portlet modes.
-    </p>
-    <p>
-    Layout or Page decorations responsible for providind a "header" area and "footer" area for a single
-    portal page which is represented by a .psml document (see: <a href="guide-psml.html">Documentation for Designers working with PSML</a>
-    for more information on psml).  They also provide general style information for the page and portlets.  However,
-    portlet level style settings can be overidden at the portlet decoration level.
-    </p>
-    
-</p>
-</section>
-<section name="Decoration File Structure">
-<p>
-    All decorations are stored in a directory directly off of the web applications
-    root called <code>decrorations</code>.  The two primary directories under the 
-    here are <code>layout</code> for layout decorations and <code>portlet</code>
-    for portlet decorations.  Individual decoartions are housed in thier own directories
-    underneath these two directories.  The name of the directory you create for under either
-    <code>layout</code> or <code>portlet</code> is how Jetspeed will locate your decoration.  We
-    will go into further detail on how this works later on in this guide.
-</p>        
-</section>
-
-<section name="Anatomy of a Layout(Page) Decoration">
-  <subsection name='Four Files in a Nutshell'>
-    <p>
-        In it's most basic form a Layout Decroation only requires you to define
-        four files:
-        <ul>
-            <li>decorator.properties</li>
-            <li>styles.css</li>
-            <li>header.vm</li>
-            <li>footer.vm</li>
-        </ul>
-        Three of these files; decorator.properties, header.vm, and footer.vm go directly into 
-        the directory you create under <code>/decorations/layout</code>.  The styles.css needs
-        to be put into a subdirectory of your decoration names <code>css/</code>.
-    </p>
-  </subsection>
-  
-   <subsection name='Basic Layout Decoration Configuration: decorator.properties'>
-    <p>
-        The decorator.properties file holds basic information about your layout
-        decoration.  In all actuallity, this file can be blank, but we still require
-        that it be present as it is used by other APIs to "discover" available decorations.  
-        With that being said, it is safe to assume that all the properties defined below 
-        are optional.
-        <table>
-            <tr>
-                <th>Property Name</th>
-                <th>Description</th>
-                <th>Default</th>
-            </tr>
-            <tr>
-                <td>base.css.class</td>
-                <td>
-                    This value is generally placed in the top most element tag
-                    of your header template.  You will see how it is used when
-                    we go into development of a header template.
-                </td>
-                <td>Defaults to the name of your decoration</td>
-            </tr>
-            <tr>
-                <td>stylesheet</td>
-                <td>Relative path to your decoration's stylesheet</td>
-                <td>css/styles.css</td>
-            </tr>
-            <tr>
-                <td>header</td>
-                <td>Relative path to your decoration's header template</td>
-                <td>header.vm</td>
-            </tr>
-            <tr>
-                <td>footer</td>
-                <td>Relative path to your decoration's footer template</td>
-                <td>footer.vm</td>
-            </tr>            
-        </table>
-    </p>
-   </subsection>
-   <subsection name='Top o&apos; the Page to ya: header.vm'>
-    <p>
-        The <strong>header.vm</strong> represnts the top portion of your portal page.  Below is a section
-        by section walkthrough of the basics required to write a functional header
-        template.
-        <br/><br/>
-        <strong>NOTICE:</strong> It is assumed that the reader is proficient in both
-        the use of HTML and CSS.  A rudimentary knowledge of Velocity helps but is not 
-        required to develop a decoration.
-    </p>
-    <p>
-<source>
-<![CDATA[        
-<html>
-   <head>
-     #defineLayoutObjects()
-]]></source>   
-        The first two lines should be obvious, if they are not, this guide from here
-        on out will not be much help to you ;-)
-
-  		<h4>Our First Macro: #defineLayoutObjects()</h4>
-        <p>
-            Now the line containing <code>#defineLayoutObjects()</code> will not be as obvious in its
-            purpose as the previous two.  <code>#defineLayoutObjects()</code> is what is known, in
-            Velocity vernacular, as a macro.  A macro is a predefined snippet of Velocity 
-            code that can be reused within any Velocity template.  All of the global macros
-            we will be using (including this one) are defined within the <code>WEB-INF/jetspeed_macros.vm</code>.
-            Later in this guide we will discuss supplying your own, custom macros for assisting
-            you in your decoration development, if you choose to.  Now, back to the <code>#defineLayoutObjects()</code>.
-            <code>#defineLayoutObjects()</code> adds values to Velocity that will be accessible within header.vm,
-            footer.vm, other macros and all of your portlet decoration templates.  We could easily stop here 
-            regarding <code>#defineLayoutObjects()</code>, however, I feel it can be helpful to have some 
-            insights into the inner workings of Velocity for the uninitiated.  With out further ado, the 
-            code:        
-<source>
-<![CDATA[        
-  #macro (defineLayoutObjects)
-    #set($preferedLocale = $JS2RequestContext.locale)
-    #set($rootFragment = $jetspeed.currentFragment)
-    #set($site = $request.getAttribute("org.apache.jetspeed.portalsite.PortalSiteRequestContext"))
-    #set($theme = $request.getAttribute("org.apache.jetspeed.theme"))
-    #set($layoutDecoration = $theme.getDecoration($rootFragment))
-  #end        
-]]></source>        
-			
-            Hmm. What is actually happening here. Okay first off we have, <code>#set()</code>, this is what is known as a
-            directive in Velocity.  A directive is built-in functionallity and not a macro. <code>#set()</code>
-            is pretty straight forward in that it takes the value on the right of the = and assigns it to
-            the left.  Cool, that seems fairly straight forward. But how does one work with these values and where
-            the heck did <code>$JS2RequestContext.locale</code> come from?  I guess i should take a quick step back
-            and describe how we work with objects in Velocity.  All objects available to a Velocity template
-            can be referenced via the <code>$someObject</code> notation.  Knowing that much invoking a method
-            , let's getFoo(), can be done just like this <code>$someObject.getFoo()</code>.  Even cooler is the
-            fact we can short-hand getter methods that don't take any arguments like this, 
-            <code>$someObject.foo</code>.  As for this <code>$JS2RequestContext</code> this is actually
-            an instance of the <code>org.apache.jetspeed.RequestContext</code> that has been availble to Velocity
-            by Jetspeed itself.  So, by looking the javadoc for <code>org.apache.jetspeed.RequestContext</code> we see
-            <code>$JS2RequestContext.locale</code> will give us an instance of <code>java.util.Locale</code> that reperesnts
-            the locale of the current user.  Couldn't be much simpler than that could it?
-               <br/><br/>
-            Next up we have this line <code>#set($rootFragment = $jetspeed.currentFragment)</code> another set()
-            statement, this time creating an object called <code>$rootFragment</code> which is an instance of
-            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/om/page/ContentFragment.html">org.apache.jetspeed.om.page.ContentFragment</a>.
-			It is really not relevant to this guide
-            to describe what <code>$jetspeed.currentFragment</code> is doing so I am going to skip that and move on. 
-            <br/><br/>
-            <code>
-              #set($site = $request.getAttribute("org.apache.jetspeed.portalsite.PortalSiteRequestContext"))
-             <br/>
-             #set($theme = $request.getAttribute("org.apache.jetspeed.theme"))
-            </code>
-            <br/>
-            Ah <code>$request</code>, now that looks familiar, this is actually an instance of <code>javax.servlet.http.HttpServletRequest</code>
-            from which we are retreiving objects that were been placed into Velocity by Jetspeed.  The actual objects are:
-            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/portalsite/PortalSiteRequestContext.html">org.apache.jetspeed.portalsite.PortalSiteRequestContext</a>
-            and
-            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/decroation/Theme.html">org.apache.jetspeed.decoration.Theme</a>
-            respectively.  We will put all of these objects to good use in just a little while.       
-        </p>
-	  <h4>Feed Your HEAD: How to Properly Code Your Head Tag.</h4>
-	   <p>
-		This section provides you with all the information to prperly code the
-		&lt;HEAD&gt; of your Layout decroation.  So, straight to the code.
-		<source>
-<![CDATA[  
-<html>
-    <head>
-     #defineLayoutObjects()
-     
-     <base href="#BaseHref()">
-     <meta http-equiv="Content-type" content="#ContentType()" />
-     <meta http-equiv="Content-style-type" content="text/css" />   
-     #includeJavaScriptForHead()
-     #IncludeStylesheets()    
-     <title>#PageTitle()</title>
-     <meta name="description" content="#PageDescription()" />
-]]></source>
-	   </p>	
-	 
-    </p>
-	<h5>The &lt;base&gt; Tag</h5>
-	  <p>	
-		First off we have <code><![CDATA[ <base href="#BaseHref()">]]></code> which allows 
-		us to define the base path for resolution of web resources, for an in depth discussion
-		of the <code><![CDATA[ <base>]]></code> see: <a href="http://www.w3schools.com/tags/tag_base.asp">W3C Schools Reference</a>.  
-		If you have spent any time playing with Jetspeed, you will have noticed it does all sorts
-		of crazy URL rewriting that will totally hose any attempts to consistently path you html
-		and styles sheets.  By defining the BASE tag, this probelms will all but disappear.  As 
-		for the <code>#BaseHref()</code> macro, it simply generates a fully qualified path to your
-		web application's root.  The actual code, interms of the servlet api is synonimous with this:
-<source>
-HttpServletRequest request;
-StingBuffer baseHref = new StringBuffer(request.getScheme())
-     .append("://").append(request.getServerName())
-	 .append(":").append(request.getServerPort())
-	 .append(request.getContextPath()).append("/");
-return baseHref.toString();		 
-</source>
-       The actual Velocity macro code is a bit more terse ;)
-<source>
-${request.scheme}://${request.serverName}:${request.serverPort}${request.contextPath}/
-</source>
-       </p>
-	 <h5>Meta Tag: <![CDATA[<meta http-equiv="Content-type" content="#ContentType()" />]]></h5>
-	 <p>
-		Will return text/html plus the proper encoding, such as UTF.
-	 </p>
-	 <h5>#includeJavaScriptForHead()</h5>
-	 <p>
-	   At the time of the writing of this guide there is really very little javascript
-	   required to for the base Jetspeed 2 server to run.  However this may change in
-	   near future as we try to employ the use of AJAX in things such as configuration 
-	   and administration.
-	 </p>
-   </subsection>
-</section>
-<!--
-<section name='Packaging'>
-<p>
-Layouts are packaged in a JAR file. Supported decorators: 
-<ul>
-    <li>Page Decorators</li>
-    <li>Portlet Decorators</li>
-    <li>Generic Decorators</li>    
-    <li>Localized Decorators</li>
-</ul>
-Operations Supported:
-<ul>
-    <li>Deploy</li>
-    <li>Un-deploy</li>
-    <li>Re-deploy</li>
-</ul>
-The decorator.properties file must be located in the root directory of the jar archive and 
-contain the properties outlined in the next slide to be identified as a decorator by the auto 
-deployment system. The deployer will relocate the locale specific content to satisfy J2 
-content locators as necessary on deploy and undeploy. The current implementation supports 
-only 2 character language and country codes.    
-</p>    
-</section>
-<section name='Decorator Properties'>
-<p>
-The decorator.properties file must be located in the root directory of the jar archive and 
-contain the properties outlined above to be identified as a decorator by the auto-deployment system. 
-</p>
-<p>
-A deployable decorator must have the following properties set or defaulted in the decorator.properties 
-configuration:
-
-<source test=""><![CDATA[
-
-id = IDENTIFIER
-media.type=  HTML | WML
-decorates =  layout | portlet | any
-
-]]></source>
-
-To avoid conflicts with the locale logic and runtime locators, decorators should be 
-named with ids longer than 2 characters in length. The media.type property defaults to 'html'. 
-The 'any' value for the decorates property is mapped to the generic deployment directory.
-The deployer will relocate the locale specific content to satisfy J2 content locators as 
-necessary on deploy and undeploy. The current implementation supports only 2 
-character language and country codes.
-</p>    
-</section>
--->
-</body>
-</document>
-
+<?xml version="1.0"?>
+<!--
+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.
+-->
+<document>
+  <properties>
+    <title>[Guide to Jetspeed Decoration] Jetspeedデコレーション ガイド</title>
+    <subtitle>[Documentation for Designers working with Jetspeed Decorations] Jetspeedデコレーションでデザイン作業をする為の資料</subtitle>
+    <authors>
+      <person name="Scott T Weaver" email="weave****@apach*****"/>
+      <person name="David Sean Taylor" email="taylo****@apach*****"/>
+    </authors>
+    <translators>
+      <person name="中根政嗣"/>
+    </translators>
+  </properties>
+  <body>
+<section name="[Introduction to Decorators] Jetspeedデコレーターへの導入">
+
+<div class="original">
+<p>
+Decorators are defined as any static or semi-static markup surrounding a dynamically generated Fragment. 
+Decorators are usually written with either Velocity or JSP templates.  This guide will focus primarily
+on using the Velocity scripting language to build decoration.  However, most of the standards and 
+approaches described here can be applied to writing decroations in other scripting languages.
+</p>
+</div>
+<p>
+デコレーターとは  動的に作成されるフラグメント(画面の一部分)の周りを囲むもので 静的もしくは、半静的な マークアップランゲージで記述
+できるものと 定義されます。デコレーターは、 通常 Velocityテンプレートもしくは、JSPテンプレートとして書かれます。このガイドでは、主に
+Velocityスクリプト言語で デコレーターを作成する方法について書きます。しかし、ここに書かれる 標準的な方法とアプローチ手段は、大体の所、
+他のスクリプト言語で、デコレーションを作成する際にも応用可能です。
+</p>
+
+<div class="original">
+<p>
+    There are two different types of decorations that are used when building a page; Portlet and Layout (or page).
+    <p>
+    Portlet decorations are the "window dressings" of Jetspeed.  They wrap each indivual portlet fragment's
+    rendered content with HTML (XHTML, VXML, etc).  Portlet decoration's are responsible for displaying the
+    appropriate title and any buttons associated with changing window states or portlet modes.
+    </p>
+    <p>
+    Layout or Page decorations responsible for providind a "header" area and "footer" area for a single
+    portal page which is represented by a .psml document (see: <a href="guide-psml.html">Documentation for Designers working with PSML</a>
+    for more information on psml).  They also provide general style information for the page and portlets.  However,
+    portlet level style settings can be overidden at the portlet decoration level.
+    </p>
+    
+</p>
+</div>
+<p>
+	ページを構築する際に使用するデコレーションの種類には 次の2つがあります。;ポートレット と レイアウト(ページ)。
+    <p>
+	ポートレットのデコレーションとは Jetspeedの ウインドウの装飾にあたります。これは、それぞれのポートレット部分を
+	作成されるコンテンツ部分をHTML (XHTML, VXML, etc) で 囲むもので、適切なタイトルの表示や、ウインドウの状態や
+	ポートレットのモードの変化と連携して変わるボタン群の表示を担当します。
+    </p>
+    <p>
+	レイアウトもしくはページのデコレーションとは、1つPSMLファイルを元に表される1つのポータルページの ヘッダー部分とフッター部分の装飾を
+	提供するものです。(参考: PSMLについての更なる情報については、<a href="guide-psml.html">PSMLを扱ってデザインをする人のための資料</a>)
+	これらのデコレーションは、ページとポートレットの一般的なスタイル情報を持ちます。
+	ポートレット内部のスタイル情報は、デコレーターのスタイル情報によって上書きされます。
+    </p>
+    
+</p>
+
+</section>
+<section name="[Decoration File Structure] デコレーションのファイル構成">
+
+<div class="original">
+<p>
+    All decorations are stored in a directory directly off of the web applications
+    root called <code>decrorations</code>.  The two primary directories under the 
+    here are <code>layout</code> for layout decorations and <code>portlet</code>
+    for portlet decorations.  Individual decoartions are housed in thier own directories
+    underneath these two directories.  The name of the directory you create for under either
+    <code>layout</code> or <code>portlet</code> is how Jetspeed will locate your decoration.  We
+    will go into further detail on how this works later on in this guide.
+</p>        
+</div>
+<p>
+	全てのデコレーション用のファイルは、webアプリケーションのルートディレクトリの直下にある<code>decrorations</code>というディレクトリに
+	保存されます。このディレクトリの下の 重要な2つのディレクトリが、レイアウト装飾用の<code>layout</code>ディレクトリと
+	ポートレット装飾用の<code>portlet</code>ディレクトリです。個別のデコレーションは、これら2つのディレクトリの下に、それぞれ独自のディレクトリを持ちます。
+	Jetspeedは、<code>layout</code> か <code>portlet</code> の下に あなたが に作成するディレクトリの名称で、
+	デコレーターファイルの場所を特定します。では、これが どういう仕組みで働くかについての 更なる詳細をこのガイドの続き で見ていきましょう。
+</p>        
+
+</section>
+
+<section name="[Anatomy of a Layout(Page) Decoration] レイアウト(ページ) デコレーションの詳細">
+  <subsection name='[Four Files in a Nutshell] 一言でいうと 4つのファイル'>
+<div class="original">
+    <p>
+        In it's most basic form a Layout Decroation only requires you to define
+        four files:
+	</p>
+</div>
+    <p>
+    	もっとも基本的な形で レイアウトのデコレーションをするのであれば、4つのファイルを定義するだけです。:
+	</p>
+        <ul>
+            <li>decorator.properties</li>
+            <li>styles.css</li>
+            <li>header.vm</li>
+            <li>footer.vm</li>
+        </ul>
+<div class="original">
+       	<p>
+        Three of these files; decorator.properties, header.vm, and footer.vm go directly into 
+        the directory you create under <code>/decorations/layout</code>.  The styles.css needs
+        to be put into a subdirectory of your decoration names <code>css/</code>.
+		</p>		
+</div>
+       	<p>
+		この中の3つのファイル;decorator.properties, header.vm, と footer.vm は、<code>/decorations/layout</code>の
+		下に作成したディレクトリに直接置いてください。styles.css は、あなた作ったデコレーションのサブディレクトリ<code>css/</code>
+		に入れます。[訳注:すなわち/YOUR_WEB_APP/decorations/layout/YOUR_DECORATION_NAME/cssディレクトリにスタイルシートを置く。]
+		</p>
+  </subsection>
+  
+   <subsection name='[Basic Layout Decoration Configuration: decorator.properties] レイアウト デコレーションの基本設定: decorator.properties'>
+	<div class="original" color="#FF8000">
+    	<p>
+        The decorator.properties file holds basic information about your layout
+        decoration.  In all actuallity, this file can be blank, but we still require
+        that it be present as it is used by other APIs to "discover" available decorations.  
+        With that being said, it is safe to assume that all the properties defined below 
+        are optional.
+		</p>
+	</div>
+    	<p>
+        decorator.properties ファイルは、あなたのレイアウト デコレーションの基本情報を保持します。
+		実際のところ、このファイルは 空白でも構いませんが、他のAPIが使用可能なデコレーションを探すのに使用されるため
+		ファイル自体は存在する必要があります。ということで、下の定義にあるプロパティは 全てオプションであると仮定しても
+		問題ありません。
+		</p>
+	<div class="original">
+        <table>
+            <tr>
+                <th>Property Name</th>
+                <th>Description</th>
+                <th>Default</th>
+            </tr>
+            <tr>
+                <td>base.css.class</td>
+                <td>
+                    This value is generally placed in the top most element tag
+                    of your header template.  You will see how it is used when
+                    we go into development of a header template.
+                </td>
+                <td>
+                	Defaults to the name of your decoration
+                </td>
+            </tr>
+            <tr>
+                <td>stylesheet</td>
+                <td>
+                	Relative path to your decoration's stylesheet
+                </td>
+                <td>css/styles.css</td>
+            </tr>
+            <tr>
+                <td>header</td>
+                <td>
+                	Relative path to your decoration's header template
+                </td>
+                <td>header.vm</td>
+            </tr>
+            <tr>
+                <td>footer</td>
+                <td>
+                	Relative path to your decoration's footer template
+                </td>
+                <td>footer.vm</td>
+            </tr>            
+        </table>
+    </div>
+        
+        <table>
+            <tr>
+                <th>Property Name</th>
+                <th>Description</th>
+                <th>Default</th>
+            </tr>
+            <tr>
+                <td>base.css.class</td>
+                <td>
+                   	この値は、一般的に ヘッダーのテンプレートファイルの一番上の要素タグの中に
+                   	配置されます。ヘッダーテンプレート作成の説明のところで、この使用方法を
+                   	見ることになります。
+                </td>
+                <td>
+                	あなたのデコレーション名がデフォルト値と なります。
+                </td>
+            </tr>
+            <tr>
+                <td>stylesheet</td>
+                <td>
+                	デコレーションのスタイルシートへの相対パス
+                </td>
+                <td>css/styles.css</td>
+            </tr>
+            <tr>
+                <td>header</td>
+                <td>
+                	デコレーションのヘッダーテンプレートへの相対パス
+                </td>
+                <td>header.vm</td>
+            </tr>
+            <tr>
+                <td>footer</td>
+                <td>
+                	デコレーションのフッターテンプレートへの相対パス
+                </td>
+                <td>footer.vm</td>
+            </tr>            
+        </table>
+
+   </subsection>
+   <subsection name='[Top o&apos; the Page to ya: header.vm] 自分専用のページトップ: header.vm'>
+<div class="original">
+    <p>
+        The <strong>header.vm</strong> represnts the top portion of your portal page.  Below is a section
+        by section walkthrough of the basics required to write a functional header
+        template.
+        <br/><br/>
+        <strong>NOTICE:</strong> It is assumed that the reader is proficient in both
+        the use of HTML and CSS.  A rudimentary knowledge of Velocity helps but is not 
+        required to develop a decoration.
+    </p>
+</div>
+    <p>
+        ファイル<strong>header.vm</strong>は、あなたのポータルページのトップ部分を表します。
+       機能的なヘッダーテンプレートを記述すのに必要になる基本事項について 以下に 各セクションごとに 書いてあります。
+        <br/><br/>
+        <strong>注意:</strong>前提事項として、読者は、HTMLとCSSについての十分な知識があると仮定してあります。
+        デコレーションを開発するに当たって、基本的なVelocityの知識は、あれば良いくらいで、必須の知識ではありません。
+    </p>
+
+<source>
+<![CDATA[        
+<html>
+   <head>
+     #defineLayoutObjects()
+]]></source>   
+		<div class="original">
+    <p>
+        The first two lines should be obvious, if they are not, this guide from here
+        on out will not be much help to you ;-)
+    </p>
+		</div>
+    <p>
+		上の最初の2行の意味は明らかでしょう、もし そうでない場合は、これ以降の内容は あまり あなたの助けにならないでしょう。^^)
+    </p>
+
+  		<h4>[Our First Macro: #defineLayoutObjects()] 最初のマクロ: #defineLayoutObjects()</h4>
+<div class="original">
+        <p>
+            Now the line containing <code>#defineLayoutObjects()</code> will not be as obvious in its
+            purpose as the previous two.  <code>#defineLayoutObjects()</code> is what is known, in
+            Velocity vernacular, as a macro.  A macro is a predefined snippet of Velocity 
+            code that can be reused within any Velocity template.  All of the global macros
+            we will be using (including this one) are defined within the <code>WEB-INF/jetspeed_macros.vm</code>.
+            Later in this guide we will discuss supplying your own, custom macros for assisting
+            you in your decoration development, if you choose to.  Now, back to the <code>#defineLayoutObjects()</code>.
+            <code>#defineLayoutObjects()</code> adds values to Velocity that will be accessible within header.vm,
+            footer.vm, other macros and all of your portlet decoration templates.  We could easily stop here 
+            regarding <code>#defineLayoutObjects()</code>, however, I feel it can be helpful to have some 
+            insights into the inner workings of Velocity for the uninitiated.  With out further ado, the 
+            code:        
+    </p>
+</div>
+        <p>
+			さて、<code>#defineLayoutObjects()</code>を含む行ですが、これは、前の2行ほどは その目的について意味が あまり明らかではありません。
+			<code>#defineLayoutObjects()</code>は、いわゆる Velocityの世界で マクロと 言われるものです。
+			マクロは、事前に定義された Velocityの小さなコードで、Velocityテンプレートの中で再利用されます。
+			これから使用する全てのグローバル マクロ(このマクロも含む)は、<code>WEB-INF/jetspeed_macros.vm</code>で定義されています。
+			後ほど、 このガイドの中で、もし あなたが そうしたいのであれば、自分のデコレーションを作成するにあたって
+			便利であるカスタムマクロの作成方法について議論します。では、<code>#defineLayoutObjects()</code>にもどりましょう。
+			<code>#defineLayoutObjects()</code>は、様々な値をVelocityに対して追加し、それらは、header.vm,
+            footer.vm,他のマクロと そして全てのポートレット デコレーション テンプレートの内部でアクセス可能になります。
+			ここで、<code>#defineLayoutObjects()</code>に関する話を 簡単にやめることはできますが、Velocityをまだはじめた事が
+			ない人のために Velocityの内部の動きを見ていく方が 助けになる気がします。では 余計な事をいうのはこれくらいにして、
+			コードは、こうなっています。
+    	</p>
+<source>
+<![CDATA[        
+  #macro (defineLayoutObjects)
+    #set($preferedLocale = $JS2RequestContext.locale)
+    #set($rootFragment = $jetspeed.currentFragment)
+    #set($site = $request.getAttribute("org.apache.jetspeed.portalsite.PortalSiteRequestContext"))
+    #set($theme = $request.getAttribute("org.apache.jetspeed.theme"))
+    #set($layoutDecoration = $theme.getDecoration($rootFragment))
+  #end        
+]]></source>        
+			
+<div class="original">
+        <p>
+            Hmm. What is actually happening here. Okay first off we have, <code>#set()</code>, this is what is known as a
+            directive in Velocity.  A directive is built-in functionallity and not a macro. <code>#set()</code>
+            is pretty straight forward in that it takes the value on the right of the = and assigns it to
+            the left.  Cool, that seems fairly straight forward. But how does one work with these values and where
+            the heck did <code>$JS2RequestContext.locale</code> come from?  I guess i should take a quick step back
+            and describe how we work with objects in Velocity.  All objects available to a Velocity template
+            can be referenced via the <code>$someObject</code> notation.  Knowing that much invoking a method
+            , let's getFoo(), can be done just like this <code>$someObject.getFoo()</code>.  Even cooler is the
+            fact we can short-hand getter methods that don't take any arguments like this, 
+            <code>$someObject.foo</code>.  As for this <code>$JS2RequestContext</code> this is actually
+            an instance of the <code>org.apache.jetspeed.RequestContext</code> that has been availble to Velocity
+            by Jetspeed itself.  So, by looking the javadoc for <code>org.apache.jetspeed.RequestContext</code> we see
+            <code>$JS2RequestContext.locale</code> will give us an instance of <code>java.util.Locale</code> that reperesnts
+            the locale of the current user.  Couldn't be much simpler than that could it?
+               <br/><br/>
+            Next up we have this line <code>#set($rootFragment = $jetspeed.currentFragment)</code> another set()
+            statement, this time creating an object called <code>$rootFragment</code> which is an instance of
+            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/om/page/ContentFragment.html">org.apache.jetspeed.om.page.ContentFragment</a>.
+			It is really not relevant to this guide
+            to describe what <code>$jetspeed.currentFragment</code> is doing so I am going to skip that and move on. 
+        </p>
+</div>
+        <p>
+			むむ、この中ではいったい何がおきているのでしょうか?さて、1行目には、<code>#set()</code>があります。これは Velocityで指示子と
+			呼ばれるものです。指示子は オリジナルの関数であり マクロではありません。<code>#set()</code>は、非常にわかりやすいですね。
+			イコール記号の 右辺にある値を 受け取り 左辺へ 割り当てるものです。素晴らしい、これは、かなりわかり易いですね。しかし、
+			どうやってこの値を取り扱えばいいのでしょうか?いったい<code>$JS2RequestContext.locale</code>は、どこから現れたのでしょう?
+			では、すこしだけ戻って、Velocityのオブジェクトをどうやって使うか書きたいと思います。全てのVelocityテンプレートで利用可能なオブジェクト
+			は、<code>$someObject</code>という書き方で参照することができます。メソッドの実行は、<code>$someObject.getFoo()</code> の様に
+			書くことで 実行できます。getFoo()を実行してみましょう。実は、引数を取らないgetterメソッドは、<code>$someObject.foo</code>
+			こんな風に書けるというのは、さらに素晴らしい事です。この<code>$JS2RequestContext</code>に関していうと、これは、<code>org.apache.jetspeed.RequestContext</code>
+			のインスタンスで、JetspeedがVelocityで使用できるように、インスタンス化されます。それで、<code>org.apache.jetspeed.RequestContext</code>
+			をJava docを見るとわかりますが、<code>$JS2RequestContext.locale</code>は、<code>java.util.Locale</code>のインスタンスを
+			渡してくれ、これは、現在のポートレットのユーザーのロケールになります。これ以上は シンプルにはできないでしょう?
+               <br/><br/>
+			次に 出てくるのは、 <code>#set($rootFragment = $jetspeed.currentFragment)</code> の行ですね、またset()の組
+			今回は、<code>$rootFragment</code> と呼ばれるものを作成していすね。これは、
+			<a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/om/page/ContentFragment.html">org.apache.jetspeed.om.page.ContentFragment</a>
+			のインスタンスです。<code>$jetspeed.currentFragment</code>が何をするのかは、このガイドでは、重要ではないので、
+			飛ばして 先に進みます。
+        </p>
+
+            <br/><br/>
+            <code>
+              #set($site = $request.getAttribute("org.apache.jetspeed.portalsite.PortalSiteRequestContext"))
+             <br/>
+             #set($theme = $request.getAttribute("org.apache.jetspeed.theme"))
+            </code>
+            <br/>
+<div class="original">
+        <p>
+            Ah <code>$request</code>, now that looks familiar, this is actually an instance of <code>javax.servlet.http.HttpServletRequest</code>
+            from which we are retreiving objects that were been placed into Velocity by Jetspeed.  The actual objects are:
+            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/portalsite/PortalSiteRequestContext.html">org.apache.jetspeed.portalsite.PortalSiteRequestContext</a>
+            and
+            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/decroation/Theme.html">org.apache.jetspeed.decoration.Theme</a>
+            respectively.  We will put all of these objects to good use in just a little while.       
+        </p>
+</div>
+        <p>
+			おお、<code>$request</code>です。やっと親しみのあるものが出てきました。これは、実際に<code>javax.servlet.http.HttpServletRequest</code>の
+			インスタンスで、我々はここから Jetspeedから Velocityに 渡された オブジェクトを取り出します。
+			本当のオブジェクトは、それぞれ
+            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/portalsite/PortalSiteRequestContext.html">org.apache.jetspeed.portalsite.PortalSiteRequestContext</a>
+			と
+            <a href="http://portals.apache.org/jetspeed-2/multiproject/jetspeed-api/apidocs/org/apache/jetspeed/decroation/Theme.html">org.apache.jetspeed.decoration.Theme</a>
+           	です。もうちょっと後で  これら全てのオブジェクトのよい利用方法を見ていきます。
+        </p>
+	  <h4>[Feed Your HEAD: How to Properly Code Your Head Tag.] ヘッダーを作る:ヘッダータグの適切なコーディング方法</h4>
+<div class="original">
+	   <p>
+		This section provides you with all the information to prperly code the
+		&lt;HEAD&gt; of your Layout decroation.  So, straight to the code.
+	   </p>
+</div>
+	   <p>
+		このセクションでは、レイアウトデコレーションの&lt;HEAD&gt;タグを適切にコーディングするための情報を書きます。
+		では、さっそく コードを見てみましょう。
+	   </p>
+		<source>
+<![CDATA[  
+<html>
+    <head>
+     #defineLayoutObjects()
+     
+     <base href="#BaseHref()">
+     <meta http-equiv="Content-type" content="#ContentType()" />
+     <meta http-equiv="Content-style-type" content="text/css" />   
+     #includeJavaScriptForHead()
+     #IncludeStylesheets()    
+     <title>#PageTitle()</title>
+     <meta name="description" content="#PageDescription()" />
+]]></source>
+	<h5>[The &lt;base&gt; Tag] &lt;base&gt;タグ</h5>
+<div class="original">
+	  <p>	
+		First off we have <code><![CDATA[ <base href="#BaseHref()">]]></code> which allows 
+		us to define the base path for resolution of web resources, for an in depth discussion
+		of the <code><![CDATA[ <base>]]></code> see: <a href="http://www.w3schools.com/tags/tag_base.asp">W3C Schools Reference</a>.  
+		If you have spent any time playing with Jetspeed, you will have noticed it does all sorts
+		of crazy URL rewriting that will totally hose any attempts to consistently path you html
+		and styles sheets.  By defining the BASE tag, this probelms will all but disappear.  As 
+		for the <code>#BaseHref()</code> macro, it simply generates a fully qualified path to your
+		web application's root.  The actual code, interms of the servlet api is synonimous with this:
+	  </p>	
+</div>		
+	  <p>	
+		最初に、<code><![CDATA[ <base href="#BaseHref()">]]></code>から始めましょう。これは、
+		WEBのリソースの場所の解決をするためのベースを定義する際に使用します。<code><![CDATA[ <base>]]></code>に
+		ついての深い議論については、<a href="http://www.w3schools.com/tags/tag_base.asp">W3C Schools Reference</a>を
+		見てください。もし すでに あなたがJetspeedで、遊んだ経験があるのであれば 気づいたかもしれませんが、
+		このタグは、非常にややこしいURLリライトの問題を解決してくれ、常に 整合性を保ちながら
+		HTMLファイルやスタイルシートへのパスを提供してくれます。BASEタグを定義することにより、この問題は全て解決されます。
+		<code>#BaseHref()</code>マクロに関していうと、これは、単に あなたのWEBアプリケーションのルートディレクトリへの絶対パス
+		を作成します。実際のコードは、サーブレットAPIを使って記述するとこうなります。:
+	  </p>	
+<source>
+HttpServletRequest request;
+StingBuffer baseHref = new StringBuffer(request.getScheme())
+     .append("://").append(request.getServerName())
+	 .append(":").append(request.getServerPort())
+	 .append(request.getContextPath()).append("/");
+return baseHref.toString();		 
+</source>
+<div class="original">
+	  <p>
+       The actual Velocity macro code is a bit more terse ;)
+	  </p>
+</div>	
+	  <p>
+		Velocityマクロのコードは もう少し簡潔になります。^^)
+	  </p>
+<source>
+${request.scheme}://${request.serverName}:${request.serverPort}${request.contextPath}/
+</source>
+	 <h5>[Meta Tag: <![CDATA[<meta http-equiv="Content-type" content="#ContentType()" />]]>] メタタグ: <![CDATA[<meta http-equiv="Content-type" content="#ContentType()" />]]></h5>
+<div class="original">
+	 <p>
+		Will return text/html plus the proper encoding, such as UTF.
+	 </p>
+</div>		
+	 <p>
+		は  text/htmlと、UTFの様な適切なエンコードの種類を返します。
+	 </p>
+		
+	 <h5>#includeJavaScriptForHead()</h5>
+<div class="original">
+	 <p>
+	   At the time of the writing of this guide there is really very little javascript
+	   required to for the base Jetspeed 2 server to run.  However this may change in
+	   near future as we try to employ the use of AJAX in things such as configuration 
+	   and administration.
+	 </p>
+</div>	
+	 <p>
+	
+	  このガイドを書いている今の時点では、オリジナルのJetspeed2サーバーを実行させるためには、
+	 	ほとんど Java Scriptを書く必要はありません。しかし、今後、設定機能や管理機能でAJAXを利用しようと考えているので
+		近い将来変わるかもしれません。
+	 </p>
+		
+   </subsection>
+</section>
+<!--
+<section name='Packaging'>
+<p>
+Layouts are packaged in a JAR file. Supported decorators: 
+<ul>
+    <li>Page Decorators</li>
+    <li>Portlet Decorators</li>
+    <li>Generic Decorators</li>    
+    <li>Localized Decorators</li>
+</ul>
+Operations Supported:
+<ul>
+    <li>Deploy</li>
+    <li>Un-deploy</li>
+    <li>Re-deploy</li>
+</ul>
+The decorator.properties file must be located in the root directory of the jar archive and 
+contain the properties outlined in the next slide to be identified as a decorator by the auto 
+deployment system. The deployer will relocate the locale specific content to satisfy J2 
+content locators as necessary on deploy and undeploy. The current implementation supports 
+only 2 character language and country codes.    
+</p>    
+</section>
+<section name='Decorator Properties'>
+<p>
+The decorator.properties file must be located in the root directory of the jar archive and 
+contain the properties outlined above to be identified as a decorator by the auto-deployment system. 
+</p>
+<p>
+A deployable decorator must have the following properties set or defaulted in the decorator.properties 
+configuration:
+
+<source test=""><![CDATA[
+
+id = IDENTIFIER
+media.type=  HTML | WML
+decorates =  layout | portlet | any
+
+]]></source>
+
+To avoid conflicts with the locale logic and runtime locators, decorators should be 
+named with ids longer than 2 characters in length. The media.type property defaults to 'html'. 
+The 'any' value for the decorates property is mapped to the generic deployment directory.
+The deployer will relocate the locale specific content to satisfy J2 content locators as 
+necessary on deploy and undeploy. The current implementation supports only 2 
+character language and country codes.
+</p>    
+</section>
+-->
+</body>
+</document>
+



Jetspeed-japan-trans メーリングリストの案内
Back to archive index