You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mark Stang <ms...@pingidentity.com> on 2005/08/12 20:45:07 UTC

RE: Remove Objects from a List

I think what you want to do is use the Submit Listener.
Frame.html:
<input jwcid="@Submit" label="Next >" type="submit" selected="ognl:submitListener" tag="ognl:listeners.onNext"/>

Frame.java
In my page class:

public abstract class Frame
    extends BasePage
{
    public abstract IActionListener getSubmitListener();
    public abstract void setSubmitListener(IActionListener listener);

    public void onNext(IRequestCycle cycle)
    {
    }

    public void formListener(IRequestCycle cycle)
    {
        IActionListener submitListener = getSubmitListener();

        // then do the Frame listener
        if (submitListener != null)
        {
            submitListener.actionTriggered(null, cycle);
            submitListener = null;
        }
        
    }

}

This implementation should call onNext() after Tapestry is done doing all of its stuff.
If you step through the "actionTriggered" method you will see that it is executing a Method call to whatever button you selected.   Besides Next, I also have Previous, Cancel and Save.

HTH,

Mark

-----Original Message-----
From: Mathias.Herkt@sqs.de [mailto:Mathias.Herkt@sqs.de]
Sent: Mon 6/13/2005 1:15 AM
To: tapestry-user@jakarta.apache.org
Subject: AW: Remove Objects from a List
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

Jean Tremblay wrote:
> [...]
> This error would occur with normal collections if you try to
> remove items while iterating over it.
> 
> You must use the iterator.remove().
> http://java.sun.com/j2se/1.5.0/docs/api/java/util/ConcurrentMo
> dificationException.html 
> 
I know that there is a problem if one remove an object from a List at the
same time if I would iterate of it. But I didn't touch the List. The Problem
is that tapestry somehow iterate over the List at the same time, as my
button listener is active. I fixed the problem, now i just mark the element
in the button listener method and remove the object in the Form listner. I
don't think that this is a good solution, but it works.

Thanks for help.


> On 6/9/05, Robert Zeigler <ro...@scazdl.org> wrote:
>> I'm not sure what you're trying to accomplish, but...
>> it you might try looking at the palette component (in the contrib
>> library). You give a list of available options (through a property
>> selection model), and the user can add or remove "selected" options
>> to a list... 
>> 
>> Robert
>> 
>> Mathias.Herkt@sqs.de wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>> 
>>> Hi,
>>> 
>>> i'm a little bit confused. I have a List with some Objects, depended
>>> on what the user chose. The User can add more Objects to this List
>>> with a PropertySelection and a button. That works fine.
>>> 
>>> <property-specification name="chosenProjects1"
>>> type="java.util.List" persistent="yes"/> (getter and setter are
>>> abstract) 
>>> 
>>> <component id="addProj1" type="Submit">
>>>       <binding name="listener" expression="listeners.addProj1"/>
>>>       <static-binding name="label" value="Hinzufuegen"/>
>>> </component> 
>>> 
>>> I'd like to delete also some Objects from the List with a button.
>>> The application can delete the object from the List, but if it's not
>>> the last object in the List, i get an
> java.util.ConcurrentModificationException.
>>> 
>>> <component id="eachProjects1" type="Foreach">
>>>       <binding name="source" expression="chosenProjects1"/>
>>>       <binding name="value" expression="projectAccess"/>
>>>       <static-binding name="element" value="div"/> </component>
>>> 
>>> <component id="delProj1" type="Submit">
>>>       <binding name="listener" expression="listeners.delProj1"/>
>>>       <binding name="tag" expression="projectAccess"/>
>>>       <binding name="selected" expression="delProject1"/>
>>>       <static-binding name="label" value="Entfernen"/> </component>
>>> 
>>> Does anyone can help me with that problem?
>>> 
>>> Best Regards,
>>> 
>>> Mathias
>>> 
>>> - --
>>> Mathias Herkt (Diplomand)    | SQS Software Quality Systems AG
>>>                              | Stollwerckstrasse 11
>>> Phone:+49 2203/9154-7110     | D-51149 Cologne, GERMANY
>>> Fax:+49 2203/9154-15         | http://www.sqs.de
>>> 
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.1 (MingW32)
>>> 
>>> iD8DBQFCqBlT8hWAS3IShqURAiM8AJ4zn4hbpLzfHg1uRs5qpJWoybfhZACfSd+s
>>> M4Qcn8HFKXop3UTjgxfoc2o= =5P/p
>>> -----END PGP SIGNATURE-----
>>> 

Mit freundlichen Grüßen

- -- 
Mathias Herkt (Diplomand)     | SQS Software Quality Systems AG
                              | Stollwerckstrasse 11
Phone:+49 2203/9154-7110      | D-51149 Köln
Fax:+49 2203/9154-15          | http://www.sqs.de

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFCrTKh8hWAS3IShqURAsu4AJ9aiQAXoQr1VTM5vHpL6PFp6ZNiagCfYSu+
IvG55bucHQAehEn1BF6VsRY=
=bypf
-----END PGP SIGNATURE-----