[jboss-cvs] jboss-seam/trinidad/examples/seamdiscs/view ...

Peter Muir peter at bleepbleep.org.uk
Sun Apr 15 13:45:42 EDT 2007


  User: pmuir   
  Date: 07/04/15 13:45:42

  Added:       trinidad/examples/seamdiscs/view               home.xhtml
                        artists.xhtml discs.xhtml index.html discs.page.xml
                        home.page.xml disc.page.xml error.xhtml login.xhtml
                        login.page.xml artist.page.xml artists.page.xml
                        disc.xhtml artist.xhtml
  Log:
  JBSEAM-757, move Trinidad example to trinidad directory
  
  Revision  Changes    Path
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/examples/seamdiscs/view/home.xhtml
  
  Index: home.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">Welcome to Seam Discs!</f:facet>
      	<p>This application allows you to catalogue your favourite
      	bands, and albums they've released. It uses:</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) &amp; <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>&lt;tr:table /&gt;</code>, 
      	<code>&lt;tr:treeTable /&gt;</code> and <code>&lt;tr:tree /&gt;</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>&lt;tr:panelPartialRoot /&gt;</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>&lt;s:decorate /&gt;</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" rows="#{discs.maxResults}" >
  		    		<tr:column sortable="true" sortProperty="disc.name">
  		    			<f:facet name="header">
  		    				Disc
  		    			</f:facet>
  		    			<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 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>
      	</tr:panelPartialRoot>
      </rich:panel>
      
  </ui:define> 
  </ui:composition>
  
  
  
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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="#{artists.maxResults}" 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>
  
  
  
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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="#{discs.maxResults}">
  		    		<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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/examples/seamdiscs/view/index.html
  
  Index: index.html
  ===================================================================
  <html>
  <head>
    <meta http-equiv="Refresh" content="0; URL=home.seam">
  </head>
  </html>
  
  
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/examples/seamdiscs/view/error.xhtml
  
  Index: error.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"
                  template="layout/template.xhtml">
  
  <ui:define name="body">
  
      <h1>Error</h1>
      <p>Something bad happened :-(</p>
      
      <h:messages styleClass="message"/>
          
  </ui:define> 
  </ui:composition>
  
  
  
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/examples/seamdiscs/view/login.xhtml
  
  Index: login.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"
                  template="layout/template.xhtml">
  
  <ui:define name="body">
      
      <h:messages styleClass="message"/>
      
      <h:form id="login">
      
          <rich:panel>
              <f:facet name="header">Login</f:facet>
      
              <p>Please login using any username and password</p>
          
              <div class="dialog">
                  <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
                      <h:outputLabel for="username">Username</h:outputLabel>
                      <h:inputText id="username" 
                                value="#{identity.username}"/>
                      <h:outputLabel for="password">Password</h:outputLabel>
                      <h:inputSecret id="password" 
                                  value="#{identity.password}"/>
                      <h:outputLabel for="rememberMe">Remember me</h:outputLabel>
                      <h:selectBooleanCheckbox id="rememberMe" 
                                            value="#{identity.rememberMe}"/>
                  </h:panelGrid>
              </div>
                  
          </rich:panel>
              
          <div class="actionButtons">
              <h:commandButton value="Login" action="#{identity.login}"/>
          </div>
            
      </h:form>
  
   </ui:define> 
  </ui:composition>
  
  
  
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/examples/seamdiscs/view/login.page.xml
  
  Index: login.page.xml
  ===================================================================
  <!DOCTYPE page PUBLIC
            "-//JBoss/Seam Pages Configuration DTD 1.2//EN"
            "http://jboss.com/products/seam/pages-1.2.dtd">
  
  <page>
     <navigation from-action="#{identity.login}">
        <rule if="#{identity.loggedIn}">
           <redirect view-id="/home.xhtml"/>
        </rule>
     </navigation>
  </page>
  
  
  1.1      date: 2007/04/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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>
  		    		<s:validateAll>
  			    		<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>
  					</s:validateAll>
  		    	</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/15 17:45:41;  author: pmuir;  state: Exp;jboss-seam/trinidad/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>
  
  
  



More information about the jboss-cvs-commits mailing list