This content has been marked as final.
Show 3 replies
-
1. Problem with dropTarget inside a4j:repeat/dataTable
ilya_shaikovsky Apr 21, 2011 3:51 AM (in response to mausbull)please provide sources.
-
2. Problem with dropTarget inside a4j:repeat/dataTable
mausbull Apr 21, 2011 4:16 AM (in response to ilya_shaikovsky)Hi Ilya,
I'll try to create a testcase for that. Currently, the page + beans are too intertwined.
-
3. Re: Problem with dropTarget inside a4j:repeat/dataTable
mausbull Apr 22, 2011 5:54 AM (in response to mausbull)Hi,
took me a bit to break it down but now I have an example that shows the described behavior:
When I load the page (simple.xhtml) with a fresh session and select the first item in the h:selectOneMenu the two drag and drop lists get rendered as expected but on subsequent selections nothing is rendered anymore (when I change the selection).
However, when I reload the page everything works as expected and the different lists appear according to the selected item.
After clearing the session the bug occurs again.
Code:
simple.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <f:view contentType="text/html" 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:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> <html> <h:head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </h:head> <h:body> <div id="main" style="padding: 20px;"> <h:form> <a4j:region> <h:selectOneMenu id="runMenu" styleClass="alfredComboBoxLarge" value="#{simple.selection}"> <f:selectItems value="#{simple.upperSelection}" var="mySel" itemLabel="#{mySel}" itemValue="#{mySel}"> </f:selectItems> <a4j:ajax render="dnd" execute="@region" /> </h:selectOneMenu> </a4j:region> </h:form> <rich:panel id="dnd" header="dndTest" > <div style="float: left; border: solid; padding: 5px;"> <a4j:repeat value="#{simple.dragList}" var="drag"> <a4j:outputPanel layout="block" styleClass="alfredPrepSampleDrag" > #{drag} <rich:dragSource type="myType" dragValue="#{drag}" /> </a4j:outputPanel> </a4j:repeat> </div> <div style="float: left; border: solid; padding: 5px; margin-left: 10px;"> <a4j:repeat value="#{simple.dropList}" var="drop"> <a4j:outputPanel layout="block" styleClass="alfredPrepSampleDrag" > #{drop} <rich:dropTarget acceptedTypes="@all" dropValue="#{drop}" dropListener="#{simpleDropController.processDrop}" render="dnd" /> </a4j:outputPanel> </a4j:repeat> </div> <div style="clear:both" /> </rich:panel> </div> </h:body> </html> </f:view>
Simple.java
import java.util.ArrayList; import java.util.List; import javax.ejb.Stateful; import javax.faces.bean.SessionScoped; import javax.inject.Named; /** * Simple bean for testing richfaces dnd */ @Named @Stateful @SessionScoped public class Simple { private List<String> upperSelection; private String selection; private List<String> dragsFirst; private List<String> dragsSecond; private List<String> dropsFirst; private List<String> dropsSecond; public Simple() { this.upperSelection = new ArrayList<String>(); upperSelection.add("first"); upperSelection.add("second"); //First dragsFirst = new ArrayList<String>(); dragsFirst.add("drags_first_1"); dragsFirst.add("drags_first_2"); dragsFirst.add("drags_first_3"); dropsFirst = new ArrayList<String>(); dropsFirst.add("drops_first_1"); dropsFirst.add("drops_first_2"); dropsFirst.add("drops_first_3"); //Second dragsSecond = new ArrayList<String>(); dragsSecond.add("drags_second_1"); dragsSecond.add("drags_second_2"); dragsSecond.add("drags_second_3"); dropsSecond = new ArrayList<String>(); dropsSecond.add("drops_second_1"); dropsSecond.add("drops_second_2"); dropsSecond.add("drops_second_3"); } public List<String> getDragList() { if (selection == null) return null; if (selection.equals("first")) { return dragsFirst; } else { return dragsSecond; } } public List<String> getDropList() { if (selection == null) return null; if (selection.equals("second")) { return dropsFirst; } else { return dropsSecond; } } //GETTER SETTERS (excluded here) }
Thanks for your help
Stephan