最近の更新

2012年6月18日月曜日

(RichFaces3 ShowCase)ToolTip

【目的】
RichFaces3 ShowCaseのToolTipを実行します。



【手順】
1.「RichFaces3プロジェクトの作成方法」の手順で、「RichFaces3Sample012-ToolTip」といプロジェクトを作成。
※プロジェクトの設定は以下の通り。

動的
Web
プロジェクト
プロジェクト名RichFaces3Sample012-ToolTip

ターゲット・ランタイムApache Tomcat v6.0
動的 web モジュール バージョン2.5
構成Apache Tomcat v6.0 デフォルト構成
EARメンバーシップチェックなし
ワーキング・セットチェックなし
Javaビルド・パス上のソース・フォルダーsrc
デフォルト出力フォルダーbuild\classes
Web
モジュール
コンテキスト・ルートRichFaces3Sample012-ToolTip

コンテンツ・ディレクトリーWebContent
web.xml デプロイメント記述子の作成チェックあり


2.「WebContent/WEB-INF/web.xml」を以下の様に入力。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

    <display-name>RichFaces3Sample012-ToolTip</display-name>

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>blueSky</param-value>
    </context-param>

    <context-param>
        <param-name>org.richfaces.CONTROL_SKINNING</param-name>
        <param-value>enable</param-value>
    </context-param>

    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>

    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

</web-app>

3.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング、「Ctrl+S」でファイルを保存。
4.「WebContent/WEB-INF/faces-config.xml」を以下の様に入力。
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
    version="1.2">

    <application>
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
    </application>

</faces-config>

5.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング、「Ctrl+S」でファイルを保存。
6.「任意のファイルの作成方法」の手順で、「WebContent/」ディレクトリに「index.xhtml」というファイルを作成。
7.「index.xhtml」を以下の様に入力。
<html xmlns="http://www.w3c.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
<head>
</head>
<body>
    <h:panelGrid columns="2">
        <rich:panel>
            パネル1-1の中身
            <rich:toolTip>
                パネル1-1のツールチップ
            </rich:toolTip>
        </rich:panel>
        <rich:panel>
            パネル1-2の中身
            <rich:toolTip>
                パネル1-2のツールチップ
            </rich:toolTip>
        </rich:panel>
        <rich:panel>
            パネル2-1の中身
            <rich:toolTip>
                パネル2-1のツールチップ
            </rich:toolTip>
        </rich:panel>
        <rich:panel>
            パネル2-2の中身
            <rich:toolTip>
                パネル2-2のツールチップ
            </rich:toolTip>
        </rich:panel>
    </h:panelGrid>
</body>
</html>

8.「Ctrl+Shift+F」を押し、ソースコードをフォーマッティング、「Ctrl+S」でファイルを保存。
9.「動的Webアプリケーションをサーバーに配置する方法」の手順で、作成したプロジェクトをサーバーに配置します。
10.「サーバーをデバッグモードで起動する方法」の手順で、サーバーを起動します。
11.ブラウザで以下のURLにアクセスします。
http://localhost:8080/RichFaces3Sample012-ToolTip/faces/index.xhtml

12.以下の様に表示されれば成功です。






17.以下の様なHTMLが出力されました。
<html xmlns="http://www.w3c.org/1999/xhtml">
<head>
    <link class="component" href="/RichFaces3Sample012-ToolTip/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/basic_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=7C5AE571C7C8D8747CEF34457E28A8F6" rel="stylesheet" type="text/css" />
    <link class="component" href="/RichFaces3Sample012-ToolTip/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/extended_both.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=7C5AE571C7C8D8747CEF34457E28A8F6" media="rich-extended-skinning" rel="stylesheet" type="text/css" />
    <link class="component" href="/RichFaces3Sample012-ToolTip/faces/a4j/s/3_3_3.Finalcss/panel.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=7C5AE571C7C8D8747CEF34457E28A8F6" rel="stylesheet" type="text/css" />
    <script src="/RichFaces3Sample012-ToolTip/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript" type="text/javascript">
    </script>
    <script src="/RichFaces3Sample012-ToolTip/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript">
    </script>
    <script src="/RichFaces3Sample012-ToolTip/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/jquery/jquery.js" type="text/javascript">
    </script>
    <script src="/RichFaces3Sample012-ToolTip/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/utils.js" type="text/javascript">
    </script>
    <script src="/RichFaces3Sample012-ToolTip/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/tooltip.js" type="text/javascript">
    </script>
    <link class="component" href="/RichFaces3Sample012-ToolTip/faces/a4j/s/3_3_3.Finalorg/richfaces/renderkit/html/css/tooltip.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__;jsessionid=7C5AE571C7C8D8747CEF34457E28A8F6" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
    <script src="/RichFaces3Sample012-ToolTip/faces/a4j/g/3_3_3.Finalorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript">
    </script>
</head>
<body>
    <table>
        <tbody>
            <tr>
                <td>
                    <div class="rich-panel " id="j_id2">
                        <div class="rich-panel-body " id="j_id2_body">
                             パネル1-1の中身
                             <span class="rich-tool-tip " id="j_id4" style="z-index:99; ">
                                <span id="j_id4content">
                                    パネル1-1のツールチップ
                                </span>
                                <span id="j_id4script" style="display:none">
                                    <script type="text/javascript" id ="scriptj_id4">
                                        new ToolTip("j_id4","j_id2",{'showEvent':'mouseover'} );
                                    </script>
                                </span>
                            </span>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="rich-panel " id="j_id6">
                        <div class="rich-panel-body " id="j_id6_body">
                            パネル1-2の中身
                            <span class="rich-tool-tip " id="j_id8" style="z-index:99; ">
                                <span id="j_id8content">
                                    パネル1-2のツールチップ
                                </span>
                                <span id="j_id8script" style="display:none">
                                    <script type="text/javascript" id ="scriptj_id8">
                                        new ToolTip("j_id8","j_id6",{'showEvent':'mouseover'} );
                                    </script>
                                </span>
                            </span>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="rich-panel " id="j_id10">
                        <div class="rich-panel-body " id="j_id10_body">
                            パネル2-1の中身
                            <span class="rich-tool-tip " id="j_id12" style="z-index:99; ">
                                <span id="j_id12content">
                                    パネル2-1のツールチップ
                                </span>
                                <span id="j_id12script" style="display:none">
                                    <script type="text/javascript" id ="scriptj_id12">
                                        new ToolTip("j_id12","j_id10",{'showEvent':'mouseover'} );
                                    </script>
                                </span>
                            </span>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="rich-panel " id="j_id14">
                        <div class="rich-panel-body " id="j_id14_body">
                            パネル2-2の中身
                            <span class="rich-tool-tip " id="j_id16" style="z-index:99; ">
                                <span id="j_id16content">
                                    パネル2-2のツールチップ
                                </span>
                                <span id="j_id16script" style="display:none">
                                    <script type="text/javascript" id ="scriptj_id16">
                                        new ToolTip("j_id16","j_id14",{'showEvent':'mouseover'} );
                                    </script>
                                </span>
                            </span>
                        </div>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
</body>
</html>



以上です。

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。

関連記事