On Mon, Feb 15, 2010 at 3:21 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Mon, 15 Feb 2010 03:51:08 -0200, Nathan Kopp <nathan0...@nathankopp.com>
> wrote:
>
>  This looks like a bug in your code, most probably by working in a T4-ish
>>> way in T5.
>>>
>>
>> Well, it's certainly a "bug" in that I'm trying to do something that T5
>> doesn't seem to handle out-of-the-box.
>>
>
> I disagree. A bug is something that doesn't work like it should. In this
> case, it could be the lack of a feature, not a bug. Or just lack of T5
> experience. :)


I have to laugh at the miscommunication happening here.  Otherwise I'd get
frustrated.  I was not trying to say it was a bug in Tapestry.  It's a "bug
in my code" in the fact that I'm trying to use a nonexistent feature.  And
I'm NOT suggesting that T5 should replay loops like T4.  Tapestry has moved
beyond that and I have too.  I am fully aware that Tapestry has introduced a
number of other features (page activation context, action context, and
formState) to take the place of replaying loops.  I just haven't found the
"thing" that handles this particular use case.  It actually might be there
but I just don't know.  I do have a lack of T5 experience, as you point out.
 So I am asking to see if anyone on this forum can help me to discover what
I'm missing.

Please don't get defensive and think that I'm blaming T5.  I really like T5.
 But I need to get my code to work.


>
>  First, I need to rely on a loop variable.  Period.  The component exists
>> in the context of one iteration of the loop.  Without the loop variable, the
>> component wouldn't need to exist.
>>
>
> I didn't meant to remove the loop variable, just not using it when handling
> events.


And how do you propose I do that?  I'm NOT using the loop variable for
handling events in my Java code.  The NPE is happening not in my code but
rather in the middle of T5's processing of the component tree and handling
parameter bindings in preparation for triggering the event from th
eventlink.  I'm using the loop variable inside the TML file as part of
passing a parameter to a component.  There's no way around that, as far as I
can see, though I am open to suggestions.


>
>  I'll rephrase my problem like this: "I
>> need to rely on the loop variable, but it is null when tapestry processes
>> the click from the eventlink, so I need to find a way to make it not null
>> while tapestry processes that eventlink click... and specifically make it
>> equal the a value for a specific iteration through the loop... the
>> iteration that was occurring at the time the eventlink was being rendered."
>>
>
> You'll won't have a nice solution for that because, in an event request,
> the loop is not rerendered, so the loop variable is not set. That's how T5
> works. You need to find the solution in another way, most probably using the
> context of an EventLink.
>

As stated before, the context for the eventlink doesn't seem to solve the
problem.  I already tried.  My event method isn't even being reached,
because the NPE happens in the middle of Tapestry's code (parameter binding)
before Tapestry can get a chance to fire my event.  I need to find a way to
make the variable NOT NULL so that Tapestry is able to process all of the
necessary parameter bindings so that it can fire my event... only then can I
start thinking about the action context for the eventlink.


>
>  3) context for eventlink, actionlink, and form;
>> #3 wont' work because my loop is not happening at the evenlink level, but
>> rather at an intermediate level
>>
>
> There's no such thing as an EventLink level. Events bubble from inside to
> outside. Just pass all the needed info in the context. Inside your
> component, create an event handler method for the event.
>

Understood.  That's what I meant to say... "the level of the component into
which the EventLink is placed"... but that was really long so I wrote
"eventlink level" instead.  I already tried this suggestion and it didn't
work.  Trust me, please.  I really did try all of these things with real
code before saying that they didn't work.  I'm not just assuming that they
won't work... I actually really did try them all.  :-)


> And don't forget that the EventLink context is independent from the page
> activation context. ComponentEventRequestParameters has two contexts: the
> page one (getPageActivationContext) and the event one ().


Understood.  That's why I mentioned both (#2 and #3) separately.  I'm well
aware that they are separate.

Please don't misunderstand the tone here... I am extremely grateful for the
desire to help me find a solution.  I love the fact that Tapestry has a
great community of users who are willing to give time to help.  But I do
know at least a bit of what I'm talking about.  I'm not looking for an RTFM
answer.  I've already read the manuals.  I've read some of the JavaDocs.
 I've read tutorials.  I've even looked at Tapestry's internal source code.
 I understand the concepts of T5 and how they differ from T4.  But none of
that has yet helped me get past *this* problem.  There might be a built-in
solution and I just am missing some setting or a different way of
approaching the problem.  That's what I'm asking for.

-Nathan

Reply via email to