SeamFramework.orgCommunity Documentation

第18章 iText PDF 生成

18.1. PDF サポートを使う
18.1.1. ドキュメントを作成する
18.1.2. 基本的なテキストのエレメント
18.1.3. ヘッダーとフッター
18.1.4. 章とセクション
18.1.5. リスト
18.1.6. 表
18.1.7. ドキュメントの定数
18.2. グラフ
18.3. バーコード
18.4. 入力フォーム
18.5. Swing/AWT コンポーネントをレンダリングする
18.6. iText を設定する
18.7. その他のドキュメント

Seam now includes a component set for generating documents using iText. The primary focus of Seam's iText document support is for the generation of PDF documents, but Seam also offers basic support for RTF document generation.

iText support is provided by jboss-seam-pdf.jar. This JAR contains the iText JSF controls, which are used to construct views that can render to PDF, and the DocumentStore component, which serves the rendered documents to the user. To include PDF support in your application, put jboss-seam-pdf.jar in your WEB-INF/lib directory along with the iText JAR file. There is no further configuration needed to use Seam's iText support.

Seam iText モジュールにはビューテクノロジーとして Facelets を使用する必要があります。 ライブラリの今後のバージョンも JSP の使用に対応する可能性があります。 また、 seam-ui パッケージの使用も必要となります。

examples/itext プロジェクトには実行可能なデモ用 PDF サポートのサンプルが含まれています。 正確なパッケージ化の導入を行い、 現在サポートされている PDF 生成の主要な機能を実際に示すサンプルがいくつか含まれています。

<p:document>

詳細

ドキュメントは http://jboss.com/products/seam/pdf 名前空間にあるタグを使い facelet XHTML で生成されます。 ドキュメントにはそのルートに必ず document タグがあるはずです。 document タグは Seam がドキュメントを DocumentStore に生成しその格納コンテントに HTML リダイレクトをレンダリングするための準備を行います。

属性

  • type — 生成されるドキュメントのタイプです。 有効な値は PDFRTFHTML の各モードになります。 Seam は PDF 生成にデフォルト設定するため多くの機能は PDF ドキュメント生成時にのみ正しく動作します。

  • pageSize — 生成されるページのサイズです。 最も一般的に使用される値は LETTERA4 でしょう。 対応ページサイズの全一覧は com.lowagie.text.PageSize クラスにあります。 代わりに pageSize でページの幅と高さを直接与えることもできます。 たとえば、 「612 792」は LETTER ページサイズと同じになります。

  • orientation — ページの向きです。 有効な値は portraitlandscape です。 landscape モードではページの高さと幅のサイズ値が逆になります。

  • margins — 左、 右、 上、 下の余白の値です。

  • marginMirroring — 余白の設定が交互のページで逆になることを示します。

  • disposition — ウェブブラウザで PDF を生成する場合にドキュメントの HTTP Content-Disposition を判断します。 有効な値は可能であればブラウザウィンドウ内にドキュメントを表示させることを表す inline とドキュメントをダウンロードとして処理することを表す attachment になります。 デフォルト値は inline です。

  • fileName — 添付用です。 この値はダウンロードしたファイル名を上書きします。

メタデータの属性

  • title

  • subject

  • keywords

  • author

  • creator

使い方


<p:document xmlns:p="http://jboss.com/products/seam/pdf"
>                                                      
  The document goes here.                                                                                             
</p:document
>

Useful documents will need to contain more than just text; however, the standard UI components are geared towards HTML generation and are not useful for generating PDF content. Instead, Seam provides a special UI components for generating suitable PDF content. Tags like <p:image> and <p:paragraph> are the basic foundations of simple documents. Tags like <p:font> provide style information to all the content surrounding them.

<p:paragraph>

詳細

テキストでの使用が多く、 文章をひとかたまりごとに区切るため理にかなったグループでテキストの断片の流れを作り、形成、スタイル化することができます。

