During construction of TodayPanel, it hasn't been added to the page yet so
getParent() is null.  Maybe you should do the 'if(user != null) {...' stuff
in @Override ...onBeforeRender() {...}.  The first time you're okay because
if (user!=null) fails and getParent() is not executed.  The second time it
gets executes.

On Thu, Apr 3, 2008 at 7:19 AM, Cristi Manole <[EMAIL PROTECTED]>
wrote:

> Hello,
>
> I have a HomePage where, in constructor, i add a Panel :
>
>    public HomePage(final PageParameters parameters) {
>        Date clientDate = getClientCalendar().getTime();
>        Label label = new Label("today", "Today's Status [" +
> DateFormat.getDateInstance(DateFormat.SHORT).format(clientDate) + "]");
>        add(label);
>        add(reportModalWindow = createReportModalWindow());
>        add(countButtonsPanel = new CountButtonsPanel("countButtonsDiv",
> ((WebSession)getSession()).isSignedIn(), this));
>        add(iSmokedModalWindow = createISmokedModalWindow());
> *        add(todayPanel = new TodayPanel("todayPanel", new
> java.sql.Date(clientDate.getTime())));
> *    }
>
> in TodayPanel's constructor, i check if the user is logged, and if he is,
> update an ajax table (current page)
>
>        if(user != null) {
>
> ajaxTable.setCurrentPage(ajaxTable.getUserRow(user.getUsername(), new
> Date(((HomePage)getParent()).getClientCalendar().getTimeInMillis())) /
> ROWS_PER_PAGE);
>        }
>
>
> When first running the application (no user logged in), today panel is
> cool.
> I log in and today panel is correctly updated.
>
> Now, when i start *another* browser page and point to the application's
> url,
> i get a org.apache.wicket.WicketRuntimeException
>  because TodayPanel's getParent() returns null.
>
> Question is: why?... i could understand it if it were consistent...
> meaning
> it will get me null on the first login too.
>
> I tested in Firefox tabs.
>
> Tks in advance,
> Cristi Manole
>

Reply via email to