OK. I think I've a nice workaround. I'll use it until the Seam and myFaces
developers worked together to solve this problem ;)
Here it is:
@Stateful
| @Scope(ScopeType.SESSION)
| @LoggedIn
| @Name("testactionDeveloper")
| @Interceptors(SeamInterceptor.class)
| public class TestactionDeveloperAction implements TestactionDeveloper,
Serializable {
| @PersistenceContext(unitName = "aresDatabase")
| private EntityManager em;
|
| @In @Valid
| private User user;
|
| @DataModel(scope=ScopeType.PAGE)
| private List<Testaction> testactions;
| @DataModelSelectionIndex
| private int testactionIndex;
| @DataModelSelection
| private Testaction testaction;
|
| @In(required=false)
| @Out(required=false, scope=ScopeType.SESSION)
| private Testaction currentTestaction;
|
| private List<Testaction> currentTestactions;
| private int currentTestactionIndex;
|
| @In(required=false)
| private Release selectedRelease;
|
| private Long lastSelectedReleaseID;
|
| private transient List<Testcase> testcases;
| private transient List<User> developers;
| private transient List<Revisionclass> revisions;
| private transient List<Release> devReleases;
| private transient List<Buildnumber> devBuilds;
| private transient List<Defectcause> defectCauses;
|
| private boolean renderSaveButtons;
| private String sortColumn = "id";
| private boolean ascending=true;
|
|
| @Factory("testactions")
| public List<Testaction> getTestactions() {
| renderSaveButtons = true;
| if(selectedReleaseChanged() || testactions == null) {
| if(selectedRelease != null) {
| testactions = em.createQuery(
| "from Testaction where
TACT_DEV_USR_ID=:dev and TACT_REL_ID=:rel and (TACT_REV_ID is null or
TACT_REV_ID=9) order by TACT_ID asc"
| ).setParameter("dev",
user.getID()).setParameter("rel", selectedRelease.getID()).getResultList();
| } else {
| testactions = em.createQuery(
| "from Testaction where
TACT_DEV_USR_ID=:dev and (TACT_REV_ID is null or TACT_REV_ID=9) order by
TACT_ID asc"
| ).setParameter("dev",
user.getID()).getResultList();
| }
| lastSelectedReleaseID = (selectedRelease == null) ?
null : selectedRelease.getID();
| }
| Collections.sort(testactions, new
TestactionComparator(sortColumn, ascending));
| return testactions;
| }
|
| public String select() {
| devBuilds = null;
| currentTestaction = testaction;
| currentTestactions = testactions;
| currentTestactionIndex = testactionIndex;
| return "selected";
| }
<t:dataTable value="#{testactions}" var="testaction_var"
renderedIfEmpty="false" sortColumn="#{testactionDeveloper.sortColumn}"
sortAscending="#{testactionDeveloper.ascending}">
| <h:column>
| <f:facet name="header">
| <t:commandSortHeader columnName="id">
| <h:outputText
value="#{ares_messages.label_testaction_ID}" />
| </t:commandSortHeader>
| </f:facet>
| <h:commandLink value="#{testaction_var.ID}"
action="#{testactionDeveloper.select}" />
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <t:commandSortHeader columnName="sev">
| <h:outputText
value="#{ares_messages.label_testaction_SevID}" />
| </t:commandSortHeader>
| </f:facet>
| <h:outputText value="#{testaction_var.sevID}" />
| </h:column>
Just aks if you need more. The @DataModelSelectionIndex now gets the correct
value, but the @DataModelSelection doesn't. But this is not really a problem
since I can retrieve it from the list in the select method. That's what I'll
implement now.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3935014#3935014
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3935014
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user