属性

  • firstLineIndent

  • extraParagraphSpace

  • leading

  • multipliedLeading

  • spacingBefore — エレメントの前に空白スペースが挿入されます。

  • spacingAfter — エレメントの後に空白スペースが挿入されます。

  • indentationLeft

  • indentationRight

  • keepTogether

使い方


<p:paragraph alignment="justify">
    This is a simple document.  It isn't very fancy.
</p:paragraph
>

<p:text>

詳細

text タグにより通常の JSF 変換メカニズムを使ってアプリケーションデータからテキストの断片を生成することができます。 HTML ドキュメントをレンダリングする際に使用される outputText によく似ています。

属性

  • value — 表示される値です。 一般的には値バインディング式になります。

使い方


<p:paragraph>
    The item costs <p:text value="#{product.price}">
        <f:convertNumber type="currency" currencySymbol="$"/>
    </p:text>
</p:paragraph
>

<p:html>

詳細

html タグは HTML コンテントを PDF にレンダリングします。

属性

  • value — 表示されるテキストです。

使い方



<p:html value="This is HTML with <b
>some markup</b
>." />
<p:html>
    <h1
>This is more complex HTML</h1>
    <ul>
        <li
>one</li>
        <li
>two</li>
        <li
>three</li>
    </ul>
</p:html>

<p:html>
    <s:formattedText value="*This* is |Seam Text| as HTML.  It's very^cool^." />
</p:html
>                                    

<p:font>

詳細

フォントタグはその中のすべてのテキストに使用されるデフォルトフォントを定義します。

属性

  • name — フォント名です。 たとえば、 COURIERHELVETICATIMES-ROMANSYMBOLZAPFDINGBATS などです。

  • size — フォントのポイントサイズです。

  • style — フォントのスタイルです。 いずれを組み合わせることもできます。 NORMALBOLDITALICOBLIQUEUNDERLINELINE-THROUGH

  • color — The font color. (see 項18.1.7.1. 「Color Values」 for color values)

  • encoding — 文字セットエンコーディングです。

使い方


<p:font name="courier" style="bold" size="24">
    <p:paragraph
>My Title</p:paragraph>
</p:font
>

<p:newPage>

詳細

p:newPage は改ページを挿入します。

使い方


<p:newPage />

<p:image>

詳細

p:image inserts an image into the document. Images can be loaded from the classpath or from the web application context using the value attribute.

リソースはアプリケーションコードで動的に生成することもできます。 imageData 属性は値バインディング表現を指定することができ、 この値は java.awt.Image オブジェクトになります。

属性

  • value — アプリケーション生成のイメージにバインドするメソッド式またはリソース名です。

  • rotation — 角度単位のイメージ回転です。

  • height — イメージの高さです。

  • width — イメージの幅です。

  • alignment— イメージの位置です。 (可能な値については項18.1.7.2. 「位置調整の値」 を参照)

  • alt — イメージの代替となるテキスト表示です。

  • indentationLeft

  • indentationRight

  • spacingBefore — エレメントの前に空白スペースが挿入されます。

  • spacingAfter — エレメントの後に空白スペースが挿入されます。

  • widthPercentage

  • initialRotation

  • dpi

  • scalePercent — イメージに使用する倍率です (パーセンテージ)。 x と y の倍率を表す単一のパーセンテージ値または 2 つのパーセンテージ値で表すことができます。

  • scaleToFit — Specifies the X any Y size to scale the image to. The image will be scale to fit those dimensions as closely as possible while preserving the XY ratio of the image.

  • wrap

  • underlying

使い方


<p:image value="/jboss.jpg" />

<p:image value="#{images.chart}" />

<p:anchor>

詳細

p:anchor はドキュメントからクリックできるリンクを定義します。 次の属性をサポートしています。

属性

  • name — ドキュメント内アンカーの行き先名です。

  • reference — The destination the link refers to. Links to other points in the document should begin with a "#". For example, "#link1" to refer to an anchor position with a name of link1. Links may also be a full URL to point to a resource outside of the document.

使い方


<p:listItem
><p:anchor reference="#reason1"
>Reason 1</p:anchor
></p:listItem
> 
...
<p:paragraph>
    <p:anchor name="reason1"
