[seam-commits] Seam SVN: r11937 - in branches/enterprise/JBPAPP_5_0: examples/itext/view and 3 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Jan 8 04:17:32 EST 2010
Author: manaRH
Date: 2010-01-08 04:17:32 -0500 (Fri, 08 Jan 2010)
New Revision: 11937
Added:
branches/enterprise/JBPAPP_5_0/examples/itext/view/columns.xhtml
branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java
Modified:
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Itext.xml
branches/enterprise/JBPAPP_5_0/examples/itext/view/index.xhtml
branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/faces-config.xml
branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/seam-pdf.taglib.xml
branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ITextUtils.java
Log:
JBPAPP-3202
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Itext.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Itext.xml 2010-01-08 08:26:37 UTC (rev 11936)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Itext.xml 2010-01-08 09:17:32 UTC (rev 11937)
@@ -388,6 +388,50 @@
</entry>
</row>
+<row>
+ <entry valign="top">
+ <para>
+ <literal><p:textcolumn></literal>
+ </para>
+ </entry>
+ <entry valign="top">
+ <para>
+ <emphasis>Description</emphasis>
+ </para>
+ <para><literal>p:textcolumn</literal> inserts a text column that can
+ be used to control the flow of text. The most common case is to
+ support right to left direction fonts.</para>
+ <para>
+ <emphasis>Attributes</emphasis>
+ <itemizedlist>
+ <listitem>
+ <para><literal>left</literal> — The left bounds of
+ the text column</para>
+ </listitem>
+ <listitem>
+ <para><literal>right</literal> — The right bounds
+ of the text column</para>
+ </listitem>
+ <listitem>
+ <para><literal>direction</literal> — The run direction
+ of the text in the column: <literal>RTL</literal>,
+ <literal>LTR</literal>, <literal
+ >NO-BIDI</literal>, <literal>DEFAULT</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ <emphasis>Usage</emphasis>
+ </para>
+ <programlisting role="XHTML"><![CDATA[
+<p:textcolumn left="400" right="600" direction="rtl">
+ <p:font name="/Library/Fonts/Arial Unicode.ttf"
+ encoding="Identity-H"
+ embedded="true">#{phrases.arabic}</p:font>
+</p:textcolumn>]]></programlisting>
+ </entry>
+ </row>
<row>
<entry valign="top">
<para>
Added: branches/enterprise/JBPAPP_5_0/examples/itext/view/columns.xhtml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/itext/view/columns.xhtml (rev 0)
+++ branches/enterprise/JBPAPP_5_0/examples/itext/view/columns.xhtml 2010-01-08 09:17:32 UTC (rev 11937)
@@ -0,0 +1,26 @@
+<p:document xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:p="http://jboss.com/products/seam/pdf">
+
+
+ <p:newPage />
+ <p:image alignment="right" value="/jboss.jpg" />
+
+ <p:font family="Helvetica" size="36">
+ <p:paragraph alignment="center">Multiple columns example</p:paragraph>
+ </p:font>
+
+ <p:font family="Helvetica">
+
+ <p:textcolumn left="300" right="500">
+ JBoss Seam is a powerful new application framework for building next generation Web 2.0 applications by unifying and integrating technologies such as Asynchronous JavaScript and XML (AJAX), Java Server Faces (JSF), Enterprise Java Beans (EJB3), Java Portlets and Business Process Management (BPM).
+ </p:textcolumn>
+
+ <p:textcolumn left="100" right="250" direction="rtl">
+ Seam has been designed from the ground up to eliminate complexity at the architecture and the API level. It enables developers to assemble complex web applications with simple annotated Plain Old Java Objects (POJOs), componentized UI widgets and very little XML. The simplicity of Seam 1.0 will enable easy integration with the JBoss Enterprise Service Bus (ESB) and Java Business Integration (JBI) in the future.
+ </p:textcolumn>
+ </p:font>
+
+
+</p:document>
+
Property changes on: branches/enterprise/JBPAPP_5_0/examples/itext/view/columns.xhtml
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/enterprise/JBPAPP_5_0/examples/itext/view/index.xhtml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/itext/view/index.xhtml 2010-01-08 08:26:37 UTC (rev 11936)
+++ branches/enterprise/JBPAPP_5_0/examples/itext/view/index.xhtml 2010-01-08 09:17:32 UTC (rev 11937)
@@ -29,6 +29,7 @@
<li><s:link view="/lists.xhtml" value="PDF Lists" /></li>
<li><s:link view="/font.xhtml" value="Font Selection" /></li>
<li><s:link view="/pages.xhtml" value="Multiple Pages" /></li>
+ <li><s:link view="/columns.xhtml" value="Multicolumns" /></li>
<li><s:link view="/chapters.xhtml" value="Chapters" /></li>
<li><s:link view="/sections.xhtml" value="Sections" /></li>
<li><s:link view="/table.xhtml" value="Tables" /></li>
Modified: branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/faces-config.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/faces-config.xml 2010-01-08 08:26:37 UTC (rev 11936)
+++ branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/faces-config.xml 2010-01-08 09:17:32 UTC (rev 11937)
@@ -168,7 +168,11 @@
<component-class>org.jboss.seam.pdf.ui.UIForm</component-class>
</component>
-
+ <component>
+ <component-type>org.jboss.seam.pdf.ui.UIMultiColumnText</component-type>
+ <component-class>org.jboss.seam.pdf.ui.UIMultiColumnText</component-class>
+ </component>
+
<!--
<render-kit>
<render-kit-id>PDF</render-kit-id>
Modified: branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/seam-pdf.taglib.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/seam-pdf.taglib.xml 2010-01-08 08:26:37 UTC (rev 11936)
+++ branches/enterprise/JBPAPP_5_0/src/pdf/META-INF/seam-pdf.taglib.xml 2010-01-08 09:17:32 UTC (rev 11937)
@@ -237,4 +237,11 @@
</component>
</tag>
+ <tag>
+ <tag-name>textcolumn</tag-name>
+ <component>
+ <component-type>org.jboss.seam.pdf.ui.UIMultiColumnText</component-type>
+ </component>
+ </tag>
+
</facelet-taglib>
Modified: branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ITextUtils.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ITextUtils.java 2010-01-08 08:26:37 UTC (rev 11936)
+++ branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ITextUtils.java 2010-01-08 09:17:32 UTC (rev 11937)
@@ -7,6 +7,7 @@
import com.lowagie.text.ElementTags;
import com.lowagie.text.PageSize;
import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.PdfWriter;
public class ITextUtils
{
@@ -129,4 +130,19 @@
return values;
}
+
+ public static int runDirection(String direction)
+ {
+ if (direction == null || direction.equalsIgnoreCase("default")) {
+ return PdfWriter.RUN_DIRECTION_DEFAULT;
+ } else if (direction.equalsIgnoreCase("rtl")) {
+ return PdfWriter.RUN_DIRECTION_RTL;
+ } else if (direction.equalsIgnoreCase("ltr")) {
+ return PdfWriter.RUN_DIRECTION_LTR;
+ } else if (direction.equalsIgnoreCase("no-bidi")) {
+ return PdfWriter.RUN_DIRECTION_NO_BIDI;
+ } else {
+ throw new RuntimeException("unknown run direction " + direction);
+ }
+ }
}
Added: branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/pdf/org/jboss/seam/pdf/ui/UIMultiColumnText.java 2010-01-08 09:17:32 UTC (rev 11937)
@@ -0,0 +1,92 @@
+package org.jboss.seam.pdf.ui;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.pdf.ITextUtils;
+
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.PageSize;
+import com.lowagie.text.pdf.MultiColumnText;
+
+
+public class UIMultiColumnText
+ extends ITextComponent
+{
+
+ float left = 36;
+ float right = PageSize.LETTER.getWidth()-36;
+ String direction = "default";
+
+ MultiColumnText multiColumnText = null;
+
+
+ public float getLeft()
+ {
+ return (Float) valueBinding("left", left);
+ }
+
+ public void setLeft(float left)
+ {
+ this.left = left;
+ }
+
+ public float getRight()
+ {
+ return (Float) valueBinding("right", right);
+ }
+
+ public void setRight(float right)
+ {
+ this.right = right;
+ }
+
+ public String getDirection()
+ {
+ return (String) valueBinding("direction", direction);
+ }
+
+ public void setDirection(String direction)
+ {
+ this.direction = direction;
+ }
+
+ @Override
+ public void createITextObject(FacesContext context) throws IOException, DocumentException
+ {
+ multiColumnText = new MultiColumnText();
+
+ multiColumnText.addSimpleColumn(getLeft(), getRight());
+ multiColumnText.setRunDirection(ITextUtils.runDirection(getDirection()));
+ }
+
+ @Override
+ public Object getITextObject()
+ {
+ return multiColumnText;
+ }
+
+ @Override
+ public void handleAdd(Object other)
+ {
+ if (other instanceof Element) {
+ try {
+ multiColumnText.addElement((Element)other);
+ } catch (DocumentException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ throw new RuntimeException("UIMultiColumnText only supports Element children");
+ }
+
+ }
+
+ @Override
+ public void removeITextObject()
+ {
+ multiColumnText = null;
+ }
+
+}
More information about the seam-commits
mailing list