getPage() Question

2010-08-13 Thread Thierry Peng

Hi

I have a Singlepage Application where I swap some panels on the main 
page depending what the user does. Specifically I have a Panel for 
changing the password which looks like:



@SuppressWarnings(serial)
public class ChangePasswordPanel extends Panel
{
 @Inject
 private ChangePasswordAction action;

 @Inject
 private AmtUserHome home;



 @SuppressWarnings(unchecked)
 public ChangePasswordPanel(String id)
 {
   super(id);
   this.setOutputMarkupId(true);

.. some fields added here

   Button change = new Button(change, new 
ResourceModel(middle.changepw.change))
   {
 @Override
 public void onSubmit()
 {
   getPage().addOrReplace(new ChangePasswordSuccessPanel(middle));
   action.saveChanges(); 
   super.onSubmit();

 }
   };
   ..some code
   Button cancel = new Button(cancel, new 
ResourceModel(middle.changepw.cancel))
   {
 @Override
 public void onSubmit()
 {
   
   getPage().addOrReplace(new ChangePasswordPanel(middle));

   getPage().addOrReplace(new ChangePasswordInformationPanel(right));
   super.onSubmit();
 }

 @Override
 public boolean isVisible()
 {
   PostfachModel model = session.getModel();
   return !model.isNeedsPasswordChange();
 }
   };

   cancel.setDefaultFormProcessing(false);
   
.. some more code


   add(form);
   
   container.add(oldPassword);

   form.add(cancel, change, text, password, passwordrepeat, container);

 }
}


However, I'm encountering the following exception:

java.lang.IllegalStateException: No Page found for component [MarkupContainer 
[Component id = cancel]]
at org.apache.wicket.Component.getPage(Component.java:1756)
at 
ch.admin.bj.ba.postfach.ui.panels.ChangePasswordPanel$5.onSubmit(ChangePasswordPanel.java:102)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:882)

But only when I click the cancel button (102 points to 

getPage().addOrReplace(new ChangePasswordInformationPanel(right));

). The submit(change) button works fine and I'm using in both 
onsubmit() almost the identical code. Is there any explanation for this 
behaviour? The buttons in the html are identical:


input type=submit class=button wicket:id=change/
input type=submit class=button wicket:id=cancel/

Wicket version is 1.4.9 on a glassfish 3

Thanks in advance

thierry



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: getPage() Question

2010-08-13 Thread Thierry Peng

I figured it out.

For who is interested:

The first getPage().addOrReplace replaced the middlepanel which was also 
the current changepasswordpanel.
The second call on getParent() can only yield null because the panel in 
question was already swapped.


So there are two valid solutions:

first use the var-arg:

getPage().addOrReplace( new MiddleInfoPanel(middle),new 
LoginPanel(right));


second, swap first the right panel, then the middle panel

getPage().addOrReplace(new LoginPanel(right));
getPage().addOrReplace(new MiddleInfoPanel(middle));



both solutions works and my faith in wicket is saved

silly me

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



getPage question

2009-11-10 Thread Pamir Erdem
In the attachment you'll see that the regions that intersect with each other
indicates that the slowest method execution on stack trace. If you look at
Count Delta on getPage method you will see that it  equals to 37 which means
thatgetPage is executed  37 times  in a request. There are too many ajax
calls in the web page. Is there anything which we can do to tune that screen
?



-- 
Pamir Erdem

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Re: getPage question

2009-11-10 Thread Pamir Erdem
Again it's related with ajax calls. It coud solve this issue when
implementing ajax polls.

Thanks

On Wed, Nov 11, 2009 at 1:18 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 your attachment never made it through.

 -igor

 On Tue, Nov 10, 2009 at 3:12 PM, Pamir Erdem pamir.er...@gmail.com
 wrote:
  In the attachment you'll see that the regions that intersect with each
 other
  indicates that the slowest method execution on stack trace. If you look
 at
  Count Delta on getPage method you will see that it  equals to 37 which
 means
  thatgetPage is executed  37 times  in a request. There are too many ajax
  calls in the web page. Is there anything which we can do to tune that
 screen
  ?
 
 
  --
  Pamir Erdem
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Pamir Erdem


Re: getPage question

2009-11-10 Thread Igor Vaynberg
37 getpage() calls should be no big deal. even a 100.

-igor

On Tue, Nov 10, 2009 at 3:27 PM, Pamir Erdem pamir.er...@gmail.com wrote:
 Again it's related with ajax calls. It coud solve this issue when
 implementing ajax polls.

 Thanks

 On Wed, Nov 11, 2009 at 1:18 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 your attachment never made it through.

 -igor

 On Tue, Nov 10, 2009 at 3:12 PM, Pamir Erdem pamir.er...@gmail.com
 wrote:
  In the attachment you'll see that the regions that intersect with each
 other
  indicates that the slowest method execution on stack trace. If you look
 at
  Count Delta on getPage method you will see that it  equals to 37 which
 means
  thatgetPage is executed  37 times  in a request. There are too many ajax
  calls in the web page. Is there anything which we can do to tune that
 screen
  ?
 
 
  --
  Pamir Erdem
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 Pamir Erdem


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: getPage question

2009-11-10 Thread Igor Vaynberg
your attachment never made it through.

-igor

On Tue, Nov 10, 2009 at 3:12 PM, Pamir Erdem pamir.er...@gmail.com wrote:
 In the attachment you'll see that the regions that intersect with each other
 indicates that the slowest method execution on stack trace. If you look at
 Count Delta on getPage method you will see that it  equals to 37 which means
 thatgetPage is executed  37 times  in a request. There are too many ajax
 calls in the web page. Is there anything which we can do to tune that screen
 ?


 --
 Pamir Erdem


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org