>It's the quickest way to get "rich"</p:anchor
> 
    ... 
</p:paragraph
>

<p:header>

<p:footer>

詳細

p:headerp:footer コンポーネントは生成されたドキュメントの各ページにヘッダーとフッターのテキストを配置する機能を提供します。 ヘッダーとフッターの宣言はドキュメントの冒頭に表されます。

属性

  • alignment — ヘッダーとフッターのボックスセクションの位置です (位置の値については 項18.1.7.2. 「位置調整の値」 を参照)。

  • backgroundColor — ヘッダーとフッターボックスの背景色です (色の値については 項18.1.7.1. 「Color Values」 を参照)。

  • borderColor — ヘッダーとフッターボックスの境界線の色です。 borderColorLeftborderColorRightborderColorTopborderColorBottom を使って境界線ごとに指定が可能です (色の値については 項18.1.7.1. 「Color Values」 を参照)。

  • borderWidth — The width of the border. Individual border sides can be specified using borderWidthLeft, borderWidthRight, borderWidthTop and borderWidthBottom.

使い方


<f:facet name="header">
  <p:font size="12">
    <p:footer borderWidthTop="1" borderColorTop="blue" 
              borderWidthBottom="0" alignment="center">
        Why Seam? [<p:pageNumber />]
    </p:footer>
  </p:font>
</f:facet
>

<p:pageNumber>

詳細

現在のページ番号は p:pageNumber タグを使うとヘッダーまたはフッターの内側に配置することができます。 このページ番号タグはヘッダーまたはフッターのコンテキスト内で 1 度だけ使用することができます。

使い方


<p:footer borderWidthTop="1" borderColorTop="blue" 
          borderWidthBottom="0" alignment="center">
    Why Seam? [<p:pageNumber />]
</p:footer>

<p:chapter>

<p:section>

詳細

生成されるドキュメントが本または論文の構造をとる場合、 p:chapterp:section の各タグを使用して必要となる構造を構成することができます。 セクションは章の内側でのみ使用できますが、 適宜、 ネストさせることができます。 ほとんどの PDF ビューワはドキュメント内の章とセクション間を簡単に移動できる機能を提供しています。

属性

  • alignment — ヘッダーとフッターのボックスセクションの位置です (位置の値については 項18.1.7.2. 「位置調整の値」 を参照)。

  • number — 章番号です。 各章すべてに章番号を割り当ててください。

  • numberDepth — The depth of numbering for section. All sections are numbered relative to their surrounding chapter/sections. The fourth section of the first section of chapter three would be section 3.1.4, if displayed at the default number depth of three. To omit the chapter number, a number depth of 2 should be used. In that case, the section number would be displayed as 1.4.

使い方


<p:document xmlns:p="http://jboss.com/products/seam/pdf"
            title="Hello">

   <p:chapter number="1">
      <p:title
><p:paragraph
>Hello</p:paragraph
></p:title>
      <p:paragraph
>Hello #{user.name}!</p:paragraph>
   </p:chapter>

   <p:chapter number="2">
      <p:title
><p:paragraph
>Goodbye</p:paragraph
></p:title>
      <p:paragraph
>Goodbye #{user.name}.</p:paragraph>
   </p:chapter>

</p:document
> 

<p:header>

詳細

いずれの章やセクションも p:title を含むことができます。 タイトルは章/セクション番号のとなりに表示されます。 タイトルのボディは、 生テキストを含ませることも、 p:paragraph にすることもできます。

List structures can be displayed using the p:list and p:listItem tags. Lists may contain arbitrarily-nested sublists. List items may not be used outside of a list. The following document uses the ui:repeat tag to to display a list of values retrieved from a Seam component.


<p:document xmlns:p="http://jboss.com/products/seam/pdf"
            xmlns:ui="http://java.sun.com/jsf/facelets"
            title="Hello">
   <p:list style="numbered">
      <ui:repeat value="#{documents}" var="doc">
         <p:listItem
>#{doc.name}</p:listItem>
      </ui:repeat>
   </p:list>
