Seam SVN: r8992 - in trunk/src: main/org/jboss/seam/navigation and 2 other directories.
by seam-commits@lists.jboss.org
Author: jacob.orshalick
Date: 2008-09-14 21:49:00 -0400 (Sun, 14 Sep 2008)
New Revision: 8992
Added:
trunk/src/test/unit/org/jboss/seam/test/unit/PageConversationControlTest.java
Modified:
trunk/src/main/org/jboss/seam/navigation/ConversationControl.java
trunk/src/main/org/jboss/seam/navigation/Pages.java
trunk/src/main/org/jboss/seam/pages-2.1.xsd
trunk/src/test/unit/META-INF/pagesForPageActionsTest.xml
trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java
Log:
JBSEAM-1943 added pages.xml support
Modified: trunk/src/main/org/jboss/seam/navigation/ConversationControl.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/ConversationControl.java 2008-09-14 17:16:48 UTC (rev 8991)
+++ trunk/src/main/org/jboss/seam/navigation/ConversationControl.java 2008-09-15 01:49:00 UTC (rev 8992)
@@ -3,6 +3,7 @@
import org.jboss.seam.core.Conversation;
import org.jboss.seam.core.ConversationEntries;
import org.jboss.seam.core.ConversationEntry;
+import org.jboss.seam.core.Manager;
import org.jboss.seam.core.Expressions.ValueExpression;
import org.jboss.seam.pageflow.Pageflow;
/**
@@ -16,6 +17,7 @@
private boolean isBeginConversation;
private boolean isEndConversation;
private boolean isEndConversationBeforeRedirect;
+ private boolean isEndRootConversation;
private boolean join;
private boolean nested;
private FlushModeType flushMode;
@@ -44,13 +46,20 @@
{
if ( endConversation() )
{
+ Conversation conversation = Conversation.instance();
+
+ if (isEndRootConversation && conversation.isNested())
+ {
+ conversation.root();
+ }
+
if (isEndConversationBeforeRedirect)
{
- Conversation.instance().endBeforeRedirect();
+ conversation.endBeforeRedirect();
}
else
{
- Conversation.instance().end();
+ conversation.end();
}
}
if ( beginConversation() )
@@ -131,6 +140,14 @@
{
this.isEndConversationBeforeRedirect = isEndConversationBeforeRedirect;
}
+ public boolean isEndRootConversation()
+ {
+ return isEndConversationBeforeRedirect;
+ }
+ public void setEndRootConversation(boolean isEndRootConversation)
+ {
+ this.isEndRootConversation = isEndRootConversation;
+ }
public ValueExpression<Boolean> getBeginConversationCondition()
{
return beginConversationCondition;
Modified: trunk/src/main/org/jboss/seam/navigation/Pages.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Pages.java 2008-09-14 17:16:48 UTC (rev 8991)
+++ trunk/src/main/org/jboss/seam/navigation/Pages.java 2008-09-15 01:49:00 UTC (rev 8992)
@@ -1267,6 +1267,7 @@
{
control.setEndConversation(true);
control.setEndConversationBeforeRedirect( "true".equals( endConversation.attributeValue("before-redirect") ) );
+ control.setEndRootConversation( "true".equals( endConversation.attributeValue("root") ) );
String expression = endConversation.attributeValue("if");
if (expression!=null)
{
Modified: trunk/src/main/org/jboss/seam/pages-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-09-14 17:16:48 UTC (rev 8991)
+++ trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-09-15 01:49:00 UTC (rev 8992)
@@ -325,6 +325,14 @@
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="root" default="false">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
</xs:attribute>
<xs:attribute name="if"/>
</xs:attributeGroup>
Modified: trunk/src/test/unit/META-INF/pagesForPageActionsTest.xml
===================================================================
--- trunk/src/test/unit/META-INF/pagesForPageActionsTest.xml 2008-09-14 17:16:48 UTC (rev 8991)
+++ trunk/src/test/unit/META-INF/pagesForPageActionsTest.xml 2008-09-15 01:49:00 UTC (rev 8992)
@@ -108,5 +108,13 @@
</rule>
</navigation>
</page>
+
+ <page view-id="/end-conversation-test.xhtml">
+ <end-conversation />
+ </page>
+
+ <page view-id="/end-root-conversation-test.xhtml">
+ <end-conversation root="true" />
+ </page>
</pages>
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java 2008-09-14 17:16:48 UTC (rev 8991)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java 2008-09-15 01:49:00 UTC (rev 8992)
@@ -29,6 +29,8 @@
*/
public abstract class AbstractPageTest
{
+ private static final String TEST_PAGES_DOT_XML = "/META-INF/pagesForPageActionsTest.xml";
+
@BeforeMethod
public void setup()
{
@@ -68,7 +70,7 @@
appContext.set(Seam.getComponentName(Init.class), init);
Map<String, Conversions.PropertyValue> properties = new HashMap<String, Conversions.PropertyValue>();
appContext.set(Component.PROPERTIES, properties);
- properties.put(Seam.getComponentName(Pages.class) + ".resources", new Conversions.FlatPropertyValue("/META-INF/pagesForPageActionsTest.xml"));
+ properties.put(Seam.getComponentName(Pages.class) + ".resources", new Conversions.FlatPropertyValue(TEST_PAGES_DOT_XML));
installComponent(appContext, NoRedirectFacesManager.class);
installComponent(appContext, ResourceLoader.class);
@@ -79,7 +81,13 @@
installComponent(appContext, TestActions.class);
}
- private void installComponent(Context appContext, Class clazz)
+ /**
+ * Installs a component for use in the current test context.
+ *
+ * @param appContext
+ * @param clazz
+ */
+ protected void installComponent(Context appContext, Class clazz)
{
appContext.set(Seam.getComponentName(clazz) + ".component", new Component(clazz));
}
Added: trunk/src/test/unit/org/jboss/seam/test/unit/PageConversationControlTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/PageConversationControlTest.java (rev 0)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/PageConversationControlTest.java 2008-09-15 01:49:00 UTC (rev 8992)
@@ -0,0 +1,105 @@
+package org.jboss.seam.test.unit;
+
+import javax.faces.context.FacesContext;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.FacesLifecycle;
+import org.jboss.seam.core.Conversation;
+import org.jboss.seam.core.ConversationEntries;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.core.Manager;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.navigation.Pages;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Tests that validate the ConversationControl component as initialized for a Page instance.
+ *
+ * @author Jacob Orshalick
+ */
+public class PageConversationControlTest extends AbstractPageTest
+{
+ /**
+ * Override the base setup to add the required conversation components included in testing.
+ */
+ @BeforeMethod
+ @Override
+ public void setup()
+ {
+ super.setup();
+
+ installComponent(Contexts.getApplicationContext(), ConversationEntries.class);
+ installComponent(Contexts.getApplicationContext(), Conversation.class);
+ installComponent(Contexts.getApplicationContext(), FacesMessages.class);
+ installComponent(Contexts.getApplicationContext(), Manager.class);
+ installComponent(Contexts.getApplicationContext(), Events.class);
+
+ Manager.instance().initializeTemporaryConversation();
+ FacesLifecycle.resumeConversation(FacesContext.getCurrentInstance().getExternalContext());
+ }
+
+ /**
+ * Tests that when a nested conversation encounters an end-conversation tag the nested conversation is
+ * demoted to temporary.
+ */
+ @Test
+ public void testBeginNestedAndEndConversation() {
+ Manager.instance().beginConversation();
+ Manager.instance().beginNestedConversation();
+
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ facesContext.getViewRoot().setViewId("/end-conversation-test.xhtml");
+ Pages.instance().preRender(facesContext);
+
+ // nested conversation should be demoted to temporary
+ assert !Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+ }
+
+ /**
+ * Tests that when a non-nested conversation encounters an end-conversation tag specifying that the root
+ * should be ended the current conversation is simply demoted to temporary.
+ */
+ @Test
+ public void testBeginAndEndRootConversation() {
+ Manager.instance().beginConversation();
+
+ assert Manager.instance().isLongRunningConversation();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ facesContext.getViewRoot().setViewId("/end-root-conversation-test.xhtml");
+ Pages.instance().preRender(facesContext);
+
+ assert !Manager.instance().isLongRunningConversation();
+ }
+
+ /**
+ * Tests that when a nested conversation encounters an end-conversation tag specifying that the root
+ * should be ended the root is ended thereby destroying the conversation stack.
+ */
+ @Test
+ public void testBeginNestedAndEndRootConversation() {
+ Manager.instance().beginConversation();
+ String rootConversationId = Manager.instance().getCurrentConversationId();
+
+ Manager.instance().beginNestedConversation();
+
+ assert !Manager.instance().getCurrentConversationId().equals(rootConversationId);
+ assert Manager.instance().isLongRunningConversation();
+ assert Manager.instance().isNestedConversation();
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ facesContext.getViewRoot().setViewId("/end-root-conversation-test.xhtml");
+ Pages.instance().preRender(facesContext);
+
+ assert Manager.instance().getCurrentConversationId().equals(rootConversationId);
+ assert !Manager.instance().isLongRunningConversation();
+ assert !Manager.instance().isNestedConversation();
+ }
+}
16 years, 2 months
Seam SVN: r8991 - trunk/examples/nestedbooking/src/org/jboss/seam/example/booking.
by seam-commits@lists.jboss.org
Author: jacob.orshalick
Date: 2008-09-14 13:16:48 -0400 (Sun, 14 Sep 2008)
New Revision: 8991
Modified:
trunk/examples/nestedbooking/src/org/jboss/seam/example/booking/HotelBookingAction.java
Log:
JBSEAM-1943 updated nested booking
Modified: trunk/examples/nestedbooking/src/org/jboss/seam/example/booking/HotelBookingAction.java
===================================================================
--- trunk/examples/nestedbooking/src/org/jboss/seam/example/booking/HotelBookingAction.java 2008-09-14 16:40:40 UTC (rev 8990)
+++ trunk/examples/nestedbooking/src/org/jboss/seam/example/booking/HotelBookingAction.java 2008-09-14 17:16:48 UTC (rev 8991)
@@ -8,6 +8,7 @@
import javax.persistence.PersistenceContext;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
@@ -93,6 +94,7 @@
booking.setCheckoutDate( calendar.getTime() );
}
+ @End(root=true)
public void confirm()
{
// on confirmation we set the room preference in the booking. the room preference
@@ -103,51 +105,11 @@
facesMessages.add("Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}");
log.info("New booking: #{booking.id} for #{user.username}");
events.raiseTransactionSuccessEvent("bookingConfirmed");
-
- endRoot();
}
- public void cancel()
- {
- endRootBeforeRedirect();
- }
+ @End(root=true, beforeRedirect=true)
+ public void cancel() {}
@Destroy @Remove
public void destroy() {}
-
- /**
- * End the root conversation in case we are currently in a nested conversation.
- * Currently this can only be done programatically, but if you are interested
- * in this feature being supported by Seam vote on:
- *
- * http://jira.jboss.org/jira/browse/JBSEAM-1943
- */
- private void endRoot()
- {
- Conversation conversation = Conversation.instance();
-
- if(conversation.isNested()) {
- conversation.root();
- }
-
- conversation.end();
- }
-
- /**
- * End the root conversation prior to redirect in case we are currently in a
- * nested conversation. Currently this can only be done programatically, but
- * if you are interested in this feature being supported by Seam vote on:
- *
- * http://jira.jboss.org/jira/browse/JBSEAM-1943
- */
- private void endRootBeforeRedirect()
- {
- Conversation conversation = Conversation.instance();
-
- if(conversation.isNested()) {
- conversation.root();
- }
-
- conversation.endBeforeRedirect();
- }
}
16 years, 2 months
Seam SVN: r8990 - in trunk/src: main/org/jboss/seam/core and 1 other directories.
by seam-commits@lists.jboss.org
Author: jacob.orshalick
Date: 2008-09-14 12:40:40 -0400 (Sun, 14 Sep 2008)
New Revision: 8990
Modified:
trunk/src/main/org/jboss/seam/annotations/End.java
trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java
trunk/src/test/unit/org/jboss/seam/test/unit/Foo.java
trunk/src/test/unit/org/jboss/seam/test/unit/InterceptorTest.java
Log:
JBSEAM-1943 annotational support for ending root conversation
Modified: trunk/src/main/org/jboss/seam/annotations/End.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/End.java 2008-09-14 13:13:08 UTC (rev 8989)
+++ trunk/src/main/org/jboss/seam/annotations/End.java 2008-09-14 16:40:40 UTC (rev 8990)
@@ -40,4 +40,15 @@
* @return false by default
*/
boolean beforeRedirect() default false;
+
+ /**
+ * If the conversation is nested, should the root
+ * of the conversation be destroyed? (The default
+ * behavior is to simply pop the conversation
+ * stack.)
+ *
+ * @return false by default
+ */
+ boolean root() default false;
+
}
Modified: trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java 2008-09-14 13:13:08 UTC (rev 8989)
+++ trunk/src/main/org/jboss/seam/core/ConversationInterceptor.java 2008-09-14 16:40:40 UTC (rev 8990)
@@ -69,7 +69,7 @@
{
if ( isEndConversationRequired(e) )
{
- endConversation(false);
+ endConversation(false, false);
}
throw e;
}
@@ -253,6 +253,8 @@
boolean beforeRedirect = ( isEndAnnotation && method.getAnnotation(End.class).beforeRedirect() ) ||
( isEndTaskAnnotation && method.getAnnotation(EndTask.class).beforeRedirect() );
+ boolean endRoot = ( isEndAnnotation && method.getAnnotation(End.class).root() );
+
boolean simpleEnd =
( isEndAnnotation && method.getAnnotation(End.class).ifOutcome().length==0 ) ||
( isEndTaskAnnotation && method.getAnnotation(EndTask.class).ifOutcome().length==0 );
@@ -260,7 +262,7 @@
{
if ( result!=null || method.getReturnType().equals(void.class) ) //null outcome interpreted as redisplay
{
- endConversation(beforeRedirect);
+ endConversation(beforeRedirect, endRoot);
}
}
else if ( isEndAnnotation )
@@ -268,7 +270,7 @@
String[] outcomes = method.getAnnotation(End.class).ifOutcome();
if ( Arrays.asList(outcomes).contains(result) )
{
- endConversation(beforeRedirect);
+ endConversation(beforeRedirect, endRoot);
}
}
else if ( isEndTaskAnnotation )
@@ -277,14 +279,24 @@
String[] outcomes = method.getAnnotation(EndTask.class).ifOutcome();
if ( Arrays.asList(outcomes).contains(result) )
{
- endConversation(beforeRedirect);
+ endConversation(beforeRedirect, endRoot);
}
}
}
- private void endConversation(boolean beforeRedirect)
+ private void endConversation(boolean beforeRedirect, boolean endRoot)
{
- Manager.instance().endConversation(beforeRedirect);
+ Manager manager = Manager.instance();
+
+ if(endRoot)
+ {
+ if(manager.isNestedConversation())
+ {
+ manager.switchConversation(manager.getRootConversationId());
+ }
+ }
+
+ manager.endConversation(beforeRedirect);
}
public boolean isInterceptorEnabled()
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/Foo.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/Foo.java 2008-09-14 13:13:08 UTC (rev 8989)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/Foo.java 2008-09-14 16:40:40 UTC (rev 8990)
@@ -73,6 +73,17 @@
return null;
}
+ @Begin(nested=true)
+ public String beginNested()
+ {
+ return "begunNested";
+ }
+ @End(root=true)
+ public String endRoot()
+ {
+ return "endedRoot";
+ }
+
@Begin
public void beginVoid() { }
@End
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/InterceptorTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/InterceptorTest.java 2008-09-14 13:13:08 UTC (rev 8989)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/InterceptorTest.java 2008-09-14 16:40:40 UTC (rev 8990)
@@ -741,8 +741,96 @@
assert !Manager.instance().isLongRunningConversation();
assert "success".equals(result);
+
+ ///////////////////////////////////////////////
+ // Test @End(root=true) for nested conversation
+ ///////////////////////////////////////////////
+
+ result = (String) ci.aroundInvoke( new MockInvocationContext() {
+ @Override
+ public Method getMethod()
+ {
+ return InterceptorTest.getMethod("begin");
+ }
+ @Override
+ public Object proceed() throws Exception
+ {
+ return "begun";
+ }
+ });
+
+ assert Manager.instance().isLongRunningConversation();
+ assert "begun".equals(result);
+
+ result = (String) ci.aroundInvoke( new MockInvocationContext() {
+ @Override
+ public Method getMethod()
+ {
+ return InterceptorTest.getMethod("beginNested");
+ }
+ @Override
+ public Object proceed() throws Exception
+ {
+ return "begunNested";
+ }
+ });
+
+ assert Manager.instance().isNestedConversation();
+ assert "begunNested".equals(result);
- ServletLifecycle.endApplication();
+ result = (String) ci.aroundInvoke( new MockInvocationContext() {
+ @Override
+ public Method getMethod()
+ {
+ return InterceptorTest.getMethod("endRoot");
+ }
+ @Override
+ public Object proceed() throws Exception
+ {
+ return "endedRoot";
+ }
+ });
+
+ assert !Manager.instance().isNestedConversation();
+ assert !Manager.instance().isLongRunningConversation();
+ assert "endedRoot".equals(result);
+
+ /////////////////////////////////////////////////////
+ // Test @End(root=true) for a non-nested conversation
+ /////////////////////////////////////////////////////
+
+ result = (String) ci.aroundInvoke( new MockInvocationContext() {
+ @Override
+ public Method getMethod()
+ {
+ return InterceptorTest.getMethod("begin");
+ }
+ @Override
+ public Object proceed() throws Exception
+ {
+ return "begun";
+ }
+ });
+
+ assert Manager.instance().isLongRunningConversation();
+ assert "begun".equals(result);
+
+ result = (String) ci.aroundInvoke( new MockInvocationContext() {
+ @Override
+ public Method getMethod()
+ {
+ return InterceptorTest.getMethod("endRoot");
+ }
+ @Override
+ public Object proceed() throws Exception
+ {
+ return "endedRoot";
+ }
+ });
+
+ assert !Manager.instance().isNestedConversation();
+ assert !Manager.instance().isLongRunningConversation();
+ assert "endedRoot".equals(result);
}
@Test
16 years, 2 months
Seam SVN: r8989 - trunk/src/main/org/jboss/seam/security/management.
by seam-commits@lists.jboss.org
Author: jacob.orshalick
Date: 2008-09-14 09:13:08 -0400 (Sun, 14 Sep 2008)
New Revision: 8989
Modified:
trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java
Log:
JBSEAM-3418
Modified: trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java 2008-09-12 03:16:24 UTC (rev 8988)
+++ trunk/src/main/org/jboss/seam/security/management/JpaIdentityStore.java 2008-09-14 13:13:08 UTC (rev 8989)
@@ -594,7 +594,7 @@
return PasswordHash.instance().generateSaltedHash(password, salt);
}
}
- else if ("none".equals(algorithm))
+ else if ("none".equalsIgnoreCase(algorithm))
{
return password;
}
16 years, 2 months
Seam SVN: r8988 - trunk/examples/seamspace/view.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-09-11 23:16:24 -0400 (Thu, 11 Sep 2008)
New Revision: 8988
Modified:
trunk/examples/seamspace/view/userdetail.xhtml
Log:
should be s:button
Modified: trunk/examples/seamspace/view/userdetail.xhtml
===================================================================
--- trunk/examples/seamspace/view/userdetail.xhtml 2008-09-11 21:24:00 UTC (rev 8987)
+++ trunk/examples/seamspace/view/userdetail.xhtml 2008-09-12 03:16:24 UTC (rev 8988)
@@ -67,7 +67,7 @@
</div>
<div class="formButtons">
- <h:commandButton value="Save" action="#{userAction.save}" styleClass="formButton"/>
+ <s:button value="Save" action="#{userAction.save}" styleClass="formButton"/>
<s:button view="/usermanager.xhtml" value="Cancel" propagation="end" styleClass="formButton"/>
</div>
16 years, 2 months
Seam SVN: r8987 - in trunk: src/excel/org/jboss/seam/excel/css and 1 other directory.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2008-09-11 17:24:00 -0400 (Thu, 11 Sep 2008)
New Revision: 8987
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
trunk/src/excel/org/jboss/seam/excel/css/Parser.java
Log:
JBSEAM-3410
Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-09-11 20:10:57 UTC (rev 8986)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-09-11 21:24:00 UTC (rev 8987)
@@ -3152,16 +3152,6 @@
</listitem>
<listitem>
<para>
- When using external stylesheets they must be formatted in
- one line per entry like
- </para>
- <programlisting role="XML">
- .header { xls-font: bold 14 Verdana }
- .data { xls-font: 12 'Times New Roman' }
- </programlisting>
- </listitem>
- <listitem>
- <para>
When using the datatable exporter, CSS must be entered through
style-attributes, external stylesheets are not supported
</para>
Modified: trunk/src/excel/org/jboss/seam/excel/css/Parser.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/css/Parser.java 2008-09-11 20:10:57 UTC (rev 8986)
+++ trunk/src/excel/org/jboss/seam/excel/css/Parser.java 2008-09-11 21:24:00 UTC (rev 8987)
@@ -32,22 +32,29 @@
// Where to look for the style class
private static final String STYLE_CLASS_ATTRIBUTE = "styleClass";
-
+
// What separates multiple XLS-CSS attributes in a style string
private static final String STYLES_SEPARATOR = ";";
-
+
// What separates the key and value in a XLS-CSS style
private static final String STYLE_NAME_VALUE_SEPARATOR = ":";
-
+
// What separates multiple style class references
private static final String STYLE_SHORTHAND_SEPARATOR = " ";
- // The style classes that have been read in from e:link referenced, mapped on style class name
+ // What starts a rule block in a CSS file
+ private static final String LEFT_BRACE = "{";
+
+ // What ends a rule block in a CSS file
+ private static final String RIGHT_BRACE = "}";
+
+ // The style classes that have been read in from e:link referenced, mapped on
+ // style class name
private Map<String, StyleMap> definedStyleClasses = new HashMap<String, StyleMap>();
-
+
// The registered property builders, mapped on attribute name
private Map<String, PropertyBuilder> propertyBuilders = new HashMap<String, PropertyBuilder>();
-
+
// A cache of previously parsed css, mapped on component
private Map<UIComponent, StyleMap> cellStyleCache = new HashMap<UIComponent, StyleMap>();
@@ -134,8 +141,29 @@
}
/**
- * Parses a style sheet. Really crude. Assumes data is nicely formatted on one line per entry
+ * Reads data from an URL to a String
*
+ * @param url The URL to read
+ * @return The read data as a String
+ * @throws IOException If the stream could not be read
+ */
+ private static String readCSS(URL url) throws IOException
+ {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
+ StringBuffer buffer = new StringBuffer();
+ String line;
+ while ((line = reader.readLine()) != null)
+ {
+ buffer.append(line);
+ }
+ reader.close();
+ return buffer.toString();
+ }
+
+ /**
+ * Parses a style sheet. Really crude. Assumes data is nicely formatted on
+ * one line per entry
+ *
* @param URL The URL to read
* @return A map of style class names mapped to StyleMaps
* @throws MalformedURLException
@@ -144,28 +172,29 @@
private Map<String, StyleMap> parseStylesheet(String URL) throws MalformedURLException, IOException
{
Map<String, StyleMap> styleClasses = new HashMap<String, StyleMap>();
- BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(URL).openStream()));
- String line;
- while ((line = reader.readLine()) != null)
+ String css = readCSS(new URL(URL)).toLowerCase();
+ int firstBrace = -1;
+ int secondBrace = -1;
+ while (!"".equals(css))
{
- String[] spaceParts = line.split(" ");
- String name = spaceParts[0];
- if (name.startsWith("."))
+ firstBrace = css.indexOf(LEFT_BRACE);
+ if (firstBrace >= 0)
{
- name = name.substring(1);
+ secondBrace = css.indexOf(RIGHT_BRACE, firstBrace + 1);
}
- int startbrace = line.indexOf("{");
- int stopbrace = line.indexOf("}");
- if (startbrace < 0 || stopbrace < 0)
+ if (firstBrace >= 0 && secondBrace >= 0 && firstBrace != secondBrace)
{
- String message = Interpolator.instance().interpolate("Could not find braces in #0", line);
- throw new ExcelWorkbookException(message);
+ String styleName = css.substring(0, firstBrace).trim();
+ String styleString = css.substring(firstBrace + 1, secondBrace).trim();
+ StyleMap styleMap = parseStyleString(styleString);
+ styleClasses.put(styleName, styleMap);
+ css = css.substring(secondBrace + 1);
}
- String styleData = line.substring(startbrace + 1, stopbrace).trim();
- StyleMap styleMap = parseStyleString(styleData);
- styleClasses.put(name, styleMap);
+ else
+ {
+ css = "";
+ }
}
- reader.close();
return styleClasses;
}
@@ -175,20 +204,22 @@
* @param component The component to examine
* @return null if not found, otherwise style string
*/
- public static String getStyle(UIComponent component) {
+ public static String getStyle(UIComponent component)
+ {
return getStyleProperty(component, STYLE_ATTRIBUTE);
}
-
+
/**
* Gets style class from a component
*
* @param component The component to examine
* @return null if not found, otherwise style class(es) string
*/
- public static String getStyleClass(UIComponent component) {
+ public static String getStyleClass(UIComponent component)
+ {
return getStyleProperty(component, STYLE_CLASS_ATTRIBUTE);
}
-
+
/**
* Reads a property from a component
*
@@ -221,33 +252,38 @@
* @param styleMaps The list of collected style maps
* @return The list of style maps
*/
- private List<StyleMap> cascadeStyleMap(UIComponent component, List<StyleMap> styleMaps) {
+ private List<StyleMap> cascadeStyleMap(UIComponent component, List<StyleMap> styleMaps)
+ {
styleMaps.add(getStyleMap(component));
- if (component.getParent() != null) {
+ if (component.getParent() != null)
+ {
cascadeStyleMap(component.getParent(), styleMaps);
}
return styleMaps;
}
-
+
/**
- * Gets the cascaded style map for a component. Recurses on parents, collecting style maps.
- * The reverses the list and merges the styles
+ * Gets the cascaded style map for a component. Recurses on parents,
+ * collecting style maps. The reverses the list and merges the styles
*
* @param component The component to examine
* @return The merged style map
*/
- public StyleMap getCascadedStyleMap(UIComponent component) {
+ public StyleMap getCascadedStyleMap(UIComponent component)
+ {
List<StyleMap> styleMaps = cascadeStyleMap(component, new ArrayList<StyleMap>());
Collections.reverse(styleMaps);
StyleMap cascadedStyleMap = new StyleMap();
- for (StyleMap styleMap : styleMaps) {
+ for (StyleMap styleMap : styleMaps)
+ {
cascadedStyleMap.putAll(styleMap);
}
return cascadedStyleMap;
}
-
+
/**
* Gets a style map for a component (from cache if available)
+ *
* @param component The component to examine
* @return The style map of the component
*/
16 years, 2 months
Seam SVN: r8986 - in trunk: examples/excel/view and 3 other directories.
by seam-commits@lists.jboss.org
Author: nickarls
Date: 2008-09-11 16:10:57 -0400 (Thu, 11 Sep 2008)
New Revision: 8986
Added:
trunk/src/excel/org/jboss/seam/excel/ui/UIFooter.java
trunk/src/excel/org/jboss/seam/excel/ui/UIHeader.java
Removed:
trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooter.java
trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommand.java
trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommands.java
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
trunk/examples/excel/view/people.xhtml
trunk/src/excel/META-INF/faces-config.xml
trunk/src/excel/META-INF/seam-excel.taglib.xml
trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java
trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java
Log:
JBSEAM-3236. Dropped the header/footer/commands/command structure for a header and footer tag that parses a single string.
Modified: trunk/doc/Seam_Reference_Guide/en-US/Excel.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/doc/Seam_Reference_Guide/en-US/Excel.xml 2008-09-11 20:10:57 UTC (rev 8986)
@@ -1725,9 +1725,8 @@
<section id="excel.headersfooters">
<title>Headers and footers</title>
<para>
- Headers and footers are childrens of worksheets and worksheet templates
- and parents of header and footer commands They add headers and footers
- to printed worksheets.
+ Headers and footers are childrens of worksheets and contain facets which
+ in turn contains a string with commands that are parsed.
</para>
<informaltable>
<tgroup cols="2">
@@ -1737,7 +1736,7 @@
<row>
<entry valign="top">
<para>
- <literal><e:headerFooter></literal>
+ <literal><e:header></literal>
</para>
</entry>
<entry valign="top">
@@ -1747,9 +1746,7 @@
<itemizedlist>
<listitem>
<para>
- <literal>type</literal>
- —The type of the header or footer. The value
- is string that can be either "header" or "footer".
+ <literal>none</literal>
</para>
</listitem>
</itemizedlist>
@@ -1794,11 +1791,6 @@
</tbody>
</tgroup>
</informaltable>
- <para>
- The <literal><e:headerFooterCommands></literal>
- is just a nesting container in order to support multiple header/footer
- commands.
- </para>
<informaltable>
<tgroup cols="2">
<colspec colnum="1" colwidth="1*" />
@@ -1807,7 +1799,7 @@
<row>
<entry valign="top">
<para>
- <literal><e:headerFooterCommands></literal>
+ <literal><e:footer></literal>
</para>
</entry>
<entry valign="top">
@@ -1826,7 +1818,9 @@
</para>
<itemizedlist>
<listitem>
- <para>Zero or more header/footer commands.</para>
+ <para>
+ <literal>none</literal>
+ </para>
</listitem>
</itemizedlist>
<para>
@@ -1835,9 +1829,25 @@
<itemizedlist>
<listitem>
<para>
- <literal>none</literal>
+ <literal>left</literal>
+ —The contents of the left header/footer
+ part.
</para>
</listitem>
+ <listitem>
+ <para>
+ <literal>center</literal>
+ —The contents of the center header/footer
+ part.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>right</literal>
+ —The contents of the right header/footer
+ part.
+ </para>
+ </listitem>
</itemizedlist>
</entry>
</row>
@@ -1845,8 +1855,8 @@
</tgroup>
</informaltable>
<para>
- Header/footer commands adds actual commands to the header or footer in
- the location where the containing facet points.
+ The content of the facets is a string that can contain various #-delimited
+ commands as follows:
</para>
<informaltable>
<tgroup cols="2">
@@ -1855,119 +1865,171 @@
<tbody>
<row>
<entry valign="top">
+ <para>#date#</para>
+ </entry>
+ <entry valign="top">
+ <para>Inserts the current date</para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#page_number#</para>
+ </entry>
+ <entry valign="top">
+ <para>Inserts the current page number</para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#time#</para>
+ </entry>
+ <entry valign="top">
+ <para>Inserts the current time</para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#total_pages#</para>
+ </entry>
+ <entry valign="top">
+ <para>Inserts the total page count</para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#worksheet_name#</para>
+ </entry>
+ <entry valign="top">
+ <para>Inserts the worksheet name</para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#workbook_name#</para>
+ </entry>
+ <entry valign="top">
+ <para>Inserts the workbook name</para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#bold#</para>
+ </entry>
+ <entry valign="top">
<para>
- <literal><e:headerFooterCommand></literal>
+ Toggles bold font, use another #bold# to
+ turn it off
</para>
</entry>
+ </row>
+ <row>
<entry valign="top">
+ <para>#italics#</para>
+ </entry>
+ <entry valign="top">
<para>
- <emphasis>Attributes</emphasis>
+ Toggles italic font, use another #italic# to
+ turn it off
</para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>command</literal>
- —The command to execute. The value is a
- string
- <itemizedlist>
- <listitem>
- "append" - appends the text in the
- <literal>parameter</literal>
- </listitem>
- <listitem>
- "date" - appends the current date
- </listitem>
- <listitem>
- "page_number" - appends the page number
- </listitem>
- <listitem>"time" - appends the time</listitem>
- <listitem>
- "total_pages" - appends the total page count
- </listitem>
- <listitem>
- "workbook_name" - appends the workbook name
- </listitem>
- <listitem>
- "worksheet_name" - appends the worksheet
- name
- </listitem>
- <listitem>
- "toggle_bold" - toggles bold font
- </listitem>
- <listitem>
- "toggle_italics" - toggles italics
- </listitem>
- <listitem>
- "toggle_double_underline" - toggles double
- underlining
- </listitem>
- <listitem>
- "toggle_outline" - toggles outline
- </listitem>
- <listitem>
- "toggle_shadow" - toggles shadow
- </listitem>
- <listitem>
- "toggle_strikethrough" - toggles
- strikethrough
- </listitem>
- <listitem>
- "toggle_subscript" - toggles subscript
- </listitem>
- <listitem>
- "toggle_superscript" - toggles superscript
- </listitem>
- <listitem>
- "toggle_underline" - toggles underline
- </listitem>
- <listitem>
- "font_name" - sets the font name given in
- the
- <literal>parameter</literal>
- </listitem>
- <listitem>
- "font_size" - sets the font size given in
- the
- <literal>parameter</literal>
- </listitem>
- </itemizedlist>
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>parameter</literal>
- —The parameter for some commands. Used by
- the font_name, font_size and append commands. The
- font_name parameter is a string that represents
- the requested font name, the font_size parameter
- is a number that represents the requested font
- size and the append parameter is a string of text
- to be appended to the header/footer.
- </para>
- </listitem>
- </itemizedlist>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#underline#</para>
+ </entry>
+ <entry valign="top">
<para>
- <emphasis>Child elemenents</emphasis>
+ Toggles underlining, use another #underline# to
+ turn it off
</para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>none</literal>
- </para>
- </listitem>
- </itemizedlist>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#double_underline#</para>
+ </entry>
+ <entry valign="top">
<para>
- <emphasis>Facets</emphasis>
+ Toggles double underlining, use another #double_underline# to
+ turn it off
</para>
- <itemizedlist>
- <listitem>
- <para>
- <literal>none</literal>
- </para>
- </listitem>
- </itemizedlist>
</entry>
</row>
+ <row>
+ <entry valign="top">
+ <para>#outline#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Toggles outlined font, use another #outline# to
+ turn it off
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#shadow#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Toggles shadowed font, use another #shadow# to
+ turn it off
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#strikethrough#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Toggles strikethrough font, use another #strikethrough# to
+ turn it off
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#subscript#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Toggles subscripted font, use another #subscript# to
+ turn it off
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#superscript#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Toggles superscript font, use another #superscript# to
+ turn it off
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#font_name#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Sets font name, used like #font_name=Verdana"
+ </para>
+ </entry>
+ </row>
+ <row>
+ <entry valign="top">
+ <para>#font_size#</para>
+ </entry>
+ <entry valign="top">
+ <para>
+ Sets font size, use like #font_size=12#
+ </para>
+ </entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
@@ -1975,18 +2037,18 @@
<![CDATA[
<e:workbook>
<e:worksheet>
- <e:headerFooter type="header">
+ <e:header>
<f:facet name="left">
- <e:headerFooterCommands>
- <e:headerFooterCommand command="page_number"/>
- </e:headerFooterCommands>
+ This document was made on #date# and has #total_pages# pages
</f:facet>
- </e:headerFooter>
+ <f:facet name="right">
+ #time#
+ </f:facet>
+ </e:header>
<e:worksheet>
</e:workbook>
]]>
</programlisting>
- <para>Defines a header with the page number in the left corner.</para>
</section>
<section id="excel.printareatitles">
<title>Print areas and titles</title>
Modified: trunk/examples/excel/view/people.xhtml
===================================================================
--- trunk/examples/excel/view/people.xhtml 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/examples/excel/view/people.xhtml 2008-09-11 20:10:57 UTC (rev 8986)
@@ -5,6 +5,11 @@
<e:workbook type="#{exportType}">
<e:worksheet name="People" value="#{people}" var="person">
+ <e:header>
+ <f:facet name="left">
+ The date is #date# and the time is #time#
+ </f:facet>
+ </e:header>
<e:column style="xls-column-autosize: true">
<f:facet name="header">
<e:cell value="Name" style="xls-font: red bold 10 Verdana"/>
Modified: trunk/src/excel/META-INF/faces-config.xml
===================================================================
--- trunk/src/excel/META-INF/faces-config.xml 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/META-INF/faces-config.xml 2008-09-11 20:10:57 UTC (rev 8986)
@@ -21,18 +21,14 @@
<component-class>org.jboss.seam.excel.ui.UIWorksheet</component-class>
</component>
<component>
- <component-type>org.jboss.seam.excel.ui.UIHeaderFooter</component-type>
- <component-class>org.jboss.seam.excel.ui.UIHeaderFooter</component-class>
+ <component-type>org.jboss.seam.excel.ui.UIHeader</component-type>
+ <component-class>org.jboss.seam.excel.ui.UIHeader</component-class>
</component>
<component>
- <component-type>org.jboss.seam.excel.ui.UIHeaderFooterCommands</component-type>
- <component-class>org.jboss.seam.excel.ui.UIHeaderFooterCommands</component-class>
+ <component-type>org.jboss.seam.excel.ui.UIFooter</component-type>
+ <component-class>org.jboss.seam.excel.ui.UIFooter</component-class>
</component>
<component>
- <component-type>org.jboss.seam.excel.ui.UIHeaderFooterCommand</component-type>
- <component-class>org.jboss.seam.excel.ui.UIHeaderFooterCommand</component-class>
- </component>
- <component>
<component-type>org.jboss.seam.excel.ui.UIPrintArea</component-type>
<component-class>org.jboss.seam.excel.ui.UIPrintArea</component-class>
</component>
Modified: trunk/src/excel/META-INF/seam-excel.taglib.xml
===================================================================
--- trunk/src/excel/META-INF/seam-excel.taglib.xml 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/META-INF/seam-excel.taglib.xml 2008-09-11 20:10:57 UTC (rev 8986)
@@ -35,27 +35,20 @@
</tag>
<tag>
- <tag-name>headerFooter</tag-name>
+ <tag-name>header</tag-name>
<component>
- <component-type>org.jboss.seam.excel.ui.UIHeaderFooter</component-type>
+ <component-type>org.jboss.seam.excel.ui.UIHeader</component-type>
</component>
</tag>
<tag>
- <tag-name>headerFooterCommands</tag-name>
+ <tag-name>footer</tag-name>
<component>
- <component-type>org.jboss.seam.excel.ui.UIHeaderFooterCommands</component-type>
+ <component-type>org.jboss.seam.excel.ui.UIFooter</component-type>
</component>
</tag>
<tag>
- <tag-name>headerFooterCommand</tag-name>
- <component>
- <component-type>org.jboss.seam.excel.ui.UIHeaderFooterCommand</component-type>
- </component>
- </tag>
-
- <tag>
<tag-name>printArea</tag-name>
<component>
<component-type>org.jboss.seam.excel.ui.UIPrintArea</component-type>
Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLFactory.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -1,13 +1,16 @@
package org.jboss.seam.excel.jxl;
+import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
import jxl.HeaderFooter;
+import jxl.HeaderFooter.Contents;
import jxl.biff.DisplayFormat;
import jxl.biff.FontRecord;
import jxl.format.Alignment;
@@ -27,14 +30,13 @@
import org.jboss.seam.core.Interpolator;
import org.jboss.seam.excel.ExcelWorkbookException;
import org.jboss.seam.excel.css.CellStyle;
-import org.jboss.seam.excel.ui.UIHeaderFooter;
-import org.jboss.seam.excel.ui.UIHeaderFooterCommand;
+import org.jboss.seam.excel.ui.ExcelComponent;
import org.jboss.seam.log.Log;
import org.jboss.seam.log.Logging;
/**
* Factory for creating JExcelAPI objects
- *
+ *
* @author karlsnic
*/
public class JXLFactory
@@ -51,10 +53,29 @@
private static final String PATTERN_CLASS_NAME = "jxl.format.Pattern";
private static final String PAGE_ORIENTATION_CLASS_NAME = "jxl.format.PageOrientation";
private static final String PAPER_SIZE_CLASS_NAME = "jxl.format.PaperSize";
- private static final String HEADER_FOOTER_COMMAND_CLASS_NAME = "org.jboss.seam.excel.UIHeaderFooterCommand";
private static final String SCRIPT_STYLE_CLASS_NAME = "jxl.format.ScriptStyle";
private static final String UNDERLINE_STYLE_CLASS_NAME = "jxl.format.UnderlineStyle";
-
+
+ private static final String HEADERFOOTER_COMMAND_MARKER = "#";
+ private static final String HEADERFOOTER_PAIR_DELIMITER = "=";
+
+ private static final String HF_CMD_FONT_SIZE = "font_size";
+ private static final String HF_CMD_FONT_NAME = "font_name";
+ private static final String HF_CMD_UNDERLINE = "underline";
+ private static final String HF_CMD_SUPERSCRIPT = "superscript";
+ private static final String HF_CMD_SUBSCRIPT = "subscript";
+ private static final String HF_CMD_STRIKETHROUGH = "strikethrough";
+ private static final String HF_CMD_SHADOW = "shadow";
+ private static final String HF_CMD_OUTLINE = "outline";
+ private static final String HF_CMD_ITALICS = "italics";
+ private static final String HF_CMD_DOUBLE_UNDERLINE = "double_underline";
+ private static final String HF_CMD_BOLD = "bold";
+ private static final String HF_CMD_WORKSHEET_NAME = "worksheet_name";
+ private static final String HF_CMD_WORKBOOK_NAME = "workbook_name";
+ private static final String HF_CMD_TOTAL_PAGES = "total_pages";
+ private static final String HF_CMD_TIME = "time";
+ private static final String HF_CMD_PAGE_NUMBER = "page_number";
+
private static final Log log = Logging.getLog(JXLFactory.class);
/**
@@ -63,27 +84,30 @@
* @param text The text to check
* @return True if border line style, false otherwise
*/
- public static boolean isBorderLineStyle(String text) {
+ public static boolean isBorderLineStyle(String text)
+ {
return getValidContants(BORDER_LINE_STYLE_CLASS_NAME).contains(text.toLowerCase());
}
-
+
/**
* Checks if text is a pattern
*
* @param text The text to check
* @return True if pattern, false otherwise
*/
- public static boolean isPattern(String text) {
+ public static boolean isPattern(String text)
+ {
return getValidContants(PATTERN_CLASS_NAME).contains(text.toLowerCase());
}
-
+
/**
* Checks if text is a color
*
* @param text The text to check
* @return True if color, false otherwise
*/
- public static boolean isColor(String text) {
+ public static boolean isColor(String text)
+ {
return getValidContants(COLOR_CLASS_NAME).contains(text.toLowerCase());
}
@@ -93,7 +117,8 @@
* @param text The text to check
* @return True if alignment, false otherwise
*/
- public static boolean isAlignment(String text) {
+ public static boolean isAlignment(String text)
+ {
return getValidContants(ALIGNMENT_CLASS_NAME).contains(text.toLowerCase());
}
@@ -103,7 +128,8 @@
* @param text The text to check
* @return True if orientation, false otherwise
*/
- public static boolean isOrientation(String text) {
+ public static boolean isOrientation(String text)
+ {
return getValidContants(ORIENTATION_CLASS_NAME).contains(text.toLowerCase());
}
@@ -113,7 +139,8 @@
* @param text The text to check
* @return True if vertical alignment, false otherwise
*/
- public static boolean isVerticalAlignment(String text) {
+ public static boolean isVerticalAlignment(String text)
+ {
return getValidContants(VERTICAL_ALIGNMENT_CLASS_NAME).contains(text.toLowerCase());
}
@@ -123,7 +150,8 @@
* @param text The text to check
* @return True if underline style, false otherwise
*/
- public static boolean isUnderlineStyle(String text) {
+ public static boolean isUnderlineStyle(String text)
+ {
return getValidContants(UNDERLINE_STYLE_CLASS_NAME).contains(text.toLowerCase());
}
@@ -133,7 +161,8 @@
* @param text The text to check
* @return True if script style, false otherwise
*/
- public static boolean isScriptStyle(String text) {
+ public static boolean isScriptStyle(String text)
+ {
return getValidContants(SCRIPT_STYLE_CLASS_NAME).contains(text.toLowerCase());
}
@@ -143,9 +172,10 @@
* @param className The class to examine
* @return A list of constants
*/
- private static List<String> getValidContants(String className) {
+ private static List<String> getValidContants(String className)
+ {
List<String> constants = new ArrayList<String>();
-
+
if (log.isTraceEnabled())
{
log.trace("Getting valid constants from #0", className);
@@ -171,7 +201,7 @@
}
return constants;
}
-
+
/**
* Gets a suggestion string of available constants from a class.
*
@@ -189,10 +219,11 @@
buffer.append(i++ == 0 ? field : ", " + field);
}
return Interpolator.instance().interpolate("[#0]", buffer.toString());
- }
-
+ }
+
/**
* Gets a constant from a class
+ *
* @param className The class name to examine
* @param fieldName The field to read
* @return The constant
@@ -216,8 +247,8 @@
{
throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not read field #0 from class #1", fieldName, className), e);
}
- }
-
+ }
+
/**
* Creates a JExcelAPI representation of an alignment
*
@@ -242,7 +273,7 @@
throw new ExcelWorkbookException(message, e);
}
}
-
+
/**
* Creates a JExcelAPI representation of an script style
*
@@ -266,8 +297,8 @@
String message = Interpolator.instance().interpolate("Script style {0} not supported, try {1}", scriptStyle, getValidConstantsSuggestion(SCRIPT_STYLE_CLASS_NAME));
throw new ExcelWorkbookException(message, e);
}
- }
-
+ }
+
/**
* Creates a JExcelAPI representation of an underline style
*
@@ -291,8 +322,8 @@
String message = Interpolator.instance().interpolate("Underline style {0} not supported, try {1}", underlineStyle, getValidConstantsSuggestion(UNDERLINE_STYLE_CLASS_NAME));
throw new ExcelWorkbookException(message, e);
}
- }
-
+ }
+
/**
* Creates a JExcelAPI representation of a font
*
@@ -304,32 +335,40 @@
public static FontRecord createFont(CellStyle.Font fontspecs) throws WriteException
{
WritableFont font = null;
- if (fontspecs.family != null) {
+ if (fontspecs.family != null)
+ {
font = new WritableFont(WritableFont.createFont(fontspecs.family));
}
else
{
font = new WritableFont(WritableFont.ARIAL);
}
- if (fontspecs.pointSize != null) {
+ if (fontspecs.pointSize != null)
+ {
font.setPointSize(fontspecs.pointSize);
}
- if (fontspecs.color != null) {
+ if (fontspecs.color != null)
+ {
font.setColour(createColor(fontspecs.color));
}
- if (fontspecs.bold != null) {
+ if (fontspecs.bold != null)
+ {
font.setBoldStyle(fontspecs.bold ? WritableFont.BOLD : WritableFont.NO_BOLD);
}
- if (fontspecs.italic != null) {
+ if (fontspecs.italic != null)
+ {
font.setItalic(fontspecs.italic);
}
- if (fontspecs.struckOut != null) {
+ if (fontspecs.struckOut != null)
+ {
font.setStruckout(fontspecs.struckOut);
}
- if (fontspecs.scriptStyle != null) {
+ if (fontspecs.scriptStyle != null)
+ {
font.setScriptStyle(createScriptStyle(fontspecs.scriptStyle));
}
- if (fontspecs.underlineStyle != null) {
+ if (fontspecs.underlineStyle != null)
+ {
font.setUnderlineStyle(createUnderlineStyle(fontspecs.underlineStyle));
}
return font;
@@ -362,7 +401,6 @@
}
}
-
/**
* Creates a JExcelAPI date display format
*
@@ -545,7 +583,7 @@
throw new ExcelWorkbookException(message, e);
}
}
-
+
/**
* Creates a JExcelAPI representation of a page orientation
*
@@ -567,7 +605,7 @@
String message = Interpolator.instance().interpolate("Page orientation {0} not supported, try {1}", orientation, getValidConstantsSuggestion(PAGE_ORIENTATION_CLASS_NAME));
throw new ExcelWorkbookException(message, e);
}
- }
+ }
/**
* Creates a JExcelAPI representation of a paper size
@@ -591,7 +629,7 @@
throw new ExcelWorkbookException(message, e);
}
}
-
+
/**
* Creates a JExcelAPI header or footer representation. Processes the left,
* center and right facets using a helper method
@@ -601,24 +639,24 @@
* to
* @return The JExcelAPI header or footer representation
*/
- public static HeaderFooter createHeaderFooter(UIHeaderFooter uiHeaderFooter, HeaderFooter headerFooter)
+ public static HeaderFooter createHeaderFooter(UIComponent uiHeaderFooter, HeaderFooter headerFooter)
{
if (log.isTraceEnabled())
{
log.trace("Processing header/footer #0", uiHeaderFooter);
}
- processHeaderFooterFacet(headerFooter.getLeft(), uiHeaderFooter.getFacet(UIHeaderFooter.LEFT_FACET));
- processHeaderFooterFacet(headerFooter.getCentre(), uiHeaderFooter.getFacet(UIHeaderFooter.CENTER_FACET));
- processHeaderFooterFacet(headerFooter.getRight(), uiHeaderFooter.getFacet(UIHeaderFooter.RIGHT_FACET));
+ processHeaderFooterFacet(headerFooter.getLeft(), uiHeaderFooter.getFacet("left"));
+ processHeaderFooterFacet(headerFooter.getCentre(), uiHeaderFooter.getFacet("middle"));
+ processHeaderFooterFacet(headerFooter.getRight(), uiHeaderFooter.getFacet("right"));
return headerFooter;
}
/**
* Processes a header or footer facet. A header or footer facet in JExcelAPI
* is split into three parts, left, center and right and the UI
- * representation has facets with the same namings. Gets the requested
- * facet from the UI component and calls helper methods for processing the
- * header commands in sequence
+ * representation has facets with the same namings. Gets the requested facet
+ * from the UI component and calls helper methods for processing the header
+ * commands in sequence
*
* @param headerFooter The JExcelAPI header or footer facet to process
* @param facetName The name of the facet to process (left, center, right)
@@ -635,83 +673,139 @@
{
return;
}
- for (UIComponent child : facet.getChildren())
+ String facetContent = null;
+ try
{
- if (child.getClass() == UIHeaderFooterCommand.class)
+ facetContent = ExcelComponent.cmp2String(FacesContext.getCurrentInstance(), facet);
+ }
+ catch (IOException e)
+ {
+ throw new ExcelWorkbookException("Could not get content from header facet", e);
+ }
+ if (facetContent == null)
+ {
+ return;
+ }
+ facetContent = facetContent.trim();
+ int firstHash;
+ int secondHash;
+ String command;
+ String pre;
+ while (!"".equals(facetContent))
+ {
+ firstHash = -1;
+ secondHash = -1;
+ firstHash = facetContent.indexOf(HEADERFOOTER_COMMAND_MARKER);
+ if (firstHash >= 0)
{
- processHeaderFooterCommand(contents, (UIHeaderFooterCommand) child);
+ secondHash = facetContent.indexOf(HEADERFOOTER_COMMAND_MARKER, firstHash + 1);
}
+ if (firstHash >= 0 && secondHash >= 0 && firstHash != secondHash)
+ {
+ pre = facetContent.substring(0, firstHash);
+ if (!"".equals(pre))
+ {
+ contents.append(pre);
+ }
+ command = facetContent.substring(firstHash + 1, secondHash);
+ processCommand(contents, command);
+ facetContent = facetContent.substring(secondHash + 1);
+ }
+ else
+ {
+ contents.append(facetContent);
+ facetContent = "";
+ }
}
}
/**
- * Processes a header command and applies it to the JExcelAPI header contents
+ * Processes a header or footer command, adding itself to the contents
*
- * @param contents The contents to apply the command to (left, center, right)
- * @param command The command to interpret
+ * @param contents The target contents
+ * @param command The command to execute
*/
- private static void processHeaderFooterCommand(HeaderFooter.Contents contents, UIHeaderFooterCommand command)
+ private static void processCommand(Contents contents, String command)
{
- if (log.isTraceEnabled())
+ command = command.toLowerCase();
+ if (command.startsWith("date"))
{
- log.trace("Processing header/footer command #0", command);
+ contents.appendDate();
}
- switch (command.getCommand())
+ else if (command.startsWith(HF_CMD_PAGE_NUMBER))
{
- case append:
- contents.append((String) command.getParameter());
- break;
- case date:
- contents.appendDate();
- break;
- case page_number:
contents.appendPageNumber();
- break;
- case time:
+ }
+ else if (command.startsWith(HF_CMD_TIME))
+ {
contents.appendTime();
- break;
- case total_pages:
+ }
+ else if (command.startsWith(HF_CMD_TOTAL_PAGES))
+ {
contents.appendTotalPages();
- break;
- case workbook_name:
+ }
+ else if (command.startsWith(HF_CMD_WORKBOOK_NAME))
+ {
contents.appendWorkbookName();
- break;
- case worksheet_name:
+ }
+ else if (command.startsWith(HF_CMD_WORKSHEET_NAME))
+ {
contents.appendWorkSheetName();
- break;
- case font_name:
- contents.setFontName((String) command.getParameter());
- break;
- case font_size:
- contents.setFontSize((Integer) command.getParameter());
- break;
- case toggle_bold:
+ }
+ else if (command.startsWith(HF_CMD_BOLD))
+ {
contents.toggleBold();
- break;
- case toggle_italics:
+ }
+ else if (command.startsWith(HF_CMD_DOUBLE_UNDERLINE))
+ {
+ contents.toggleDoubleUnderline();
+ }
+ else if (command.startsWith(HF_CMD_ITALICS))
+ {
contents.toggleItalics();
- break;
- case toggle_double_underline:
- contents.toggleDoubleUnderline();
- break;
- case toggle_outline:
+ }
+ else if (command.startsWith(HF_CMD_OUTLINE))
+ {
contents.toggleOutline();
- break;
- case toggle_shadow:
+ }
+ else if (command.startsWith(HF_CMD_SHADOW))
+ {
contents.toggleShadow();
- break;
- case toggle_strikethrough:
+ }
+ else if (command.startsWith(HF_CMD_STRIKETHROUGH))
+ {
contents.toggleStrikethrough();
- break;
- case toggle_subscript:
+ }
+ else if (command.startsWith(HF_CMD_SUBSCRIPT))
+ {
contents.toggleSubScript();
- break;
- case toggle_superscript:
+ }
+ else if (command.startsWith(HF_CMD_SUPERSCRIPT))
+ {
contents.toggleSuperScript();
- break;
- default:
- String message = Interpolator.instance().interpolate("Header/Footer command {0} not supported, try {1}", command.getCommand(), getValidConstantsSuggestion(HEADER_FOOTER_COMMAND_CLASS_NAME));
- throw new ExcelWorkbookException(message);
}
- }
+ else if (command.startsWith(HF_CMD_UNDERLINE))
+ {
+ contents.toggleUnderline();
+ }
+ else if (command.startsWith(HF_CMD_FONT_NAME))
+ {
+ String[] parts = command.split(HEADERFOOTER_PAIR_DELIMITER);
+ if (parts.length != 2)
+ {
+ log.warn("Header/Footer font name error in #0", command);
+ }
+ contents.setFontName(parts[1].trim());
+ }
+ else if (command.startsWith(HF_CMD_FONT_SIZE))
+ {
+ String[] parts = command.split(HEADERFOOTER_PAIR_DELIMITER);
+ if (parts.length != 2)
+ {
+ log.warn("Header/Footer font size error in #0", command);
+ }
+ contents.setFontSize(Integer.parseInt(parts[1].trim()));
+ }
+ }
+
}
Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLHelper.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -36,7 +36,8 @@
import org.jboss.seam.excel.ui.UICell;
import org.jboss.seam.excel.ui.UICellBase;
import org.jboss.seam.excel.ui.UIColumn;
-import org.jboss.seam.excel.ui.UIHeaderFooter;
+import org.jboss.seam.excel.ui.UIFooter;
+import org.jboss.seam.excel.ui.UIHeader;
import org.jboss.seam.excel.ui.UILink;
import org.jboss.seam.excel.ui.UIPrintArea;
import org.jboss.seam.excel.ui.UIPrintTitles;
@@ -415,20 +416,12 @@
UIPrintTitles printTitles = (UIPrintTitles) child;
settings.setPrintTitles(printTitles.getFirstCol(), printTitles.getFirstRow(), printTitles.getLastCol(), printTitles.getLastRow());
}
- else if (child.getClass() == UIHeaderFooter.class)
- {
- UIHeaderFooter headerFooter = (UIHeaderFooter) child;
- switch (headerFooter.getType())
- {
- case header:
- settings.setHeader(JXLFactory.createHeaderFooter(headerFooter, settings.getHeader()));
- break;
- case footer:
- settings.setFooter(JXLFactory.createHeaderFooter(headerFooter, settings.getFooter()));
- break;
- default:
- throw new ExcelWorkbookException("Header/Footer type " + headerFooter.getType() + " not supported, try [header, footer]");
- }
+ else if (child.getClass() == UIHeader.class) {
+ UIHeader uiHeader = (UIHeader) child;
+ settings.setHeader(JXLFactory.createHeaderFooter(uiHeader, settings.getHeader()));
+ } else if (child.getClass() == UIFooter.class) {
+ UIFooter uiFooter = (UIFooter) child;
+ settings.setFooter(JXLFactory.createHeaderFooter(uiFooter, settings.getFooter()));
}
}
}
Added: trunk/src/excel/org/jboss/seam/excel/ui/UIFooter.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIFooter.java (rev 0)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIFooter.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -0,0 +1,17 @@
+package org.jboss.seam.excel.ui;
+
+public class UIFooter extends ExcelComponent
+{
+ public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIFooter";
+
+ public static final String LEFT_FACET = "left";
+ public static final String CENTER_FACET = "center";
+ public static final String RIGHT_FACET = "right";
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_TYPE;
+ }
+
+}
Added: trunk/src/excel/org/jboss/seam/excel/ui/UIHeader.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIHeader.java (rev 0)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIHeader.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -0,0 +1,17 @@
+package org.jboss.seam.excel.ui;
+
+public class UIHeader extends ExcelComponent
+{
+ public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIHeader";
+
+ public static final String LEFT_FACET = "left";
+ public static final String CENTER_FACET = "center";
+ public static final String RIGHT_FACET = "right";
+
+ @Override
+ public String getFamily()
+ {
+ return COMPONENT_TYPE;
+ }
+
+}
Deleted: trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooter.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooter.java 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooter.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -1,34 +0,0 @@
-package org.jboss.seam.excel.ui;
-
-public class UIHeaderFooter extends ExcelComponent
-{
- public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIHeaderFooter";
-
- public static final String LEFT_FACET = "left";
- public static final String CENTER_FACET = "center";
- public static final String RIGHT_FACET = "right";
-
- public enum Type
- {
- header, footer
- }
-
- private Type type;
-
- public Type getType()
- {
- return (Type) valueOf("type", type);
- }
-
- public void setType(Type type)
- {
- this.type = type;
- }
-
- @Override
- public String getFamily()
- {
- return COMPONENT_TYPE;
- }
-
-}
Deleted: trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommand.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommand.java 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommand.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -1,41 +0,0 @@
-package org.jboss.seam.excel.ui;
-
-public class UIHeaderFooterCommand extends ExcelComponent
-{
- public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIHeaderFooterCommand";
-
- public enum Command
- {
- append, date, page_number, time, total_pages, workbook_name, worksheet_name, toggle_bold, toggle_double_underline, toggle_italics, toggle_outline, toggle_shadow, toggle_strikethrough, toggle_subscript, toggle_superscript, toggle_underline, font_name, font_size
- }
-
- private Command command;
- private Object parameter;
-
- public Command getCommand()
- {
- return (Command) valueOf("command", command);
- }
-
- public void setCommand(Command command)
- {
- this.command = command;
- }
-
- public Object getParameter()
- {
- return valueOf("parameter", parameter);
- }
-
- public void setParameter(Object parameter)
- {
- this.parameter = parameter;
- }
-
- @Override
- public String getFamily()
- {
- return COMPONENT_TYPE;
- }
-
-}
Deleted: trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommands.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommands.java 2008-09-11 15:19:14 UTC (rev 8985)
+++ trunk/src/excel/org/jboss/seam/excel/ui/UIHeaderFooterCommands.java 2008-09-11 20:10:57 UTC (rev 8986)
@@ -1,13 +0,0 @@
-package org.jboss.seam.excel.ui;
-
-public class UIHeaderFooterCommands extends ExcelComponent
-{
- public static final String COMPONENT_TYPE = "org.jboss.seam.excel.ui.UIHeaderFooterCommands";
-
- @Override
- public String getFamily()
- {
- return COMPONENT_TYPE;
- }
-
-}
16 years, 2 months
Seam SVN: r8984 - in branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide: en-US and 1 other directory.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2008-09-11 11:14:27 -0400 (Thu, 11 Sep 2008)
New Revision: 8984
Added:
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.ent
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.xml
Modified:
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/Makefile
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Book_Info.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Components.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Dependencies.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Groovy.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Hsearch.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/I18n.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Itext.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Migration.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Persistence.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Revision_History.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Security.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Spring.xml
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Tutorial.xml
Log:
added released docs from EAP 4.3.2.1
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/Makefile
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/Makefile 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/Makefile 2008-09-11 15:14:27 UTC (rev 8984)
@@ -3,13 +3,10 @@
#Copyright Red Hat Inc. 2006
XML_LANG = en-US
-DOCNAME = Seam_Reference_Guide
-PRODUCT = Seam_Framework
+
BRAND = JBoss
-TRANSLATIONS = $(XML_LANG)
OTHER_LANGS = as-IN bn-IN de-DE es-ES fr-FR gu-IN hi-IN it-IT ja-JP kn-IN ko-KR ml-IN mr-IN or-IN pa-IN pt-BR ru-RU si-LK sl-SL ta-IN te-IN zh-CN zh-TW
-#TRANSLATIONS = $(XML_LANG) $(OTHER_LANGS)
COMMON_CONFIG = /usr/share/publican
include $(COMMON_CONFIG)/make/Makefile.common
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Book_Info.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Book_Info.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Book_Info.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -1,10 +1,31 @@
-<?xml version="1.0" standalone="no"?>
+<?xml version='1.0'?>
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
-<bookinfo>
- <title>Seam - Contextual Components</title>
- <subtitle>A Framework for Enterprise Java</subtitle>
- <xi:include href="Version_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<bookinfo id="Seam_Reference_Guide-Seam___Contextual_Components">
+ <title>Seam Reference Guide CP02 FP01</title>
+ <subtitle>for Use with JBoss Enterprise Application Platform 4.3.0 Cumulative Patch 2 Feature Pack 1</subtitle>
+ <edition>2.0</edition>
+ <pubsnumber>2</pubsnumber>
+ <productname>JBoss Enterprise Application Platform</productname>
+ <productnumber>4.3</productnumber>
+ <pubdate>August, 2008</pubdate>
+ <isbn>N/A</isbn>
+ <abstract><para>This book is a Reference Guide to Seam 2.0.2 for JBoss Enterprise Application Platform 4.3.0_CP02_FP01</para>
+ </abstract>
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="Common_Content/images/redhat-logo.svg" />
+ </imageobject>
+ </inlinemediaobject>
+ </corpauthor>
+ <copyright>
+ <year>&YEAR;</year>
+ <holder>&HOLDER;</holder>
+ </copyright>
+ <xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</bookinfo>
- <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-</bookinfo>
+
+
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Components.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Components.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Components.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -1521,38 +1521,38 @@
</itemizedlist>
</listitem>
</varlistentry>
- <varlistentry>
+ <!-- <varlistentry>
<term><emphasis><entityHome></emphasis></term>
- <term><literal>org.jboss.seam.framework.EntityHome</literal></term>
- <listitem>
- <para></para>
+ <term><literal>org.jboss.seam.framework.EntityHome</literal></term> -->
+ <!-- <listitem>
+ <para></para> -->
<!-- TODO: Document this -->
- </listitem>
- </varlistentry>
- <varlistentry>
+ <!-- </listitem> -->
+ <!-- </varlistentry> -->
+<!-- <varlistentry>
<term><emphasis><hibernateEntityHome></emphasis></term>
- <term><literal>org.jboss.seam.framework.HibernateEntityHome</literal></term>
- <listitem>
- <para></para>
+ <term><literal>org.jboss.seam.framework.HibernateEntityHome</literal></term> -->
+ <!-- <listitem>
+ <para></para> -->
<!-- TODO: Document this -->
- </listitem>
- </varlistentry>
- <varlistentry>
+ <!-- </listitem> -->
+ <!-- </varlistentry> -->
+ <!-- <varlistentry>
<term><emphasis><entityQuery></emphasis></term>
- <term><literal>org.jboss.seam.framework.EntityQuery</literal></term>
- <listitem>
- <para></para>
+ <term><literal>org.jboss.seam.framework.EntityQuery</literal></term> -->
+ <!-- <listitem>
+ <para></para> -->
<!-- TODO: Document this -->
- </listitem>
- </varlistentry>
- <varlistentry>
+ <!-- </listitem> -->
+ <!-- </varlistentry> -->
+ <!-- <varlistentry>
<term><emphasis><hibernateEntityQuery></emphasis></term>
- <term><literal>org.jboss.seam.framework.HibernateEntityQuery</literal></term>
- <listitem>
- <para></para>
+ <term><literal>org.jboss.seam.framework.HibernateEntityQuery</literal></term> -->
+ <!-- <listitem>
+ <para></para> -->
<!-- TODO: Document this -->
- </listitem>
- </varlistentry>
+ <!-- </listitem> -->
+ <!-- </varlistentry> -->
</variablelist>
</section>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Dependencies.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Dependencies.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -31,10 +31,10 @@
<para>
<table><title></title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -153,7 +153,7 @@
<para>provided</para>
</entry>
<entry align="center">
- <para></para>
+ <!-- <para></para> -->
</entry>
<entry>
<para>JSF API</para>
@@ -168,7 +168,7 @@
<para>provided</para>
</entry>
<entry align="center">
- <para></para>
+ <!-- <para></para> -->
</entry>
<entry>
<para>JSF Reference Implementation</para>
@@ -233,10 +233,10 @@
<title>RichFaces dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -317,10 +317,10 @@
<title>Seam Mail Dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -379,7 +379,7 @@
<para>compile only</para>
</entry>
<entry align="center">
- <para></para>
+ <!-- <para></para> -->
</entry>
<entry>
<para>Required for incoming mail support</para>
@@ -415,10 +415,10 @@
<title>Seam PDF Dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -515,10 +515,10 @@
<title>JBoss Rules Dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -580,8 +580,8 @@
<para>ear</para>
</entry>
<entry>
- <para></para>
- </entry>
+ <!-- <para></para> -->
+ </entry>
</row>
<row>
@@ -595,8 +595,8 @@
<para>ear</para>
</entry>
<entry>
- <para></para>
- </entry>
+ <!-- <para></para> -->
+ </entry>
</row>
<row>
@@ -609,9 +609,9 @@
<entry align="center">
<para>ear</para>
</entry>
- <entry>
- <para></para>
- </entry>
+ <entry>
+ <!-- <para></para> -->
+ </entry>
</row>
<row>
@@ -625,8 +625,8 @@
<para>ear</para>
</entry>
<entry>
- <para></para>
- </entry>
+ <!-- <para></para> -->
+ </entry>
</row>
</tbody>
@@ -642,10 +642,10 @@
<title>JBPM dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -677,8 +677,8 @@
<para>ear</para>
</entry>
<entry>
- <para></para>
- </entry>
+ <!-- <para></para> -->
+ </entry>
</row>
</tbody>
@@ -703,10 +703,10 @@
<title>GWT dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -763,10 +763,10 @@
<title>Spring Framework dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
+ <colspec colnum="4" colwidth="5*" /> -->
<thead>
<row>
@@ -823,11 +823,11 @@
<title>Groovy dependencies</title>
<tgroup cols="4">
- <colspec colnum="1" colwidth="4*" />
+ <!-- <colspec colnum="1" colwidth="4*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="3*" />
- <colspec colnum="4" colwidth="5*" />
-
+ <colspec colnum="4" colwidth="5*" /> -->
+
<thead>
<row>
<entry align="center">
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -146,7 +146,7 @@
<para>
The next 3 screens allow you to further customize your new project, but
- for us the defaults are fine. So just hit <empahsis>Next</empahsis>
+ for us the defaults are fine. So just hit <emphasis>Next</emphasis>
until you reach the final screen.
</para>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Groovy.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Groovy.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Groovy.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -137,7 +137,6 @@
}
}</programlisting>
- <para/>
</section>
</section>
@@ -205,7 +204,6 @@
</listitem>
</itemizedlist>
- <para/>
</section>
<section>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Hsearch.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Hsearch.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Hsearch.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -205,13 +205,12 @@
[...]
}]]></programlisting>
- <para></para>
- <caution>
+ <important>
<para>For people accustomed to Hibernate Search out of Seam, note that
using <methodname>Search.createFullTextSession</methodname> is not
necessary.</para>
- </caution>
+ </important>
<para>Check the DVDStore or the blog examples of the JBoss Seam
distribution for a concrete use of Hibernate Search.</para>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/I18n.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/I18n.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -71,8 +71,7 @@
</para>
<para>
- You can write your translation of labels
- (<xlink linkend="labels">Labels</xlink>) to your messages resource
+ You can write your translation of labels to your messages resource
bundle in the native encoding and then convert the content of the
file into the escaped format through the tool <literal>native2ascii</literal>
provided in the JDK. This tool will convert a file written in your
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Itext.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Itext.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Itext.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -23,8 +23,8 @@
<informaltable>
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
@@ -160,8 +160,8 @@
<informaltable>
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
@@ -594,8 +594,8 @@
<informaltable>
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
@@ -708,12 +708,12 @@
<informaltable>
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:chapter></literal>
</para>
@@ -721,7 +721,7 @@
<literal><p:section></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -784,12 +784,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:header></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -828,17 +828,17 @@
<informaltable>
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:list></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<!--
<para>
<emphasis>Description</emphasis>
@@ -899,12 +899,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:listItem></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -981,17 +981,17 @@
<informaltable>
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
- <entry valign="top">
- <para>
+ <entry valign="top">
+ <para>
<literal><p:table></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -1136,12 +1136,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:cell></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -1393,17 +1393,17 @@
<informaltable id="itext.barchart">
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:barchart></literal>
</para>
- </entry>
- <entry valign="top">
+ </entry>
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -1597,12 +1597,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:linechart></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -1796,12 +1796,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:piechart></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -1948,12 +1948,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:series></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -2023,12 +2023,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:data></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -2088,12 +2088,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:color></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -2137,12 +2137,12 @@
</entry>
</row>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:stroke></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -2212,17 +2212,17 @@
<informaltable id="itext.barcode">
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/> -->
+ <!-- <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:barCode></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
@@ -2330,17 +2330,17 @@
<informaltable id="itext.swing">
<tgroup cols="2">
- <colspec colnum="1" colwidth="1*"/>
- <colspec colnum="2" colwidth="3*"/>
+ <!-- <colspec colnum="1" colwidth="1*"/>
+ <colspec colnum="2" colwidth="3*"/> -->
<tbody>
<row>
- <entry valign="top">
+ <entry valign="top">
<para>
<literal><p:swing></literal>
</para>
</entry>
- <entry valign="top">
+ <entry valign="top">
<para>
<emphasis>Description</emphasis>
</para>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Migration.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Migration.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Migration.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -90,13 +90,13 @@
<para>The JSF RI doesn't require you to specify a listener.</para>
- <tip>
+ <note>
<para>
Due to an incompatibility between Seam and MyFaces, you had to
use client side state saving in Seam 1.2. Switching to the JSF RI
1.2 lifts this restriction.
</para>
- </tip>
+ </note>
</section>
@@ -273,7 +273,7 @@
<literal>SeamTest</literal> will automatically start the container.
</para>
- <tip>
+ <warning>
<para>
You must order the classpath correctly when using Embedded with
<literal>SeamTest</literal>. Make sure the jars in
@@ -281,7 +281,7 @@
For example, when using Ant, they should be declared above any
other libraries in the test classpath.
</para>
- </tip>
+ </warning>
<para>
If you want to run tests using the Eclipse TestNG plugin, you'll
@@ -310,14 +310,14 @@
<section id="migrating.general">
<title>Updating your code</title>
- <tip>
+ <important>
<para>
Don't forget to update the XSD's in <literal>pages.xml</literal> and
<literal>components.xml</literal> to point at the ones for Seam 2.
Just change the suffix from <literal>-1.2.xml</literal> to
<literal>-2.0.xml</literal>.
</para>
- </tip>
+ </important>
<section>
<title>Built-in Component changes</title>
@@ -397,12 +397,12 @@
<table>
<title>Component's in Seam 2</title>
<tgroup cols="2">
- <colspec colnum="1" colwidth="2*" />
+ <!-- <colspec colnum="1" colwidth="2*" />
<colspec colnum="2" colwidth="2*" />
<colspec colnum="3" colwidth="2*" />
<colspec colnum="4" colwidth="2*" />
<colspec colnum="5" colwidth="2*" />
- <colspec colnum="6" colwidth="2*" />
+ <colspec colnum="6" colwidth="2*" /> -->
<thead>
<row>
@@ -1260,12 +1260,12 @@
<programlisting role="XML"><![CDATA[<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />]]></programlisting>
- <tip>
+ <note>
<para>
You don't need to do this if you are just using jBPM for
pageflows.
</para>
- </tip>
+ </note>
</section>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Persistence.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Persistence.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Persistence.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -240,9 +240,8 @@
<literal>persistence:managed-persistence-context</literal>
component. If your managed persistence context is named <literal>entityManager</literal>, you can
opt to leave out the <literal>entity-manager</literal> attribute. (see
- <link linkend="persistence.seam-managed-persistence-contexts">Seam-managed persistence contexts</link>
- )
- </para>
+ <xref linkend="persistence.seam-managed-persistence-contexts"/>Seam-managed persistence contexts)
+ </para>
<programlisting role="XML"><![CDATA[<transaction:entity-transaction entity-manager="#{em}"/>]]></programlisting>
<para>
To configure Hibernate managed transactions declare the following in your components.xml where
@@ -251,8 +250,7 @@
<literal>persistence:managed-hibernate-session</literal>
component. If your managed hibernate session is named <literal>session</literal>, you can
opt to leave out the <literal>session</literal> attribute. (see
- <link linkend="persistence.seam-managed-persistence-contexts">Seam-managed persistence contexts</link>
- )
+ <xref linkend="persistence.seam-managed-persistence-contexts"/>Seam-managed persistence contexts)
</para>
<programlisting role="XML"><![CDATA[<transaction:hibernate-transaction session="#{hibernateSession}"/>]]></programlisting>
<para>
@@ -261,7 +259,7 @@
<programlisting role="XML"><![CDATA[<transaction:no-transaction />]]></programlisting>
<para>
For configuring Spring managed transactions see
- <link linkend="spring-transactions">using Spring PlatformTransactionManagement</link>
+ <xref linkend="spring-transactions"/>using Spring PlatformTransactionManagement.
.
</para>
</section>
@@ -485,7 +483,7 @@
vendor is Hibernate, and the most powerful delegate interface is
<literal>org.hibernate.Session</literal>. You'd be nuts to use anything else. Trust
me, I'm not biased at all. If you must use a different JPA provider see
- <link linkend="alt-jpa-providers">Using Alternate JPA Providers</link>.
+ <xref linkend="alt-jpa-providers"/>Using Alternate JPA Providers.
</para>
<para>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Revision_History.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Revision_History.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Revision_History.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -1,7 +1,9 @@
<?xml version='1.0'?>
<!DOCTYPE revhistory PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
-
+<appendix id="appe-Publican-Revision_History">
+ <title>Revision History</title>
+ <simpara>
<revhistory>
<revision>
@@ -20,4 +22,5 @@
</revdescription>
</revision>
</revhistory>
-
+</simpara>
+</appendix>
Added: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.ent
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.ent (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.ent 2008-09-11 15:14:27 UTC (rev 8984)
@@ -0,0 +1,3 @@
+<!ENTITY HOLDER "Red Hat, Inc">
+<!ENTITY YEAR "2008">
+<!ENTITY VERSION "4.3.0_CP02_FP01">
Added: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.xml (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ ]>
+
+<book>
+ <xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Tutorial.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Gettingstarted.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Getting_Started_With_JBoss_Tools.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Migration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Concepts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Xml.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Events.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Conversations.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Jbpm.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Persistence.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Groovy.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Framework.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Drools.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Security.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "I18n.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Text.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Itext.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Mail.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Jms.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Cache.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Webservices.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Remoting.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Spring.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Hsearch.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Configuration.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Annotations.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Components.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Controls.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Elenhancements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Testing.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Tools.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href= "Dependencies.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+<xi:include href="Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</book>
Property changes on: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Seam_Reference_Guide_CP02_FP01.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Security.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Security.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Security.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -528,8 +528,8 @@
<title>Security Message Keys</title>
<tgroup cols="2">
- <colspec colnum="1" colwidth="2*" />
- <colspec colnum="2" colwidth="3*" />
+ <!-- <colspec colnum="1" colwidth="2*" />
+ <colspec colnum="2" colwidth="3*" /> -->
<thead>
<row>
@@ -1393,8 +1393,8 @@
<title>Security Events</title>
<tgroup cols="2">
- <colspec colnum="1" colwidth="3*" />
- <colspec colnum="2" colwidth="2*" />
+ <!-- <colspec colnum="1" colwidth="3*" />
+ <colspec colnum="2" colwidth="2*" /> -->
<thead>
<row>
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Spring.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Spring.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Spring.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -106,7 +106,7 @@
<para> This example shows one way to use a Seam-managed persistence context from a Spring bean. (For a more robust
way to use Seam-managed persistence contexts as a replacement for the Spring
<literal>OpenEntityManagerInView</literal> filter see section on
- <link linkend="spring-persistence">Using a Seam Managed Persistence Context in Spring</link>)</para>
+ <xref linkend="spring-persistence"/>Using a Seam Managed Persistence Context in Spring)</para>
</section>
<section>
@@ -230,7 +230,7 @@
transaction management exposes support for many advanced features such as nested
transactions and supports full Java EE transaction propagation rules like REQUIRES_NEW and NOT_SUPPORTED. For more
information see the spring documentation
- <ulink url="http://static.springframework.org/spring/docs/2.0.x/reference/transaction...">here</ulink>.</para>
+ <ulink url="http://static.springframework.org/spring/docs/2.0.x/reference/transaction...">here.</ulink></para>
<para>To configure Seam to use Spring transactions enable the SpringTransaction component like so:</para>
@@ -330,7 +330,7 @@
<title>Using a Seam Managed Hibernate Session in Spring</title>
<para>The Seam Spring integration also provides support for complete access to a Seam managed Hibernate session
- using spring's tools. This integration is very similar to the <link linkend="spring-persistence">JPA integration</link>.</para>
+ using spring's tools. This integration is very similar to the <xref linkend="spring-persistence"/>JPA integration.</para>
<para>Like Spring's JPA integration spring's propagation model allows only one open EntityManager per
EntityManagerFactory per transaction??? to be available to spring tools. So, the Seam Session integration works
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Tutorial.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2008-09-11 15:12:07 UTC (rev 8983)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Tutorial.xml 2008-09-11 15:14:27 UTC (rev 8984)
@@ -59,7 +59,7 @@
First, make sure you have Ant correctly installed, with <literal>$ANT_HOME</literal> and
<literal>$JAVA_HOME</literal> set correctly. Next, make sure you set the location of your Tomcat
6.0 installation in the <literal>build.properties</literal> file in the root folder of your Seam
- installation. You will need to follow the instructions in <xref linkend="config.install.embedded"/>
+ installation. You will need to follow the instructions in embedded installation configuration section of this book
for installing JBoss Embedded on Tomcat 6.0. JBoss Embedded is required to run the Seam demo
applications on Tomcat. (However, it is possible to use Seam on Tomcat without JBoss Embedded.)
</para>
@@ -143,18 +143,8 @@
<!-- Can't use code hightlighting with callouts -->
<example>
<title></title>
- <programlistingco>
- <areaspec>
-
- <area id="registration-name-annotation" coords="2"/>
- <area id="registration-scope-annotation" coords="3"/>
- <area id="registration-table-annotation" coords="4"/>
- <area id="registration-attributes" coords="9"/>
- <area id="registration-empty-constructor" coords="20"/>
- <area id="registration-notnull" coords="22"/>
- <area id="registration-id-annotation" coords="44"/>
- </areaspec>
- <programlisting role="JAVA"><![CDATA[@Entity <co id="registration-entity-annotation"/>
+ <programlisting role="JAVA">
+@Entity <co id="registration-entity-annotation"/>
@Name("user")
@Scope(SESSION)
@Table(name="users")
@@ -208,59 +198,47 @@
this.username = username;
}
-}]]></programlisting>
- <calloutlist>
- <callout arearefs="registration-entity-annotation">
+}</programlisting>
+
<para> The EJB3 standard <literal>@Entity</literal> annotation indicates that the
<literal>User</literal> class is an entity bean. </para>
- </callout>
- <callout arearefs="registration-name-annotation">
+
<para> A Seam component needs a <emphasis>component name</emphasis> specified by the
- <link linkend="name-annotation">
<literal>@Name</literal>
- </link> annotation. This name must be unique within the Seam application. When JSF
+ annotation. This name must be unique within the Seam application. When JSF
asks Seam to resolve a context variable with a name that is the same as a Seam
component name, and the context variable is currently undefined (null), Seam will
instantiate that component, and bind the new instance to the context variable. In
this case, Seam will instantiate a <literal>User</literal> the first time JSF
encounters a variable named <literal>user</literal>. </para>
- </callout>
- <callout arearefs="registration-scope-annotation">
+
<para> Whenever Seam instantiates a component, it binds the new instance to a context
variable in the component's <emphasis>default context</emphasis>. The default
- context is specified using the <link linkend="scope-annotation">
+ context is specified using the
<literal>@Scope</literal>
- </link> annotation. The <literal>User</literal> bean is a session scoped component.
+ annotation. The <literal>User</literal> bean is a session scoped component.
</para>
- </callout>
- <callout arearefs="registration-table-annotation">
+
<para> The EJB standard <literal>@Table</literal> annotation indicates that the
<literal>User</literal> class is mapped to the <literal>users</literal> table.
</para>
- </callout>
- <callout arearefs="registration-attributes">
+
<para>
<literal>name</literal>, <literal>password</literal> and <literal>username</literal>
are the persistent attributes of the entity bean. All of our persistent attributes
define accessor methods. These are needed when this component is used by JSF in the
render response and update model values phases. </para>
- </callout>
- <callout arearefs="registration-empty-constructor">
+
<para> An empty constructor is both required by both the EJB specification and by Seam.
</para>
- </callout>
- <callout arearefs="registration-notnull">
+
<para> The <literal>@NotNull</literal> and <literal>@Length</literal> annotations are
part of the Hibernate Validator framework. Seam integrates Hibernate Validator and
lets you use it for data validation (even if you are not using Hibernate for
persistence). </para>
- </callout>
- <callout arearefs="registration-id-annotation">
+
<para> The EJB standard <literal>@Id</literal> annotation indicates the primary key
attribute of the entity bean. </para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
<para> The most important things to notice in this example are the <literal>@Name</literal> and
<literal>@Scope</literal> annotations. These annotations establish that this class is a Seam component. </para>
@@ -287,19 +265,9 @@
<!-- Can't use code hightlighting with callouts -->
<example>
<title></title>
- <programlistingco>
- <areaspec>
- <area id="registration-stateless-annotation" coords="1"/>
- <area id="registration-in-annotation" coords="6"/>
- <area id="registration-persistencecontext-annotation" coords="9"/>
- <area id="registration-logger-annotation" coords="12"/>
- <area id="registration-action-listener" coords="15"/>
- <area id="registration-query" coords="18"/>
- <area id="registration-log" coords="24"/>
- <area id="registration-outcome" coords="25"/>
- <area id="registration-builtin" coords="29"/>
- </areaspec>
- <programlisting><![CDATA[@Stateless
+
+ <programlisting>
+@Stateless
@Name("register")
public class RegisterAction implements Register
{
@@ -332,45 +300,37 @@
}
}
-}]]></programlisting>
+}</programlisting>
- <calloutlist>
- <callout arearefs="registration-stateless-annotation">
+
<para> The EJB standard <literal>@Stateless</literal> annotation marks this class as
a stateless session bean. </para>
- </callout>
- <callout arearefs="registration-in-annotation">
- <para> The <link linkend="in-annotation">
+
+ <para> The
<literal>@In</literal>
- </link> annotation marks an attribute of the bean as injected by Seam. In this case,
+ annotation marks an attribute of the bean as injected by Seam. In this case,
the attribute is injected from a context variable named <literal>user</literal> (the
instance variable name). </para>
- </callout>
- <callout arearefs="registration-persistencecontext-annotation">
+
<para> The EJB standard <literal>@PersistenceContext</literal> annotation is used to
inject the EJB3 entity manager. </para>
- </callout>
- <callout arearefs="registration-logger-annotation">
+
<para> The Seam <literal>@Logger</literal> annotation is used to inject the component's
<literal>Log</literal> instance. </para>
- </callout>
- <callout arearefs="registration-action-listener">
+
<para> The action listener method uses the standard EJB3
<literal>EntityManager</literal> API to interact with the database, and returns the
JSF outcome. Note that, since this is a session bean, a transaction is automatically
begun when the <literal>register()</literal> method is called, and committed when it
completes. </para>
- </callout>
- <callout arearefs="registration-query">
+
<para> Notice that Seam lets you use a JSF EL expression inside EJB-QL. Under the
covers, this results in an ordinary JPA <literal>setParameter()</literal> call on
the standard JPA <literal>Query</literal> object. Nice, huh? </para>
- </callout>
- <callout arearefs="registration-log">
+
<para> The <literal>Log</literal> API lets us easily display templated log messages.
</para>
- </callout>
- <callout arearefs="registration-outcome">
+
<para> JSF action listener methods return a string-valued outcome that determines what
page will be displayed next. A null outcome (or a void action listener method)
redisplays the previous page. In plain JSF, it is normal to always use a JSF
@@ -381,16 +341,12 @@
that when you use a view id as an outcome, Seam always performs a browser
redirect.</emphasis>
</para>
- </callout>
- <callout arearefs="registration-builtin">
+
<para> Seam provides a number of <emphasis>built-in components</emphasis> to help solve
common problems. The <literal>FacesMessages</literal> component makes it easy to
display templated error or success messages. Built-in Seam components may be
obtained by injection, or by calling an <literal>instance()</literal> method.
</para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
<para> Note that we did not explicitly specify a <literal>@Scope</literal> this time. Each Seam
@@ -418,11 +374,12 @@
<para>Naturally, our session bean needs a local interface.</para>
<example><title></title>
- <programlisting role="JAVA"><![CDATA[@Local
+ <programlisting role="JAVA">
+@Local
public interface Register
{
public String register();
-}]]></programlisting></example>
+}</programlisting></example>
<para> That's the end of the Java code. Now onto the deployment descriptors. </para>
@@ -446,17 +403,18 @@
Seam how to find our EJB components in JNDI: </para>
<example>
<title></title>
- <programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<components xmlns="http://jboss.com/products/seam/components"
+ <programlisting role="XML">
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
- http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
- <core:init jndi-pattern="@jndiPattern@"/>
+ <core:init jndi-pattern="@jndiPattern@"/>
-</components>]]></programlisting></example>
+</components> </programlisting></example>
<para> This code configures a property named <literal>jndiPattern</literal> of a built-in Seam component
named <literal>org.jboss.seam.core.init</literal>. The funny <literal>@</literal> symbols are
@@ -470,46 +428,47 @@
<para> The presentation layer for our mini-application will be deployed in a WAR. So we'll need a web
deployment descriptor. </para>
<example><title></title>
- <programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<web-app version="2.5"
+ <programlisting role="XML">
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Seam -->
- <listener>
- <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
- </listener>
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
<!-- JSF -->
- <listener>
- <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
- </listener>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
- </context-param>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.seam</url-pattern>
- </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
- <session-config>
- <session-timeout>10</session-timeout>
- </session-config>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
-</web-app>]]></programlisting></example>
+</web-app></programlisting></example>
<para> This <literal>web.xml</literal> file configures Seam and JSF. The configuration you see here is
@@ -526,18 +485,19 @@
<example>
<title></title>
- <programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="1.2"
+ <programlisting role="XML">
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<!-- Facelets support -->
- <application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- </application>
+ <application>
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ </application>
-</faces-config>]]></programlisting>
+</faces-config></programlisting>
</example>
@@ -561,26 +521,27 @@
<para> The <literal>ejb-jar.xml</literal> file integrates Seam with EJB3, by attaching the
<literal>SeamInterceptor</literal> to all session beans in the archive. </para>
- <programlisting role="XML"><![CDATA[<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ <programlisting role="XML">
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
- version="3.0">
+ version="3.0">
- <interceptors>
- <interceptor>
- <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor>
- </interceptors>
+<interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor>
+</interceptors>
- <assembly-descriptor>
- <interceptor-binding>
- <ejb-name>*</ejb-name>
- <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
- </interceptor-binding>
- </assembly-descriptor>
+<assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
+ </interceptor-binding>
+</assembly-descriptor>
-</ejb-jar>]]></programlisting>
+</ejb-jar></programlisting>
</section>
@@ -591,22 +552,23 @@
datasource, and contains some vendor-specific settings. In this case, enables automatic schema
export at startup time. </para>
- <programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ <programlisting role="XML">
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
- version="1.0">
+ version="1.0">
- <persistence-unit name="userDatabase">
- <provider>org.hibernate.ejb.HibernatePersistence</provider>
- <jta-data-source>java:/DefaultDS</jta-data-source>
- <properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- </properties>
- </persistence-unit>
+<persistence-unit name="userDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop">
+ </properties>
+</persistence-unit>
-</persistence>]]></programlisting>
+</persistence></programlisting>
</section>
@@ -618,34 +580,35 @@
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
+ <programlisting role="XHTML">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core">
+ xmlns:f="http://java.sun.com/jsf/core">
- <head>
- <title>Register New User</title>
- </head>
- <body>
- <f:view>
- <h:form>
- <s:validateAll>
- <h:panelGrid columns="2">
- Username: <h:inputText value="#{user.username}" required="true"/>
- Real Name: <h:inputText value="#{user.name}" required="true"/>
- Password: <h:inputSecret value="#{user.password}" required="true"/>
- </h:panelGrid>
- </s:validateAll>
- <h:messages/>
- <h:commandButton value="Register" action="#{register.register}"/>
- </h:form>
- </f:view>
- </body>
+<head>
+ <title>Register New User</title>
+</head>
+<body>
+ <f:view>
+ <h:form>
+ <s:validateAll>
+ <h:panelGrid columns="2">
+ Username: <h:inputText value="#{user.username}" required="true"/>
+ Real Name: <h:inputText value="#{user.name}" required="true"/>
+ Password: <h:inputSecret value="#{user.password}" required="true"/>
+ </h:panelGrid>
+ </s:validateAll>
+ <h:messages/>
+ <h:commandButton value="Register" action="#{register.register}"/>
+ </h:form>
+ </f:view>
+</body>
-</html>]]></programlisting></example>
+</html></programlisting></example>
<para> The only thing here that is specific to Seam is the
@@ -654,23 +617,21 @@
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core">
+ <programlisting role="XHTML">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"xmlns:f="http://java.sun.com/jsf/core">
- <head>
- <title>Successfully Registered New User</title>
- </head>
- <body>
- <f:view>
- Welcome, #{user.name}, you are successfully registered as #{user.username}.
- </f:view>
- </body>
+<head>
+<title>Successfully Registered New User</title>
+</head>
+<body>
+ <f:view>
+ Welcome, #{user.name}, you are successfully registered as #{user.username}.
+ </f:view>
+</body>
-</html>
-]]></programlisting>
+ </html></programlisting>
</example>
@@ -685,32 +646,33 @@
<para> Finally, since our application is deployed as an EAR, we need a deployment descriptor there, too. </para>
<example id="registration-application-xml"><title>registration application</title>
- <programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<application xmlns="http://java.sun.com/xml/ns/javaee"
+ <programlisting role="XML">
+<?xml version="1.0" encoding="UTF-8"?>
+<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_5.xsd"
- version="5">
+ version="5">
- <display-name>Seam Registration</display-name>
+<display-name>Seam Registration</display-name>
- <module>
- <web>
- <web-uri>jboss-seam-registration.war</web-uri>
- <context-root>/seam-registration</context-root>
- </web>
- </module>
- <module>
- <ejb>jboss-seam-registration.jar</ejb>
- </module>
- <module>
- <ejb>jboss-seam.jar</ejb>
- </module>
- <module>
- <java>jboss-el.jar</java>
- </module>
+<module>
+ <web>
+ <web-uri>jboss-seam-registration.war</web-uri>
+ <context-root>/seam-registration</context-root>
+ </web>
+</module>
+<module>
+ <ejb>jboss-seam-registration.jar</ejb>
+</module>
+<module>
+ <ejb>jboss-seam.jar</ejb>
+</module>
+<module>
+ <java>jboss-el.jar</java>
+</module>
-</application>]]></programlisting>
+ </application></programlisting>
</example>
<para> This deployment descriptor links modules in the enterprise archive and binds the web application
@@ -780,7 +742,8 @@
<example>
<title></title>
- <programlisting role="JAVA"><![CDATA[@Entity
+ <programlisting role="JAVA">
+@Entity
@Name("message")
@Scope(EVENT)
public class Message implements Serializable
@@ -832,7 +795,7 @@
this.datetime = datetime;
}
-}]]></programlisting>
+}</programlisting>
</example>
</section>
@@ -856,25 +819,15 @@
<!-- Can't use code hightlighting with callouts -->
<example>
<title></title>
- <programlistingco>
- <areaspec>
- <area id="messages-datamodel" coords="7"/>
- <area id="messages-datamodelselection" coords="10"/>
- <area id="messages-out" coords="11"/>
- <area id="messages-persistencecontext" coords="14"/>
- <area id="messages-factory" coords="17"/>
- <area id="messages-select" coords="24"/>
- <area id="messages-delete" coords="29"/>
- <area id="messages-remove" coords="36"/>
- </areaspec>
- <programlisting><![CDATA[@Stateful
+ <programlisting>
+@Stateful
@Scope(SESSION)
@Name("messageManager")
public class MessageManagerBean implements Serializable, MessageManager
{
@DataModel
- private List<Message> messageList;
+ private List<Message> messageList;
@DataModelSelection
@Out(required=false)
@@ -905,57 +858,46 @@
@Remove
public void destroy() {}
-}]]></programlisting>
- <calloutlist>
- <callout arearefs="messages-datamodel">
+}</programlisting>
+
<para> The <literal>@DataModel</literal> annotation exposes an attibute of type
<literal>java.util.List</literal> to the JSF page as an instance of
<literal>javax.faces.model.DataModel</literal>. This allows us to use the list
in a JSF <literal><h:dataTable></literal> with clickable links for
each row. In this case, the <literal>DataModel</literal> is made available in a
session context variable named <literal>messageList</literal>. </para>
- </callout>
- <callout arearefs="messages-datamodelselection">
+
<para> The <literal>@DataModelSelection</literal> annotation tells Seam to inject the
<literal>List</literal> element that corresponded to the clicked link. </para>
- </callout>
- <callout arearefs="messages-out">
+
<para> The <literal>@Out</literal> annotation then exposes the selected value directly
to the page. So ever time a row of the clickable list is selected, the
<literal>Message</literal> is injected to the attribute of the stateful bean,
and the subsequently <emphasis>outjected</emphasis> to the event context variable
named <literal>message</literal>. </para>
- </callout>
- <callout arearefs="messages-persistencecontext">
+
<para> This stateful bean has an EJB3 <emphasis>extended persistence context</emphasis>.
The messages retrieved in the query remain in the managed state as long as the bean
exists, so any subsequent method calls to the stateful bean can update them without
needing to make any explicit call to the <literal>EntityManager</literal>. </para>
- </callout>
- <callout arearefs="messages-factory">
+
<para> The first time we navigate to the JSP page, there will be no value in the
<literal>messageList</literal> context variable. The <literal>@Factory</literal>
annotation tells Seam to create an instance of <literal>MessageManagerBean</literal>
and invoke the <literal>findMessages()</literal> method to initialize the value. We
call <literal>findMessages()</literal> a <emphasis>factory method</emphasis> for
<literal>messages</literal>. </para>
- </callout>
- <callout arearefs="messages-select">
+
<para> The <literal>select()</literal> action listener method marks the selected
<literal>Message</literal> as read, and updates it in the database. </para>
- </callout>
- <callout arearefs="messages-delete">
+
<para> The <literal>delete()</literal> action listener method removes the selected
<literal>Message</literal> from the database. </para>
- </callout>
- <callout arearefs="messages-remove">
+
<para> All stateful session bean Seam components <emphasis>must</emphasis> have a method
with no parameters marked <literal>@Remove</literal> that Seam uses to remove
the stateful bean when the Seam context ends, and clean up any server-side state.
</para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
<para> Note that this is a session-scoped Seam component. It is associated with the user login session,
@@ -969,14 +911,15 @@
<para> All session beans have a business interface, of course. </para>
- <programlisting role="JAVA"><![CDATA[@Local
+ <programlisting role="JAVA">
+@Local
public interface MessageManager
{
public void findMessages();
public void select();
public void delete();
public void destroy();
-}]]></programlisting>
+}</programlisting>
<para> From now on, we won't show local interfaces in our code examples. </para>
@@ -994,50 +937,51 @@
component. Again, nothing specific to Seam. </para>
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<html>
- <head>
- <title>Messages</title>
- </head>
- <body>
- <f:view>
- <h:form>
- <h2>Message List</h2>
- <h:outputText value="No messages to display"
- rendered="#{messageList.rowCount==0}"/>
- <h:dataTable var="msg" value="#{messageList}"
- rendered="#{messageList.rowCount>0}">
- <h:column>
- <f:facet name="header">
- <h:outputText value="Read"/>
- </f:facet>
- <h:selectBooleanCheckbox value="#{msg.read}" disabled="true"/>
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Title"/>
- </f:facet>
- <h:commandLink value="#{msg.title}" action="#{messageManager.select}"/>
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Date/Time"/>
- </f:facet>
- <h:outputText value="#{msg.datetime}">
- <f:convertDateTime type="both" dateStyle="medium" timeStyle="short"/>
- </h:outputText>
- </h:column>
- <h:column>
- <h:commandButton value="Delete" action="#{messageManager.delete}"/>
- </h:column>
- </h:dataTable>
- <h3><h:outputText value="#{message.title}"/></h3>
- <div><h:outputText value="#{message.text}"/></div>
- </h:form>
- </f:view>
- </body>
-</html>]]></programlisting>
+ <programlisting role="XHTML">
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<html>
+ <head>
+ <title>Messages</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h2>Message List</h2>
+ <h:outputText value="No messages to display"
+ rendered="#{messageList.rowCount==0}"/>
+ <h:dataTable var="msg" value="#{messageList}"
+ rendered="#{messageList.rowCount>0}">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Read"/>
+ </f:facet>
+ <h:selectBooleanCheckbox value="#{msg.read}" disabled="true"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Title"/>
+ </f:facet>
+ <h:commandLink value="#{msg.title}" action="#{messageManager.select}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Date/Time"/>
+ </f:facet>
+ <h:outputText value="#{msg.datetime}">
+ <f:convertDateTime type="both" dateStyle="medium" timeStyle="short"/>
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <h:commandButton value="Delete" action="#{messageManager.delete}"/>
+ </h:column>
+ </h:dataTable>
+ <h3><h:outputTex> value="#{message.title}"/></h3>
+ <div><h:outputText value="#{message.text}"/></div>
+ </h:form>
+ </f:view>
+ </body>
+</html></programlisting>
</example>
@@ -1103,60 +1047,45 @@
<!-- Can't use code hightlighting with callouts -->
<example>
<title></title>
- <programlistingco>
- <areaspec>
- <area id="todo-startstate" coords="3"/>
- <area id="todo-tasknode" coords="7"/>
- <area id="todo-task" coords="8"/>
- <area id="todo-assignment" coords="9"/>
- <area id="todo-endstate" coords="14"/>
- </areaspec>
- <programlisting><![CDATA[<process-definition name="todo">
+ <programlisting>
+<process-definition name="todo">
- <start-state name="start">
- <transition to="todo"/>
- </start-state>
+<start-state name="start">
+<transition to="todo"/>
+</start-state>
- <task-node name="todo">
- <task name="todo" description="#{todoList.description}">
- <assignment actor-id="#{actor.id}"/>
- </task>
- <transition to="done"/>
- </task-node>
+<task-node name="todo">
+<task name="todo" description="#{todoList.description}">
+<assignment actor-id="#{actor.id}"/>
+</task>
+<transition to="done"/>
+</task-node>
- <end-state name="done"/>
+<end-state name="done"/>
-</process-definition>]]></programlisting>
- <calloutlist>
- <callout arearefs="todo-startstate">
+</process-definition></programlisting>
+
<para> The <literal><start-state></literal> node represents the logical start
of the process. When the process starts, it immediately transitions to the
<literal>todo</literal> node. </para>
- </callout>
- <callout arearefs="todo-tasknode">
+
<para> The <literal><task-node></literal> node represents a <emphasis>wait
state</emphasis>, where business process execution pauses, waiting for one or more
tasks to be performed. </para>
- </callout>
- <callout arearefs="todo-task">
+
<para> The <literal><task></literal> element defines a task to be performed by
a user. Since there is only one task defined on this node, when it is complete,
execution resumes, and we transition to the end state. The task gets its description
from a Seam component named <literal>todoList</literal> (one of the JavaBeans). </para>
- </callout>
- <callout arearefs="todo-assignment">
+
<para> Tasks need to be assigned to a user or group of users when they are created. In this
case, the task is assigned to the current user, which we get from a built-in Seam
component named <literal>actor</literal>. Any Seam component may be used to perform task
assignment. </para>
- </callout>
- <callout arearefs="todo-endstate">
+
<para> The <literal><end-state></literal> node defines the logical end of the
business process. When execution reaches this node, the process instance is destroyed.
</para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
@@ -1181,7 +1110,8 @@
would also need to authenticate the user.) </para>
<example>
<title></title>
- <programlisting role="JAVA"><![CDATA[@Name("login")
+ <programlisting role="JAVA">
+@Name("login")
public class Login {
@In
@@ -1202,7 +1132,7 @@
actor.setId(user);
return "/todo.jsp";
}
-}]]></programlisting>
+}</programlisting>
</example>
@@ -1211,24 +1141,25 @@
<para> The JSP itself is trivial: </para>
- <programlisting role="XHTML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
-<html>
-<head>
-<title>Login</title>
-</head>
-<body>
-<h1>Login</h1>
-<f:view>
- <h:form>
- <div>
- <h:inputText value="#{login.user}"/>
- <h:commandButton value="Login" action="#{login.login}"/>
- </div>
- </h:form>
-</f:view>
-</body>
-</html>]]></programlisting>
+ <programlisting role="XHTML">
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title>Login</title>
+ </head>
+ <body>
+ <h1>Login</h1>
+ <f:view>
+ <h:form>
+ <div>
+ <h:inputText value="#{login.user}"/>
+ <h:commandButton value="Login" action="#{login.login}"/>
+ </div>
+ </h:form>
+ </f:view>
+ </body>
+</html></programlisting>
@@ -1237,13 +1168,8 @@
<!-- Can't use code hightlighting with callouts -->
<example>
<title></title>
- <programlistingco>
- <areaspec>
- <area id="todo-description" coords="6"/>
- <area id="todo-createprocess-annotation" coords="15"/>
- <area id="todo-task-annotations" coords="18"/>
- </areaspec>
- <programlisting><![CDATA[@Name("todoList")
+ <programlisting>
+@Name("todoList")
public class TodoList {
private String description;
@@ -1263,23 +1189,17 @@
@StartTask @EndTask
public void done() {}
-}]]></programlisting>
- <calloutlist>
- <callout arearefs="todo-description">
+}</programlisting>
+
<para> The description property accepts user input form the JSP page, and exposes it to the
process definition, allowing the task description to be set. </para>
- </callout>
- <callout arearefs="todo-createprocess-annotation">
+
<para> The Seam <literal>@CreateProcess</literal> annotation creates a new jBPM process
instance for the named process definition. </para>
- </callout>
- <callout arearefs="todo-task-annotations">
+
<para> The Seam <literal>@StartTask</literal> annotation starts work on a task. The
<literal>@EndTask</literal> ends the task, and allows the business process execution
to resume. </para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
@@ -1290,71 +1210,72 @@
<para> Finally, the meat of the application is in <literal>todo.jsp</literal>: </para>
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
-<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
-<%@ taglib uri="http://jboss.com/products/seam/taglib" prefix="s" %>
-<html>
-<head>
-<title>Todo List</title>
-</head>
-<body>
-<h1>Todo List</h1>
-<f:view>
- <h:form id="list">
- <div>
- <h:outputText value="There are no todo items."
- rendered="#{empty taskInstanceList}"/>
- <h:dataTable value="#{taskInstanceList}" var="task"
- rendered="#{not empty taskInstanceList}">
- <h:column>
- <f:facet name="header">
- <h:outputText value="Description"/>
- </f:facet>
- <h:inputText value="#{task.description}"/>
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Created"/>
- </f:facet>
- <h:outputText value="#{task.taskMgmtInstance.processInstance.start}">
- <f:convertDateTime type="date"/>
- </h:outputText>
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Priority"/>
- </f:facet>
- <h:inputText value="#{task.priority}" style="width: 30"/>
- </h:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="Due Date"/>
- </f:facet>
- <h:inputText value="#{task.dueDate}" style="width: 100">
- <f:convertDateTime type="date" dateStyle="short"/>
- </h:inputText>
- </h:column>
- <h:column>
- <s:button value="Done" action="#{todoList.done}" taskInstance="#{task}"/>
- </h:column>
- </h:dataTable>
- </div>
- <div>
- <h:messages/>
- </div>
- <div>
- <h:commandButton value="Update Items" action="update"/>
- </div>
- </h:form>
- <h:form id="new">
- <div>
- <h:inputText value="#{todoList.description}"/>
- <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/>
- </div>
- </h:form>
-</f:view>
-</body>
-</html>]]></programlisting>
+ <programlisting role="XHTML">
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib uri="http://jboss.com/products/seam/taglib" prefix="s" %>
+<html>
+ <head>
+ <title>Todo List</title>
+ </head>
+ <body>
+ <h1>Todo List</h1>
+ <f:view>
+ <h:form id="list">
+ <div>
+ <h:outputText value="There are no todo items."
+ rendered="#{empty taskInstanceList}"/>
+ <h:dataTable value="#{taskInstanceList}" var="task"
+ rendered="#{not empty taskInstanceList}">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Description"/>
+ </f:facet>
+ <h:inputText value="#{task.description}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Created"/>
+ </f:facet>
+ <h:outputText value="#{task.taskMgmtInstance.processInstance.start}">
+ <f:convertDateTime type="date"/>
+ </h:outputText>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Priority"/>
+ </f:facet>
+ <h:inputText value="#{task.priority}" style="width: 30"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="Due Date"/>
+ </f:facet>
+ <h:inputText value="#{task.dueDate}" style="width: 100">
+ <f:convertDateTime type="date" dateStyle="short"/>
+ </h:inputText>
+ </h:column>
+ <h:column>
+ <s:button value="Done" action="#{todoList.done}" taskInstance="#{task}"/>
+ </h:column>
+ </h:dataTable>
+ </div>
+ <div>
+ <h:messages/>
+ </div>
+ <div>
+ <h:commandButton value="Update Items" action="update"/>
+ </div>
+ </h:form>
+ <h:form id="new">
+ <div>
+ <h:inputText value="#{todoList.description}"/>
+ <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/>
+ </div>
+ </h:form>
+ </f:view>
+ </body>
+</html></programlisting>
</example>
@@ -1364,57 +1285,60 @@
<literal>taskInstanceList</literal>. The list is defined inside a JSF form. </para>
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<h:form id="list">
- <div>
- <h:outputText value="There are no todo items." rendered="#{empty taskInstanceList}"/>
- <h:dataTable value="#{taskInstanceList}" var="task"
- rendered="#{not empty taskInstanceList}">
+ <programlisting role="XHTML">
+<h:form id="list">
+<div>
+ <h:outputText value="There are no todo items." rendered="#{empty taskInstanceList}"/>
+ <h:dataTable value="#{taskInstanceList}" var="task"
+ rendered="#{not empty taskInstanceList}">
...
- </h:dataTable>
- </div>
-</h:form>]]></programlisting>
+ </h:dataTable>
+</div>
+</h:form></programlisting>
</example>
<para> Each element of the list is an instance of the jBPM class <literal>TaskInstance</literal>. The
following code simply displays the interesting properties of each task in the list. For the description,
priority and due date, we use input controls, to allow the user to update these values. </para>
- <programlisting role="XHTML"><![CDATA[<h:column>
- <f:facet name="header">
- <h:outputText value="Description"/>
- </f:facet>
- <h:inputText value="#{task.description}"/>
-</h:column>
-<h:column>
- <f:facet name="header">
- <h:outputText value="Created"/>
- </f:facet>
- <h:outputText value="#{task.taskMgmtInstance.processInstance.start}">
- <f:convertDateTime type="date"/>
- </h:outputText>
-</h:column>
-<h:column>
- <f:facet name="header">
- <h:outputText value="Priority"/>
- </f:facet>
- <h:inputText value="#{task.priority}" style="width: 30"/>
-</h:column>
-<h:column>
- <f:facet name="header">
- <h:outputText value="Due Date"/>
- </f:facet>
- <h:inputText value="#{task.dueDate}" style="width: 100">
- <f:convertDateTime type="date" dateStyle="short"/>
- </h:inputText>
-</h:column>]]></programlisting>
+ <programlisting role="XHTML">
+<h:column>
+ <f:facet name="header">
+ <h:outputText value="Description"/>
+ </f:facet>
+ <h:inputText value="#{task.description}"/>
+</h:column>
+<h:column>
+ <f:facet name="header">
+ <h:outputText value="Created"/>
+ </f:facet>
+ <h:outputText value="#{task.taskMgmtInstance.processInstance.start}">
+ <f:convertDateTime type="date"/>
+ </h:outputText>
+</h:column>
+<h:column>
+ <f:facet name="header">
+ <h:outputText value="Priority"/>
+ </f:facet>
+ <h:inputText value="#{task.priority}" style="width: 30"/>
+</h:column>
+<h:column>
+ <f:facet name="header">
+ <h:outputText value="Due Date"/>
+ </f:facet>
+ <h:inputText value="#{task.dueDate}" style="width: 100">
+ <f:convertDateTime type="date" dateStyle="short"/>
+ </h:inputText>
+</h:column></programlisting>
<para> This button ends the task by calling the action method annotated <literal>@StartTask
@EndTask</literal>. It passes the task id to Seam as a request parameter: </para>
- <programlisting role="XHTML"><![CDATA[<h:column>
- <s:button value="Done" action="#{todoList.done}" taskInstance="#{task}"/>
-</h:column>]]></programlisting>
+ <programlisting role="XHTML">
+<h:column>
+ <s:button value="Done" action="#{todoList.done}" taskInstance="#{task}"/>
+</h:column></programlisting>
<para> (Note that this is using a Seam <literal><s:button></literal> JSF control from the
<literal>seam-ui.jar</literal> package.) </para>
@@ -1422,17 +1346,20 @@
<para> This button is used to update the properties of the tasks. When the form is submitted, Seam and jBPM
will make any changes to the tasks persistent. There is no need for any action listener method: </para>
- <programlisting role="XHTML"><![CDATA[<h:commandButton value="Update Items" action="update"/>]]></programlisting>
+ <programlisting role="XHTML">
+<h:commandButton value="Update Items" action="update"/>
+ </programlisting>
<para> A second form on the page is used to create new items, by calling the action method annotated
<literal>@CreateProcess</literal>. </para>
- <programlisting role="XHTML"><![CDATA[<h:form id="new">
- <div>
- <h:inputText value="#{todoList.description}"/>
- <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/>
- </div>
-</h:form>]]></programlisting>
+ <programlisting role="XHTML">
+<h:form id="new">
+ <div>
+ <h:inputText value="#{todoList.description}"/>
+ <h:commandButton value="Create New Item" action="#{todoList.createTodo}"/>
+ </div>
+</h:form></programlisting>
<para> There are several other files needed for the example, but they are just standard jBPM and Seam
configuration and not very interesting. </para>
@@ -1473,80 +1400,67 @@
<!-- Can't use code hightlighting with callouts -->
<example>
<title></title>
- <programlistingco>
- <areaspec>
- <area id="numberguess-page" coords="8"/>
- <area id="numberguess-transition" coords="10"/>
- <area id="numberguess-action" coords="11"/>
- <area id="numberguess-decision" coords="16"/>
- </areaspec>
- <programlisting><![CDATA[<pageflow-definition
+ <programlisting>
+<pageflow-definition
xmlns="http://jboss.com/products/seam/pageflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pageflow
http://jboss.com/products/seam/pageflow-2.1.xsd"
- name="numberGuess">
+ name="numberGuess">
- <start-page name="displayGuess" view-id="/numberGuess.jspx">
- <redirect/>
- <transition name="guess" to="evaluateGuess">
- <action expression="#{numberGuess.guess}"/>
- </transition>
- <transition name="giveup" to="giveup"/>
- </start-page>
+<start-page name="displayGuess" view-id="/numberGuess.jspx">
+ <redirect/>
+ <transition name="guess" to="evaluateGuess">
+ <action expression="#{numberGuess.guess}"/>
+ </transition>
+ <transition name="giveup" to="giveup"/>
+ </start-page>
- <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
- <transition name="true" to="win"/>
- <transition name="false" to="evaluateRemainingGuesses"/>
- </decision>
+ <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
+ <transition name="true" to="win"/>
+ <transition name="false" to="evaluateRemainingGuesses"/>
+ </decision>
- <decision name="evaluateRemainingGuesses" expression="#{numberGuess.lastGuess}">
- <transition name="true" to="lose"/>
- <transition name="false" to="displayGuess"/>
- </decision>
+ <decision name="evaluateRemainingGuesses" expression="#{numberGuess.lastGuess}">
+ <transition name="true" to="lose"/>
+ <transition name="false" to="displayGuess"/>
+ </decision>
- <page name="giveup" view-id="/giveup.jspx">
- <redirect/>
- <transition name="yes" to="lose"/>
- <transition name="no" to="displayGuess"/>
- </page>
+ <page name="giveup" view-id="/giveup.jspx">
+ <redirect/>
+ <transition name="yes" to="lose"/>
+ <transition name="no" to="displayGuess"/>
+ </page>
- <page name="win" view-id="/win.jspx">
- <redirect/>
- <end-conversation/>
- </page>
+ <page name="win" view-id="/win.jspx">
+ <redirect/>
+ <end-conversation/>
+ </page>
- <page name="lose" view-id="/lose.jspx">
- <redirect/>
- <end-conversation/>
- </page>
+ <page name="lose" view-id="/lose.jspx">
+ <redirect/>
+ <end-conversation/>
+ </page>
-</pageflow-definition>]]></programlisting>
- <calloutlist>
- <callout arearefs="numberguess-page">
+</pageflow-definition></programlisting>
+
<para> The <literal><page></literal> element defines a wait state where the
system displays a particular JSF view and waits for user input. The
<literal>view-id</literal> is the same JSF view id used in plain JSF navigation rules.
The <literal>redirect</literal> attribute tells Seam to use post-then-redirect when
navigating to the page. (This results in friendly browser URLs.) </para>
- </callout>
- <callout arearefs="numberguess-transition">
+
<para> The <literal><transition></literal> element names a JSF outcome. The
transition is triggered when a JSF action results in that outcome. Execution will then
proceed to the next node of the pageflow graph, after invocation of any jBPM transition
actions. </para>
- </callout>
- <callout arearefs="numberguess-action">
+
<para> A transition <literal><action></literal> is just like a JSF action,
except that it occurs when a jBPM transition occurs. The transition action can invoke
any Seam component. </para>
- </callout>
- <callout arearefs="numberguess-decision">
+
<para> A <literal><decision></literal> node branches the pageflow, and
determines the next node to execute by evaluating a JSF EL expression. </para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
@@ -1567,76 +1481,76 @@
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<<?xml version="1.0"?>
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ <programlisting role="XHTML">
+<?xml version="1.0"?>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns="http://www.w3.org/1999/xhtml"
- version="2.0">
- <jsp:output doctype-root-element="html"
+ version="2.0">
+<jsp:output doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
- doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
- <jsp:directive.page contentType="text/html"/>
- <html>
- <head>
- <title>Guess a number...</title>
- <link href="niceforms.css" rel="stylesheet" type="text/css" />
- <script language="javascript" type="text/javascript" src="niceforms.js" />
- </head>
- <body>
- <h1>Guess a number...</h1>
- <f:view>
- <h:form styleClass="niceform">
+ doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
+<jsp:directive.page contentType="text/html"/>
+<html>
+ <head>
+ <title>Guess a number...</title>
+ <link href="niceforms.css" rel="stylesheet" type="text/css" />
+ <script language="javascript" type="text/javascript" src="niceforms.js" />
+ </head>
+ <body>
+ <h1>Guess a number...</h1>
+ <f:view>
+ <h:form styleClass="niceform">
- <div>
- <h:messages globalOnly="true"/>
- <h:outputText value="Higher!"
- rendered="#{numberGuess.randomNumber gt numberGuess.currentGuess}"/>
- <h:outputText value="Lower!"
- rendered="#{numberGuess.randomNumber lt numberGuess.currentGuess}"/>
- </div>
+ <div>
+ <h:messages globalOnly="true"/>
+ <h:outputText value="Higher!" rendered="#{numberGuess.randomNumber gt numberGuess.currentGuess}"/>
+ <h:outputText value="Lower!"
+rendered="#{numberGuess.randomNumber lt numberGuess.currentGuess}"/>
+ </div>
- <div>
+ <div>
I'm thinking of a number between
- <h:outputText value="#{numberGuess.smallest}"/> and
- <h:outputText value="#{numberGuess.biggest}"/>. You have
- <h:outputText value="#{numberGuess.remainingGuesses}"/> guesses.
- </div>
+ <h:outputText value="#{numberGuess.smallest}"/> and
+ <h:outputText value="#{numberGuess.biggest}"/>. You have
+ <h:outputText value="#{numberGuess.remainingGuesses}"/> guesses.
+ </div>
- <div>
+ <div>
Your guess:
- <h:inputText value="#{numberGuess.currentGuess}" id="inputGuess"
+ <h:inputText value="#{numberGuess.currentGuess}" id="inputGuess"
required="true" size="3"
- rendered="#{(numberGuess.biggest-numberGuess.smallest) gt 20}">
- <f:validateLongRange maximum="#{numberGuess.biggest}"
- minimum="#{numberGuess.smallest}"/>
- </h:inputText>
- <h:selectOneMenu value="#{numberGuess.currentGuess}"
+ rendered="#{(numberGuess.biggest-numberGuess.smallest) gt 20}">
+ <f:validateLongRange maximum="#{numberGuess.biggest}"
+ minimum="#{numberGuess.smallest}"/>
+ </h:inputText>
+ <h:selectOneMenu value="#{numberGuess.currentGuess}"
id="selectGuessMenu" required="true"
rendered="#{(numberGuess.biggest-numberGuess.smallest) le 20 and
- (numberGuess.biggest-numberGuess.smallest) gt 4}">
- <s:selectItems value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
- </h:selectOneMenu>
- <h:selectOneRadio value="#{numberGuess.currentGuess}" id="selectGuessRadio"
+ (numberGuess.biggest-numberGuess.smallest) gt 4}">
+ <s:selectItems value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
+ </h:selectOneMenu>
+ <h:selectOneRadio value="#{numberGuess.currentGuess}" id="selectGuessRadio"
required="true"
- rendered="#{(numberGuess.biggest-numberGuess.smallest) le 4}">
- <s:selectItems value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
- </h:selectOneRadio>
- <h:commandButton value="Guess" action="guess"/>
- <s:button value="Cheat" view="/confirm.jspx"/>
- <s:button value="Give up" action="giveup"/>
- </div>
+ rendered="#{(numberGuess.biggest-numberGuess.smallest) le 4}">
+ <s:selectItems value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
+ </h:selectOneRadio>
+ <h:commandButton value="Guess" action="guess"/>
+ <s:button value="Cheat" view="/confirm.jspx"/>
+ <s:button value="Give up" action="giveup"/>
+ </div>
- <div>
- <h:message for="inputGuess" style="color: red"/>
- </div>
+ <div>
+ <h:message for="inputGuess" style="color: red"/>
+ </div>
- </h:form>
- </f:view>
- </body>
- </html>
-</jsp:root>]]></programlisting>
+ </h:form>
+ </f:view>
+ </body>
+</html>
+</jsp:root></programlisting>
</example>
@@ -1646,33 +1560,34 @@
<para> The <literal>win.jspx</literal> page is predictable: </para>
<example>
<title></title>
- <programlisting role="JSP"><![CDATA[<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
+ <programlisting role="JSP">
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns="http://www.w3.org/1999/xhtml"
version="2.0">
- <jsp:output doctype-root-element="html"
+ <jsp:output doctype-root-element="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
- <jsp:directive.page contentType="text/html"/>
- <html>
- <head>
- <title>You won!</title>
- <link href="niceforms.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <h1>You won!</h1>
- <f:view>
- Yes, the answer was <h:outputText value="#{numberGuess.currentGuess}" />.
- It took you <h:outputText value="#{numberGuess.guessCount}" /> guesses.
- <h:outputText value="But you cheated, so it doesn't count!"
+ <jsp:directive.page contentType="text/html"/>
+ <html>
+ <head>
+ <title>You won!</title>
+ <link href="niceforms.css" rel="stylesheet" type="text/css" />
+ </head>
+ <body>
+ <h1>You won!</h1>
+ <f:view>
+ Yes, the answer was <h:outputText value="#{numberGuess.currentGuess}" />.
+ It took you <h:outputText value="#{numberGuess.guessCount}" /> guesses.
+ <h:outputText value="But you cheated, so it doesn't count!"
rendered="#{numberGuess.cheat}"/>
- Would you like to <a href="numberGuess.seam">play again</a>?
- </f:view>
- </body>
- </html>
-</jsp:root>
-]]></programlisting>
+ Would you like to <a href="numberGuess.seam">play again</a>?
+ </f:view>
+ </body>
+ </html>
+ </jsp:root>
+</programlisting>
</example>
@@ -1685,7 +1600,8 @@
<areaspec>
<area id="numberguess-create" coords="13"/>
</areaspec>
- <programlisting><![CDATA[@Name("numberGuess")
+ <programlisting>
+@Name("numberGuess")
@Scope(ScopeType.CONVERSATION)
public class NumberGuess implements Serializable {
@@ -1722,7 +1638,7 @@
{
biggest = currentGuess - 1;
}
- if (currentGuess<randomNumber)
+ if (currentGuess<randomNumber)
{
smallest = currentGuess + 1;
}
@@ -1779,15 +1695,14 @@
return cheated;
}
- public List<Integer> getPossibilities()
+ public List<Integer> getPossibilities()
{
- List<Integer> result = new ArrayList<Integer>();
- for(int i=smallest; i<=biggest; i++) result.add(i);
+ List<Integer> result = new ArrayList<Integer>();
+ for(int i=smallest; i<=biggest; i++) result.add(i);
return result;
}
-}
-]]></programlisting>
+}</programlisting>
<calloutlist>
<callout arearefs="numberguess-create">
<para> The first time a JSP page asks for a <literal>numberGuess</literal> component, Seam
@@ -1806,21 +1721,22 @@
</para>
- <programlisting role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
-<pages xmlns="http://jboss.com/products/seam/pages"
+ <programlisting role="XML">
+<?xml version="1.0" encoding="UTF-8"?>
+<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd">
+ xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd">
- <page view-id="/numberGuess.jspx">
- <begin-conversation join="true" pageflow="numberGuess"/>
- </page>
+<page view-id="/numberGuess.jspx">
+ <begin-conversation join="true" pageflow="numberGuess"/>
+</page>
- <page view-id="/confirm.jspx">
- <begin-conversation nested="true" pageflow="cheat"/>
- </page>
+<page view-id="/confirm.jspx">
+ <begin-conversation nested="true" pageflow="cheat"/>
+</page>
-</pages>
-]]></programlisting>
+</pages>
+</programlisting>
<para> As you can see, this Seam component is pure business logic! It doesn't need to know anything at all
@@ -2010,14 +1926,8 @@
<example>
<title></title>
<!-- Can't use code hightlighting with callouts -->
- <programlistingco>
- <areaspec>
- <area id="booking-stateful-annotation" coords="1"/>
- <area id="booking-restrict-annotation" coords="4"/>
- <area id="booking-datamodel-annotation" coords="15"/>
- <area id="booking-destroy-annotation" coords="70"/>
- </areaspec>
- <programlisting><![CDATA[@Stateful
+ <programlisting>
+@Stateful
@Name("hotelSearch")
@Scope(ScopeType.SESSION)
@Restrict("#{identity.loggedIn}")
@@ -2032,7 +1942,7 @@
private int page;
@DataModel
- private List<Hotel> hotels;
+ private List<Hotel> hotels;
public void find()
{
@@ -2059,7 +1969,7 @@
public boolean isNextPageAvailable()
{
- return hotels!=null && hotels.size()==pageSize;
+ return hotels!=null && hotels.size()==pageSize;
}
public int getPageSize() {
@@ -2089,36 +1999,29 @@
@Remove
public void destroy() {}
-}]]></programlisting>
- <calloutlist>
- <callout arearefs="booking-stateful-annotation">
+} </programlisting>
+
<para> The EJB standard <literal>@Stateful</literal> annotation identifies this class as a
stateful session bean. Stateful session beans are scoped to the conversation context by
default. </para>
- </callout>
- <callout arearefs="booking-restrict-annotation">
+
<para> The <literal>@Restrict</literal> annotation applies a security restriction to the
component. It restricts access to the component allowing only logged-in users. The
security chapter explains more about security in Seam. </para>
- </callout>
- <callout arearefs="booking-datamodel-annotation">
- <para> The <link linkend="datamodel-annotation">
+
+ <para> The
<literal>@DataModel</literal>
- </link> annotation exposes a <literal>List</literal> as a JSF
+ annotation exposes a <literal>List</literal> as a JSF
<literal>ListDataModel</literal>. This makes it easy to implement clickable lists for
search screens. In this case, the list of hotels is exposed to the page as a
<literal>ListDataModel</literal> in the conversation variable named
<literal>hotels</literal>. </para>
- </callout>
- <callout arearefs="booking-destroy-annotation">
+
<para> The EJB standard <literal>@Remove</literal> annotation specifies that a stateful
session bean should be removed and its state destroyed after invocation of the annotated
method. In Seam, all stateful session beans must define a method with no parameters marked
<literal>@Remove</literal>. This method will be
called when Seam destroys the session context.</para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
@@ -2127,98 +2030,89 @@
<example>
<title></title>
<!-- Can't use code hightlighting with callouts -->
- <programlistingco>
- <areaspec>
- <area id="booking-support-element" coords="14"/>
- <area id="booking-status-element" coords="20"/>
- <area id="booking-outputpanel-element" coords="37"/>
- <area id="booking-link-element" coords="61"/>
- </areaspec>
- <programlisting><![CDATA[<div class="section">
+ <programlisting>
+<div class="section">
- <span class="errors">
- <h:messages globalOnly="true"/>
- </span>
+<span class="errors">
+ <h:messages globalOnly="true"/>
+</span>
- <h1>Search Hotels</h1>
+<h1>Search Hotels</h1>
- <h:form id="searchCriteria">
- <fieldset>
- <h:inputText id="searchString" value="#{hotelSearch.searchString}"
- style="width: 165px;">
- <a:support event="onkeyup" actionListener="#{hotelSearch.find}"
- reRender="searchResults" />
- </h:inputText>
+<h:form id="searchCriteria">
+<fieldset>
+ <h:inputText id="searchString" value="#{hotelSearch.searchString}"
+ style="width: 165px;">
+ <a:support event="onkeyup" actionListener="#{hotelSearch.find}"
+ reRender="searchResults" />
+ </h:inputText>
 
- <a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}"
- reRender="searchResults"/>
+ <a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}"
+ reRender="searchResults"/>
 
