[jboss-cvs] jboss-seam/examples/ui/view ...
Peter Muir
peter at bleepbleep.org.uk
Thu Mar 22 09:07:18 EDT 2007
User: pmuir
Date: 07/03/22 09:07:18
Modified: examples/ui/view index.xhtml selectItems.xhtml
index.html
Added: examples/ui/view fragment.xhtml decorateField.xhtml
template.xhtml formattedText.xhtml
Log:
Fix selectItems, add other tags, add commented config for running on RI
Revision Changes Path
1.3 +7 -20 jboss-seam/examples/ui/view/index.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: index.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/ui/view/index.xhtml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- index.xhtml 10 Mar 2007 19:09:36 -0000 1.2
+++ index.xhtml 22 Mar 2007 13:07:18 -0000 1.3
@@ -1,26 +1,13 @@
<!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"
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
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:s="http://jboss.com/products/seam/taglib"
+ template="template.xhtml"
>
-<head>
-<title>UI Example</title>
-<ui:debug id="debug" />
-</head>
-
-<body>
- <h1>UI Example</h1>
- <h2>This example shows off some the Seam UI Tags</h2>
- <ul>
- <li>
- <s:link view="/selectItems.xhtml" propagation="join">
- <code>s:selectItems</code>
- <f:param name="personId" value="1" />
- </s:link>
- </li>
- </ul>
-</body>
-
-</html>
\ No newline at end of file
+ <ui:param name="tagName" value="" />
+ <ui:define name="body">
+ <p>Seam ui components</p>
+ </ui:define>
+</ui:composition>
\ No newline at end of file
1.13 +46 -69 jboss-seam/examples/ui/view/selectItems.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: selectItems.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/ui/view/selectItems.xhtml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- selectItems.xhtml 18 Mar 2007 04:21:10 -0000 1.12
+++ selectItems.xhtml 22 Mar 2007 13:07:18 -0000 1.13
@@ -1,29 +1,12 @@
-<!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"
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
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:s="http://jboss.com/products/seam/taglib">
-<head>
-<title>SelectItems example</title>
-<ui:debug id="debug" />
-<style>
- .required {font-weight:bold; color:red; vertical-align:super}
- .labels {width:170px; float:left; text-align:right; font-weight: bold; clear:both}
- .help {width:170px; float:left; text-align:right; clear:left}
- .inputs {width:420px; float:right; text-align:left; clear:right}
- .message {width:420px; float:right; text-align:left; clear:right}
- .row {width:600px}
- .row .inputs, .row .labels {margin-top:6px; margin-bottom:2px}
- .help, .message {font-size:small; color:grey}
- .error {color:red}
- .error span {color:red}
- .error span input, .error span select {border-color:red}
-</style>
-</head>
-
-<body>
- <h1><code>s:selectItems</code></h1>
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ template="template.xhtml"
+ >
+ <ui:param name="tagName" value="s:selectItems" />
+ <ui:define name="body">
<p>This example shows example usage of the <code>s:selectItems</code> tag being used for CRUD on a <code>Person</code> entity.</p>
<p>The example also uses:</p>
<ul>
@@ -37,66 +20,61 @@
</ul>
<h:form>
-
- <s:decorateAll labelColumnClass="labels"
- fieldColumnClass="inputs"
- descriptionColumnClass="help"
- messageColumnClass="message"
- rowErrorClass="error"
- rowClass="row">
-
- <f:facet name="message"><s:message/></f:facet>
- <f:facet name="afterLabel">:</f:facet>
- <f:facet name="afterInvalidLabel">:</f:facet>
- <f:facet name="beforeRequiredLabel">
- <s:span styleClass="required">∗</s:span>
- </f:facet>
-
+ <s:decorate template="decorateField.xhtml">
+ <ui:define name="label">Title</ui:define>
<h:selectOneMenu value="#{person.honorific}">
- <f:facet name="label">Title</f:facet>
- <s:selectItems value="#{honorifics}" var="honorific" label="#{honorific.label}"/>
+ <s:selectItems value="#{honorifics}" var="honorific" label="#{honorific.label}" noSelectionLabel="Please select" />
<s:convertEnum />
</h:selectOneMenu>
+ </s:decorate>
- <h:inputText value="#{person.name}" required="true">
- <f:facet name="label">Name</f:facet>
- <f:facet name="description">Enter your name as it appears on your passport</f:facet>
- </h:inputText>
-
- <h:selectOneMenu value="#{person.continent}" required="true">
- <f:facet name="label">Continent of Birth</f:facet>
+ <s:decorate template="decorateField.xhtml">
+ <ui:define name="label">Name</ui:define>
+ <ui:define name="description">Enter your name as it appears on your passport</ui:define>
+ <h:inputText value="#{person.name}" required="true" />
+ </s:decorate>
+
+ <s:decorate template="decorateField.xhtml">
+ <ui:define name="label">Continent of Birth</ui:define>
+ <h:selectOneMenu value="#{personHome.instance.continent}" required="true" id="continent">
<s:selectItems value="#{continents.resultList}" var="continent" label="#{continent.name}" noSelectionLabel="Please Select..."/>
<s:convertEntity />
</h:selectOneMenu>
+ </s:decorate>
- <h:selectOneRadio value="#{person.country}" required="true" disabled="#{empty person.continent}">
- <f:facet name="label">Country of Birth</f:facet>
- <s:selectItems value="#{person.continent.countries}" var="country" label="#{country.name} (#{country.continent.name})" noSelectionLabel="Please Select..." hideNoSelectionLabel="true"/>
+ <s:decorate template="decorateField.xhtml" id="countryDecorate">
+ <ui:define name="label">Country of Birth</ui:define>
+ <h:selectOneRadio value="#{personHome.instance.country}" required="true" disabled="#{empty person.continent}">
+ <s:selectItems value="#{personHome.instance.continent.countries}" var="country" label="#{country.name} (#{country.continent.name})" noSelectionLabel="Please Select..." hideNoSelectionLabel="true"/>
<s:convertEntity />
</h:selectOneRadio>
+ </s:decorate>
+ <s:decorate template="decorateField.xhtml">
+ <ui:define name="label">Age</ui:define>
+ <ui:define name="description">The age list is an array of primitives</ui:define>
<h:selectOneMenu value="#{person.age}" converter="#{converters.ageConverter}">
- <f:facet name="label">Age</f:facet>
- <f:facet name="description">The age list is an array of primitives</f:facet>
<s:selectItems value="#{ages}" var="age" label="#{age}" />
</h:selectOneMenu>
+ </s:decorate>
- <h:selectManyListbox value="#{person.favouriteColours}" >
- <f:facet name="label">Favourite Colours</f:facet>
- <f:facet name="description">A colour is an entity</f:facet>
+ <s:decorate template="decorateField.xhtml">
+ <ui:define name="label">Favourite Colours</ui:define>
+ <ui:define name="description">A colour is an entity</ui:define>
+ <h:selectManyListbox value="#{personHome.instance.favouriteColours}" >
<s:selectItems value="#{colours.resultList}" var="colour" label="#{colour.name}" />
<s:convertEntity />
</h:selectManyListbox>
+ </s:decorate>
+ <s:decorate template="decorateField.xhtml">
+ <ui:define name="label">Favourite Book</ui:define>
+ <ui:define name="description">A book has a composite key</ui:define>
<h:selectOneListbox value="#{person.favouriteBook}" >
- <f:facet name="label">Favourite Book</f:facet>
- <f:facet name="description">A book has a composite key</f:facet>
<s:selectItems value="#{books.resultList}" var="book" label="#{book.name} by #{book.author} (#{book.nationality})" />
<s:convertEntity />
</h:selectOneListbox>
-
- </s:decorateAll>
-
+ </s:decorate>
<h:commandButton value="Apply" action="#{personHome.update}">
<s:conversationPropagation type="join" />
</h:commandButton>
@@ -104,6 +82,5 @@
<p><s:link view="/index.xhtml" propagation="end">Back to index</s:link></p>
</h:form>
-</body>
-
-</html>
\ No newline at end of file
+</ui:define>
+</ui:composition>
\ No newline at end of file
1.2 +1 -1 jboss-seam/examples/ui/view/index.html
(In the diff below, changes in quantity of whitespace are not shown.)
Index: index.html
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/ui/view/index.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- index.html 29 Jan 2007 23:52:49 -0000 1.1
+++ index.html 22 Mar 2007 13:07:18 -0000 1.2
@@ -1,5 +1,5 @@
<html>
<head>
- <meta http-equiv="Refresh" content="0; URL=index.jsf">
+ <meta http-equiv="Refresh" content="0; URL=index.seam">
</head>
</html>
\ No newline at end of file
1.1 date: 2007/03/22 13:07:18; author: pmuir; state: Exp;jboss-seam/examples/ui/view/fragment.xhtml
Index: fragment.xhtml
===================================================================
<!DOCTYPE html 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:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib"
template="template.xhtml"
>
<ui:param name="tagName" value="s:fragment" />
<ui:define name="body">
<p>A non-rendering component useful for enabling/disabling rendering of it's children.</p>
<p><s:fragment rendered="true">This fragment is rendered</s:fragment> whilst <s:fragment rendered="false">this one isn't</s:fragment></p>
</ui:define>
</ui:composition>
1.1 date: 2007/03/22 13:07:18; author: pmuir; state: Exp;jboss-seam/examples/ui/view/decorateField.xhtml
Index: decorateField.xhtml
===================================================================
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib">
<div class="entry">
<s:label styleClass="label #{invalid?'errors':''}">
<ui:insert name="label"/>
<s:span styleClass="required" rendered="#{required}">*</s:span>
</s:label>
<span class="input #{invalid?'errors':''}">
<s:validateAll>
<ui:insert/>
</s:validateAll>
</span>
<s:message styleClass="error errors"/>
</div>
</ui:composition>
1.1 date: 2007/03/22 13:07:18; author: pmuir; state: Exp;jboss-seam/examples/ui/view/template.xhtml
Index: template.xhtml
===================================================================
<html xmlns="http://www.w3.org/1999/xhtml"
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:s="http://jboss.com/products/seam/taglib">
<head>
<title>UI Example: #{tagName}</title>
<style>
.label {
font-weight: bold;
color: #5E5147;
}
.errors {
font-size: small;
font-weight: bold;
text-align: center;
color: #600;
}
.errors div {
text-align: left;
}
.errors span {
text-align: left;
}
.errors input {
border: 1px solid #600;
}
.errors ul {
list-style: none;
}
.entry {
padding-top: 10px;
}
.entry .label {
float: left;
padding-right: 5px;
font-weight: bold;
width: 150px;
text-align: right;
}
.entry .output {
width: 360px;
padding-top: 10px;
text-align: left;
}
.entry .input {
width: 360px;
text-align: left;
}
.entry .error {
width: 360px;
text-align: left;
}
</style>
<ui:debug id="debug" />
</head>
<body>
<s:div style="width: 200px; float: left; padding: 10px; height: 100%">
<ul>
<li><s:link view="/selectItems.xhtml" propagation="join">
<code>s:selectItems</code>
<f:param name="personId" value="1" />
</s:link></li>
<li><s:link view="/fragment.xhtml" propagation="none">
<code>s:fragment</code>
</s:link></li>
<li><s:link view="/formattedText.xhtml" propagation="none">
<code>s:formattedText</code>
<f:param name="personId" value="1" />
</s:link></li>
</ul>
</s:div>
<s:div>
<h1><code><h:outputText value="#{tagName}" /></code></h1>
<ui:insert name="body" />
</s:div>
</body>
</html>
1.1 date: 2007/03/22 13:07:18; author: pmuir; state: Exp;jboss-seam/examples/ui/view/formattedText.xhtml
Index: formattedText.xhtml
===================================================================
<!DOCTYPE html 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:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.com/products/seam/taglib"
template="template.xhtml"
>
<ui:param name="tagName" value="s:formattedText" />
<ui:define name="body">
<p>Output Seam Text:</p>
<p>In his/her spare time, <h:outputText value="#{person.name}"/> <s:formattedText value="#{person.hobbies}" /></p>
</ui:define>
</ui:composition>
More information about the jboss-cvs-commits
mailing list