</p:document
>

<p:list>

属性

  • style — リストの箇条書き/番号付けのスタイルです。 NUMBEREDLETTEREDGREEKROMANZAPFDINGBATSZAPFDINGBATS_NUMBER のいずれかになります。 スタイルの指定がない場合は中黒になります。

  • listSymbol — 箇条書きリストの場合、 その黒点を指定します。

  • indent — リストの字下げのレベルです。

  • lowerCase — letters を使ったリストのスタイルの場合、 その文字を小文字にするかどうかを示します。

  • charNumber — ZAPFDINGBATS の場合、 箇条書きに使用する符号の符号コードを示します。

  • numberType — ZAPFDINGBATS_NUMBER の場合、 番号付けのスタイルを示します。

使い方


<p:list style="numbered">
  <ui:repeat value="#{documents}" var="doc">
    <p:listItem
>#{doc.name}</p:listItem>
  </ui:repeat>
</p:list
>

<p:listItem>

詳細

p:listItem は次の属性をサポートしています。

属性

  • alignment — ヘッダーとフッターのボックスセクションの位置です (位置の値については 項18.1.7.2. 「位置調整の値」 を参照)。

  • alignment — リストアイテムの位置です (可能な値については 項18.1.7.2. 「位置調整の値」 を参照)。

  • indentationLeft — 左字下げの分量です。

  • indentationRight — 右字下げの分量です。

  • listSymbol — このリストアイテム用のデフォルトリスト記号を上書きします。

使い方


...

表の構成は p:tablep:cell のタグを使って作成することができます。 多くの表構成とは異なり明示的な列の宣言はありません。 表にコラムが 3 つある場合は、 3 セルすべてが自動的に列を形成します。 表の構成が複数ページに渡る場合、 ヘッダーとフッターは繰り返されます。

<p:table>

詳細

p:table は次の属性をサポートしています。

属性

  • columns — 表の列を構成するコラム (セル) の数です。

  • widths — 各コラムの相対幅です。 各コラムに対して値は 1 つとなります。 たとえば、 widths="2 1 1" の場合コラムは 3 つあり 1 番目のコラムが 2 番目と 3 番目のコラムの 2 倍の大きさになることを示しています。

  • headerRows — ヘッダーまたはフッターの列とみなされる列の初期の列数で、 表が複数のページをスパンする場合は繰り返されます。

  • footerRows — フッターの列とみなされる列の列数です。 この値は headerRows 値から差し引かれます。 ヘッダーを構成する列が 2 列とフッターを構成する列が 1 列のドキュメントの場合、 headerRows は 3 で footerRows は 1 にセットされます。

  • widthPercentage — 表がスパンするページ幅の割合です。

  • horizontalAlignment — 表の水平位置です (可能な値については 項18.1.7.2. 「位置調整の値」 を参照)。

  • skipFirstHeader

  • runDirection

  • lockedWidth

  • splitRows

  • spacingBefore — エレメントの前に空白スペースが挿入されます。

  • spacingAfter — エレメントの後に空白スペースが挿入されます。

  • extendLastRow

  • headersInEvent

  • splitLate

  • keepTogether

使い方


<p:table columns="3" headerRows="1">
  <p:cell
>name</p:cell>
  <p:cell
>owner</p:cell>
  <p:cell
>size</p:cell>
  <ui:repeat value="#{documents}" var="doc">
    <p:cell
>#{doc.name}</p:cell>
    <p:cell
>#{doc.user.name}</p:cell>
    <p:cell
>#{doc.size}</p:cell>
  </ui:repeat>
</p:table
>

<p:cell>

詳細

p:cell は次の属性をサポートしています。

