You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Graeme Knight <gk...@bluecatnetworks.com> on 2003/06/23 22:13:00 UTC

ListEdit examples...

... anyone got an example of ListEdit (I keep getting an AdapterException so I guess I am doing something wrong).

Many thanks, Graeme.

Re: Conditional Form elements/Stale Link page

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I definitely like the idea of FormConditional, but I don't like the idea 
of letting the developer make a choice between Conditional and 
FormConditional. But also, changing the definition of a basic component 
in beta, I think, would shun away people from using future beta 
versions. May be there should be a FormConditional now that can be 
deprecated and the functionality integrated into Conditional in 3.1.

Thanks
Harish

PS. I really appreciate the opportunity that Tapestry gives its users to 
voice their opinion.


Howard M. Lewis Ship wrote:

>I was thinking about this on the drive home.
>
>First off: shadow variables.  If you want to have:
>
><input jwcid="@Checkbox" selected="ognl:a">
><span jwcid="@Conditional" condition="ognl:a">
>...
></span>
>
>That's a problem.  When the form rewinds, if the user has clicked the checkbox, then the content of
>the conditional either renders or doesn't ... but doesn't
>match the original render.  Fall down, go boom.
>
>Now let's imagine that before we render we set property b to match property a:
>
><input jwcid="@Checkbox" selected="ognl:a">
><span jwcid="@Conditional" condition="ognl:b">
>...
></span>
>
>b shadows a.  As long as we set b properly before we rewind, then the rewind will match the original
>render, even if the user changes property a.
>In the form listener, we update b from a once it is safe.
>
>Thought #1:
>
>How about a FormConditional component?  Similar to the relationship between Foreach and ListEdit.
>On render, the FC reads a, stores it into a hidden field, and renders or doesn't appropriately.
>On rewind, the FC ignores a, reads the stored value, and renders or doesn't appropriately (matching
>the render no matter what).
>
>Thought #2:
>
>Change the Conditional component to do exactly that: if inside a Form then do what I just described
>for FC.
>
>Thought #3:
>
>That's a bigger change than I'm comfortable for in a beta.  I'd still like to do it, but from a
>community sense, I want to put it to a vote.
>
>--
>Howard M. Lewis Ship
>Creator, Tapestry: Java Web Components
>http://jakarta.apache.org/tapestry
>
>
>
>  
>
>>-----Original Message-----
>>From: Eric Schneider [mailto:eric@centralparksoftware.com] 
>>Sent: Wednesday, June 25, 2003 9:01 AM
>>To: Tapestry users
>>Subject: Re: Conditional Form elements/Stale Link page
>>
>>
>>Hi Howard,
>>
>>    
>>
>>>You need to use "shadow variables" to store these 
>>>      
>>>
>>conditionals, such 
>>    
>>
>>>that
>>>      
>>>
>>they don't take effect
>>    
>>
>>>until the form's listener is invoked.
>>>      
>>>
>>Can you elaborate?  I'm not 100% sure what you mean about 
>>"shadow variables".  Are they just additional instance 
>>variables?  Not sure how this has anything to do with the 
>>number of elements in a form.
>>
>>Thanks,
>>Eric
>>
>>----- Original Message -----
>>From: "Howard M. Lewis Ship" <hl...@attbi.com>
>>To: "'Tapestry users'" <ta...@jakarta.apache.org>
>>Sent: Wednesday, June 25, 2003 7:24 AM
>>Subject: RE: Conditional Form elements/Stale Link page
>>
>>
>>    
>>
>>>You have to make the rewind of the form match the initial 
>>>      
>>>
>>form render.
>>    
>>
>>>When you have conditionals in your form, this can be tricky.
>>>
>>>You need to use "shadow variables" to store these 
>>>      
>>>
>>conditionals, such 
>>    
>>
>>>that
>>>      
>>>
>>they don't take effect
>>    
>>
>>>until the form's listener is invoked.
>>>
>>>--
>>>Howard M. Lewis Ship
>>>Creator, Tapestry: Java Web Components 
>>>http//jakarta.apache.org/tapestry
>>>
>>>
>>>
>>>      
>>>
>>>>-----Original Message-----
>>>>From: Eric Schneider [mailto:eric@centralparksoftware.com]
>>>>Sent: Tuesday, June 24, 2003 3:44 PM
>>>>To: tapestry-user@jakarta.apache.org
>>>>Subject: Conditional Form elements/Stale Link page
>>>>
>>>>
>>>>Hi,
>>>>
>>>>I have a stateless form with a radio button group.   The
>>>>radio buttons have
>>>>a onClick event that submits the form.  Based on the users 
>>>>selection, additional form elements are shown (and in some cases 
>>>>suppressed with
>>>>Conditionals).   Unfortunatley, this doesn't work.  When 
>>>>        
>>>>
>>the form is
>>    
>>
>>>>submitted (after selecting a radio button) I always get 
>>>>        
>>>>
>>the "stale 
>>    
>>
>>>>link" page.  The form behaves as expected if I remove the 
>>>>conditionals (which of course this doesn't solve my problem).
>>>>
>>>>Anyone know how I can avoid the problem I'm having?
>>>>
>>>>Thanks in advance,
>>>>Eric
>>>>
>>>>
>>>>
>>>>        
>>>>
>>--------------------------------------------------------------------
>>    
>>
>>>>-
>>>>To unsubscribe, e-mail: 
>>>>        
>>>>
>>tapestry-user-unsubscribe@jakarta.apache.org
>>    
>>
>>>>For additional commands, e-mail: 
>>>>        
>>>>
>>tapestry-user-help@jakarta.apache.org
>>    
>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>    
>>
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: 
>>>      
>>>
>>tapestry-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>


RE: Conditional Form elements/Stale Link page

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
I was thinking about this on the drive home.

First off: shadow variables.  If you want to have:

<input jwcid="@Checkbox" selected="ognl:a">
<span jwcid="@Conditional" condition="ognl:a">
...
</span>

That's a problem.  When the form rewinds, if the user has clicked the checkbox, then the content of
the conditional either renders or doesn't ... but doesn't
match the original render.  Fall down, go boom.

Now let's imagine that before we render we set property b to match property a:

<input jwcid="@Checkbox" selected="ognl:a">
<span jwcid="@Conditional" condition="ognl:b">
...
</span>

b shadows a.  As long as we set b properly before we rewind, then the rewind will match the original
render, even if the user changes property a.
In the form listener, we update b from a once it is safe.

Thought #1:

How about a FormConditional component?  Similar to the relationship between Foreach and ListEdit.
On render, the FC reads a, stores it into a hidden field, and renders or doesn't appropriately.
On rewind, the FC ignores a, reads the stored value, and renders or doesn't appropriately (matching
the render no matter what).

