This content has been marked as final.
Show 4 replies
-
1. Re: Accessing param values using Drag n Drop
nbelaevski May 25, 2009 10:21 AM (in response to rubenrjorge)Ruben,
How do you access bean property? There are no drag/drop listeners in the posted code. -
2. Re: Accessing param values using Drag n Drop
rubenrjorge May 26, 2009 1:58 AM (in response to rubenrjorge)nbelaevski, my drop component is defined as:
<h:form style="margin-bottom:0;"> <rich:dropSupport id="dropSupportTable" acceptedTypes="attribute,level,measure" dropListener="#{SessionBean.processDropSupportTable}"></rich:dropSupport> ... </h:form>
Then in my bean I have the respective method://dropped item processors public void processDropSupportTable(DropEvent dropEvent) { if (dropEvent.getDragType().compareTo("measure") == 0) { SOLAPMeasure dragged = (SOLAPMeasure)dropEvent.getDragValue(); System.out.println("dropped: " + dragged.getId() + " named: " + dragged.getName() + " whose operator is: " + tempAggOp); } }
I can access the object's properties (getId() and getName()) perfectly, but tempAggOp (the extra parameter) is firstly null and then it always has the value of the previous dragged object. -
3. Re: Accessing param values using Drag n Drop
ilya_shaikovsky May 26, 2009 4:52 AM (in response to rubenrjorge)try to use just f:param and take the parameter from request map yourself. probably this is just an common issue with action listeners. action param works as action listener so it fired just after parent component listener (works as declared in JSF spec)
-
4. Re: Accessing param values using Drag n Drop
rubenrjorge May 26, 2009 5:51 AM (in response to rubenrjorge)Thank you very much ilya_shaikovsky. I did that and got it to work, here's the final code if anyone comes by with the same problem:
On the drag support component:<rich:dragSupport dragIndicator=":indicator" dragType="measure" dragValue="#{measure}"> <f:param name="operator" value="#{aggOp}" /> <rich:dndParam name="label" value="#{measure.name} (#{aggOp})"/> </rich:dragSupport>
On the backing bean://dropped item processors public void processDropSupportTable(DropEvent dropEvent) { if (dropEvent.getDragType().compareTo("measure") == 0) { SOLAPMeasure dragged = (SOLAPMeasure)dropEvent.getDragValue(); FacesContext context = FacesContext.getCurrentInstance(); Map requestMap = context.getExternalContext().getRequestParameterMap(); String tempAggOp = (String)requestMap.get("operator"); System.out.println("dropped: " + dragged.getId() + " named: " + dragged.getName() + " whose operator is: " + tempAggOp); } }
Thank you again.