属性

  • colspancolspan を 1 を越える値に宣言するとセルが複数のコラムをスパンできるようになります。 表には複数列に渡ったスパンを行う機能はありません。

  • horizontalAlignment — セルの水平位置です (可能な値は 項18.1.7.2. 「位置調整の値」 を参照)。

  • verticalAlignment — セルの垂直位置です (可能な値は 項18.1.7.2. 「位置調整の値」 を参照)。

  • paddingpaddingLeftpaddingRightpaddingToppaddingBottom を使って特定サイドの詰めを指定することもできます。

  • useBorderPadding

  • leading

  • multipliedLeading

  • indent

  • verticalAlignment

  • extraParagraphSpace

  • fixedHeight

  • noWrap

  • minimumHeight

  • followingIndent

  • rightIndent

  • spaceCharRatio

  • runDirection

  • arabicOptions

  • useAscender

  • grayFill

  • rotation

使い方


<p:cell
>...</p:cell
>

Charting support is also provided with jboss-seam-pdf.jar. Charts can be used in PDF documents or can be used as images in an HTML page. Charting requires the JFreeChart library (jfreechart.jar and jcommon.jar) to be added to the WEB-INF/lib directory. Four types of charts are currently supported: pie charts, bar charts and line charts. Where greater variety or control is needed, it is possible to construct charts using Java code.

<p:chart>

詳細

Displays a chart created in Java by a Seam component.

属性

  • chart — The chart object to display.

  • height — グラフの高さです。

  • width — グラフの幅です。

使い方


<p:chart chart="#{mycomponent.chart}" width="500" height="500" />
         

<p:barchart>

詳細

棒グラフを表示します。

属性

  • chart — The chart object to display, if programmatic chart creation is being used.

  • dataset — The dataset to be displayed, if programmatic dataset is being used.

  • borderVisible — グラフ全体を囲む境界線を表示するかどうかを制御します。

  • borderPaint — 境界線を表示させる場合の色になります。

  • borderBackgroundPaint — グラフのデフォルト背景色です。

  • borderStroke

  • domainAxisLabel — 領域軸のテキストラベルです。

  • domainLabelPosition — The angle of the domain axis category labels. Valid values are STANDARD, UP_45, UP_90, DOWN_45 and DOWN_90. Alternatively, the value can the positive or negative angle in radians.

  • domainAxisPaint — 領域軸ラベルの色です。

  • domainGridlinesVisible— 領域軸のグリッド線をグラフに表示させるかどうかを制御します。

  • domainGridlinePaint— 領域グリッド線を表示させる場合の色です。

  • domainGridlineStroke — The stroke style of the domain gridlines, if visible.

  • height — グラフの高さです。

  • width — グラフの幅です。

  • is3D — グラフを 2D ではなく 3D で表示させること示す boolean 値です。

  • legend — グラフに説明文を含ませるかどうかを示す boolean 値です。

  • legendItemPaint— 説明文内のテキストラベルのデフォルト色です。

  • legendItemBackgoundPaint— グラフの背景色とは異なる色にする場合の説明文の背景色です。

  • legendOutlinePaint— 説明文を囲む境界線の色です。

  • orientation — 図表の向きで、 vertical (デフォルト) または horizontal になります。

  • plotBackgroundPaint— 図表背景の色です。

  • plotBackgroundAlpha— 図表背景のアルファ (透明度) レベルです。 0 (完全に透明) から 1 (完全に不透明) の間の数字になります。

  • plotForegroundAlpha— 図表のアルファ (透明度) レベルです。 0 (完全に透明) から 1 (完全に不透明) の間の数字になります。

  • plotOutlinePaint— その範囲のグリッド線を表示させる場合の色です。

  • plotOutlineStroke — The stroke style of the range gridlines, if visible.

  • rangeAxisLabel — 範囲軸用のテキストラベルです。

  • rangeAxisPaint — 範囲軸ラベルの色です。

  • rangeGridlinesVisible— 範囲軸のグリッド線をグラフに表示させるかどうかを制御します。

  • rangeGridlinePaint— 範囲グリッド線を表示させる場合の色です。

  • rangeGridlineStroke — The stroke style of the range gridlines, if visible.

  • title — グラフタイトルのテキストです。

  • titlePaint— グラフタイトルのテキスト色です。

  • titleBackgroundPaint— グラフタイトルを囲む背景色です。

  • width — グラフの幅です。

使い方


