[jboss-cvs] jboss-seam/seam-gen/view ...

Gavin King gavin.king at jboss.com
Tue Nov 7 00:18:58 EST 2006


  User: gavin   
  Date: 06/11/07 00:18:57

  Added:       seam-gen/view   edit.xhtml.ftl list.xhtml.ftl
  Log:
  first cut at reveng templates
  
  Revision  Changes    Path
  1.1      date: 2006/11/07 05:18:57;  author: gavin;  state: Exp;jboss-seam/seam-gen/view/edit.xhtml.ftl
  
  Index: edit.xhtml.ftl
  ===================================================================
  <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <#assign entityName = pojo.shortName>
  <#assign componentName = util.lower(entityName)>
  <#assign homeName = componentName + "Home">
  <#assign masterPageName = entityName + "List">
  
  <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>${entityName}</h1>
      <p>Generated edit page</p>
      
      <h:messages globalOnly="true" styleClass="message"/>
      
      <h:form id="${componentName}">
          <div class="dialog">
          <s:validateAll>
  <#foreach property in pojo.allPropertiesIterator>
  <#if !c2h.isCollection(property) && !c2h.isManyToOne(property)>
              <div class="prop">
                  <span class="name">${property.name}</span>
                  <span class="value">
                      <s:decorate>
  <#if property.equals(pojo.identifierProperty)>
  <#if property.value.identifierGeneratorStrategy == "assigned">
                          <h:inputText id="${property.name}"
                              value="${'#'}{${homeName}.instance.${property.name}}" 
                              disabled="${'#'}{${homeName}.managed}"/>
  </#if>
  <#else>
  <#if property.value.typeName == "date">
  			           <h:inputText id="${property.name}" value="${'#'}{${homeName}.instance.${property.name}}">
  			               <f:convertDateTime type="date" dateStyle="short"/>
  			           </h:inputText>
  <#elseif property.value.typeName == "time">
  			           <h:inputText id="${property.name}" value="${'#'}{${homeName}.instance.${property.name}}">
  			               <f:convertDateTime type="time"/>
  			           </h:inputText>
  <#elseif property.value.typeName == "timestamp">
  			           <h:inputText id="${property.name}" value="${'#'}{${homeName}.instance.${property.name}}">
  			               <f:convertDateTime type="both" dateStyle="short"/>
  			           </h:inputText>
  <#elseif property.value.typeName == "boolean">
  			           <h:selectBooleanCheckbox id="${property.name}"
  			               value="${'#'}{${homeName}.instance.${property.name}}"/>
  <#else>
                          <h:inputText id="${property.name}"
                              value="${'#'}{${homeName}.instance.${property.name}}"/>
  </#if>
  </#if>
                      </s:decorate>
                  </span>
              </div>
  </#if>
  </#foreach>
          </s:validateAll>
          </div>
          <div class="actionButtons">
              <h:commandButton id="save" value="Save" 
                  action="${'#'}{${homeName}.persist}"
                  rendered="${'#'}{!${homeName}.managed}"/>     			  
              <h:commandButton id="update" value="Save" 
                  action="${'#'}{${homeName}.update}"
                  rendered="${'#'}{${homeName}.managed}"/>    			  
              <h:commandButton id="delete" value="Delete" 
                  action="${'#'}{${homeName}.remove}"
                  rendered="${'#'}{${homeName}.managed}"/>
              <s:link id="done" value="Done" linkStyle="button"
                  propagation="end" view="/${masterPageName}.xhtml"/>			  
          </div>
      </h:form>
      
  </ui:define>
  
  </ui:composition>
  
  
  
  1.1      date: 2006/11/07 05:18:57;  author: gavin;  state: Exp;jboss-seam/seam-gen/view/list.xhtml.ftl
  
  Index: list.xhtml.ftl
  ===================================================================
  <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                               "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <#assign entityName = pojo.shortName>
  <#assign componentName = util.lower(entityName)>
  <#assign listName = componentName + "List">
  <#assign pageName = entityName>
  
  <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>${entityName} list</h1>
      <p>Generated list page</p>
      
      <h:messages globalOnly="true" styleClass="message"/>
      
      <h:outputText value="No ${componentName} exists" 
              rendered="${'#'}{empty ${listName}.resultList}"/>
      <h:dataTable id="${listName}" var="${componentName}"
              value="${'#'}{${listName}.resultList}" 
              rendered="${'#'}{not empty ${listName}.resultList}">
  <#foreach property in pojo.allPropertiesIterator>
  <#if !c2h.isCollection(property) && !c2h.isManyToOne(property)>
  		<h:column>
  			<f:facet name="header">${property.name}</f:facet>
  			${'#'}{${componentName}.${property.name}}
  		</h:column>
  </#if>
  <#if c2h.isManyToOne(property)>
  <#assign parentPojo = c2j.getPOJOClass(cfg.getClassMapping(property.value.referencedEntityName))>
  		<h:column>
  			<f:facet name="header">${property.name} ${parentPojo.identifierProperty.name}</f:facet>
  			${'#'}{${componentName}.${property.name}.${parentPojo.identifierProperty.name}}
  		</h:column>
  </#if>
  </#foreach>
          <h:column>
              <f:facet name="header">action</f:facet>
              <s:link id="${componentName}" value="Select" view="/${pageName}.xhtml">
                  <f:param name="${componentName}Id" value="${'#'}{${componentName}.${pojo.identifierProperty.name}}"/>
              </s:link>
          </h:column>
      </h:dataTable>
      
      <div class="actionButtons">
          <s:link id="done" value="Create ${componentName}" linkStyle="button"
              view="/${pageName}.xhtml"/>			  
      </div>
      
  </ui:define>
  
  </ui:composition>
  
  
  
  



More information about the jboss-cvs-commits mailing list