Thought #2:

Change the Conditional component to do exactly that: if inside a Form then do what I just described
for FC.

Thought #3:

That's a bigger change than I'm comfortable for in a beta.  I'd still like to do it, but from a
community sense, I want to put it to a vote.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Eric Schneider [mailto:eric@centralparksoftware.com] 
> Sent: Wednesday, June 25, 2003 9:01 AM
> To: Tapestry users
> Subject: Re: Conditional Form elements/Stale Link page
> 
> 
> Hi Howard,
> 
> > You need to use "shadow variables" to store these 
> conditionals, such 
> > that
> they don't take effect
> > until the form's listener is invoked.
> 
> Can you elaborate?  I'm not 100% sure what you mean about 
> "shadow variables".  Are they just additional instance 
> variables?  Not sure how this has anything to do with the 
> number of elements in a form.
> 
> Thanks,
> Eric
> 
> ----- Original Message -----
> From: "Howard M. Lewis Ship" <hl...@attbi.com>
> To: "'Tapestry users'" <ta...@jakarta.apache.org>
> Sent: Wednesday, June 25, 2003 7:24 AM
> Subject: RE: Conditional Form elements/Stale Link page
> 
> 
> > You have to make the rewind of the form match the initial 
> form render.
> >
> > When you have conditionals in your form, this can be tricky.
> >
> > You need to use "shadow variables" to store these 
> conditionals, such 
> > that
> they don't take effect
> > until the form's listener is invoked.
> >
> > --
> > Howard M. Lewis Ship
> > Creator, Tapestry: Java Web Components 
> > http//jakarta.apache.org/tapestry
> >
> >
> >
> > > -----Original Message-----
> > > From: Eric Schneider [mailto:eric@centralparksoftware.com]
> > > Sent: Tuesday, June 24, 2003 3:44 PM
> > > To: tapestry-user@jakarta.apache.org
> > > Subject: Conditional Form elements/Stale Link page
> > >
> > >
> > > Hi,
> > >
> > > I have a stateless form with a radio button group.   The
> > > radio buttons have
> > > a onClick event that submits the form.  Based on the users 
> > > selection, additional form elements are shown (and in some cases 
> > > suppressed with
> > > Conditionals).   Unfortunatley, this doesn't work.  When 
> the form is
> > > submitted (after selecting a radio button) I always get 
> the "stale 
> > > link" page.  The form behaves as expected if I remove the 
> > > conditionals (which of course this doesn't solve my problem).
> > >
> > > Anyone know how I can avoid the problem I'm having?
> > >
> > > Thanks in advance,
> > > Eric
> > >
> > >
> > > 
> --------------------------------------------------------------------
> > > -
> > > To unsubscribe, e-mail: 
> tapestry-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> > >
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


Re: Conditional Form elements/Stale Link page

Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi Howard,

> You need to use "shadow variables" to store these conditionals, such that
they don't take effect
> until the form's listener is invoked.

Can you elaborate?  I'm not 100% sure what you mean about "shadow
variables".  Are they just additional instance variables?  Not sure how this
has anything to do with the number of elements in a form.

Thanks,
Eric

----- Original Message -----
From: "Howard M. Lewis Ship" <hl...@attbi.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Wednesday, June 25, 2003 7:24 AM
Subject: RE: Conditional Form elements/Stale Link page


> You have to make the rewind of the form match the initial form render.
>
> When you have conditionals in your form, this can be tricky.
>
> You need to use "shadow variables" to store these conditionals, such that
they don't take effect
> until the form's listener is invoked.
>
> --
> Howard M. Lewis Ship
> Creator, Tapestry: Java Web Components
> http://jakarta.apache.org/tapestry
>
>
>
> > -----Original Message-----
> > From: Eric Schneider [mailto:eric@centralparksoftware.com]
> > Sent: Tuesday, June 24, 2003 3:44 PM
> > To: tapestry-user@jakarta.apache.org
> > Subject: Conditional Form elements/Stale Link page
> >
> >
> > Hi,
> >
> > I have a stateless form with a radio button group.   The
> > radio buttons have
> > a onClick event that submits the form.  Based on the users
> > selection, additional form elements are shown (and in some
> > cases suppressed with
> > Conditionals).   Unfortunatley, this doesn't work.  When the form is
> > submitted (after selecting a radio button) I always get the
> > "stale link" page.  The form behaves as expected if I remove
> > the conditionals (which of course this doesn't solve my problem).
> >
> > Anyone know how I can avoid the problem I'm having?
> >
> > Thanks in advance,
> > Eric
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Conditional Form elements/Stale Link page

Posted by "Howard M. Lewis Ship" <hl...@attbi.com>.
You have to make the rewind of the form match the initial form render.

When you have conditionals in your form, this can be tricky.

You need to use "shadow variables" to store these conditionals, such that they don't take effect
until the form's listener is invoked.

--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry



> -----Original Message-----
> From: Eric Schneider [mailto:eric@centralparksoftware.com] 
> Sent: Tuesday, June 24, 2003 3:44 PM
> To: tapestry-user@jakarta.apache.org
> Subject: Conditional Form elements/Stale Link page
> 
> 
> Hi,
> 
> I have a stateless form with a radio button group.   The 
> radio buttons have
> a onClick event that submits the form.  Based on the users 
> selection, additional form elements are shown (and in some 
> cases suppressed with
> Conditionals).   Unfortunatley, this doesn't work.  When the form is
> submitted (after selecting a radio button) I always get the 
> "stale link" page.  The form behaves as expected if I remove 
> the conditionals (which of course this doesn't solve my problem).
> 
> Anyone know how I can avoid the problem I'm having?
> 
> Thanks in advance,
> Eric
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


Conditional Form elements/Stale Link page

Posted by Eric Schneider <er...@centralparksoftware.com>.
Hi,

I have a stateless form with a radio button group.   The radio buttons have
a onClick event that submits the form.  Based on the users selection,
additional form elements are shown (and in some cases suppressed with
Conditionals).   Unfortunatley, this doesn't work.  When the form is
submitted (after selecting a radio button) I always get the "stale link"
page.  The form behaves as expected if I remove the conditionals (which of
course this doesn't solve my problem).

Anyone know how I can avoid the problem I'm having?

Thanks in advance,
Eric


Re: ListEdit examples...

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
I attached some tests I have done using hibernate. Maybe they will help
you start. Note the test I have done to get a stale-link exception.
(which whould have been true if using a Foreach insteat a ListEdit)

Len


On Mon, 2003-06-23 at 23:13, Graeme Knight wrote:
> ... anyone got an example of ListEdit (I keep getting an AdapterException so I guess I am doing something wrong).
> 
> Many thanks, Graeme.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
Marilen Corciovei <le...@nemesisit.rdsnet.ro>

Re: ListEdit examples...

Posted by Bryan Lewis <br...@maine.rr.com>.
> ... anyone got an example of ListEdit (I keep getting an AdapterException
so I guess I am doing something wrong).

There's a ListEdit or two in the vlib example.  Here's another typical case,
an employee list.  I had implemented it with a Foreach, but I can simply
change the component from "@Foreach" to "@ListEdit" and it still works.

<form jwcid="form">
<table>
<span jwcid="@ListEdit" source="ognl:employees" value="ognl:employee">
<tr>
    <td>
        <span jwcid="@Insert" value="ognl:employee.id">employee id</span>
    </td>
    <!-- Other TD's displaying other employee properties... -->
 </span>
</table>
</form>

The java code doesn't do anything special.  The main thing is that the
ListEdit (or Foreach) calls setEmployee() on each row to set the "current"
employee for the row.  The table cells merely display the properties of the
current employee.

    private Map employee;

    public Map[] getEmployees()   { // returns array of data objects }
    public void setEmployee(Map value) { employee = value; }
    public Map getEmployee() { return employee; }

I'm a bit puzzled that you're getting an AdapterException, which doesn't
seem related to the ListEdit.  Maybe something is amiss in retrieving the
data?  Can you display a single object without an exception?