<p:barchart title="Bar Chart" legend="true"
            width="500" height="500">
    <p:series key="Last Year">
        <p:data columnKey="Joe" value="100" />
        <p:data columnKey="Bob" value="120" />
    </p:series
>        <p:series key="This Year">
        <p:data columnKey="Joe" value="125" />
        <p:data columnKey="Bob" value="115" />
    </p:series>
</p:barchart
>

<p:linechart>

詳細

折れ線グラフを表示します。

属性

  • chart — The chart object to display, if programmatic chart creation is being used.

  • dataset — The dataset to be displayed, if programmatic dataset is being used.

  • borderVisible — グラフ全体を囲む境界線を表示するかどうかを制御します。

  • borderPaint — 境界線を表示させる場合の色になります。

  • borderBackgroundPaint — グラフのデフォルト背景色です。

  • borderStroke

  • domainAxisLabel — 領域軸のテキストラベルです。

  • domainLabelPosition — The angle of the domain axis category labels. Valid values are STANDARD, UP_45, UP_90, DOWN_45 and DOWN_90. Alternatively, the value can the positive or negative angle in radians.

  • domainAxisPaint — 領域軸ラベルの色です。

  • domainGridlinesVisible— 領域軸のグリッド線をグラフに表示させるかどうかを制御します。

  • domainGridlinePaint— 領域グリッド線を表示させる場合の色です。

  • domainGridlineStroke — The stroke style of the domain gridlines, if visible.

  • height — グラフの高さです。

  • width — グラフの幅です。

  • is3D — グラフを 2D ではなく 3D で表示させること示す boolean 値です。

  • legend — グラフに説明文を含ませるかどうかを示す boolean 値です。

  • legendItemPaint — The default color of the text labels in the legend.

  • legendItemBackgoundPaint — The background color for the legend, if different from the chart background color.

  • legendOutlinePaint — The color of the border around the legend.

  • orientation — 図表の向きで、 vertical (デフォルト) または horizontal になります。

  • plotBackgroundPaint — The color of the plot background.

  • plotBackgroundAlpha — The alpha (transparency) level of the plot background. It should be a number between 0 (completely transparent) and 1 (completely opaque).

  • plotForegroundAlpha — The alpha (transparency) level of the plot. It should be a number between 0 (completely transparent) and 1 (completely opaque).

  • plotOutlinePaint — The color of the range gridlines, if visible.

  • plotOutlineStroke — The stroke style of the range gridlines, if visible.

  • rangeAxisLabel — 範囲軸用のテキストラベルです。

  • rangeAxisPaint — 範囲軸ラベルの色です。

  • rangeGridlinesVisible — Controls whether or not gridlines for the range axis are shown on the chart.

  • rangeGridlinePaint — The color of the range gridlines, if visible.

  • rangeGridlineStroke — The stroke style of the range gridlines, if visible.

  • title — グラフタイトルのテキストです。

  • titlePaint — The color of the chart title text.

  • titleBackgroundPaint — The background color around the chart title.

  • width — グラフの幅です。

使い方


<p:linechart title="Line Chart"
            width="500" height="500">
    <p:series key="Prices">
        <p:data columnKey="2003" value="7.36" />
        <p:data columnKey="2004" value="11.50" />
        <p:data columnKey="2005" value="34.625" />
        <p:data columnKey="2006" value="76.30" />
        <p:data columnKey="2007" value="85.05" />
    </p:series>
</p:linechart
>

<p:piechart>

詳細

円グラフを表示します。

