2013年5月31日金曜日

PrimeFacesでのテーマ追加

PrimeFacesでテーマをデフォルトから変更する方法を探したら、
その方法を説明したページがあったので記録しておく。
[参考]
Themes
http://www.primefaces.org/themes.html

で、具体的には…
1.まず、使いたいテーマのJARファイルをダウンロードする。
2.次に、web.xmlのコンテキストパラムにprimefaces.THEMEというパラメータを追加して、テーマ名を設定する。

Installation
インスタレーション
Applying a theme from Theme Gallery to your PrimeFaces project is very easy, you just need to download the theme jar, add it your classpath and configure PrimeFaces to use it.
テーマギャラリからのテーマをあなたのPrimeFacesプロジェクトに適用するのは、とても簡単で、テーマのJARをダウンロードし、それをクラスパスに追加して、PrimeFacesがそれを使うように設定すればよい。

1) You can either download the theme manually from repository or using maven.
1) あなたはテーマを手動か、mavenを使ったレポジトリからダウンロードすることができる。

Manual Download
手動のダウンロード

PrimeFaces themes are bundled as jar files available at PrimeFaces Repository.
PrimeFacesテーマはPrimeFacesレポジトリにJARファイルとしてバンドルされている。

2) Next and final step is setting primefaces.
2) 次に最後のステップはprimefacesの設定である。
THEME parameter with the theme name, note that you can also use an EL expression for dynamic themes.
テーマ名を伴ったTHEMEパラメータで、あなたはまたダイナミックテーマの為にEL式を使うことができるのに注目して欲しい。

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>bootstrap</param-value>
</context-param>