• 検索結果がありません。

iReport からサーバに接続する

ドキュメント内 JasperReports Server CP User Guide JP (ページ 78-134)

Connect to the server from iReport, as described in section 6.2, “Connecting to the Server from iReport,” on page 102.

2. 「Repository Navigator」パネルで「Temp」フォルダと「Sales By Month Report」フォルダを展開し、「Sales By Month Jasper Report」をダブルクリックします。

すると、「Designer」タブに JRXML レポートが表示されます。

In the Repository Navigator, expand the Temp and Sales By Month Report folders, then double-click Sales By Month Jasper Report.

The JRXML report appears in the Designer tab.

3. Ctrlキーを押しながら、タイトル領域の要素 $R{title}, $R{param.list}, $P{ListInput} 以外を選択します。

図 3-34 に、その様子を示します。

Ctrl-click to select all elements in the title band except $R{title}, $R{param.list}, and $P{ListInput}.

Figure 3-34 shows the selected elements in the title band

図 3-34 タイトル領域から削除する要素を選択する

4. 「Designer」タブの何もない部分を右クリックし、コンテクストメニューから [削除] を選択します。終わりの段に空要 素があるなら、それらも削除します。

図 3-35 に、残された要素を示します。

Right-click an empty area in the Designer tab, and choose Delete. If you have empty elements after the last step, delete them.

Figure 3-35 shows the remaining elements.

図 3-35 タイトル領域に残された要素

タイトル領域に、とても多くの空⽩が目⽴つようになりました。

There’s too much white space in the title band.

5. 過剰な空白を除去します。

To remove excess white space:

a. $R{param.list} と $P{ListInput} を囲むように選択ボックスをドラックします。

Drag a selection box around the $R{param.list}and $P{ListInput} elements.

b. キーボードの矢印キーを使って、要素を上方へ移動させます。

Press the Arrow key on the keyboard to move the elements upward.

c. タイトル領域の下辺のマージン部分をドラッグし、その⾼さを減らします。

Drag the bottom margin of the title band upward to reduce its height.

6. 実際のパラメータをレポートから除去します。

Remove the actual parameters from the report:

a. [ウィンドウ] > [Report Inspector] を選択します。

Choose Window > ReportInspector.

b. 「Report Inspector」パネルで「Parameters」要素を展開し、下の方までスクロールして、以下のパラメータを Ctrl キーを押しながらクリックします。

In the Report Inspector, expand Parameters, scroll to the bottom of the parameter list, and Ctrl-click to select these parameters:

TextInput CheckboxInput DateInput QueryInput LoggedInUser

c. 選択されているパラメータを右クリックし、コンテクストメニューから [削除] を選択します。

Right-click the selected parameters and select Delete

図 3-36 JRXMLから不要なパラメータを削除する 7. 「本当にこれらの 5項目を削除しますか?」と問われるので、[はい] をクリックします。

Click Yes to confirm that you want to delete these 5 items.

8. iReport上から、リポジトリの中のレポートユニットから⼊⼒コントロールリソースを削除します。

From iReport, remove the input control resources from the report unit in the repository.

a. 「Repository Navigator」パネルで、レポートユニット「Sales By Month Report」の⼊⼒コントロールを展開しま す。

In the Repository Navigator, expand Input Controls in the report unit Sales By Month Report.

図 3-37 ⼊⼒コントロールフォルダを展開する b. Ctrl キーを押しながら、以下の⼊⼒コントロールリソースをクリックします。

Ctrl-click to select these input control resources:

Text Input Control Checkbox Input Control DateInput_label QueryInput_label

c. 選択されているリソースを右クリックし、コンテクストメニューから [Delete] を選択します。

本当に削除するかどうかの質問が選択されているリソースの数だけ現れますが、すべて [はい] と回答します。

Right-click the selected resources and click Delete

Answer Yes to each prompt to confirm the deletion of the resource.

9. JRXML「Sales By Month Jasper Report」を右クリックし、コンテクストメニューから [Replace with Current Document] を選択します。

Right-click the Sales By Month Jasper Report JRXML, and choose Replace with Current Document.

図 3-38 修正した JRXML を iReport からリポジトリに保存する 10. サーバに送る前にファイルを保存するかどうか尋ねられたら、[はい] をクリックします。

Click Yes when asked if you want to save the file before sending its content to the server.

11. [表示] > [リポジトリ] を選択し、「Temp」フォルダまで移動し、「Sales By Month Report」を選択して [編集] ボタン をクリックします。

図 3-39 では、サーバ上の JasperReportウィザードで、レポート内の⼊⼒コントロールが1つしか残されていないことが わかります。

Click View > Repository, navigate to the Temp folder, and select the Sales By Month Report. Click Edit.

Figure 3-39 shows the JasperReport wizard on the server, which lists one remaining input control in the report.

図 3-39 「コントロールとリソース」には⼊⼒コントロールが1つしか表⽰されない

ローカライズされた⼊⼒インプットコントロールを使ってレポートを実⾏するには:

1. [ログアウト] をクリックします。サーバのログインページで [ロケールとタイムゾーンを表示する] をクリックし、[en – 英語] を選択し、管理者としてサーバにログインします。

Click LogOut. On the server login page, click Show locale & time zone, select the en_US-English (United States) locale, and log into the server as an administrator.

2. リポジトリの「Temp」フォルダまで移動し、「Sales By Month Report」をクリックしてレポートを実⾏します。

すると、Report Viewer は、英語のフィールドとプロパティを使ったレポートを表示します。

Navigate to the Temp folder of the repository, and click the name of the Sales By Month Report to run the report.

The Report Viewer presents the report using English field and property names in the report.

3. [Options] ボタンをクリックし、ドロップダウンリストを選択します。

図 3-41 に示すとおり、項目名や選択肢は英語で表示されます。

Click Options, and select the drop-down.

The prompt and list of values appear in English, as shown in Figure 3-41 on page 65.

4. [Log out] をクリックしてサーバのログインページに戻り、[ロケールとタイムゾーンを表示する] をクリックし、[fr – フランス語] を選択し、管理者としてサーバにログインします。

Logout, on the server login page, click Show locale & time zone, select the fr_French locale, and log into the server as an administrator.

5. リポジトリの「Temp」フォルダまで移動し、「Sales By Month Report」の名前をクリックしてレポートを実⾏します。

図 3-40 は、そのレポート出⼒を⽰しています。フランス語のタイトル、フィールド、プロパティが、リソースバンドル で定義されている名前になっています。⾦額の区切り⽂字についても、ピリオドではなくカンマが使⽤されています。フ ランス語ロケールとしてサーバにインストールされている翻訳パックとリソースバンドルにより、⾦額や⽇付のフォー マットが決定され、Webインターフェースの翻訳が⾏われます。

Navigate to the Temp folder of the repository, and click the name of the Sales By Month Report to run the report.

Figure 3-40 shows the report output: the French report title, field, and property names defined in the resource bundle. The server formats the currency using a comma instead of a decimal point to separate Euro cents from dollars. Translation packs and resource bundles installed with the server for the French locale are used to format currency and dates and to translate web interface components.

図 3-40 フランス語ロケールで表⽰されるレポート出⼒

6. [Options] ボタンをクリックし、ドロップダウンリストを選択します。⼊⼒コントロールの⾒出しや選択肢がフランス語 で表示されます。図 3-41は、英語とフランス語における⼊⼒コントロールの⾒出しと選択肢の違いを⽰しています。

Click Options, and select the drop-down. The input control prompt and static list of values appears in French.

Figure 3-41 shows the input control prompt and static list of values in English and in French.

図 3-41 英語とフランス語によるリスト項目

3.6.3 リソースバンドルを再利⽤する

リソースバンドルのロケールは、サーバがそれを使う場合の再利⽤性と条件を決定します。レポート内の $R 表記を解決する 際に、サーバはリソースバンドルを 2 つのレベルで以下の表に挙げる順序で検索します。

The location of a resource bundle determines its capability for being reused and conditions under which the server uses it. To resolve a $R expression in a report, the server scans resource bundles at two levels in the order described in this table.

順序 レベル 説明

1 レポート/

リポジトリ Report/