属性

  • title — グラフタイトルのテキストです。

  • chart — The chart object to display, if programmatic chart creation is being used.

  • dataset — The dataset to be displayed, if programmatic dataset is being used.

  • label — The default label text for pie sections.

  • legend — A boolean value indicating whether or not the chart should include a legend. Default value is true

  • is3D —A boolean value indicating that the chart should be rendered in 3D instead of 2D.

  • labelLinkMargin — The link margin for labels.

  • labelLinkPaint — The paint used for the label linking lines.

  • labelLinkStroke — he stroke used for the label linking lines.

  • labelLinksVisible — A flag that controls whether or not the label links are drawn.

  • labelOutlinePaint — The paint used to draw the outline of the section labels.

  • labelOutlineStroke — The stroke used to draw the outline of the section labels.

  • labelShadowPaint — The paint used to draw the shadow for the section labels.

  • labelPaint — The color used to draw the section labels

  • labelGap — The gap between the labels and the plot as a percentage of the plot width.

  • labelBackgroundPaint — The color used to draw the background of the section labels. If this is null, the background is not filled.

  • startAngle — The starting angle of the first section.

  • circular — A boolean value indicating that the chart should be drawn as a circle. If false, the chart is drawn as an ellipse. The default is true.

  • direction — The direction the pie section are drawn. One of: clockwise or anticlockwise. The default is clockwise.

  • sectionOutlinePaint — The outline paint for all sections.

  • sectionOutlineStroke — The outline stroke for all sections

  • sectionOutlinesVisible — Indicates whether an outline is drawn for each section in the plot.

  • baseSectionOutlinePaint — The base section outline paint.

  • baseSectionPaint — The base section paint.

  • baseSectionOutlineStroke — The base section outline stroke.

使い方


<p:piechart title="Pie Chart" circular="false" direction="anticlockwise" 
    startAngle="30" labelGap="0.1" labelLinkPaint="red"
>        
    <p:series key="Prices"
> 
        <p:data key="2003" columnKey="2003" value="7.36" /> 
        <p:data key="2004" columnKey="2004" value="11.50" /> 
        <p:data key="2005" columnKey="2005" value="34.625" /> 
        <p:data key="2006" columnKey="2006" value="76.30" /> 
        <p:data key="2007" columnKey="2007" value="85.05" /> 
    </p:series
> 
</p:piechart
>

<p:series>

詳細

カテゴリデータはシリーズに分割できます。 シリーズタグを使ってデータセットをシリーズで分類しそのシリーズ全体にスタイリングを適用します。

属性

  • key — シリーズ名です。

  • seriesPaint — シリーズ内の各アイテムの色です。

  • seriesOutlinePaint — シリーズ内の各アイテムの輪郭色です。

  • seriesOutlineStroke — シリーズ内の各アイテムを描くのに使用する線です。

  • seriesVisible — シリーズを表示させるかどうかを示す boolean です。

  • seriesVisibleInLegend — A boolean indicating if the series should be listed in the legend.

使い方


<p:series key="data1">
    <ui:repeat value="#{data.pieData1}" var="item">
        <p:data columnKey="#{item.name}" value="#{item.value}" />
    </ui:repeat>
</p:series
>

<p:data>

詳細

データタグはグラフ内で表示される各データポイントを表現します。

属性

  • key — データアイテム名です。

  • series<p:series> の内側に埋め込まれない場合のシリーズ名です。

  • value — 数値データです。

  • explodedPercent — 円グラフの場合、 explodedPercent 属性はグラフの一片がどのように展開されるかを示します。

  • sectionOutlinePaint — 棒グラフの場合のセクション輪郭の色です。

  • sectionOutlineStroke — 棒グラフの場合のセクション輪郭の線タイプです。

  • sectionPaint — 棒グラフのセクションの色です。

使い方


<p:data key="foo" value="20" sectionPaint="#111111" 
        explodedPercent=".2" />
<p:data key="bar" value="30" sectionPaint="#333333" />
<p:data key="baz" value="40" sectionPaint="#555555" 
        sectionOutlineStroke="my-dot-style" />

<p:color>

詳細

色コンポーネントは色埋めされた形を描く場合に参照できる色または階調を宣言します。

属性

  • color — 色の値です。 階調色の場合はこの色が開始色となります。 項18.1.7.1. 「Color Values」

  • color2 — 階調色の場合はこの色が階調の最終となります。

  • point — 階調色開始点の座標です。

  • point2 — 階調色終了点の座標です。

使い方


<p:color id="foo" color="#0ff00f"/>
<p:color id="bar" color="#ff00ff" color2="#00ff00" 
                  point="50 50" point2="300 300"/>

