Re: set the feedback message to js function

2008-11-01 Thread Nino Saturnino Martinez Vazquez Wael
theres a scriptaculous contrib on wicketstuff (currently down, but I 
think svn are up), in that theres a toaster so you could check that out 
for reference.


checkout this : 
*https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-scriptaculous-examples*


And the toaster example, changing it to a modal style should not be that 
hard.


rolandpeng wrote:

Excuse me. I don't get it clearly.
What does 'hack up a small js' do and please discribe more about
scriptaculous toaster, or any url for reference?
Thank you very much.

roland.


Nino.Martinez wrote:
  
I would hack up a small js component for this case, and poke it with 
the message, sort of maybe what I've done with the scriptaculous toaster.


rolandpeng wrote:


thank you,igor

here is my try and that work. 
But how could I display message only in alert dialog instead of both

feedback panel and alert dialog?
thanks.

roland.
--
HeaderContributor alert = new HeaderContributor(
  new IHeaderContributor() {
public void renderHead(IHeaderResponse response) {
  FeedbackMessages messages = Session.get().getFeedbackMessages();
 for (Iterator iter = messages.iterator(); iter.hasNext();) {
FeedbackMessage message = (FeedbackMessage) iter.next();
response.renderOnLoadJavascript(alert(\+ message.getMessage() +
\);); 
 }

}
}); 
	 
User oUser = new User();

cFeedback = new FeedbackPanel(feedback);
cFeedback.setOutputMarkupId(true);
cFeedback.add(alert);

--

igor.vaynberg wrote:
  
  

renderhead(IHeaderResponse r) {
  for (FeedbackMessage m:messages) {
r.renderonloadjavascript(alert('+m.toString()+'););
  }
}

-igor


On Dec 31, 2007 11:25 PM, JohnSmith333 [EMAIL PROTECTED]
wrote:



Thanks for your kindly reply and help.
I have read the FeedbackPanel  source code and know the use of
HeaderContributor.
But I still don't know how to do . Could you or anyone help me more?
Thanks!

HeaderContributor.forJavaScript(/js/default.js);




igor.vaynberg wrote:
  
  

see how feedbackpanel is implemented, you can write a header
contributor to spit feedback messages to a js function

-igor


On Dec 31, 2007 7:51 AM, JohnSmith333 [EMAIL PROTECTED]



wrote:
  
  

Could anyone tell me how to set the feedback message to js function
  
  

like
  
  

alert(some txt must set)?
thanks!
--
View this message in context:

  
  

http://www.nabble.com/set-the-feedback-message-to-js-function-tp14558865p14558865.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/set-the-feedback-message-to-js-function-tp14558865p14565041.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]





  
  

--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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






  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Should/Could ServletWebRequest.isAjax be cached?

2008-11-01 Thread Martin Makundi
Hi!

I was profiling my Wicket application and noticed that Jetty's
getHeader method was hit quite often.

It turns out the ServletWebRequest.isAjax method is hit quite often by
each of the page elements (I am generating a large HTML report page).
Since the Servlet container may not have optimal design for processing
the getHeader method, I wonder if the ServletWebRequest.isAjax -method
could/should be cached within wicket.

