[jboss-cvs] jboss-seam/examples/seamdiscs/view ...
Peter Muir
peter at bleepbleep.org.uk
Tue Apr 3 14:32:38 EDT 2007
User: pmuir
Date: 07/04/03 14:32:38
Modified: examples/seamdiscs/view home.xhtml
Added: examples/seamdiscs/view artist.page.xml
disc.page.xml artists.page.xml artist.xhtml
discs.xhtml home.page.xml disc.xhtml discs.page.xml
artists.xhtml
Log:
Lots of improvements for seamdiscs
Revision Changes Path
1.2 +80 -21 jboss-seam/examples/seamdiscs/view/home.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: home.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/seamdiscs/view/home.xhtml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- home.xhtml 28 Mar 2007 19:12:46 -0000 1.1
+++ home.xhtml 3 Apr 2007 18:32:38 -0000 1.2
@@ -16,24 +16,83 @@
<rich:panel>
<f:facet name="header">Welcome to Seam Discs!</f:facet>
<p>This application allows you to catalogue your favourite
- bands, and albums they've released - and shows off Seam,
- RichFaces, and Trinidad integration</p>
+ bands, and albums they've released. It uses:</p>
- <p>Discs</p>
+ <tr:panelList>
+ <h:outputText value="JBoss Seam" />
+ <h:outputText value="Apache MyFaces Trinidad" />
+ <h:outputText value="JBoss RichFaces" />
+ <h:outputText value="JBoss Ajax4jsf" />
+ <h:outputText value="EJB3/JPA" />
+ </tr:panelList>
+
+ <p>It also uses "in place" editing - you use the same screens
+ to view and edit (if you are logged in) information.</p>
+
+ <p>You can log in as <code>administrator</code>/<code>administrator</code>.</p>
+ </rich:panel>
+ <rich:modalPanel>
+ <p>This example was built using seam-gen. To add in Trinidad, the trinidad-api jar was added to
+ the ear (and referenced from application.xml) and the trinidad-impl jar, <code>jboss-seam-trinidad.jar</code> (Seam-Trinidad
+ integration) & <code>a4j-trinidad.jar</code> (Ajax4jsf-Trinidad integration) were added to <code>WEB-INF/lib</code>.</p>
+
+ <p><code>jboss-seam-trinidad.jar</code> provides an improved DataModel for Trinidad components such as <code><tr:table /></code>,
+ <code><tr:treeTable /></code> and <code><tr:tree /></code> that, when backed by a Seam Application Framework EntityQuery,
+ uses the database to sort and page.</p>
+
+ <p>Of course Trinidad and RichFaces offer some complementary components (e.g. tables, trees) - it's up to you which you choose!</p>
+ </rich:modalPanel>
+ <rich:modalPanel>
+ <p>Trinidad and Ajax4jsf both provide partial page refresh and submit. For Trinidad PPR to work, it needs to be surrounded by a component
+ which enables PPR. As the example doesn't use Trinidad to render the whole page (just sections), the <code><tr:panelPartialRoot /></code>
+ surrounds any Trinidad components which we want PPR to work on.</p>
+ </rich:modalPanel>
+ <rich:modalPanel>
+ <p>The example also shows how you can use Trinidad components to achieve "in-place" editing - the same views are used to display and edit
+ informtation. A casual visitor to the site navigates around, and see's the components in <code>readOnly</code> mode; once logged in,
+ these components are editable, and button's are rendered to submit information.</p>
+
+ <p>You could easily achieve the same using Seam's <code><s:decorate /></code> tag - and better yet, you get complete control over styling and placement
+ of labels, help text and error messages!</p>
+ </rich:modalPanel>
+ <rich:modalPanel>
+ <p>The example uses the Seam Application Framework; page parameters, <code>EntityHome</code> and <code>EntityQuery</code> are used for all CRUD
+ operations. Where possible these are defined in XML, using extension only where extra functionality is needed (for example auto-suggest).</p>
+ </rich:modalPanel>
+ <rich:modalPanel>
+ <p>You'll notice that Trinidad and RichFaces components don't exactly provide a consistent look-and-feel - there are plans afoot to improve this out of the box.</p>
+ <p>However both Trinidad and RichFaces have powerful and mature skinning/theming APIs - so you all you need to do is write some CSS!</p>
+ </rich:modalPanel>
+ <rich:panel>
+ <f:facet name="header">All Discs</f:facet>
<tr:panelPartialRoot>
<tr:form>
- <tr:table value="#{discs.dataModel}" var="disc">
- <tr:column sortable="true" sortProperty="name">
+ <tr:table value="#{discs.dataModel}" var="disc" rows="10" >
+ <tr:column sortable="true" sortProperty="disc.name">
<f:facet name="header">
Disc
</f:facet>
- <h:outputText value="#{disc.name}" />
+ <s:link action="disc">
+ <tr:outputText value="#{disc.name}" />
+ <f:param name="discId" value="#{disc.id}" />
+ </s:link>
+ </tr:column>
+ <tr:column sortable="true" sortProperty="disc.release">
+ <f:facet name="header">
+ Release
+ </f:facet>
+ <h:outputText value="#{disc.release}">
+ <s:convertDateTime pattern="yyyy" />
+ </h:outputText>
</tr:column>
- <tr:column>
+ <tr:column sortable="true" sortProperty="disc.artist">
<f:facet name="header">
Artist
</f:facet>
+ <s:link action="artist">
<h:outputText value="#{disc.artist.name}" rendered="#{disc.artist ne null}" />
+ <f:param name="artistId" value="#{disc.artist.id}" />
+ </s:link>
</tr:column>
</tr:table>
</tr:form>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/artist.page.xml
Index: artist.page.xml
===================================================================
<!DOCTYPE page PUBLIC
"-//JBoss/Seam Pages Configuration DTD 1.2//EN"
"http://jboss.com/products/seam/pages-1.2.dtd">
<page>
<param name="artistId" value="#{artistHome.id}" converterId="javax.faces.Integer"/>
<navigation>
<rule if-outcome="cancel">
<end-conversation/>
<redirect view-id="/artists.xhtml" />
</rule>
<rule if-outcome="updated">
<end-conversation/>
<redirect view-id="/artists.xhtml" />
</rule>
<rule if-outcome="persisted">
<end-conversation/>
<redirect view-id="/artists.xhtml" />
</rule>
</navigation>
</page>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/disc.page.xml
Index: disc.page.xml
===================================================================
<!DOCTYPE page PUBLIC
"-//JBoss/Seam Pages Configuration DTD 1.2//EN"
"http://jboss.com/products/seam/pages-1.2.dtd">
<page>
<param name="discId" value="#{discHome.id}" converterId="javax.faces.Integer"/>
<navigation>
<rule if-outcome="cancel">
<end-conversation/>
<redirect view-id="/discs.xhtml" />
</rule>
<rule if-outcome="updated">
<end-conversation/>
<redirect view-id="/discs.xhtml" />
</rule>
<rule if-outcome="persisted">
<end-conversation/>
<redirect view-id="/discs.xhtml" />
</rule>
</navigation>
</page>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/artists.page.xml
Index: artists.page.xml
===================================================================
<!DOCTYPE page PUBLIC
"-//JBoss/Seam Pages Configuration DTD 1.2//EN"
"http://jboss.com/products/seam/pages-1.2.dtd">
<page>
<param name="artistId" value="#{artistHome.id}" converterId="javax.faces.Integer"/>
<param name="type" value="#{artistHome.type}"/>
<navigation>
<rule if-outcome="artist">
<begin-conversation flush-mode="manual"/>
<redirect view-id="/artist.xhtml"/>
</rule>
</navigation>
</page>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/artist.xhtml
Index: artist.xhtml
===================================================================
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
template="layout/template.xhtml">
<ui:define name="body">
<h:messages globalOnly="true" styleClass="message"/>
<rich:panel>
<f:facet name="header"><tr:outputText value="#{artist.name} (#{messages[artist.class.name]})" /></f:facet>
<tr:panelPartialRoot>
<h:form>
<tr:panelFormLayout>
<tr:inputText label="Artist" value="#{artist.name}" readOnly="#{not identity.loggedIn}" required="true" autoSubmit="true"/>
<tr:panelLabelAndMessage label="Band Members" rendered="#{artist.class.simpleName eq 'Band'}">
<ul>
<ui:repeat value="#{artist.bandMembers}" var="bandMember">
<li>
<tr:inputText simple="true" value="#{bandMember.name}" readOnly="#{not identity.loggedIn}" id="bandMember"/>
<rich:suggestionbox for="bandMember" selfRendered="true" minChars="3" suggestionAction="#{bandMemberFinder.getBandMembers}" var="bandMember">
<h:column>
<h:outputText value="#{bandMember.name}" />
</h:column>
</rich:suggestionbox>
</li>
</ui:repeat>
</ul>
<f:facet name="end">
<h:commandButton action="#{artistHome.addBandMember}" value="Add Band Member" rendered="#{identity.loggedIn}"/>
</f:facet>
</tr:panelLabelAndMessage>
<tr:panelLabelAndMessage label="Details">
<tr:inputText simple="true" value="#{artist.description}" rendered="#{identity.loggedIn}" rows="4" columns="60" id="description">
<a:support event="onkeyup" reRender="description_preview" requestDelay="3000" ignoreDupResponces="true" eventsQueue="previewQueue" />
</tr:inputText>
<s:div style="width: 300px;" id="description_preview">
<s:formattedText value="#{artist.description}" rendered="#{not empty artist.description}" />
<tr:outputText value="None known" rendered="#{empty artist.description}" />
</s:div>
</tr:panelLabelAndMessage>
<tr:panelLabelAndMessage label="Discs">
<tr:table value="#{artist.discs}" var="disc" rows="5" emptyText="None Known">
<tr:column>
<f:facet name="header">
Disc
</f:facet>
<tr:inputText value="#{disc.name}" readOnly="#{not identity.loggedIn}"/>
</tr:column>
<tr:column>
<f:facet name="header">
Released
</f:facet>
<tr:inputText value="#{disc.release}" readOnly="#{not identity.loggedIn}" columns="5">
<s:convertDateTime pattern="yyyy"/>
</tr:inputText>
</tr:column>
<f:facet name="detailStamp">
<s:div style="width: 300px;">
<s:formattedText value="#{disc.description}" rendered="#{not empty disc.description}" />
<tr:outputText value="None known" rendered="#{empty disc.description}" />
</s:div>
</f:facet>
</tr:table>
<f:facet name="end">
<h:commandButton action="#{artistHome.addDisc}" value="Add Disc" rendered="#{identity.loggedIn}"/>
</f:facet>
</tr:panelLabelAndMessage>
</tr:panelFormLayout>
<tr:panelButtonBar rendered="#{identity.loggedIn}">
<h:commandButton action="#{artistHome.update}" value="Save" rendered="#{artistHome.managed}" />
<h:commandButton action="#{artistHome.persist}" value="Save" rendered="#{not artistHome.managed}" />
<s:button action="cancel" value="Cancel" />
</tr:panelButtonBar>
</h:form>
</tr:panelPartialRoot>
</rich:panel>
</ui:define>
</ui:composition>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/discs.xhtml
Index: discs.xhtml
===================================================================
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:tr="http://myfaces.apache.org/trinidad"
template="layout/template.xhtml">
<ui:define name="body">
<h:messages globalOnly="true" styleClass="message"/>
<rich:panel>
<f:facet name="header">Discs</f:facet>
<tr:panelPartialRoot>
<tr:form>
<tr:table value="#{discs.dataModel}" var="disc" rows="20">
<tr:column sortable="true" sortProperty="disc.name">
<f:facet name="header">
Name
</f:facet>
<s:link action="disc">
<tr:outputText value="#{disc.name}" />
<f:param name="discId" value="#{disc.id}" />
</s:link>
</tr:column>
<tr:column>
<f:facet name="header">
Artist
</f:facet>
<tr:outputText value="#{disc.artist.name}" />
</tr:column>
<f:facet name="detailStamp">
<s:div style="width: 200px">
<s:formattedText value="#{disc.description}" rendered="#{not empty disc.description}" />
<tr:outputText value="None known" rendered="#{empty disc.description}" />
</s:div>
</f:facet>
</tr:table>
<tr:panelButtonBar rendered="#{identity.loggedIn}">
<s:button action="disc" value="Add disc">
<f:param name="discId" value="" />
</s:button>
</tr:panelButtonBar>
</tr:form>
</tr:panelPartialRoot>
</rich:panel>
</ui:define>
</ui:composition>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/home.page.xml
Index: home.page.xml
===================================================================
<!DOCTYPE page PUBLIC
"-//JBoss/Seam Pages Configuration DTD 1.2//EN"
"http://jboss.com/products/seam/pages-1.2.dtd">
<page>
<param name="artistId" value="#{artistHome.id}" converterId="javax.faces.Integer"/>
<param name="discId" value="#{discHome.id}" converterId="javax.faces.Integer"/>
<navigation>
<rule if-outcome="artist">
<begin-conversation flush-mode="manual"/>
<redirect view-id="/artist.xhtml"/>
</rule>
<rule if-outcome="disc">
<begin-conversation flush-mode="manual"/>
<redirect view-id="/disc.xhtml"/>
</rule>
</navigation>
</page>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/disc.xhtml
Index: disc.xhtml
===================================================================
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
template="layout/template.xhtml">
<ui:define name="body">
<h:messages globalOnly="true" styleClass="message"/>
<rich:panel>
<f:facet name="header">
<s:fragment>
<i><tr:outputText value="#{disc.name}" /></i>
<tr:outputText value=" by #{disc.artist.name}" />
</s:fragment>
</f:facet>
<tr:panelPartialRoot>
<tr:form>
<tr:panelFormLayout>
<tr:inputText label="Disc" value="#{disc.name}" readOnly="#{not identity.loggedIn}" required="true" />
<tr:inputText label="Release Date" value="#{disc.release}" readOnly="#{not identity.loggedIn}" columns="5">
<s:convertDateTime pattern="yyyy"/>
</tr:inputText>
<tr:selectOneChoice value="#{disc.artist}" label="Artist" required="true" readOnly="#{not identity.loggedIn}">
<s:selectItems value="#{artists.resultList}" var="artist" label="#{artist.name}" noSelectionLabel="Please Select..." hideNoSelectionLabel="true" />
<s:convertEntity />
</tr:selectOneChoice>
<tr:panelLabelAndMessage label="Details">
<tr:inputText simple="true" value="#{disc.description}" rendered="#{identity.loggedIn}" rows="4" columns="60" id="description">
<a:support event="onkeyup" reRender="description_preview" requestDelay="3000" ignoreDupResponces="true" eventsQueue="previewQueue" />
</tr:inputText>
<s:div style="width: 300px;" id="description_preview">
<s:formattedText value="#{disc.description}" rendered="#{not empty disc.description}" />
<tr:outputText value="None known" rendered="#{empty disc.description}" />
</s:div>
</tr:panelLabelAndMessage>
</tr:panelFormLayout>
<tr:panelButtonBar rendered="#{identity.loggedIn}">
<h:commandButton action="#{discHome.update}" value="Save" rendered="#{discHome.managed}" />
<h:commandButton action="#{discHome.persist}" value="Save" rendered="#{not discHome.managed}" />
<s:button action="cancel" value="Cancel" />
</tr:panelButtonBar>
</tr:form>
</tr:panelPartialRoot>
</rich:panel>
</ui:define>
</ui:composition>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/discs.page.xml
Index: discs.page.xml
===================================================================
<!DOCTYPE page PUBLIC
"-//JBoss/Seam Pages Configuration DTD 1.2//EN"
"http://jboss.com/products/seam/pages-1.2.dtd">
<page>
<param name="discId" value="#{discHome.id}" converterId="javax.faces.Integer"/>
<navigation>
<rule if-outcome="disc">
<begin-conversation flush-mode="manual"/>
<redirect view-id="/disc.xhtml"/>
</rule>
</navigation>
</page>
1.1 date: 2007/04/03 18:32:38; author: pmuir; state: Exp;jboss-seam/examples/seamdiscs/view/artists.xhtml
Index: artists.xhtml
===================================================================
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:tr="http://myfaces.apache.org/trinidad"
template="layout/template.xhtml">
<ui:define name="body">
<h:messages globalOnly="true" styleClass="message"/>
<rich:panel>
<f:facet name="header">Artists</f:facet>
<tr:panelPartialRoot>
<tr:form>
<tr:table value="#{artists.dataModel}" var="artist" rows="20" rowBandingInterval="1">
<tr:column sortable="true" sortProperty="artist.name">
<f:facet name="header">
Name
</f:facet>
<s:link action="artist">
<tr:outputText value="#{artist.name}" />
<f:param name="artistId" value="#{artist.id}" />
</s:link>
</tr:column>
<tr:column>
<f:facet name="header">
Band Members
</f:facet>
<tr:outputText value="Solo performer" rendered="#{artist.class.simpleName eq 'Artist'}" />
<tr:outputText value="None" rendered="#{artist.class.simpleName eq 'Band' and empty artist.bandMembers}" />
<s:fragment rendered="#{artist.class.simpleName eq 'Band' and not empty artist.bandMembers}">
<ul>
<!-- <ui:repeat value="#{artist.bandMembers}" var="bandMember">
<li><tr:outputText value="#{bandMember.name}" /></li>
</ui:repeat>-->
</ul>
</s:fragment>
</tr:column>
<f:facet name="detailStamp">
<s:div style="width: 200px">
<s:formattedText value="#{artist.description}" rendered="#{not empty artist.description}" />
<tr:outputText value="None known" rendered="#{empty artist.description}" />
</s:div>
</f:facet>
</tr:table>
<tr:panelButtonBar rendered="#{identity.loggedIn}">
<s:button action="artist" value="Add artist">
<f:param name="artistId" value="" />
<f:param name="type" value="artist" />
</s:button>
<s:button action="artist" value="Add band">
<f:param name="artistId" value="" />
<f:param name="type" value="band" />
</s:button>
</tr:panelButtonBar>
</tr:form>
</tr:panelPartialRoot>
</rich:panel>
</ui:define>
</ui:composition>
More information about the jboss-cvs-commits
mailing list