You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "nhsoft.yhw" <nh...@gmail.com> on 2011/09/29 10:47:47 UTC

How to use lazy initialize ModalWindow's Panel

in WebPage, add modalwindow when page init:

modalWindow.setContent(new
CheckoutOrderModalWindow(coOrder.getOrderBillNo(), mwCheckout));

CheckoutOrderModalWindow class create code:

public class CheckoutOrderModalWindow extends Panel {

	public CheckoutOrderModalWindow(final CoOrder checkoutOrder, final
ModalWindow mwModalWindow) {

		super(mwModalWindow.getContentId());				
		
		if (coOrder.getOrderOnline() == true) { //here throw nullpointexception
			
		}

	}


}


Because in the page initialization, CoOrder has not been created, thus
leading to WebPage initialize null pointer error.

If I use ModalWindow with WebPage Mode, will not have this problem.

But ModalWindow with WebPage occur in different browser page display
problems, WebPage can not get value that changed by ModalWindow's Page.



-----
http://www.517wm.com
外卖订餐分享工具
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-use-lazy-initialize-ModalWindow-s-Panel-tp3854828p3854828.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: How to use lazy initialize ModalWindow's Panel

Posted by Andrea Del Bene <ad...@ciseonweb.it>.
Hi,

you can consider to access to checkout order not directly with a 
variable (i.e. coOrder or checkoutOrder) but using a Wicket IModel. Then 
you could initialize your panel using onInitialize method, when IModel 
contains the right CoOrder instance.

> in WebPage, add modalwindow when page init:
>
> modalWindow.setContent(new
> CheckoutOrderModalWindow(coOrder.getOrderBillNo(), mwCheckout));
>
> CheckoutOrderModalWindow class create code:
>
> public class CheckoutOrderModalWindow extends Panel {
>
> 	public CheckoutOrderModalWindow(final CoOrder checkoutOrder, final
> ModalWindow mwModalWindow) {
>
> 		super(mwModalWindow.getContentId());				
> 		
> 		if (coOrder.getOrderOnline() == true) { //here throw nullpointexception
> 			
> 		}
>
> 	}
>
>
> }
>
>
> Because in the page initialization, CoOrder has not been created, thus
> leading to WebPage initialize null pointer error.
>
> If I use ModalWindow with WebPage Mode, will not have this problem.
>
> But ModalWindow with WebPage occur in different browser page display
> problems, WebPage can not get value that changed by ModalWindow's Page.
>
>
>
> -----
> http://www.517wm.com
> 外卖订餐分享工具
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-use-lazy-initialize-ModalWindow-s-Panel-tp3854828p3854828.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>


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