popup problem

2008-01-09 Thread palun

Hi all,

I am trying to open a popup window from a page. Code looks like so:

PopupSettings popupSettings = new PopupSettings(PageMap
.forName(popuppagemap)).setHeight(300).setWidth(200);
PageParameters params = new PageParameters();
params.add(header, Answer);
params.add(text, [answer is shown here]);
item.add(new BookmarkablePageLink(popupButtonLink,
MyPopupPage.class, params).setPopupSettings(popupSettings));

The constructor of my popup window looks like:

public MyPopupPage() {
add(new Label(header,(String) getPageParameters().get(header)));
add(new Label(text,(String) getPageParameters().get(text)));
  add(new PopupCloseLink(return));
}

When I run it, the popup window pops up alright, but it displays a
NullPointerException. Apparently getPageParameters() returns null. Anyone
knows why?

(Sorry if this is elementary wicket stuff. I'm a beginner.)

Thanks
/ulf


-- 
View this message in context: 
http://www.nabble.com/popup-problem-tp14710176p14710176.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: popup problem

2008-01-09 Thread Igor Vaynberg
use the  public MyPopupPage(PageParameters params) constructor

-igor


On Jan 9, 2008 3:41 AM, palun [EMAIL PROTECTED] wrote:

 Hi all,

 I am trying to open a popup window from a page. Code looks like so:

 PopupSettings popupSettings = new PopupSettings(PageMap
 .forName(popuppagemap)).setHeight(300).setWidth(200);
 PageParameters params = new PageParameters();
 params.add(header, Answer);
 params.add(text, [answer is shown here]);
 item.add(new BookmarkablePageLink(popupButtonLink,
 MyPopupPage.class, 
 params).setPopupSettings(popupSettings));

 The constructor of my popup window looks like:

 public MyPopupPage() {
 add(new Label(header,(String) getPageParameters().get(header)));
 add(new Label(text,(String) getPageParameters().get(text)));
   add(new PopupCloseLink(return));
 }

 When I run it, the popup window pops up alright, but it displays a
 NullPointerException. Apparently getPageParameters() returns null. Anyone
 knows why?

 (Sorry if this is elementary wicket stuff. I'm a beginner.)

 Thanks
 /ulf


 --
 View this message in context: 
 http://www.nabble.com/popup-problem-tp14710176p14710176.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: popup problem

2008-01-09 Thread Igor Vaynberg
huh?

-igor


On Jan 9, 2008 12:50 PM, palun [EMAIL PROTECTED] wrote:

 But how do I change this part if I want to use a constructor with arguments?

  item.add(new BookmarkablePageLink(popupButtonLink,
  MyPopupPage.class,
  params).setPopupSettings(popupSettings));

 /ulf


 use the  public MyPopupPage(PageParameters params) constructor

 -igor


 --
 View this message in context: 
 http://www.nabble.com/popup-problem-tp14710176p14721301.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: popup problem

2008-01-09 Thread palun

But how do I change this part if I want to use a constructor with arguments?

 item.add(new BookmarkablePageLink(popupButtonLink,
 MyPopupPage.class,
 params).setPopupSettings(popupSettings));

/ulf


use the  public MyPopupPage(PageParameters params) constructor

-igor


-- 
View this message in context: 
http://www.nabble.com/popup-problem-tp14710176p14721301.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: popup problem

2008-01-09 Thread palun

WicketMessage: Can't instantiate page using constructor public
com.mycompany.pages.wicketutils.MyPopupPage(org.apache.wicket.PageParameters)
and argument text = [answer...] header = [Answer]

Root cause:

java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
java.lang.String
at com.mycompany.pages.wicketutils.MyPopupPage.init(MyPopupPage.java:12)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:154)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:96)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTa



igor.vaynberg wrote:
 
 huh?
 
 -igor
 
 
 On Jan 9, 2008 12:50 PM, palun [EMAIL PROTECTED] wrote:

 But how do I change this part if I want to use a constructor with
 arguments?

  item.add(new BookmarkablePageLink(popupButtonLink,
  MyPopupPage.class,
  params).setPopupSettings(popupSettings));

 /ulf


 use the  public MyPopupPage(PageParameters params) constructor

 -igor


 --
 View this message in context:
 http://www.nabble.com/popup-problem-tp14710176p14721301.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://www.nabble.com/popup-problem-tp14710176p14721705.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: popup problem

2008-01-09 Thread Igor Vaynberg
exception is happening in your code...what is on line MyPopupPage.java:12 ?

-igor