<p:stroke>

詳細

グラフ内に先途を描くのに使用する線を表します。

属性

  • width — 線の幅です。

  • cap — 先端のタイプです。 有効な値は buttroundsquare です。

  • join — 接合部分のタイプです。 有効な値は miterroundbevel です。

  • miterLimit — 巻いたージョイントの場合のジョイントの制限サイズです。

  • dash — この値は線を描くのに使用する点線パターンを設定します。 空白で区切られた整数は交互に描かれる箇所と描かれない箇所の長さを示します。

  • dashPhase — The dash phase indicates the offset into the dash pattern that the line should be drawn with.

使い方


<p:stroke id="dot2" width="2" cap="round" join="bevel" dash="2 3" />

Seam は iText を使って幅広い種類の形式でバーコードを生成することができます。 こうしたバーコードは PDF ドキュメントに埋め込んだり、 Web ページにイメージとして表示させたりすることができます。 HTML イメージを使用している場合、 現在バーコードはバーコード内でバーコードテキストを表示することができません。

If you have a complex, pre-generated PDF with named fields, you can easily fill in the values from your application and present it to the user.

<p:form>

詳細

移植するフォームテンプレートを定義します。

属性

  • URL — てんぷれーとして使用する PDF ファイルをポイントする URL です。 値にプロトコル部分 (://) がない場合そのファイルはローカルに読み込まれます。

  • filename — 生成される PDF ファイルに使用するファイル名です。

  • exportKey — イベントコンテキスト内の指定キー配下の DocumentData オブジェクトに生成される PDF ファイルを配置します。 セットされるとリダイレクトが起こらなくなります。

<p:field>

詳細

フィールド名をその値に接続します。

属性

  • name — フィールド名です。

  • value — フィールドの値です。

  • readOnly — フィールドは読み取り専用です。 デフォルトは true です。



                                <p:form
                                       xmlns:p="http://jboss.com/products/seam/pdf"
                                       URL="http://localhost/Concept/form.pdf">
                                    <p:field name="person.name" value="Me, myself and I"/>
                                </p:form>
                        
                

Seam は Swing コンポーネントを PDF イメージにレンダリングするサポートを実験的に提供するようになります。 いくつかの外観サポート、 特にネイティブウィジェットを使用するものは正しいレンダリングを行いません。

ドキュメントの生成は特に設定を必要とすることなく、 そのまま動作させることができます。 ただし、 本格的なアプリケーションには必要となる設定ポイントがいくつかあります。

デフォルト実装では汎用 URL /seam-doc.seam から PDF ドキュメントを提供します。 ブラウザの多くは /myDocument.pdf などのように実際の PDF 名を含んでいる URL を表示する傾向にあり、 またユーザーもそれを好みます。 これを行うにはいくつかの設定を必要とします。 PDF ファイルを提供するにはすべての *.pdf リソースが DocumentStoreServlet にマッピングされなければなりません。


<servlet>
    <servlet-name
>Document Store Servlet</servlet-name>
    <servlet-class
>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name
>Document Store Servlet</servlet-name>
    <url-pattern
>*.pdf</url-pattern>
</servlet-mapping
>

ドキュメントストアのコンポーネントにある use-extensions オプションはドキュメントストアに生成されるドキュメントタイプの正しいファイル名拡張子を付けて URL を生成するよう指示することでこれを行います。


<components xmlns="http://jboss.com/products/seam/components"
    xmlns:document="http://jboss.com/products/seam/document"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.1.xsd
        http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
    <document:document-store use-extensions="true"/>
</components>

ドキュメントストアは対話スコープにドキュメントを格納し、 対話が終了するとドキュメントが終了します。 この時点でドキュメントへの参照は無効になります。 documentStoreerror-page プロパティを使ってドキュメントが存在しない場合にデフォルトのビューが表示されるよう指定することができます。


<document:document-store use-extensions="true" error-page="/documentMissing.seam" />

iText に関する詳細は、 次を参照してください。