Ryan,

Here is some more of my code

        public void pageBeginRender(PageEvent pageEvent){


                if (!pageEvent.getRequestCycle().isRewinding()){

                        // if doing a render and the channel list is empty then 
obtain a
new channel list and persist.
                        if 
((getChannelSetup()==null)||(getChannelSetup().size()==0)){
                                try {
                                        refreshCelloPagesSettings();
                                } catch (Exception e) {
                                        e.printStackTrace();
                                }

                        }
                        System.out.println("rendering");
                } else {
                        System.out.println("rewinding");
                }
        }

        public void refreshCelloPagesSettings(){
                Cello6 cello6=null;
                try {
                        cello6 = getCello6DAO().get(getCelloSerialNumber());
                } catch (SQLException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                }

                if (cello6==null) return;

                
setChannelSetup(getCello6DAO().getChannelSetup(getCelloSerialNumber()));
                setBatteryAlarm(getCello6().isBatteryAlarm());
                byte rate = (byte)cello6.getLoggingRate();
                setLoggingRate(rate);
        }

I only initialise setChannelSetup when getChannelSetup is  null, i.e.
when the page is first called and renders.

I will trace the page with breakpoints and see what happens.

On 14/10/06, Ryan Holmes <[EMAIL PROTECTED]> wrote:
Without seeing more of your code, my guess it that you are
unconditionally calling setChannelSetup() in your pageBeginRender
method. Something like this:

public void pageBeginRender(PageEvent event) {
       setChannelSetup(new ArrayList<Cello6ChannelSetup>());
}

Remember that pageBeginRender is called *every time* the page is
rendered, not just the first time the page is displayed. So, if your
button calls a listener method that does something along the lines of
this:

public void addNewSetup() {
       Cello6ChannelSetup setup = new Cello6ChannelSetup(...);
       getChannelSetup().add(setup);
}

Then the pageBeginRender method runs *after* your listener method,
thus wiping out the change by re-initializing the list. I can
probably guess your next question, but I'll wait to see if I'm on the
right track first.

FYI, a good way to get a handle on Tapestry behavior for things like
this is to set a breakpoint in your listener method and in your
pageBeginRender method so you can see the order in which they are
called.

-Ryan

On Oct 14, 2006, at 11:52 AM, Jabbar wrote:

> Hello,
>
> I've been struggling all day editing persistent page properties and
> finding that the values of the properties is not what I expected after
> the render phases
>
> The persistant page property is
>
>    @Persist
>       public abstract List<Cello6ChannelSetup> getChannelSetup();
>       public abstract void setChannelSetup(List<Cello6ChannelSetup> d);
>
> This gets sets in PageBeginRender when the page is first called. A
> button on the page is pressed which changes the property of one of the
> elements of the list. After the render the value of the channelSetup
> property is not what I expect.
>
> Does anybody have any ideas?
>
> Thanks
>
> --
> Thanks
>
> A Jabbar Azam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Ryan Holmes, CISSP

[EMAIL PROTECTED]
ph. (213) 626-0026



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Thanks

A Jabbar Azam

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to