On Jan 9, 2008 1:11 PM, palun [EMAIL PROTECTED] wrote:

 WicketMessage: Can't instantiate page using constructor public
 com.mycompany.pages.wicketutils.MyPopupPage(org.apache.wicket.PageParameters)
 and argument text = [answer...] header = [Answer]

 Root cause:

 java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
 java.lang.String
 at com.mycompany.pages.wicketutils.MyPopupPage.init(MyPopupPage.java:12)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:154)
 at
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:96)
 at org.apache.wicket.request.target.component.BookmarkablePageRequestTa




 igor.vaynberg wrote:
 
  huh?
 
  -igor
 
 
  On Jan 9, 2008 12:50 PM, palun [EMAIL PROTECTED] wrote:
 
  But how do I change this part if I want to use a constructor with
  arguments?
 
   item.add(new BookmarkablePageLink(popupButtonLink,
   MyPopupPage.class,
   params).setPopupSettings(popupSettings));
 
  /ulf
 
 
  use the  public MyPopupPage(PageParameters params) constructor
 
  -igor
 
 
  --
  View this message in context:
  http://www.nabble.com/popup-problem-tp14710176p14721301.html
 
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context: 
 http://www.nabble.com/popup-problem-tp14710176p14721705.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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



Re: popup problem

2008-01-09 Thread palun

That would be the first line in the constructor:

public MyPopupPage(PageParameters params) {
add(new Label(header, (String) params.get(header)));   --- 
line 12
add(new Label(text, (String) params.get(text)));
add(new PopupCloseLink(return));
}

/ulf


igor.vaynberg wrote:
 
 exception is happening in your code...what is on line MyPopupPage.java:12
 ?
 
 -igor
 
 
 On Jan 9, 2008 1:11 PM, palun [EMAIL PROTECTED] wrote:

 WicketMessage: Can't instantiate page using constructor public
 com.mycompany.pages.wicketutils.MyPopupPage(org.apache.wicket.PageParameters)
 and argument text = [answer...] header = [Answer]

 Root cause:

 java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
 java.lang.String
 at
 com.mycompany.pages.wicketutils.MyPopupPage.init(MyPopupPage.java:12)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:154)
 at
 org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:96)
 at org.apache.wicket.request.target.component.BookmarkablePageRequestTa




 igor.vaynberg wrote:
 
  huh?
 
  -igor
 
 
  On Jan 9, 2008 12:50 PM, palun [EMAIL PROTECTED] wrote:
 
  But how do I change this part if I want to use a constructor with
  arguments?
 
   item.add(new BookmarkablePageLink(popupButtonLink,
   MyPopupPage.class,
   params).setPopupSettings(popupSettings));
 
  /ulf
 
 
  use the  public MyPopupPage(PageParameters params) constructor
 
  -igor
 
 
  --
  View this message in context:
  http://www.nabble.com/popup-problem-tp14710176p14721301.html
 
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context:
 http://www.nabble.com/popup-problem-tp14710176p14721705.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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


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

-- 
View this message in context: 
http://www.nabble.com/popup-problem-tp14710176p14722766.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: popup problem

2008-01-09 Thread Igor Vaynberg
try getString(header)

i think get() returns String[]

-igor


On Jan 9, 2008 2:09 PM, palun [EMAIL PROTECTED] wrote:

 That would be the first line in the constructor:

 public MyPopupPage(PageParameters params) {
 add(new Label(header, (String) params.get(header)));   --- 
 line 12
 add(new Label(text, (String) params.get(text)));
 add(new PopupCloseLink(return));
 }

 /ulf



 igor.vaynberg wrote:
 
  exception is happening in your code...what is on line MyPopupPage.java:12
  ?
 
  -igor
 
 
  On Jan 9, 2008 1:11 PM, palun [EMAIL PROTECTED] wrote:
 
  WicketMessage: Can't instantiate page using constructor public
  com.mycompany.pages.wicketutils.MyPopupPage(org.apache.wicket.PageParameters)
  and argument text = [answer...] header = [Answer]
 
  Root cause:
 
  java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
  java.lang.String
  at
  com.mycompany.pages.wicketutils.MyPopupPage.init(MyPopupPage.java:12)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
  at
  org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:154)
  at
  org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:96)
  at org.apache.wicket.request.target.component.BookmarkablePageRequestTa
 
 
 
 
  igor.vaynberg wrote:
  
   huh?
  
   -igor
  
  
   On Jan 9, 2008 12:50 PM, palun [EMAIL PROTECTED] wrote:
  
   But how do I change this part if I want to use a constructor with
   arguments?
  
item.add(new BookmarkablePageLink(popupButtonLink,
MyPopupPage.class,
params).setPopupSettings(popupSettings));
  
   /ulf
  
  
   use the  public MyPopupPage(PageParameters params) constructor
  
   -igor
  
  
   --
   View this message in context:
   http://www.nabble.com/popup-problem-tp14710176p14721301.html
  
   Sent from the Wicket - User mailing list archive at Nabble.com.
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
  --
  View this message in context:
  http://www.nabble.com/popup-problem-tp14710176p14721705.html
 
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context: 
 http://www.nabble.com/popup-problem-tp14710176p14722766.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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