I made the following modification to the ServletWebRequest.isAjax
method, and measured a notable increase in performance:

  public boolean isAjax() {
if (ajax == null) {
  ajax = false;

  String ajaxHeader = httpServletRequest.getHeader(Wicket-Ajax);
  if (Strings.isEmpty(ajaxHeader) == false)
  {
try
{
  ajax = Strings.isTrue(ajaxHeader);
}
catch (StringValueConversionException e)
{
  // We are not interested in this exception but we log it anyway
  log.debug(Couldn't convert the Wicket-Ajax header:  + ajaxHeader);
}
  }
}

return ajax;
  }


However, my question remains: is this a valid optimization or does it
break the Wicket framework? Should it somehow be incorporated in the
next releases?

**
Martin

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

WicketTester.assertErrorMessages - encoding problem

2008-11-01 Thread Artur W.

Hi!

My test failed becouse Wicket returns FeedbackMessages in different encoding
(?) than the expected messages.

Example:

tester.assertErrorMessages(new String[] { Pole 'domena' musi zawierać od 3
do 32 znaków. };

gives:
junit.framework.AssertionFailedError:
expect (1):
   Pole 'domena' musi zawierać od 3 do 32 znaków.
but was (1):
   Pole 'domena' musi zawierać od 3 do 32 znaków.

I compile my tests with javac with encoding set to UTF-8. I don't know how
are feedback messages encoded or if it is some other problem when comparing
error msgs in the test.


Thanks in advance,
Artur


-- 
View this message in context: 
http://www.nabble.com/WicketTester.assertErrorMessages---encoding-problem-tp20280074p20280074.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]



wicket hangman

2008-11-01 Thread Axel Leucht
I'm currently trying to compile the hangman sample with Eclipse 3.4
(Ganymede). 

I'd copied the sources from my apache-wicket-1.4-m3 directory and setup a
new project in Eclipse. Then I stripped down the WicketExample page to make
its dependencies a little bit smaller. 

Unfortunately, the software doesn't compile and complains about errors in
Guess.java:

*   The type ListView is not generic; 
*   The type Model is not generic 
*   The type PropertyModel is not generic 

I do compile with java 6 and can can do so successfully with a HelloWorld
type of application. 

Does anyone have a clue what is wrong here?

Thanks in advance.

/Axel


  _  

Ich verwende die kostenlose Version von SPAMfighter
http://www.spamfighter.com/lde , die bisher
39 Spammails entfernt und mir so eine Menge Zeit gespart hat.
Rund 5,4 Millionen Leute nutzen SPAMfighter schon.
Bezahlende Anwender haben diesen Hinweis nicht in ihren E-Mails. 


Re: wicket hangman

2008-11-01 Thread Nino Saturnino Martinez Vazquez Wael

compiling against wrong version of wicket?

Axel Leucht wrote:

I'm currently trying to compile the hangman sample with Eclipse 3.4
(Ganymede). 


I'd copied the sources from my apache-wicket-1.4-m3 directory and setup a
new project in Eclipse. Then I stripped down the WicketExample page to make
its dependencies a little bit smaller. 


Unfortunately, the software doesn't compile and complains about errors in
Guess.java:

*   The type ListView is not generic; 
*   The type Model is not generic 
*   The type PropertyModel is not generic 


I do compile with java 6 and can can do so successfully with a HelloWorld
type of application. 


Does anyone have a clue what is wrong here?

Thanks in advance.

/Axel


  _  


Ich verwende die kostenlose Version von SPAMfighter
http://www.spamfighter.com/lde , die bisher
39 Spammails entfernt und mir so eine Menge Zeit gespart hat.
Rund 5,4 Millionen Leute nutzen SPAMfighter schon.
Bezahlende Anwender haben diesen Hinweis nicht in ihren E-Mails. 

  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: WicketTester.assertErrorMessages - encoding problem

2008-11-01 Thread Martin Makundi
Hi!

Have you tried in your WicketApplication.init to set encoding:

getMarkupSettings().setDefaultMarkupEncoding(WebPageConstants.ISO_8859_1);

**
Martin

2008/11/1 Artur W. [EMAIL PROTECTED]:

 Hi!

 My test failed becouse Wicket returns FeedbackMessages in different encoding
 (?) than the expected messages.

 Example:

 tester.assertErrorMessages(new String[] { Pole 'domena' musi zawierać od 3
 do 32 znaków. };

 gives:
 junit.framework.AssertionFailedError:
 expect (1):
   Pole 'domena' musi zawierać od 3 do 32 znaków.
 but was (1):
   Pole 'domena' musi zawierać od 3 do 32 znaków.

 I compile my tests with javac with encoding set to UTF-8. I don't know how
 are feedback messages encoded or if it is some other problem when comparing
 error msgs in the test.


 Thanks in advance,
 Artur


 --
 View this message in context: 
 http://www.nabble.com/WicketTester.assertErrorMessages---encoding-problem-tp20280074p20280074.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: WicketTester.assertErrorMessages - encoding problem

2008-11-01 Thread Artur W.

The problem is in tester.assertErrorMessages at:
msgs.add(iterator.next().toString());

The .toString() returns string with iso-8859-1 encoding.


The workaround is to create your own assertErrorMessages like this:

ListSerializable actualMessages =
tester.getMessages(FeedbackMessage.ERROR);
ListSerializable msgs = new ArrayListSerializable();
for (IteratorSerializable iterator = 
actualMessages.iterator();
iterator.hasNext();) {
msgs.add( new 
String(iterator.next().toString().getBytes(ISO-8859-1),
UTF-8) );
}

WicketTesterHelper.assertEquals(Arrays.asList(expectedErrorMessages),
msgs);

What do you think about fixing the tester code as above? Maybe this is a
good idea because AFAIK Wicket works in UTF-8 but default.

Thanks,
Artur


-- 
View this message in context: 
http://www.nabble.com/WicketTester.assertErrorMessages---encoding-problem-tp20280074p20280466.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: WicketTester.assertErrorMessages - encoding problem

2008-11-01 Thread Artur W.

Hi Martin!

Martin Makundi wrote:
 
 Have you tried in your WicketApplication.init to set encoding:
 

 getMarkupSettings().setDefaultMarkupEncoding(WebPageConstants.ISO_8859_1);
 

I tried both of this:

tester.getApplication().getMarkupSettings().setDefaultMarkupEncoding(ISO-8859-1);
tester.getApplication().getMarkupSettings().setDefaultMarkupEncoding(UTF-8);

but it didn't help.

Best regards,
Artur


-- 
View this message in context: 
http://www.nabble.com/WicketTester.assertErrorMessages---encoding-problem-tp20280074p20280503.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: WicketTester.assertErrorMessages - encoding problem

2008-11-01 Thread Marat Radchenko
Cbuttic bug in locale-specifics handling. I think it is a candidate for a
bugreport.

2008/11/1 Artur W. [EMAIL PROTECTED]


 The problem is in tester.assertErrorMessages at:
 msgs.add(iterator.next().toString());

 The .toString() returns string with iso-8859-1 encoding.


 The workaround is to create your own assertErrorMessages like this:

ListSerializable actualMessages =
 tester.getMessages(FeedbackMessage.ERROR);
ListSerializable msgs = new ArrayListSerializable();
for (IteratorSerializable iterator =
 actualMessages.iterator();
 iterator.hasNext();) {
msgs.add( new
 String(iterator.next().toString().getBytes(ISO-8859-1),
 UTF-8) );
}

  WicketTesterHelper.assertEquals(Arrays.asList(expectedErrorMessages),
 msgs);

 What do you think about fixing the tester code as above? Maybe this is a
 good idea because AFAIK Wicket works in UTF-8 but default.

 Thanks,
 Artur


 --
 View this message in context:
 http://www.nabble.com/WicketTester.assertErrorMessages---encoding-problem-tp20280074p20280466.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]




AW: wicket hangman

2008-11-01 Thread Axel Leucht
Nino, you're me hero!

After staring at the code for too long I didn't see the wood for the trees,
but now it works like a charm. And time to make a break ;-)

/Axel
-Ursprüngliche Nachricht-
Von: Nino Saturnino Martinez Vazquez Wael [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 1. November 2008 14:01
An: users@wicket.apache.org
Betreff: Re: wicket hangman

compiling against wrong version of wicket?

Axel Leucht wrote:
 I'm currently trying to compile the hangman sample with Eclipse 3.4
 (Ganymede). 

 I'd copied the sources from my apache-wicket-1.4-m3 directory and setup a
 new project in Eclipse. Then I stripped down the WicketExample page to
make
 its dependencies a little bit smaller. 

 Unfortunately, the software doesn't compile and complains about errors in
 Guess.java:

 *   The type ListView is not generic; 
 *   The type Model is not generic 
 *   The type PropertyModel is not generic 

 I do compile with java 6 and can can do so successfully with a HelloWorld
 type of application. 

 Does anyone have a clue what is wrong here?

 Thanks in advance.

 /Axel


   _  

 Ich verwende die kostenlose Version von SPAMfighter
 http://www.spamfighter.com/lde , die bisher
 39 Spammails entfernt und mir so eine Menge Zeit gespart hat.
 Rund 5,4 Millionen Leute nutzen SPAMfighter schon.
 Bezahlende Anwender haben diesen Hinweis nicht in ihren E-Mails. 

   

-- 
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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


-- 
Ich verwende die kostenlose Version von SPAMfighter für private Anwender,
die bei mir bis jetzt 38 Spammails entfernt hat.
Rund 5,5 Millionen Leute nutzen SPAMfighter schon. Bezahlende Anwender haben
diesen Hinweis nicht in ihren E-Mails.
Laden Sie SPAMfighter kostenlos herunter: http://www.spamfighter.com/lde


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



Re: AW: wicket hangman

2008-11-01 Thread Nino Saturnino Martinez Vazquez Wael

Good to hear:)

Axel Leucht wrote:

Nino, you're me hero!

After staring at the code for too long I didn't see the wood for the trees,
but now it works like a charm. And time to make a break ;-)

/Axel
-Ursprüngliche Nachricht-
Von: Nino Saturnino Martinez Vazquez Wael [mailto:[EMAIL PROTECTED] 
Gesendet: Samstag, 1. November 2008 14:01

An: users@wicket.apache.org
Betreff: Re: wicket hangman

compiling against wrong version of wicket?

Axel Leucht wrote:
  

I'm currently trying to compile the hangman sample with Eclipse 3.4
(Ganymede). 


I'd copied the sources from my apache-wicket-1.4-m3 directory and setup a
new project in Eclipse. Then I stripped down the WicketExample page to


make
  
its dependencies a little bit smaller. 


Unfortunately, the software doesn't compile and complains about errors in
Guess.java:

*   The type ListView is not generic; 
*   The type Model is not generic 
*   The type PropertyModel is not generic 


I do compile with java 6 and can can do so successfully with a HelloWorld
type of application. 


Does anyone have a clue what is wrong here?

Thanks in advance.

/Axel


  _  


Ich verwende die kostenlose Version von SPAMfighter
http://www.spamfighter.com/lde , die bisher
39 Spammails entfernt und mir so eine Menge Zeit gespart hat.
Rund 5,4 Millionen Leute nutzen SPAMfighter schon.
Bezahlende Anwender haben diesen Hinweis nicht in ihren E-Mails. 

  



  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Should/Could ServletWebRequest.isAjax be cached?

2008-11-01 Thread Matej Knopp
Sure this is valid but i can't imagine why this would be a bottleneck.
Unless the webserver does something very weird while retrieving the
header.

-Matej

On Sat, Nov 1, 2008 at 6:01 PM, Igor Vaynberg [EMAIL PROTECTED] wrote:
 looks good, please create a jira issue.

 -igor

 On Sat, Nov 1, 2008 at 5:11 AM, Martin Makundi
 [EMAIL PROTECTED] wrote:
 Hi!

 I was profiling my Wicket application and noticed that Jetty's
 getHeader method was hit quite often.

 It turns out the ServletWebRequest.isAjax method is hit quite often by
 each of the page elements (I am generating a large HTML report page).
 Since the Servlet container may not have optimal design for processing
 the getHeader method, I wonder if the ServletWebRequest.isAjax -method
 could/should be cached within wicket.

 I made the following modification to the ServletWebRequest.isAjax
 method, and measured a notable increase in performance:

  public boolean isAjax() {
if (ajax == null) {
  ajax = false;

  String ajaxHeader = httpServletRequest.getHeader(Wicket-Ajax);
  if (Strings.isEmpty(ajaxHeader) == false)
  {
try
{
  ajax = Strings.isTrue(ajaxHeader);
}
catch (StringValueConversionException e)
{
  // We are not interested in this exception but we log it anyway
  log.debug(Couldn't convert the Wicket-Ajax header:  + ajaxHeader);
}
  }
}

return ajax;
  }


 However, my question remains: is this a valid optimization or does it
 break the Wicket framework? Should it somehow be incorporated in the
 next releases?

 **
 Martin


 -
 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]



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



Re: Redirect from an AjaxSelfUpdatingTimerBehavior

2008-11-01 Thread Adriano dos Santos Fernandes

Yes. Do you want a quickstart demonstrating the problem?


Adriano


Igor Vaynberg wrote:

does it work if you do not use ajax?

-igor

On Fri, Oct 31, 2008 at 6:38 AM, Adriano dos Santos Fernandes
[EMAIL PROTECTED] wrote:
  

Francisco Diaz Trepat - gmail escreveu:


Hi Adriano, maybe looking for PDF dynamic resource will bring something
up.
We had a similiar issue and discussed it on the list a while ago.
f(t)
  

Are you referring to this one
http://www.nabble.com/Hi%2C-PDF-Question-td15050471.html#a15065319?

It seems not my case, or I don't get it.

And when I redirect with PageRequestTarget it works so seems an issue with
ResourceStreamRequestTarget.


Adriano


-
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]

  



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



Re: Redirect from an AjaxSelfUpdatingTimerBehavior

2008-11-01 Thread Igor Vaynberg
yes

-igor

On Sat, Nov 1, 2008 at 11:25 AM, Adriano dos Santos Fernandes
[EMAIL PROTECTED] wrote:
 Yes. Do you want a quickstart demonstrating the problem?


 Adriano


 Igor Vaynberg wrote:

 does it work if you do not use ajax?

 -igor

 On Fri, Oct 31, 2008 at 6:38 AM, Adriano dos Santos Fernandes
 [EMAIL PROTECTED] wrote:


 Francisco Diaz Trepat - gmail escreveu:


 Hi Adriano, maybe looking for PDF dynamic resource will bring something
 up.
 We had a similiar issue and discussed it on the list a while ago.
 f(t)


 Are you referring to this one
 http://www.nabble.com/Hi%2C-PDF-Question-td15050471.html#a15065319?

 It seems not my case, or I don't get it.

 And when I redirect with PageRequestTarget it works so seems an issue
 with
 ResourceStreamRequestTarget.


 Adriano


 -
 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]




 -
 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]