2007年4月28日土曜日

[Eclipse][Tomcat] Tomcatプラグイン

TomcatプラグインのEclipse3.2版が正式リリースされていた。

http://www.eclipsetotale.com/tomcatPlugin.html

2007年4月17日火曜日

BIRT PDF出力に失敗する

BIRT2.1.2でレポートのPDFプレビュー時に、Eclipseのツールバーより[View report as PDF]を選ぶと、
以下のエラーが発生する。

org.eclipse.birt.report.service.api.ReportServiceException: Report engine fails to create extension to handle this request.

http://www.eclipse.org/birt/phoenix/build/#itextによると、

BIRT 2.1.0 (or later)
The itext-1.3.jar file needs to be copied to the plugins/com.lowagie.itext_*/lib directory.

Birt 2.1.1 or Later Note:
* To Support Asian fonts in PDF, download the following jar and place it in the plugins/com.lowagie.itext_*/lib directory.
iTextAsian.jar.

と書いてある。
lib以下に、itext-1.3.jar, iTextAsian.jarをコピーしたら、正常に動作した。
おお、素晴らしい。

ここも参照。

2007年4月9日月曜日

Teeda メッセージ出力

ボタンのイベントハンドラ等でメッセージを出力する方法。

(1)メッセージリソースのIDを指定する方法
FacesContextUtils.addInfoMessage(String messageId, Object[] args);
FacesContextUtils.addErrorMessage(String messageId, Object[] args);
FacesContextUtils.addFatalMessage(String messageId, Object[] args);
FacesContextUtils.addWarnMessage(String messageId, Object[] args);

(2)任意の文字列を出力する方法
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(clientId, new FacesMessage(メッセージ文字列));

clientIdは

<form id="hogeForm">
<input type="text" id="hogeField"/>
</form>

の場合、"hogeForm:hogeField"となる。

メッセージの種類を設定するには
new FacesMessage(Severity severity, ~)
を使用する。
SeverityはFacesMessageに
public static final Severity SEVERITY_INFO = new Severity("INFO", 1);
public static final Severity SEVERITY_WARN = new Severity("WARN", 2);
public static final Severity SEVERITY_ERROR = new Severity("ERROR", 3);
public static final Severity SEVERITY_FATAL = new Severity("FATAL", 4);
として定義されている。

※メッセージリソースはデフォルトではappMessages(_ja).properitiesになる。

参考)
http://d.hatena.ne.jp/shot6/20070129

2007年4月5日木曜日

Java StringBuilder

StringBufferは同期化されている。
StringBufferと同一のAPIを持つ同期化されていないStringBuilderクラスがある。
JDK5.0から導入されていたようだ。知らなかったよ。

2007年4月1日日曜日

Teeda NULL_LABELメッセージ

セレクトのNullLabelメッセージを変更したい場合はappMessages.properties(日本語メッセージはappMessages_ja.properties)へ記述する。

例)
org.seasar.teeda.extension.component.TSelect.NULL_LABEL=選択してね!

なお、メッセージリソースのファイル名はfaces-config.xmlで定義されている。

Eclipse プロパティエディタ

native2asciiを自動で行ってくれるプロパティエディタ。

http://propedit.sourceforge.jp/

更新サイトはhttp://propedit.sourceforge.jp/eclipse/updates/