Jochen,

just a short mail;
see here for some infos on findComponent():
http://weblogs.java.net/blog/jhook/archive/2006/02/new_feature_for.html

-Matthias

On 12/5/06, Böhringer Jochen <[EMAIL PROTECTED]> wrote:
Hello,



I am developing custom components to support drag and drop. This components are 
based on the Trinidad PPR capabilities and Dojo for the drag and drop 
rendering. I have one Draggable component and a DropZone component. If a 
Draggable component is dropped on a DropZone component the client side 
Javascript executes a _adfspu() call which contains the draggable's client id 
and the dropzone's client id. The decode method in my DropZoneRenderer parses 
the draggable's id from the request and tries to find the corresponding 
component via UIXComponentBase#findComponent(id).



But if I place my Draggable inside a TreeTable the generated clientIds contain 
a digit to express the row of the table the Draggable is part of:



e.g.:
_id25:treeTableId:0:_id40
_id25:treeTableId:1:_id40
_id25:treeTableId:2:_id40

I prepend a NamingContainer.SEPARATOR_CHARACTER to advice the findComponent() 
method that the id is an absolute one:

:_id25:treeTableId:0:_id40
:_id25:treeTableId:1:_id40
:_id25:treeTableId:2:_id40


But my findComponet call fails with the exception below. If I debug the 
findComponent method I can see, that the the UIXComponentBase#_findInsideOf() 
method can't find the digit ids inside the naming container of my treetable. Is 
there another possibility to get Access to my draggable component from inside 
my dropzone Renderer? And is the behaviour of UIXComponentBase.findComponent a 
bug or a known limitation?



As additional info: Even if I omit the prepended SEPERATOR_CHARACTER the 
findComponent method fails with the same exception but a little bit different 
stack trace.



java.lang.IllegalArgumentException

      at 
org.apache.myfaces.trinidad.component.UIXComponentBase.findComponent(UIXComponentBase.java:450)

      at 
org.apache.myfaces.trinidad.component.UIXComponentBase.findComponent(UIXComponentBase.java:451)

      at 
org.apache.myfaces.trinidad.component.UIXComponentBase.findComponent(UIXComponentBase.java:451)

      at 
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.DropZoneRenderer.decode(DropZoneRenderer.java:152)

      at 
org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1011)



my decode method:



      @Override

      public void decode(FacesContext context, UIComponent component) {

            if (component.isRendered()) {

                  DropZone dropZone = (DropZone) component;

                  Map<String, String> parameterMap = 
context.getExternalContext()

                             .getRequestParameterMap();



                  String source = parameterMap.get("source");

                  String clientId = component.getClientId(context);

                  String draggableClientId = 
parameterMap.get("draggableClientId");



                  if (draggableClientId != null && draggableClientId.length() > 
0) {

                        Draggable draggable = (Draggable) component

                                   .findComponent(draggableClientId);



                        if ((source != null) && source.equals(clientId)) {

                             new DragAndDropEvent(component, draggable, 
dropZone)

                                         .queue();

                             System.out.println("Action event queued for value: 
"

                                         + dropZone.getValue());

                             if (getPartialSubmit(getFacesBean(component))) {

                                   
PartialPageUtils.forcePartialRendering(context);

                             }

                        }

                  }

            }

      }



Regards

Jochen





--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Reply via email to