Repository

レポートレベルのバンドルの場合、JRXML ファイルのヘッダでリソースバンドルベース名が 宣言されます。ルーマニアリソースバンドルはレポートレベルバンドルです。リポジトリレベ ルバンドルの場合は、すべてのレポートから独⽴しており、複数のレポートからリンクするこ とができます。

A report-level bundle declares the resource bundle base name in the header of its JRXML file. The Romanian resource bundle is a report-level bundle. A repository-level bundle is independent of any specific report and can be linked to multiple reports, as described in section 7.5, “Locale Bundles,” on page 194).

2 サーバ Server

サーバワイドバンドルは、サーバメッセージやユーザインターフェースのラベルを含んでいま す。詳細については「JasperReports Server Administrator Guide」に述べられています。

このバンドルは、一般にはサーバの WEB-INF/bundles ディレクトリに格納されます。

A server-wide bundle typically contains server messages and labels of user interface components, as described in the JasperReports Server Administrator Guide. This bundle typically resides in the WEB-INF/bundles directory of the server.

サーバは最初にレポート/リポジトリレベルを検索し、$R表記を解決できるリソースバンドルが⾒つかれば、そこで検索を終了 します。もし⾒つからなければ、フィールドのリソースIDを使ってサーバレベルの検索を⾏います。

First, the server searches the report/repository level and stops scanning resource bundles if it finds a resolution to the

$R expression. If the server doesn’t find a resolution, it scans the server level for the resource ID of the field and uses this ID.

3.6.4 JasperReports Server の規定のフォントを使う 規定では、サーバはレポート内で 3 つのフォントを使用します。

By default, the server uses three fonts you can use in reports:

DejaVu Sans

DejaVu Serif DejaVu Sans Mono

サーバに付属するVejaVu フォントを使うと、すべての環境におけるフォントの可用性を保証します。PDF では、いつでもピク セルパーフェクトになります。

Using the DejaVu fonts shipped with the server ensures availability of fonts in all environments; the PDF is pixel-perfect every time.

DejaVu フォントは、以前のバージョンのサーバで使われていた以下の Java論理フォントに換わるものです。

The DejaVu fonts replace the Java logical fonts used in previous versions of the server:

SansSerif Serif Monospaced

SansSerif, Serif, Monospaced フォントは今でも使えますが、Java論理フォントは、環境が異なると異なるTTF ファイルにマッピングされ、PDFで出⼒したときに⽂字列が途切れるなどの危険がありますので、推奨されません。

また、これらの Java論理フォントはいくつかのブラウザでは認識されず、代⽤フォントが使われてしまいます。例 えば、Windows 環境の FireFox では、SansSerif論理フォントはSerif フォントで描画されます。

SansSerif, Serif, Monospaced can still be used, but are deprecated because these Java logical fonts map to different TTF files in different environments, and run the risk of text being cut when exported to PDF due to font metric mismatches. Also, these Java logical fonts aren't recognized by some browsers, resulting in font substitution. For example, Firefox in a Windows environment renders the SansSerif logical font as Serif.

JasperReports の拡張フォントである DejaVu フォントを使えば、JRXML 内で(pdfXXXattributes のような)フォント属性を 設定したり、フォントマッピングを指定したりする必要がなくなります。拡張フォントファイルでは、フォント属性とマッピン グが自動的に設定されます。

When using the DejaVu fonts coming from JasperReports font extensions, you don’t need to set any other font attributes (such as the pdfXXXattributes) in the JRXML or specify font mapping. The font extension file sets font attributes and mapping.

DejaVu フォントに関する詳細については、SourceForge プロジェクトを参照してください。

http://dejavu-fonts.org/wiki/index.php?title=Main_Page

For more information about DejaVu fonts,refer to its SourceForge project at:

http://dejavu-fonts.org/wiki/index.php?title=Main_Page.

リポジトリに TrueType フォントをアップロードする場合、そのファイル名は正しい拡張子(.TTF)を保っている 必要があります。

When you upload a TrueType font to the repository, the file name must include the correct extension (.TTF)

ドキュメント内 JasperReports Server CP User Guide JP (ページ 78-134)