[
http://jira.jboss.com/jira/browse/JBSEAM-1661?page=comments#action_12368996 ]
Matt Drees commented on JBSEAM-1661:
------------------------------------
s:decorate is great, definitely. But its usage in seam-gen is still a bit verbose. E.g.
Seam-gen makes this:
<s:decorate id="beginDateDecoration"
template="layout/edit.xhtml">
<ui:define name="label">beginDate</ui:define>
<h:inputText id="beginDate"
maxlength="10"
size="10"
required="true"
value="#{conferenceHome.instance.beginDate}">
<s:convertDateTime type="date"
dateStyle="short" pattern="MM/dd/yyyy"/>
<a:support event="onblur"
reRender="beginDateDecoration"/>
</h:inputText>
<s:selectDate for="beginDate">
<h:graphicImage url="img/dtpick.gif"
style="margin-left:5px"/>
</s:selectDate>
</s:decorate>
<s:decorate id="endDateDecoration"
template="layout/edit.xhtml">
<ui:define name="label">endDate</ui:define>
<h:inputText id="endDate"
maxlength="10"
size="10"
required="true"
value="#{conferenceHome.instance.endDate}">
<s:convertDateTime type="date"
dateStyle="short" pattern="MM/dd/yyyy"/>
<a:support event="onblur"
reRender="endDateDecoration"/>
</h:inputText>
<s:selectDate for="endDate">
<h:graphicImage url="img/dtpick.gif"
style="margin-left:5px"/>
</s:selectDate>
</s:decorate>
In my app, I would have this instead:
<crs:editDate value="#{conferenceHome.instance.beginDate}"
required="true"/>
<crs:editDate value="#{conferenceHome.instance.endDate}"
required="true"/>
This is much less verbose, and it lets you tweak all of your date fields at once (eg.,
changing the parameter for the h:graphicImage)
(my editDate.xhtml uses s:decorate just like seam-gen does, btw. Also, if I don't
specify a label, it generates one from the valueExpression getExpressionString())
You could probably achieve a similar affect using just s:decorate and different types of
templates, e.g:
<s:decorate template="layout/editDate.xhtml">
<ui:param name = "value"
value="#{conferenceHome.instance.beginDate"/>
<ui:param name = "required" value="true"/>
</s:decorate>
<s:decorate template="layout/editDate.xhtml">
<ui:param name = "value"
value="#{conferenceHome.instance.endDate"/>
<ui:param name = "required" value="true"/>
</s:decorate>
Either way, something that could be repeated dozens of times throughout your app should be
as few lines as possible.
Use more templating in seam-gen
-------------------------------
Key: JBSEAM-1661
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1661
Project: JBoss Seam
Issue Type: Feature Request
Affects Versions: 2.0.0.BETA1
Reporter: Matt Drees
Priority: Minor
Seam-gen'ed apps tend to look very copy-pasted, which makes it difficult to tweak
things once created. It'd be nice if it used more templating and/or source tags
(maybe going as far as using Rick Hightower's <a:field fieldName="title"
entity="#{CDManagerBean.cd}" /> tag (see
http://www.ibm.com/developerworks/java/library/j-facelets/index.html and
http://www.ibm.com/developerworks/java/library/j-facelets2.html)).
Also, I think it would be good for people new to JSF to see good patterns in an example
app. The downside is it's more complex, but I think it's worth it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira