seam-gen does not handle wire correctly on edit for creation
------------------------------------------------------------
Key: JBSEAM-3686
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3686
Project: Seam
Issue Type: Bug
Components: Tools
Affects Versions: 2.1.0.GA
Environment: Hibernate, Richfaces
Reporter: Valerie Griffin
I've got a seam-gen'd project with quite a few foreign keys. Some of the foreign
keys are used to create composite primary keys. The related entities are, quite
appropriately, used in the generated ...Home.isWired method as:
public boolean isWired() {
if (getInstance().getSsoApplication() == null)
return false;
return true;
}
The ...Edit.xhtml code includes a save button appropriate for new entries:
<h:commandButton id="save"
value="Save"
action="#{appPermissionHome.persist}"
disabled="#{!appPermissionHome.wired}"
rendered="#{!appPermissionHome.managed}"/>
It is valid for the save button to be enabled only when the underlying component has been
wired, but the generated xhtml does not actually cause anything to become wired! It
includes:
<s:decorate id="appNameField"
template="layout/edit.xhtml">
<ui:define name="label">App name</ui:define>
<h:inputText id="appName"
disabled="#{appPermissionHome.managed}"
required="true"
size="20"
maxlength="20"
value="#{appPermissionHome.instance.id.appName}">
<a:support event="onblur"
reRender="appNameField" bypassUpdates="true"
ajaxSingle="true"/>
</h:inputText>
</s:decorate>
The a:support property reRender needs to include ",save" to force the button to
decide whether or not it needs to be enabled. The bypassUpdates property needs to be
"false" (yay forced updates!) to force the update that isWired checks.
I don't know for certain that this is enough to fix the problem because i changed my
actual code to use a dropdown (h:selectOneMenu with s:selectItems and s:convertEntity)
connected to the instance. To make that work, I added code to update id.appName in the
entity's setSsoApplication method.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira