Re: Using one component's value as input for the other

2011-04-14 Thread Martin Grigorov
If you use Wicket 1.5 then yet another approach is to use the events:
http://wicketstuff.org/wicket/events/

On Thu, Apr 14, 2011 at 3:49 AM, Michael O'Cleirigh 
michael.ocleir...@rivulet.ca wrote:

 Another way is to pass down a common IModelString into both panels from a
 shared parent. Or to create an abstract readonly model on the label that
 will get the model object from the text field.

 e.g.

 Shared model from above.

 In Parent Component:

 IModelStringfieldModel = new ModelString();

   add (autocompletePanel = new AutoCompletPanel(textfield, fieldModel));

  add (new Label (label, fieldModel);


 e.g. custom model on the label:

 In Parent Component:

   add (autocompletePanel = new AutoCompletPanel(textfield...));

  add (new Label (label, new AbstractReadOnlyModel String() {
public String getObject() {
return autocompletePanel.getModelObjectAsString();
  }
 });


 If they aren't contained in this way you can have the field model actually
 store the value in the session or a session scoped service bean and then
 have the label model fetch from that source instead.

 Regards,

 Mike


  You just use a normal reference if you can.  Or, use a more
 listenery approach.

 On Wed, Apr 13, 2011 at 7:19 PM, Reinout van Schouwenrein...@gmail.com
  wrote:

 Hello all,

 This would seem like a simple question but I've been tearing my hair
 out all evening about it.
 I have one form component, a wiquery autocomplete textfield.Once the
 user has entered a value in it I want the value to appear in a label
 in a different panel.

 My approach was to use an AjaxFormComponentUpdatingBehavior, to update
 the model of the label once a value has been entered and adding the
 label's container to the AjaxRequestTarget. But how do I refer to the
 label? I tried to use getPage().get(labelId) but this gives me a null
 pointer.

 Surely I'm overlooking a simple solution that Google didn't turn up for
 me?

 regards,

 --
 Reinout van Schouwen
 http://vanschouwen.info/

 -
 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



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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: CryptedUrlWebRequestCodingStrategy and bookmarkable pages

2011-04-14 Thread Vitaly Tsaplin
Hi Igor,

 you can tweak the crypter to ignore bookmarkable urls.
Well, that's what the crypter is supposed to do by default, isn't it?
Now it simply tries to encrypt everything that starts with ? safely
ignoring only RESTful urls.

VItaly

2011/4/14 Igor Vaynberg igor.vaynb...@gmail.com:
 urls are encrypted with session-relative randomly generated keys. so
 they are not bookmarkable.

 vitaly,
 you can tweak the crypter to ignore bookmarkable urls.

 -igor


 On Wed, Apr 13, 2011 at 2:59 AM, Martin Grigorov mgrigo...@apache.org wrote:
 I don't have time to debug it right now but as far as I know the crypting
 algorithm doesn't use the sessionid.
 Either try to debug and see what happens or create a ticket with a
 quickstart and wait until someone of us have time to look at it.

 On Wed, Apr 13, 2011 at 11:46 AM, Vitaly Tsaplin
 vitaly.tsap...@gmail.comwrote:

 when I try to copy this link and open it in another browser it says
 The page you requested has expired. Does it mean that the link is
 bookmarkable? ) But it works as it should with no crypting. Bug? I use
 1.4.17. The strategy is set like this

    @Override
    protected IRequestCycleProcessor newRequestCycleProcessor() {
        return new WebRequestCycleProcessor() {
            @Override
            protected IRequestCodingStrategy newRequestCodingStrategy() {
                return new CryptedUrlWebRequestCodingStrategy(new
 WebRequestCodingStrategy());
             }
        };
    }


 2011/4/13 Martin Grigorov mgrigo...@apache.org:
  well, this is what crypting does ...
  but I think the url is still bookmarkable, i.e. clicking on it always
  creates a new instance of ProductViewPage
 
  On Wed, Apr 13, 2011 at 9:37 AM, Vitaly Tsaplin 
 vitaly.tsap...@gmail.comwrote:
 
  Hi Martin,
 
  Here is how it looks
 
 
 http://localhost:8080/mysite/?x=Dc11lSgdY6XfDJ4ubDucC6WRETrJP52-jOltr8KdvSmpmKOCpyMIMn-JtJePH3kpFspghl8jR-5be5cN-L0iMC8wWtD2AXFO
 
  with disabled strategy it becomes
 
 
 http://localhost:8080/mysite/?wicket:bookmarkablePage=:com.tsaplin.web.engine.components.commerce.ProductViewPageid=5
 
  Vitaly
 
  2011/4/13 Martin Grigorov mgrigo...@apache.org:
   On Tue, Apr 12, 2011 at 9:11 PM, Vitaly Tsaplin 
  vitaly.tsap...@gmail.comwrote:
  
   Hi everyone,
  
   I am using CryptedUrlWebRequestCodingStrategy to encode urls. I also
   put an instance of BookmarkablePageLink on my page and the link that
   has been generated by this is NOT bookmarkable. What's wrong I am
   doing? Do I always have to mount my page as bookmarkable?
  
   How does this generated url look like ?
  
  
  
   Best regards,
   Vitaly
  
   -
   To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
  
   --
   Martin Grigorov
   jWeekend
   Training, Consulting, Development
   http://jWeekend.com http://jweekend.com/
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.com/
 

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




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/


 -
 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



Css url unexpected change

2011-04-14 Thread Tito
I have a page with an external css file wich is linked from html file. I
mean, path is relative but hard.
I guess wicket rewrite urls but here is the strange thing:

I have a form with standar validation like a required field. I submit
without adding information and all work, then again I click submit and
unexpectedly my css path changed.

Originally was rsrc/screen.css and later ../rsrc/screen.css where obviously
the file is not and consequently my page lost all design.

Thanks

Tito


Re: Css url unexpected change

2011-04-14 Thread Martin Grigorov
Either use absolute url, or context relative or use ResourceReference to
setup it.
Otherwise Wicket will try to fix it for you.

On Thu, Apr 14, 2011 at 1:19 PM, Tito njyt...@gmail.com wrote:

 I have a page with an external css file wich is linked from html file. I
 mean, path is relative but hard.
 I guess wicket rewrite urls but here is the strange thing:

 I have a form with standar validation like a required field. I submit
 without adding information and all work, then again I click submit and
 unexpectedly my css path changed.

 Originally was rsrc/screen.css and later ../rsrc/screen.css where obviously
 the file is not and consequently my page lost all design.

 Thanks

 Tito




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


image in java script

2011-04-14 Thread fachhoch
I have a simple jquery  function   and it needs an image , right now I placed
the image in webapp root and hadcoded the image path in jquery function
including context root  , please advice me how to use images in jquery
functions ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/image-in-java-script-tp3449390p3449390.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Css url unexpected change

2011-04-14 Thread Tito
Yes, I know that wicket do that. But in my case wicket breaks it. Is it
posible?

2011/4/14 Martin Grigorov mgrigo...@apache.org

 Either use absolute url, or context relative or use ResourceReference to
 setup it.
 Otherwise Wicket will try to fix it for you.

 On Thu, Apr 14, 2011 at 1:19 PM, Tito njyt...@gmail.com wrote:

  I have a page with an external css file wich is linked from html file. I
  mean, path is relative but hard.
  I guess wicket rewrite urls but here is the strange thing:
 
  I have a form with standar validation like a required field. I submit
  without adding information and all work, then again I click submit and
  unexpectedly my css path changed.
 
  Originally was rsrc/screen.css and later ../rsrc/screen.css where
 obviously
  the file is not and consequently my page lost all design.
 
  Thanks
 
  Tito
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/



Re: Css url unexpected change

2011-04-14 Thread Martin Grigorov
Yes. By fix I meant that it will break it.
Wicket tries to fix all relative urls. Since you don't use absolute
(http://)
or context relative one (/css/my.css) Wicket touches your resource url as
well.

On Thu, Apr 14, 2011 at 1:45 PM, Tito njyt...@gmail.com wrote:

 Yes, I know that wicket do that. But in my case wicket breaks it. Is it
 posible?

 2011/4/14 Martin Grigorov mgrigo...@apache.org

  Either use absolute url, or context relative or use ResourceReference to
  setup it.
  Otherwise Wicket will try to fix it for you.
 
  On Thu, Apr 14, 2011 at 1:19 PM, Tito njyt...@gmail.com wrote:
 
   I have a page with an external css file wich is linked from html file.
 I
   mean, path is relative but hard.
   I guess wicket rewrite urls but here is the strange thing:
  
   I have a form with standar validation like a required field. I submit
   without adding information and all work, then again I click submit and
   unexpectedly my css path changed.
  
   Originally was rsrc/screen.css and later ../rsrc/screen.css where
  obviously
   the file is not and consequently my page lost all design.
  
   Thanks
  
   Tito
  
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.com/
 




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Css url unexpected change

2011-04-14 Thread Tito
Sorry, I understood your expression. But, I mean if it is my mistake or
could be a wicket bug... Because I can't see anything rare in the code.

2011/4/14 Martin Grigorov mgrigo...@apache.org

 Yes. By fix I meant that it will break it.
 Wicket tries to fix all relative urls. Since you don't use absolute
 (http://)
 or context relative one (/css/my.css) Wicket touches your resource url as
 well.

 On Thu, Apr 14, 2011 at 1:45 PM, Tito njyt...@gmail.com wrote:

  Yes, I know that wicket do that. But in my case wicket breaks it. Is it
  posible?
 
  2011/4/14 Martin Grigorov mgrigo...@apache.org
 
   Either use absolute url, or context relative or use ResourceReference
 to
   setup it.
   Otherwise Wicket will try to fix it for you.
  
   On Thu, Apr 14, 2011 at 1:19 PM, Tito njyt...@gmail.com wrote:
  
I have a page with an external css file wich is linked from html
 file.
  I
mean, path is relative but hard.
I guess wicket rewrite urls but here is the strange thing:
   
I have a form with standar validation like a required field. I submit
without adding information and all work, then again I click submit
 and
unexpectedly my css path changed.
   
Originally was rsrc/screen.css and later ../rsrc/screen.css where
   obviously
the file is not and consequently my page lost all design.
   
Thanks
   
Tito
   
  
  
  
   --
   Martin Grigorov
   jWeekend
   Training, Consulting, Development
   http://jWeekend.com http://jweekend.com/
  
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/



Re: Css url unexpected change

2011-04-14 Thread Martin Grigorov
This is how Wicket works.
You need to pick one of the options I enumerated in my first mail.

On Thu, Apr 14, 2011 at 2:41 PM, Tito njyt...@gmail.com wrote:

 Sorry, I understood your expression. But, I mean if it is my mistake or
 could be a wicket bug... Because I can't see anything rare in the code.

 2011/4/14 Martin Grigorov mgrigo...@apache.org

  Yes. By fix I meant that it will break it.
  Wicket tries to fix all relative urls. Since you don't use absolute
  (http://)
  or context relative one (/css/my.css) Wicket touches your resource url as
  well.
 
  On Thu, Apr 14, 2011 at 1:45 PM, Tito njyt...@gmail.com wrote:
 
   Yes, I know that wicket do that. But in my case wicket breaks it. Is it
   posible?
  
   2011/4/14 Martin Grigorov mgrigo...@apache.org
  
Either use absolute url, or context relative or use ResourceReference
  to
setup it.
Otherwise Wicket will try to fix it for you.
   
On Thu, Apr 14, 2011 at 1:19 PM, Tito njyt...@gmail.com wrote:
   
 I have a page with an external css file wich is linked from html
  file.
   I
 mean, path is relative but hard.
 I guess wicket rewrite urls but here is the strange thing:

 I have a form with standar validation like a required field. I
 submit
 without adding information and all work, then again I click submit
  and
 unexpectedly my css path changed.

 Originally was rsrc/screen.css and later ../rsrc/screen.css where
obviously
 the file is not and consequently my page lost all design.

 Thanks

 Tito

   
   
   
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/
   
  
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.com/
 




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Css url unexpected change

2011-04-14 Thread Tito
Thanks!
I solved it using another url mounting strategy.

2011/4/14 Martin Grigorov mgrigo...@apache.org

 This is how Wicket works.
 You need to pick one of the options I enumerated in my first mail.

 On Thu, Apr 14, 2011 at 2:41 PM, Tito njyt...@gmail.com wrote:

  Sorry, I understood your expression. But, I mean if it is my mistake or
  could be a wicket bug... Because I can't see anything rare in the code.
 
  2011/4/14 Martin Grigorov mgrigo...@apache.org
 
   Yes. By fix I meant that it will break it.
   Wicket tries to fix all relative urls. Since you don't use absolute
   (http://)
   or context relative one (/css/my.css) Wicket touches your resource url
 as
   well.
  
   On Thu, Apr 14, 2011 at 1:45 PM, Tito njyt...@gmail.com wrote:
  
Yes, I know that wicket do that. But in my case wicket breaks it. Is
 it
posible?
   
2011/4/14 Martin Grigorov mgrigo...@apache.org
   
 Either use absolute url, or context relative or use
 ResourceReference
   to
 setup it.
 Otherwise Wicket will try to fix it for you.

 On Thu, Apr 14, 2011 at 1:19 PM, Tito njyt...@gmail.com wrote:

  I have a page with an external css file wich is linked from html
   file.
I
  mean, path is relative but hard.
  I guess wicket rewrite urls but here is the strange thing:
 
  I have a form with standar validation like a required field. I
  submit
  without adding information and all work, then again I click
 submit
   and
  unexpectedly my css path changed.
 
  Originally was rsrc/screen.css and later ../rsrc/screen.css where
 obviously
  the file is not and consequently my page lost all design.
 
  Thanks
 
  Tito
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/

   
  
  
  
   --
   Martin Grigorov
   jWeekend
   Training, Consulting, Development
   http://jWeekend.com http://jweekend.com/
  
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/



Ajax Response and a Redirect, anyone seen this

2011-04-14 Thread Brown, Berlin [GCG-PFS]
https://gist.github.com/918794
 
Has anyone seen this, where is the code to process an ajax-response.
 
 
POST /life/launch/?wicket:
interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1:-1
wicket:ignoreIfNotActive=truerandom=0.006311339758800216 HTTP/1.1
Accept: text/xml
Accept-Language: en-us
wicket-ajax: true
Referer: https://mysite/launch/
wicket-focusedelementid: idc96
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Host: mysite
Content-Length: 457
Connection: Keep-Alive
Cache-Control: no-cache


idc9e_hf_0=firstName=SP


HTTP/1.1 200 OK
Date: Wed, 13 Apr 2011 19:24:37 GMT
Server: IBM_HTTP_Server
Ajax-Location: ?wicket:bookmarkablePage=:theapplife.errors.ErrorPage
Content-Length: 121
Keep-Alive: timeout=10, max=97
Connection: Keep-Alive
Content-Type: text/xml
Content-Language: en-US


Re: Ajax Response and a Redirect, anyone seen this

2011-04-14 Thread Martin Grigorov
the code is in wicket-ajax.js

you Ajax callback lead to an error and thus the redirect to your internal
error page

On Thu, Apr 14, 2011 at 3:46 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 https://gist.github.com/918794

 Has anyone seen this, where is the code to process an ajax-response.


 POST /life/launch/?wicket:
 interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1:-1
 wicket:ignoreIfNotActive=truerandom=0.006311339758800216 HTTP/1.1
 Accept: text/xml
 Accept-Language: en-us
 wicket-ajax: true
 Referer: https://mysite/launch/
 wicket-focusedelementid: idc96
 Content-Type: application/x-www-form-urlencoded
 UA-CPU: x86
 Accept-Encoding: gzip, deflate
 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
 Host: mysite
 Content-Length: 457
 Connection: Keep-Alive
 Cache-Control: no-cache


 idc9e_hf_0=firstName=SP


 HTTP/1.1 200 OK
 Date: Wed, 13 Apr 2011 19:24:37 GMT
 Server: IBM_HTTP_Server
 Ajax-Location: ?wicket:bookmarkablePage=:theapplife.errors.ErrorPage
 Content-Length: 121
 Keep-Alive: timeout=10, max=97
 Connection: Keep-Alive
 Content-Type: text/xml
 Content-Language: en-US




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


RE: Ajax Response and a Redirect, anyone seen this

2011-04-14 Thread Brown, Berlin [GCG-PFS]
Where is the code to process the ajax-response, the java code? 

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Thursday, April 14, 2011 9:56 AM
To: users@wicket.apache.org
Subject: Re: Ajax Response and a Redirect, anyone seen this

the code is in wicket-ajax.js

you Ajax callback lead to an error and thus the redirect to your
internal error page

On Thu, Apr 14, 2011 at 3:46 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 https://gist.github.com/918794

 Has anyone seen this, where is the code to process an ajax-response.


 POST /life/launch/?wicket:
 interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1:
 -1
 wicket:ignoreIfNotActive=truerandom=0.006311339758800216 HTTP/1.1
 Accept: text/xml
 Accept-Language: en-us
 wicket-ajax: true
 Referer: https://mysite/launch/
 wicket-focusedelementid: idc96
 Content-Type: application/x-www-form-urlencoded
 UA-CPU: x86
 Accept-Encoding: gzip, deflate
 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET 
 CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
 Host: mysite
 Content-Length: 457
 Connection: Keep-Alive
 Cache-Control: no-cache


 idc9e_hf_0=firstName=SP


 HTTP/1.1 200 OK
 Date: Wed, 13 Apr 2011 19:24:37 GMT
 Server: IBM_HTTP_Server
 Ajax-Location: ?wicket:bookmarkablePage=:theapplife.errors.ErrorPage
 Content-Length: 121
 Keep-Alive: timeout=10, max=97
 Connection: Keep-Alive
 Content-Type: text/xml
 Content-Language: en-US




--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


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



Re: Ajax Response and a Redirect, anyone seen this

2011-04-14 Thread Martin Grigorov
AjaxRequestTarget creates it by default.
Only when a redirect is needed ServletWebResponse creates it.

On Thu, Apr 14, 2011 at 4:10 PM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 Where is the code to process the ajax-response, the java code?

 -Original Message-
 From: Martin Grigorov [mailto:mgrigo...@apache.org]
 Sent: Thursday, April 14, 2011 9:56 AM
 To: users@wicket.apache.org
 Subject: Re: Ajax Response and a Redirect, anyone seen this

 the code is in wicket-ajax.js

 you Ajax callback lead to an error and thus the redirect to your
 internal error page

 On Thu, Apr 14, 2011 at 3:46 PM, Brown, Berlin [GCG-PFS] 
 berlin.br...@primerica.com wrote:

  https://gist.github.com/918794
 
  Has anyone seen this, where is the code to process an ajax-response.
 
 
  POST /life/launch/?wicket:
  interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1:
  -1
  wicket:ignoreIfNotActive=truerandom=0.006311339758800216 HTTP/1.1
  Accept: text/xml
  Accept-Language: en-us
  wicket-ajax: true
  Referer: https://mysite/launch/
  wicket-focusedelementid: idc96
  Content-Type: application/x-www-form-urlencoded
  UA-CPU: x86
  Accept-Encoding: gzip, deflate
  User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
  CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
  Host: mysite
  Content-Length: 457
  Connection: Keep-Alive
  Cache-Control: no-cache
 
 
  idc9e_hf_0=firstName=SP
 
 
  HTTP/1.1 200 OK
  Date: Wed, 13 Apr 2011 19:24:37 GMT
  Server: IBM_HTTP_Server
  Ajax-Location: ?wicket:bookmarkablePage=:theapplife.errors.ErrorPage
  Content-Length: 121
  Keep-Alive: timeout=10, max=97
  Connection: Keep-Alive
  Content-Type: text/xml
  Content-Language: en-US
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/


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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: image in java script

2011-04-14 Thread Andrea Del Bene

Hi fachhoch,

I had a similar problem with a custom date component (called 
JQueryDateField) which uses JQuery UI Datapicker.  The problem was 
relative to the icon trigger  next to the input field which should open 
Datapicker. When we initialize Datapicker we needs to know icon's URL,  
for example:


|$(function() {
$( #datepicker ).datepicker({
showOn: button,
buttonImage: images/calendar.gif,
buttonImageOnly: true
});
});|


I solved problem using Wicket package resources. I've put calendar icon 
(calendar.jpg) and javascript (JQDatePicker.js) into the same package of 
JQueryDateField. In JQDatePicker.js I substituted buttonImage value with 
a variable called ${calendarIcon}, i.e.



|$(function() {
$( #datepicker ).datepicker({
showOn: button,
buttonImage: *${calendarIcon}*,
buttonImageOnly: true
});
});|



Now in constructor I loaded javascript as PackageTextTemplate and put 
icon's URL into JavaScript like this:


PackageTextTemplate textTemplate = new 
PackageTextTemplate(getClass(), JQDatePicker.js);


MapString,Object variables = new HashMapString, Object();
PackageResourceReference resourceReference = new 
PackageResourceReference(getClass(), calendar.jpg);
variables.put(calendarIcon,  urlFor(resourceReference, new 
PageParameters()));



String jQueryCalendar = textTemplate.asString(variables);


Finally  I added jQueryCalendar as render head in method renderHead


public void renderHead(IHeaderResponse response) {
response.renderOnDomReadyJavaScript(jQueryCalendar);
}


That is all. With this code you don't need to hardcode url in your code.


I have a simple jquery  function   and it needs an image , right now I placed
the image in webapp root and hadcoded the image  in jquery function
including context root  , please advice me how to use images in jquery
functions ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/image-in-java-script-tp3449390p3449390.html
Sent from the Users forum mailing list archive at Nabble.com.

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







Re: image in java script

2011-04-14 Thread Pedro Santos
In a similar use case I assembled the JavaScript in an
IHeaderContributor#renderHead implementation and written it in response
using IHeaderResponse#renderOnDomReadyJavascript
e.g.:
class SetupDatepicker extends Behavior{
@Override
public void renderHead(IHeaderResponse response) {
response.renderJavascriptReference(new
ResourceReference(JQueryReferences.class, jquery/jquery-1.5.1.min.js));
response.renderJavascriptReference(new
ResourceReference(JQueryReferences.class, ui/jquery-ui-1.8.11.custom.min.js));

 response.renderCSSReference(new ResourceReference(JQueryReferences.class,
path));
String js = String.format($(\ + getSelector() +
\).datepicker({dateFormat: '%s'});, parsedPattern);
response.renderOnDomReadyJavascript(js);
}
}

On Thu, Apr 14, 2011 at 12:24 PM, Andrea Del Bene adelb...@ciseonweb.itwrote:

 Hi fachhoch,

 I had a similar problem with a custom date component (called
 JQueryDateField) which uses JQuery UI Datapicker.  The problem was relative
 to the icon trigger  next to the input field which should open Datapicker.
 When we initialize Datapicker we needs to know icon's URL,  for example:

 |$(function() {
$( #datepicker ).datepicker({
showOn: button,
buttonImage: images/calendar.gif,
buttonImageOnly: true
});
});|


 I solved problem using Wicket package resources. I've put calendar icon
 (calendar.jpg) and javascript (JQDatePicker.js) into the same package of
 JQueryDateField. In JQDatePicker.js I substituted buttonImage value with a
 variable called ${calendarIcon}, i.e.


 |$(function() {
$( #datepicker ).datepicker({
showOn: button,
buttonImage: *${calendarIcon}*,
buttonImageOnly: true
});
});|



 Now in constructor I loaded javascript as PackageTextTemplate and put
 icon's URL into JavaScript like this:

PackageTextTemplate textTemplate = new
 PackageTextTemplate(getClass(), JQDatePicker.js);

MapString,Object variables = new HashMapString, Object();
PackageResourceReference resourceReference = new
 PackageResourceReference(getClass(), calendar.jpg);
variables.put(calendarIcon,  urlFor(resourceReference, new
 PageParameters()));


String jQueryCalendar = textTemplate.asString(variables);


 Finally  I added jQueryCalendar as render head in method renderHead


 public void renderHead(IHeaderResponse response) {
response.renderOnDomReadyJavaScript(jQueryCalendar);
}


 That is all. With this code you don't need to hardcode url in your code.

  I have a simple jquery  function   and it needs an image , right now I
 placed
 the image in webapp root and hadcoded the image  in jquery function

 including context root  , please advice me how to use images in jquery
 functions ?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/image-in-java-script-tp3449390p3449390.html
 Sent from the Users forum mailing list archive at Nabble.com.

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







-- 
Pedro Henrique Oliveira dos Santos


How to check if form submission succeeded using JavaScript?

2011-04-14 Thread Alec Swan
Hello,

I have a button on a page which submits a Wicket form by calling
form.submit() using straight JavaScript. If the form submitted without
errors, then the JavaScript code should set a cookie. I am looking for
some ideas on how to detect if the form was submitted successfully or
not in JavaScript?

Thanks,

Alec

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



Re: How to check if form submission succeeded using JavaScript?

2011-04-14 Thread Pedro Santos
Hi, you can set a cookie in the Button#onSubmit implementation,

new Button(){
public void onSubmit() {
//at this point all validations are tested
((WebResponse)RequestCycle.get().getResponse()).addCookie(new
Cookie(name, value));
}
}

On Thu, Apr 14, 2011 at 1:25 PM, Alec Swan alecs...@gmail.com wrote:

 Hello,

 I have a button on a page which submits a Wicket form by calling
 form.submit() using straight JavaScript. If the form submitted without
 errors, then the JavaScript code should set a cookie. I am looking for
 some ideas on how to detect if the form was submitted successfully or
 not in JavaScript?

 Thanks,

 Alec

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




-- 
Pedro Henrique Oliveira dos Santos


Re: How to check if form submission succeeded using JavaScript?

2011-04-14 Thread Alec Swan
Thanks for the prompt response. However, in my case is has to be set
on the client/JavaScript side because our application allows page
designers to change the content of the page and its behavior at
runtime and decide which cookie to set if any.

Thanks,

Alec

On Thu, Apr 14, 2011 at 10:37 AM, Pedro Santos pedros...@gmail.com wrote:
 Hi, you can set a cookie in the Button#onSubmit implementation,

 new Button(){
    public void onSubmit() {
        //at this point all validations are tested
        ((WebResponse)RequestCycle.get().getResponse()).addCookie(new
 Cookie(name, value));
    }
 }

 On Thu, Apr 14, 2011 at 1:25 PM, Alec Swan alecs...@gmail.com wrote:

 Hello,

 I have a button on a page which submits a Wicket form by calling
 form.submit() using straight JavaScript. If the form submitted without
 errors, then the JavaScript code should set a cookie. I am looking for
 some ideas on how to detect if the form was submitted successfully or
 not in JavaScript?

 Thanks,

 Alec

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




 --
 Pedro Henrique Oliveira dos Santos


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



dynamic image loading issue with IE

2011-04-14 Thread kasim ahmed
I am using wicket framework. Issue is with dynamic image, it works fine with
Firefox but the problem is with IE.



i have method settimeout, images are laoding with dynamic action in IE and
FF, but it is not going to next page.



static private class SafeSubmitBehaviour extends AbstractBehavior{

public void onRendered( Component component ) {

  super.onRendered( component );

  StringBuffer buffer = new StringBuffer(200);

  buffer.append(script type=\text/javascript\ \n);

  buffer.append(if
(document.getElementById(\).append(component.getMarkupId()).append(\).submitted.value
== \false\) {\n);

  
buffer.append(document.getElementById(\).append(component.getMarkupId()).append(\).submitted.value
= \true\;\n);

  
buffer.append(setTimeout('document.getElementById(\).append(component.getMarkupId()).append(\).submit()',
100);\n}else{\n);


buffer.append(document.getElementById(\toHide\).style.display=\none\;\n}]]*//script);


  component.getResponse().write(buffer);

}

  }

Here I also tried with adding function after setTimeout, but no use.



HTML code:



div id=toHide class=pb-text-align-center

img style=display: inline
src=img/load.gif /

form wicket:id=safeForm
class=clearfix

input type=hidden
wicket:id=submitted value=false /

/form

/div



 how can i solve this? My issue is image with animation is not working IE,
but working fine with FF.



Java script funtion from html view source:



 if (document.getElementById(safeForm4d).submitted.value == false) {

 document.getElementById(safeForm4d).submitted.value = true;

 setTimeout(function(){'document.getElementById(safeForm4d).submit()'},
100);

 }else{

 document.getElementById(toHide).style.display=none;

 }


Re: dynamic image loading issue with IE

2011-04-14 Thread kasim ahmed
I have tried modifying set timeout by adding alert message as:

alert(setTimeout('document.getElementById(\).append(component.getMarkupId()).append(\).submit()',
100));

it displays alert msg, then dynamic images are loaded ie animation is
happeing then when user click ok for alert it stops animation and goes to
next page.

if I use function inside set timeout, then dynamic images are loading  with
animation, but never goes to next page.



On Thu, Apr 14, 2011 at 7:09 PM, kasim ahmed mail2ka...@googlemail.comwrote:

 I am using wicket framework. Issue is with dynamic image, it works fine
 with Firefox but the problem is with IE.



 i have method settimeout, images are laoding with dynamic action in IE and
 FF, but it is not going to next page.



 static private class SafeSubmitBehaviour extends AbstractBehavior{

 public void onRendered( Component component ) {

   super.onRendered( component );

   StringBuffer buffer = new StringBuffer(200);

   buffer.append(script type=\text/javascript\ \n);

   buffer.append(if
 (document.getElementById(\).append(component.getMarkupId()).append(\).submitted.value
 == \false\) {\n);

   
 buffer.append(document.getElementById(\).append(component.getMarkupId()).append(\).submitted.value
 = \true\;\n);

   
 buffer.append(setTimeout('document.getElementById(\).append(component.getMarkupId()).append(\).submit()',
 100);\n}else{\n);


 buffer.append(document.getElementById(\toHide\).style.display=\none\;\n}]]*//script);


   component.getResponse().write(buffer);

 }

   }

 Here I also tried with adding function after setTimeout, but no use.



 HTML code:



 div id=toHide class=pb-text-align-center

 img style=display: inline
 src=img/load.gif /

 form wicket:id=safeForm
 class=clearfix

 input type=hidden
 wicket:id=submitted value=false /

 /form

 /div



  how can i solve this? My issue is image with animation is not working IE,
 but working fine with FF.



 Java script funtion from html view source:



  if (document.getElementById(safeForm4d).submitted.value == false)
 {

  document.getElementById(safeForm4d).submitted.value = true;

  setTimeout(function(){'document.getElementById(safeForm4d).submit()'},
 100);

  }else{

  document.getElementById(toHide).style.display=none;

  }





Re: How to check if form submission succeeded using JavaScript?

2011-04-14 Thread Martin Grigorov
if you use (JavaScript) form.submit() then this will reload the whole page.
I.e. there is no way to do anything with JavaScript after submitting the
form.

On Thu, Apr 14, 2011 at 6:25 PM, Alec Swan alecs...@gmail.com wrote:

 Hello,

 I have a button on a page which submits a Wicket form by calling
 form.submit() using straight JavaScript. If the form submitted without
 errors, then the JavaScript code should set a cookie. I am looking for
 some ideas on how to detect if the form was submitted successfully or
 not in JavaScript?

 Thanks,

 Alec

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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Refreshing loadable detachable model object inside an ajax call

2011-04-14 Thread Iain Reddick
Firstly, that LDM code is broken - calling detach() on load() makes no sense.

Also, it will hit hibernate on every call to getObject(), as you aren't caching 
the loaded Parent entity. This is probably the cause of the hibernate 
exceptions you are seeing.

Check out http://wicketinaction.com/2008/09/building-a-smart-entitymodel/ for a 
solid persistence backed LDM implementation.

Unrelated, your ParentsService.load() method probably doesn't need to take the 
entity class a parameter - the service should know the entity type it is 
querying hibernate for.

- Original Message -
From: lucast lucastol...@hotmail.com
To: users@wicket.apache.org
Sent: Wednesday, 13 April, 2011 7:20:15 PM
Subject: Re: Refreshing loadable detachable model object inside an ajax call

Hi Clint, thanks for your email.

After reading your post, this is how I've implemented the LDM class:


public class LoadableParentModel extends LoadableDetachableModel {

Long id;

public LoadableParentModel(Long id){

this.id = id;

}

@Override   protected Parent load() {

Parent Parent =
WicketApplication.get().getParents_service().load(Parent.class, id);

detach();

return Parent;

}

}




Is that what you mean by explicitly calling .detach() on the LDM?

I apologise if I didn't get that right straight away. I have implemented it
as in the above example but when I call (Parent) model.getObject(); I get
the same exception as before.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Refreshing-loadable-detachable-model-object-inside-an-ajax-call-tp3446979p3447904.html
Sent from the Users forum mailing list archive at Nabble.com.

-
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



Re: Refreshing loadable detachable model object inside an ajax call

2011-04-14 Thread lucast
Thank you, Iain.
I shall try that.
Cheers,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Refreshing-loadable-detachable-model-object-inside-an-ajax-call-tp3446979p3450740.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Refreshing loadable detachable model object inside an ajax call

2011-04-14 Thread Jeremy Thomerson
On Thu, Apr 14, 2011 at 3:51 PM, Iain Reddick
iain.redd...@beatsystems.comwrote:

 Firstly, that LDM code is broken - calling detach() on load() makes no
 sense.


Right - you should *not* call detach from within load().


 Also, it will hit hibernate on every call to getObject(), as you aren't
 caching the loaded Parent entity. This is probably the cause of the
 hibernate exceptions you are seeing.


Wrong - LDM caches the returned object within it.  That's the whole point of
LDM.


 Check out http://wicketinaction.com/2008/09/building-a-smart-entitymodel/for 
 a solid persistence backed LDM implementation.

 Unrelated, your ParentsService.load() method probably doesn't need to take
 the entity class a parameter - the service should know the entity type it is
 querying hibernate for.


-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*


Re: How to check if form submission succeeded using JavaScript?

2011-04-14 Thread Alec Swan
Thanks. I will follow yours and Pedro's recommendations and submit
form using AjaxButton.

On Thu, Apr 14, 2011 at 12:54 PM, Martin Grigorov mgrigo...@apache.org wrote:
 if you use (JavaScript) form.submit() then this will reload the whole page.
 I.e. there is no way to do anything with JavaScript after submitting the
 form.

 On Thu, Apr 14, 2011 at 6:25 PM, Alec Swan alecs...@gmail.com wrote:

 Hello,

 I have a button on a page which submits a Wicket form by calling
 form.submit() using straight JavaScript. If the form submitted without
 errors, then the JavaScript code should set a cookie. I am looking for
 some ideas on how to detect if the form was submitted successfully or
 not in JavaScript?

 Thanks,

 Alec

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




 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com


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



Re: Firefox 4: Modal windows redirect to invalid page, i.e WICKET-2207 in Firefox 4

2011-04-14 Thread Alec Swan
FYI, I had to disable Yahoo! Toolbar FireFox 4.0 add-on to get modal
windows to work.

On Mon, Apr 11, 2011 at 12:47 PM, Isammoc OFF isam...@gmail.com wrote:
 I agree with Matthias :
 FF4 for windows (under windows 7 x32)
 All ModalWindows work perfectly

 But a GET request for http://:/; is sent


 2011/4/11 Gabriel Landon glan...@piti.pf

 I'm using wicket =1.4.15 with FF4 for windows (under windows 7 x64) and
 all
 the ModalWindows work perfectly (both using Components or pages).

 With a wicket page the iframe's src is //:



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Firefox-4-Modal-windows-redirect-to-invalid-page-i-e-WICKET-2207-in-Firefox-4-tp3440251p3442748.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 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