pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Möbius <dmoeb...@scoop-gmbh.de>
Subject Re: Object dereference problem
Date Mon, 23 Aug 2010 09:59:30 GMT
My first thought was that this problem could be solved by using  
<wtkx:define>. Then I realized that there is no way to dereference the  
defined object in a container. Currently the object can only be  
referenced in an attribute. So there's something missing; a  
counterpart to <wtkx:define>. I propose <wtkx:ref>. Example:

   <TableView wtkx:id="view">

   <PushButton buttonData="Load">
       <loadAction:LoadAction table="$view" />
   <wtkx:ref name="$view"/>

Should be easy to implement. What do you think?


Greg Brown <gkbrown@mac.com> wrote:

> Unfortunately, there is no way to refer to a variable in WTKX before  
> you declare it. Like a script, WTKX is processed linearly. In  
> general, this does not cause a problem because you often want to  
> refer to other page variables in an event handler, which isn't  
> evaluated until after the WTKX document has been completely  
> processed. See this thread for more info (WTKX has been renamed to  
> BXML in Pivot 2.0):
> http://mail-archives.apache.org/mod_mbox/pivot-dev/201008.mbox/%3c11FA9F00-043E-4C7F-A54F-0FA609CF5272@mac.com%3e
> As an alternative, you could create a script block at the end of  
> your document that creates the association between the action and  
> the table view. Alternatively, if you use Pivot 2.0, you can use  
> namespace binding to accomplish this:
> <loadAction:LoadAction table="${view}"/>
> Namespace bindings aren't processed until the entire document has been read.
> Greg
> On Aug 22, 2010, at 11:20 AM, adsantos@free.fr wrote:
>> Hi
>> in a TableBox, I have a TableView and a PushButton with an action  
>> that populates
>> the table.
>> The action needs a reference to the table in order to populate it.  
>> My wtkx file
>> looks like this:
>> <TableView wtkx:id="view">
>> ....
>> </TableView>
>> <PushButton buttonData="Load">
>>    <action>
>>      <loadAction:LoadAction table="$view" />
>>    </action>
>> </PushButton>
>> This worked fine. But now, I want the button to be displayed on top of the
>> table, so I declared it in the wtkx file before the table and now following
>> exception is thrown:
>> org.apache.pivot.beans.PropertyNotFoundException: Property "table" does not
>> exist or is read-only.
>> I could work around this problem with a custom TableView class, but  
>> I 'd like to
>> know if there is another way to do it ?
>> Thanks
>> Anton

View raw message