- <a:status>
- <f:facet name="start">
- <h:graphicImage value="/img/spinner.gif"/>
- </f:facet>
- </a:status>
- <br/>
- <h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
- <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
- <f:selectItem itemLabel="5" itemValue="5"/>
- <f:selectItem itemLabel="10" itemValue="10"/>
- <f:selectItem itemLabel="20" itemValue="20"/>
- </h:selectOneMenu>
- </fieldset>
- </h:form>
+ <a:status>
+ <f:facet name="start">
+ <h:graphicImage value="/img/spinner.gif"/>
+ </f:facet>
+ </a:status>
+ <br/>
+ <h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
+ <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
+ <f:selectItem itemLabel="5" itemValue="5"/>
+ <f:selectItem itemLabel="10" itemValue="10"/>
+ <f:selectItem itemLabel="20" itemValue="20"/>
+ </h:selectOneMenu>
+ </fieldset>
+ </h:form>
-</div>
+ </div>
-<a:outputPanel id="searchResults">
- <div class="section">
- <h:outputText value="No Hotels Found"
- rendered="#{hotels != null and hotels.rowCount==0}"/>
- <h:dataTable id="hotels" value="#{hotels}" var="hot"
- rendered="#{hotels.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <a:outputPanel id="searchResults">
+ <div class="section">
+ <h:outputText value="No Hotels Found"
+ rendered="#{hotels != null and hotels.rowCount==0}"/>
+ <h:dataTable id="hotels" value="#{hotels}" var="hot"
+ rendered="#{hotels.rowCount>0}">
+ <h:column>
+ <f:facet name="header">Name</f:facet>
#{hot.name}
- </h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Address</f:facet>
#{hot.address}
- </h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ </h:column>
+ <h:column>
+ <f:facet name="header">City, State</f:facet>
#{hot.city}, #{hot.state}, #{hot.country}
- </h:column>
- <h:column>
- <f:facet name="header">Zip</f:facet>
+ </h:column>
+ <h:column>
+ <f:facet name="header">Zip</f:facet>
#{hot.zip}
- </h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
- <s:link id="viewHotel" value="View Hotel"
- action="#{hotelBooking.selectHotel(hot)}"/>
- </h:column>
- </h:dataTable>
- <s:link value="More results" action="#{hotelSearch.nextPage}"
- rendered="#{hotelSearch.nextPageAvailable}"/>
- </div>
-</a:outputPanel> ]]></programlisting>
- <calloutlist>
- <callout arearefs="booking-support-element">
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
+ <s:link id="viewHotel" value="View Hotel"
+ action="#{hotelBooking.selectHotel(hot)}"/>
+ </h:column>
+ </h:dataTable>
+ <s:link value="More results" action="#{hotelSearch.nextPage}"
+ rendered="#{hotelSearch.nextPageAvailable}"/>
+ </div>
+</a:outputPanel>
+</programlisting>
+
<para> The RichFaces Ajax <literal><a:support></literal> tag allows a JSF action
event listener to be called by asynchronous <literal>XMLHttpRequest</literal> when a
JavaScript event like <literal>onkeyup</literal> occurs. Even better, the
<literal>reRender</literal> attribute lets us render a fragment of the JSF page and
perform a partial page update when the asynchronous response is received. </para>
- </callout>
- <callout arearefs="booking-status-element">
+
<para> The RichFaces Ajax <literal><a:status></literal> tag lets us display a cheesy
annimated image while we wait for asynchronous requests to return. </para>
- </callout>
- <callout arearefs="booking-outputpanel-element">
+
<para> The RichFaces Ajax <literal><a:outputPanel></literal> tag defines a region of
the page which can be re-rendered by an asynchronous request. </para>
- </callout>
- <callout arearefs="booking-link-element">
+
<para> The Seam <literal><s:link></literal> tag lets us attach a JSF action
listener to an ordinary (non-JavaScript) HTML link. The advantage of this over the
standard JSF <literal><h:commandLink></literal> is that it preserves the
@@ -2228,10 +2122,8 @@
EL that lets you use parameters on any method binding expression. </para>
<para> If you're wondering how navigation occurs,
you can find all the rules in <literal>WEB-INF/pages.xml</literal>;
- this is discussed in <xref linkend="events.pageaction.navigation"/>. </para>
- </callout>
- </calloutlist>
- </programlistingco>
+ this is discussed in the navigation section of this book. </para>
+
</example>
@@ -2247,15 +2139,8 @@
<example>
<title></title>
<!-- Can't use code hightlighting with callouts -->
- <programlistingco>
- <areaspec>
- <area id="booking-extendedpersistencecontext-annotation" coords="7"/>
- <area id="booking-out-annotation" coords="17"/>
- <area id="booking-begin-annotation" coords="31"/>
- <area id="booking-end-annotation" coords="72"/>
- <area id="booking-dest-annotation" coords="85"/>
- </areaspec>
- <programlisting><![CDATA[@Stateful
+ <programlisting>
+@Stateful
@Name("hotelBooking")
@Restrict("#{identity.loggedIn}")
public class HotelBookingAction implements HotelBooking
@@ -2341,43 +2226,35 @@
@Remove
public void destroy() {}
-]]></programlisting>
- <calloutlist>
- <callout arearefs="booking-extendedpersistencecontext-annotation">
+</programlisting>
+
<para> This bean uses an EJB3 <emphasis>extended persistence context</emphasis>, so that any
entity instances remain managed for the whole lifecycle of the stateful session bean.
</para>
- </callout>
- <callout arearefs="booking-out-annotation">
- <para> The <link linkend="out-annotation">
+
+ <para> The
<literal>@Out</literal>
- </link> annotation declares that an attribute value is <emphasis>outjected</emphasis> to
+ annotation declares that an attribute value is <emphasis>outjected</emphasis> to
a context variable after method invocations. In this case, the context variable named
<literal>hotel</literal> will be set to the value of the <literal>hotel</literal>
instance variable after every action listener invocation completes. </para>
- </callout>
- <callout arearefs="booking-begin-annotation">
- <para> The <link linkend="begin-annotation">
+
+ <para> The
<literal>@Begin</literal>
- </link> annotation specifies that the annotated method begins a <emphasis>long-running
+ annotation specifies that the annotated method begins a <emphasis>long-running
conversation</emphasis>, so the current conversation context will not be destroyed
at the end of the request. Instead, it will be reassociated with every request from the
current window, and destroyed either by timeout due to conversation inactivity or
invocation of a matching <literal>@End</literal> method. </para>
- </callout>
- <callout arearefs="booking-end-annotation">
- <para> The <link linkend="end-annotation">
+
+ <para> The
<literal>@End</literal>
- </link> annotation specifies that the annotated method ends the current long-running
+ annotation specifies that the annotated method ends the current long-running
conversation, so the current conversation context will be destroyed at the end of the
request. </para>
- </callout>
- <callout arearefs="booking-dest-annotation">
+
<para> This EJB remove method will be called when Seam destroys the conversation context.
Don't forget to define this method! </para>
- </callout>
- </calloutlist>
- </programlistingco>
</example>
@@ -2404,7 +2281,9 @@
<literal><s:link></literal> control for navigation from the search screen to the hotel
page: </para>
- <programlisting role="JAVA"><![CDATA[<s:link value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>]]></programlisting>
+ <programlisting role="JAVA">
+<s:link value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
+</programlisting>
<para> The use of <literal><s:link></literal> here allows us to attach an action listener to a
HTML link without breaking the browser's "open in new window" feature. The standard JSF
@@ -2426,7 +2305,9 @@
<literal>WEB-INF/lib</literal>, along with the Facelets, and if you set the debug property
of the <literal>init</literal> component:</para>
- <programlisting role="XML"><![CDATA[<core:init jndi-pattern="@jndiPattern@" debug="true"/>]]></programlisting>
+<programlisting role="XML">
+<core:init jndi-pattern="@jndiPattern@" debug="true"/>
+</programlisting>
<para> This page lets you browse and inspect the Seam components
in any of the Seam contexts associated with your current login session. Just point your browser at
@@ -2529,34 +2410,36 @@
entries: </para>
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<h:dataTable value="#{blog.recentBlogEntries}" var="blogEntry" rows="3">
- <h:column>
- <div class="blogEntry">
- <h3>#{blogEntry.title}</h3>
- <div>
- <h:outputText escape="false"
- value="#{blogEntry.excerpt==null ? blogEntry.body : blogEntry.excerpt}"/>
- </div>
- <p>
- <h:outputLink value="entry.seam" rendered="#{blogEntry.excerpt!=null}">
- <f:param name="blogEntryId" value="#{blogEntry.id}"/>
+ <programlisting role="XHTML">
+<h:dataTable value="#{blog.recentBlogEntries}" var="blogEntry" rows="3">
+<h:column>
+<div class="blogEntry">
+<h3>#{blogEntry.title}</h3>
+<div>
+ <h:outputText escape="false"
+ value="#{blogEntry.excerpt==null ? blogEntry.body : blogEntry.excerpt}"/>
+</div>
+<p>
+ <h:outputLink value="entry.seam" rendered="#{blogEntry.excerpt!=null}">
+ <f:param name="blogEntryId" value="#{blogEntry.id}"/>
Read more...
- </h:outputLink>
- </p>
- <p>
- [Posted on
- <h:outputText value="#{blogEntry.date}">
- <f:convertDateTime timeZone="#{blog.timeZone}"
- locale="#{blog.locale}" type="both"/>
- </h:outputText>]
+ </h:outputLink>
+</p>
+<p>
+[Posted on
+<h:outputText value="#{blogEntry.date}">
+ <f:convertDateTime timeZone="#{blog.timeZone}"
+ locale="#{blog.locale}" type="both"/>
+</h:outputText>]
 
- <h:outputLink value="entry.seam">[Link]
- <f:param name="blogEntryId" value="#{blogEntry.id}"/>
- </h:outputLink>
- </p>
- </div>
- </h:column>
-</h:dataTable>]]></programlisting>
+<h:outputLink value="entry.seam">[Link]
+ <f:param name="blogEntryId" value="#{blogEntry.id}"/>
+</h:outputLink>
+</p>
+</div>
+</h:column>
+</h:dataTable>
+</programlisting>
</example>
@@ -2568,12 +2451,8 @@
<example>
<title></title>
<!-- Can't use code hightlighting with callouts -->
- <programlistingco>
- <areaspec>
- <area id="blog-seampc" coords="7"/>
- <area id="blog-unwrap" coords="9"/>
- </areaspec>
- <programlisting><![CDATA[@Name("blog")
+ <programlisting>
+@Name("blog")
@Scope(ScopeType.STATELESS)
@AutoCreate
public class BlogService
@@ -2589,23 +2468,19 @@
.getSingleResult();
}
-}]]></programlisting>
- <calloutlist>
- <callout arearefs="blog-seampc">
+</programlisting>
+
<para> This component uses a <emphasis>seam-managed persistence context</emphasis>. Unlike
the other examples we've seen, this persistence context is managed by Seam, instead of
by the EJB3 container. The persistence context spans the entire web request, allowing us
to avoid any exceptions that occur when accessing unfetched associations in the view.
</para>
- </callout>
- <callout arearefs="blog-unwrap">
+
<para> The <literal>@Unwrap</literal> annotation tells Seam to provide the return value of
the method—the <literal>Blog</literal>—instead of the actual
<literal>BlogService</literal> component to clients. This is the Seam
<emphasis>manager component pattern</emphasis>. </para>
- </callout>
- </calloutlist>
- </programlistingco>
+
</example>
@@ -2622,12 +2497,13 @@
template, <literal>template.xhtml</literal>: </para>
<example>
<title></title>
- <programlisting role="XHTML"><![CDATA[<div id="search">
- <h:form>
- <h:inputText value="#{searchAction.searchPattern}"/>
- <h:commandButton value="Search" action="/search.xhtml"/>
- </h:form>
-</div>]]></programlisting>
+ <programlisting role="XHTML">
+<div id="search">
+ <h:form>
+ <h:inputText value="#{searchAction.searchPattern}"/>
+ <h:commandButton value="Search" action="/search.xhtml"/>
+ </h:form>
+</div></programlisting>
<para> To implement a bookmarkable search results page, we need to perform a browser redirect after
@@ -2635,23 +2511,27 @@
automatically redirects to the view id when the form is submitted. Alternatively, we could have defined
a navigation rule like this: </para>
- <programlisting role="XML"><![CDATA[<navigation-rule>
- <navigation-case>
- <from-outcome>searchResults</from-outcome>
- <to-view-id>/search.xhtml</to-view-id>
- <redirect/>
- </navigation-case>
-</navigation-rule>]]></programlisting>
+ <programlisting role="XML">
+<navigation-rule>
+ <navigation-case>
+ <from-outcome>searchResults</from-outcome>
+ <to-view-id>/search.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+</navigation-rule>
+</programlisting>
</example>
<para> Then the form would have looked like this: </para>
- <programlisting role="XHTML"><![CDATA[<div id="search">
- <h:form>
- <h:inputText value="#{searchAction.searchPattern}"/>
- <h:commandButton value="Search" action="searchResults"/>
- </h:form>
-</div>]]></programlisting>
+ <programlisting role="XHTML">
+<div id="search">
+ <h:form>
+ <h:inputText value="#{searchAction.searchPattern}"/>
+ <h:commandButton value="Search" action="searchResults"/>
+ </h:form>
+</div>
+</programlisting>
<para> But when we redirect, we need to include the values submitted with the form as request parameters, to
@@ -2661,12 +2541,13 @@
<literal>WEB-INF/pages.xml</literal>: </para>
<example>
<title></title>
- <programlisting role="XML"><![CDATA[<pages>
- <page view-id="/search.xhtml">
- <param name="searchPattern" value="#{searchService.searchPattern}"/>
- </page>
- ...
-</pages>]]></programlisting>
+ <programlisting role="XML">
+<pages>
+ <page view-id="/search.xhtml">
+ <param name="searchPattern" value="#{searchService.searchPattern}"/>
+ </page>
+</pages>
+</programlisting>
</example>
@@ -2676,25 +2557,28 @@
<para> The redirect takes us to the <literal>search.xhtml</literal> page: </para>
- <programlisting role="XHTML"><![CDATA[<h:dataTable value="#{searchResults}" var="blogEntry">
- <h:column>
- <div>
- <h:outputLink value="entry.seam">
- <f:param name="blogEntryId" value="#{blogEntry.id}"/>
+ <programlisting role="XHTML">
+<h:dataTable value="#{searchResults}" var="blogEntry">
+ <h:column>
+ <div>
+ <h:outputLink value="entry.seam">
+ <f:param name="blogEntryId" value="#{blogEntry.id}"/>
#{blogEntry.title}
- </h:outputLink>
+ </h:outputLink>
posted on
- <h:outputText value="#{blogEntry.date}">
- <f:convertDateTime timeZone="#{blog.timeZone}" locale="#{blog.locale}" type="both"/>
- </h:outputText>
- </div>
- </h:column>
-</h:dataTable>]]></programlisting>
+ <h:outputText value="#{blogEntry.date}">
+ <f:convertDateTime timeZone="#{blog.timeZone}" locale="#{blog.locale}" type="both"/>
+ </h:outputText>
+ </div>
+ </h:column>
+</h:dataTable>
+</programlisting>
<para> Which again uses "pull"-style MVC to retrieve the actual search results: </para>
- <programlisting role="JAVA"><![CDATA[@Name("searchService")
+ <programlisting role="JAVA">
+@Name("searchService")
public class SearchService
{
@@ -2704,7 +2588,7 @@
private String searchPattern;
@Factory("searchResults")
- public List<BlogEntry> getSearchResults()
+ public List<BlogEntry> getSearchResults()
{
if (searchPattern==null)
{
@@ -2737,7 +2621,7 @@
this.searchPattern = searchPattern;
}
-}]]></programlisting>
+}</programlisting>
</section>
@@ -2753,7 +2637,8 @@
<para> The <literal>entryAction</literal> component works much like an action class in a traditional
push-MVC action-oriented framework like Struts: </para>
- <programlisting role="JAVA"><![CDATA[@Name("entryAction")
+ <programlisting role="JAVA">
+@Name("entryAction")
@Scope(STATELESS)
public class EntryAction
{
@@ -2769,23 +2654,20 @@
if (blogEntry==null) throw new EntryNotFoundException(id);
}
-}]]></programlisting>
+}</programlisting>
<para> Page actions are also declared in <literal>pages.xml</literal>: </para>
- <programlisting role="XML"><![CDATA[<pages>
- ...
-
- <page view-id="/entry.xhtml" action="#{entryAction.loadBlogEntry(blogEntry.id)}">
- <param name="blogEntryId" value="#{blogEntry.id}"/>
- </page>
-
- <page view-id="/post.xhtml" action="#{loginAction.challenge}"/>
-
- <page view-id="*" action="#{blog.hitCount.hit}"/>
-
-</pages>]]></programlisting>
+ <programlisting role="XML">
+<pages>
+ <page view-id="/entry.xhtml" action="#{entryAction.loadBlogEntry(blogEntry.id)}">
+ <param name="blogEntryId" value="#{blogEntry.id}"/>
+ </page>
+ <page view-id="/post.xhtml" action="#{loginAction.challenge}"/>
+ <page view-id="*" action="#{blog.hitCount.hit}"/>
+</pages>
+</programlisting>
<para> Notice that the example is using page actions for some other functionality—the login
@@ -2798,26 +2680,29 @@
data—the <literal>blogEntry</literal>—and places it in the Seam event context.
Finally, the following is rendered: </para>
- <programlisting role="XHTML"><![CDATA[<div class="blogEntry">
- <h3>#{blogEntry.title}</h3>
- <div>
- <h:outputText escape="false" value="#{blogEntry.body}"/>
- </div>
- <p>
+ <programlisting role="XHTML">
+<div class="blogEntry">
+<h3>#{blogEntry.title}</h3>
+<div>
+ <h:outputText escape="false" value="#{blogEntry.body}"/>
+</div>
+<p>
[Posted on 
- <h:outputText value="#{blogEntry.date}">
- <f:convertDateTime timezone="#{blog.timeZone}"
- locale="#{blog.locale}" type="both"/>
- </h:outputText>]
- </p>
-</div>]]></programlisting>
+ <h:outputText value="#{blogEntry.date}">
+ <f:convertDateTime timezone="#{blog.timeZone}"
+ locale="#{blog.locale}" type="both"/>
+ </h:outputText>]
+</p>
+</div>
+</programlisting>
<para> If the blog entry is not found in the database, the <literal>EntryNotFoundException</literal>
exception is thrown. We want this exception to result in a 404 error, not a 505, so we annotate the
exception class: </para>
- <programlisting role="JAVA"><![CDATA[@ApplicationException(rollback=true)
+ <programlisting role="JAVA">
+@ApplicationException(rollback=true)
@HttpError(errorCode=HttpServletResponse.SC_NOT_FOUND)
public class EntryNotFoundException extends Exception
{
@@ -2825,12 +2710,13 @@
{
super("entry not found: " + id);
}
-}]]></programlisting>
+}</programlisting>
<para> An alternative implementation of the example does not use the parameter in the method binding: </para>
- <programlisting role="JAVA"><![CDATA[@Name("entryAction")
+ <programlisting role="JAVA">
+@Name("entryAction")
@Scope(STATELESS)
public class EntryAction
{
@@ -2846,17 +2732,15 @@
if (blogEntry==null) throw new EntryNotFoundException(id);
}
-}]]></programlisting>
+}</programlisting>
- <programlisting role="XML"><![CDATA[<pages>
- ...
-
- <page view-id="/entry.xhtml" action="#{entryAction.loadBlogEntry}">
- <param name="blogEntryId" value="#{blogEntry.id}"/>
- </page>
-
- ...
-</pages>]]></programlisting>
+ <programlisting role="XML">
+<pages>
+ <page view-id="/entry.xhtml" action="#{entryAction.loadBlogEntry}">
+ <param name="blogEntryId" value="#{blogEntry.id}"/>
+ </page>
+</pages>
+</programlisting>
<para> It is a matter of taste which implementation you prefer. </para>
16 years, 2 months
Seam SVN: r8980 - branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: petemuir
Date: 2008-09-11 11:06:58 -0400 (Thu, 11 Sep 2008)
New Revision: 8980
Modified:
branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml
Log:
minor
Modified: branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml 2008-09-11 15:03:14 UTC (rev 8979)
+++ branches/enterprise/JBPAPP_4_3_FP01/doc/Seam_Reference_Guide/en-US/Getting_Started_With_JBoss_Tools.xml 2008-09-11 15:06:58 UTC (rev 8980)
@@ -27,14 +27,9 @@
<title>Before you start</title>
<para>
- Make sure you have JDK 5, JBoss AS 4.2, Eclipse 3.3, the JBoss Tools
- plugins (at least Seam Tools, the Visual Page Editor, jBPM Tools and
- JBoss AS Tools) and the TestNG plugin for Eclipse correctly installed
- before starting.
+ Make sure you have JBoss EAP 4.3 FP01 and JBDS installed.
</para>
- <para>TODO - detail where the update sites are.</para>
-
</section>
<section>
16 years, 2 months
Seam SVN: r8976 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: danielc.roth
Date: 2008-09-11 10:48:46 -0400 (Thu, 11 Sep 2008)
New Revision: 8976
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
Log:
Added Matt Drees and Jacob Orshalick to authors list.
Modified: trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml 2008-09-11 14:47:49 UTC (rev 8975)
+++ trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml 2008-09-11 14:48:46 UTC (rev 8976)
@@ -56,6 +56,14 @@
<firstname>Daniel</firstname>
<surname>Roth</surname>
</author>
+ <author>
+ <firstname>Matt</firstname>
+ <surname>Drees</surname>
+ </author>
+ <author>
+ <firstname>Jacob</firstname>
+ <surname>Orshalick</surname>
+ </author>
<othercredit>
<firstname>James</firstname>
<surname>Cobb</surname>
16 years, 2 months