Is it possible that only invariant expression bindings are updated in
listener methods for form submissions and invoking direct service urls?

-----Original Message-----
From: Marko Mrkus [mailto:marko.mr...@bumblehood.com] 
Sent: Wednesday, January 20, 2010 2:55 PM
To: 'Tapestry users'
Subject: T4.1.6 Troubles with accessing bindings from async listener method

Hi, all!

 

I have problems with understanding how bindings work in Tapestry when they
are accessed from async listener.

I'm trying to build a List component which takes parameters source, value
and selectedValue. It renders source and updates value as For component.

I would like that users can select one row in List component and that some
components on page are updated and that they use this updated selected
object value.

 

Component specification is:

 

<component-specification class="org.tapestry.example.ListComponent">

            <parameter name="source" />

            <parameter name="value" />

            <parameter name="selectedValue" />

            <parameter name="updateComponents" />

 

            <component id="iterator" type="For">

            <inherited-binding parameter-name="source" name="source" />

            <inherited-binding parameter-name="value" name="value" />

</component>

 

<component id="selectLink" type="DirectLink">

            <binding name="listener" value="listener:changeSelecedObject" />

            <binding name="parameters"
value="ognl:components.get('iterator').index" />

 </component>

 

</component-specification>

 

Java class:

 

package org.tapestry.example;

 

public abstract class ListComponent extends BaseComponents{

            

            public void changeSelectedObject(IRequestCycle cycle) {

                        int indexOfRow =
(Integer)cycle.getListenerParameters[0];

                        Object value = this.getSource().get(indexOfRow);
<----------------- THIS LINE THROWS IndexOutOfBoundsException since
this.getSource() returns empty list.

 

                        this.setSelectedValue(value);

 

                        for (String compId : this.getUpdateComponents) {

 
cycle.getResponseBuilder().updateComponent(compId);

}

}

 

public abstract void getSource(); // Biding accessor for Source parameter

public abstract void getUpdateComponents(); //Biding accessor for Update
Components parameter

public abstract void setSelectedValue(Object objValue);

}

 

I wonder why I'm getting empty list in listener method. Parameter source was
bound with list with 2 items in it and I got there empty list. 

 

Any help is appreciated.

 

Regards,

Marko



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to