Re: Loading Javascript for wicket component

2015-05-29 Thread MartinoSuperman
When you use the 'target' of AjaxRequestTarget, you can use the method
appendJavaScript(..) in it.

You can call a function in JavaScript in it. In that way, you are loading a
JavaScript with and for a Wicket component. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670989.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



Loading Javascript for wicket component

2015-05-25 Thread avchavan
Hi,
I am using a custom .js file as a datepicker.
the datepicket is visible when i click on the edit button.
what happens is the datepicker icon doesnt show up after clicking on edit
button.
but if i refresh the page the icon shows up.
What could possibly the issue and resolution for such behavior?

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871.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: Loading Javascript for wicket component

2015-05-25 Thread Martin Grigorov
Hi,


On Mon, May 25, 2015 at 9:14 AM, avchavan avinash.cha...@yahoo.co.in
wrote:

 Hi,
 I am using a custom .js file as a datepicker.
 the datepicket is visible when i click on the edit button.
 what happens is the datepicker icon doesnt show up after clicking on edit
 button.
 but if i refresh the page the icon shows up.
 What could possibly the issue and resolution for such behavior?


You don't repaint everything that needs to be repainted.
Show us some code to be able to help you more.



 Thanks

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871.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: Loading Javascript for wicket component

2015-05-25 Thread avchavan
public void onClick(AjaxRequestTarget target) {

dateChangeModalWindow.setModelObject(modelObject);
dateChangeModalWindow.setVisible(true);
if(target != null){
target.add(dateChangeModalWindow);
}
}

});

I have included the required .js files in my parent HTML.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670875.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: Loading Javascript for wicket component

2015-05-25 Thread Martin Grigorov
:




 Call for Modal Window:

 final DateChangeModalWindow dateChangeModalWindow = new
 DateChangeModalWindow(dateChangeModalWindow, this);
 add(dateChangeModalWindow);
 add(new AjaxFallbackLink(modalWindow) {

 @Override
 public void onClick(AjaxRequestTarget target) {

 dateChangeModalWindow.setModelObject(modelObject);
 dateChangeModalWindow.setVisible(true);
 if(target != null){
 target.add(dateChangeModalWindow);
 }
 }

 });

 I have included the required .js files in my parent HTML.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670875.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: Loading Javascript for wicket component

2015-05-25 Thread avchavan
The entire code written in javascript and it works.
If i just keep the HTML pages then it loads the datepicker at startup but in
my case the datpicker.js is not being picked up when the modal window
opens...if i refresh the page then it gets loaded and everything works fine
after that.
So, is there a way to ensure that the javascript file gets loaded when the
modal window opens?


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670879.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: Loading Javascript for wicket component

2015-05-25 Thread Martin Grigorov
I still think you need to tell the JS widget that the text field is visible.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 25, 2015 at 2:16 PM, avchavan avinash.cha...@yahoo.co.in
wrote:

 The entire code written in javascript and it works.
 If i just keep the HTML pages then it loads the datepicker at startup but
 in
 my case the datpicker.js is not being picked up when the modal window
 opens...if i refresh the page then it gets loaded and everything works fine
 after that.
 So, is there a way to ensure that the javascript file gets loaded when the
 modal window opens?


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670879.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: Loading Javascript for wicket component

2015-05-25 Thread avchavan
Martin, i get your point. But would this work if my .js file is not being
loaded unless i refresh?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670881.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: Loading Javascript for wicket component

2015-05-25 Thread Martin Grigorov
Nope. There is no file.

I don't need the jquery.datepicker.js file. I need your glue code that
makes the TextField's input a datepicker.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 25, 2015 at 2:50 PM, avchavan avinash.cha...@yahoo.co.in
wrote:

 file uploaded.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670883.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: Loading Javascript for wicket component

2015-05-25 Thread Martin Grigorov
Please show me the JS code
On May 25, 2015 2:56 PM, avchavan avinash.cha...@yahoo.co.in wrote:

 Martin, i get your point. But would this work if my .js file is not being
 loaded unless i refresh?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670881.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: Loading Javascript for wicket component

2015-05-25 Thread avchavan
file uploaded.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670883.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: Loading Javascript for wicket component

2015-05-25 Thread avchavan
DatePicker javascript


this is what i have.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670885.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: Loading Javascript for wicket component

2015-05-25 Thread Martin Grigorov
http://www.7thweb.net/wicket-jquery-ui/datepicker/DefaultDatePickerPage

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, May 25, 2015 at 2:56 PM, avchavan avinash.cha...@yahoo.co.in
wrote:

 DatePicker javascript


 this is what i have.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Loading-Javascript-for-wicket-component-tp4670871p4670885.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




getResourceBundles().add css or javascript in wicket application

2014-08-28 Thread lucast
Dear forum,
I want to bundle css files from inside my wicket application.

I read  wicket guide Resource management
https://wicket.apache.org/guide/guide/resources.html   chapter and wicket
in action   Wicket 6 resource management
http://wicketinaction.com/2012/07/wicket-6-resource-management/   blog.

The examples provided refer to static files that one packages with one's
project.

Is it possible to reference to remote css or java script files, like  Font
Awesome
http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css 
, for example?

Also, what is the recommended practice? To download third party css and
javascript files and bundle them in the application or to reference to them
via URL?

Thanks in advance,
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/getResourceBundles-add-css-or-javascript-in-wicket-application-tp4667207.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: getResourceBundles().add css or javascript in wicket application

2014-08-28 Thread Martin Grigorov
Hi,

Bundle only local resources.
If a resource is available thru a CDN network then it is recommended to use
it directly from there.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Thu, Aug 28, 2014 at 2:53 PM, lucast lucastol...@hotmail.com wrote:

 Dear forum,
 I want to bundle css files from inside my wicket application.

 I read  wicket guide Resource management
 https://wicket.apache.org/guide/guide/resources.html   chapter and
 wicket
 in action   Wicket 6 resource management
 http://wicketinaction.com/2012/07/wicket-6-resource-management/   blog.

 The examples provided refer to static files that one packages with one's
 project.

 Is it possible to reference to remote css or java script files, like  Font
 Awesome
 
 http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css
 
 , for example?

 Also, what is the recommended practice? To download third party css and
 javascript files and bundle them in the application or to reference to them
 via URL?

 Thanks in advance,
 Lucas


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/getResourceBundles-add-css-or-javascript-in-wicket-application-tp4667207.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: getResourceBundles().add css or javascript in wicket application

2014-08-28 Thread Sebastien
Hi Martin, Lucas,

AFAIK font-awesome's license prevent to package/redistribute it, so the
question might be how can I make a resource reference from an online/CDN
file?...

https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/master/bootstrap-extensions/src/main/java/de/agilecoders/wicket/extensions/markup/html/bootstrap/icon/FontAwesomeCDNCSSReference.java

Best regards,
Sebastien



On Thu, Aug 28, 2014 at 1:58 PM, Martin Grigorov mgrigo...@apache.org
wrote:

 Hi,

 Bundle only local resources.
 If a resource is available thru a CDN network then it is recommended to use
 it directly from there.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov


 On Thu, Aug 28, 2014 at 2:53 PM, lucast lucastol...@hotmail.com wrote:

  Dear forum,
  I want to bundle css files from inside my wicket application.
 
  I read  wicket guide Resource management
  https://wicket.apache.org/guide/guide/resources.html   chapter and
  wicket
  in action   Wicket 6 resource management
  http://wicketinaction.com/2012/07/wicket-6-resource-management/
  blog.
 
  The examples provided refer to static files that one packages with one's
  project.
 
  Is it possible to reference to remote css or java script files, like
 Font
  Awesome
  
 
 http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css
  
  , for example?
 
  Also, what is the recommended practice? To download third party css and
  javascript files and bundle them in the application or to reference to
 them
  via URL?
 
  Thanks in advance,
  Lucas
 
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/getResourceBundles-add-css-or-javascript-in-wicket-application-tp4667207.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: getResourceBundles().add css or javascript in wicket application

2014-08-28 Thread lucast
Hi Sebastein, and Martin
Thank you for your post.

I think until Martin's reply I had the impression that one could bundle
local resources AND third party resources together.

Based on Sebastien's post, that would not be possible for certain third
party libraries such as font-awesome. Would that be correct?

Thanks, once more,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/getResourceBundles-add-css-or-javascript-in-wicket-application-tp4667207p4667210.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: getResourceBundles().add css or javascript in wicket application

2014-08-28 Thread Martin Grigorov
Hi,

It seems you don't value the benefit of CDNs...
If you really want it you can extend few classes (ResourceReference
related) and make it possible to bundle local and remote resources.
But I don't recommend it.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Thu, Aug 28, 2014 at 4:58 PM, lucast lucastol...@hotmail.com wrote:

 Hi Sebastein, and Martin
 Thank you for your post.

 I think until Martin's reply I had the impression that one could bundle
 local resources AND third party resources together.

 Based on Sebastien's post, that would not be possible for certain third
 party libraries such as font-awesome. Would that be correct?

 Thanks, once more,
 Lucas

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/getResourceBundles-add-css-or-javascript-in-wicket-application-tp4667207p4667210.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




Migration issue: fire AjaxFormComponentUpdatingBehavior(change) by Javascript the Wicket 6 way?

2013-02-22 Thread Martin Dietze
I understand that with Wicket 6 the event handlers are no longer
inline, thus calling input.onchange() will no longer work. 

But what do I now do instead? I have hand-written inputs which
rely on onchange() being called via Javascript after user
interaction. So what do I have to call inside my JS code to have
a AjaxFormComponentUpdatingBehavior(change) invoked in my Java
code? 

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
Hier ich bin, steine Dich wie ein Wirbelwind.

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



Re: Migration issue: fire AjaxFormComponentUpdatingBehavior(change) by Javascript the Wicket 6 way?

2013-02-22 Thread Martin Grigorov
jQuery(selector).triggerHandler('change')


On Fri, Feb 22, 2013 at 11:36 AM, Martin Dietze d...@fh-wedel.de wrote:

 I understand that with Wicket 6 the event handlers are no longer
 inline, thus calling input.onchange() will no longer work.

 But what do I now do instead? I have hand-written inputs which
 rely on onchange() being called via Javascript after user
 interaction. So what do I have to call inside my JS code to have
 a AjaxFormComponentUpdatingBehavior(change) invoked in my Java
 code?

 Cheers,

 M'bert

 --
 --- / http://herbert.the-little-red-haired-girl.org /
 -
 =+=
 Hier ich bin, steine Dich wie ein Wirbelwind.

 -
 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: Migration issue: fire AjaxFormComponentUpdatingBehavior(change) by Javascript the Wicket 6 way?

2013-02-22 Thread Ernesto Reinaldo Barreiro
$(#componentid').trigger('change');?

On Fri, Feb 22, 2013 at 10:36 AM, Martin Dietze d...@fh-wedel.de wrote:

 I understand that with Wicket 6 the event handlers are no longer
 inline, thus calling input.onchange() will no longer work.

 But what do I now do instead? I have hand-written inputs which
 rely on onchange() being called via Javascript after user
 interaction. So what do I have to call inside my JS code to have
 a AjaxFormComponentUpdatingBehavior(change) invoked in my Java
 code?

 Cheers,

 M'bert

 --
 --- / http://herbert.the-little-red-haired-girl.org /
 -
 =+=
 Hier ich bin, steine Dich wie ein Wirbelwind.

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




-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ http://antiliasoft.com/antilia


Re: Best Practices for Using JavaScript With Wicket

2010-04-06 Thread Nishant Neeraj
Thanks Jeremy.

I had been using component.setMarkupId(..); which is not recommended... so I
was wondering what is the standard.
I need to get hands-on JS-Wicket integration, so I was looking for a good
organized documentation/resource (other than WIA).

 So, what's the objection to using it?

:) Nothing against wiQuery and I, probably, will go with wiQuery... I was
worried if I can integrate various the plug-ins available like jNice (
http://www.whitespace-creative.com/jquery/jNice/) and likes.

Thanks for pointers.
Nishant

On Tue, Apr 6, 2010 at 4:26 AM, Jeremy Thomerson
jer...@wickettraining.comwrote:

 
  I am finding it very cumbersome to integrate JavaScript/JS-library. Can
  someone point to (or probably write a blog-post on :-)  the best
 practices
  of integrating JS/JS-library with Wicket.
 

 Wicket is pretty flexible in that you can integrate your JS a dozen
 different ways.  jQuery is especially easy to integrate with because the
 programming model matches Wicket's fairly nicely.  The primary thing is
 that
 if you want to use element IDs to tie in to jQuery, you'll need to do this
 from behaviors in your java code so that you get the correct ID.


 
  I am using JQuery but I would like to know the best approach without
 using
  WiQuery or jWicket. (Unless, I have to write my own jWicket to get this
  done.)
 

 I'm not sure I understand.  wiQuery has been fairly well recognized as a
 very nice Wicket/jQuery integration.  It has active development and a
 helpful mailing list.  So, what's the objection to using it?  I'm not
 saying
 that you can't have an objection, I just wonder what it is.  It's an open
 source project, so you can use it as a base and add your own functionality
 as needed (hopefully contributing back).

 Even if you don't want to use it, you can see some of the things they are
 doing with it - it has some very nice features, including mergin all the JS
 header contributions into a common (single) resource file.

 --
 Jeremy Thomerson
 http://www.wickettraining.com



AW: Best Practices for Using JavaScript With Wicket

2010-04-06 Thread Stefan Lindner
Hi Nishant,

you should use

component.setOutputMarkupId(true);

this tells wicket to generate a unique markup id. You can refer to the 
generated id with

 component.getMerkupId();

later.

If you want to add some javascript to your page, you may use two different 
tricks:

A: Ajax-related
If you have an AjaxTrigger (e.g. an AjaxLink) do the following

AjaxLink() {
onClick(AjaxRequestTarget target) {
target.appendJavaScript(put your javascript here);
// e.g. doSomethingWithDomelementWithId('+ 
component.getmarkupId()+ ');
}
}

B. during page creation
If you want to bind some javascript during page creation/HTML render time try 
this

Class MyPanel extends Panel {
...

@Override
public void renderHead(HtmlHeaderContainer container) {

container.getHeaderResponse().renderJavascriptReference(add a resource 
reference to your js library here);

container.getHeaderResponse().renderOnDomReadyJavascript(soSomethingWith(' + 
getMarkupId() + '););
}
}

And: Please have a look at the javadocs.

Stefan

-Ursprüngliche Nachricht-
Von: Nishant Neeraj [mailto:nishant.has.a.quest...@gmail.com] 
Gesendet: Dienstag, 6. April 2010 18:02
An: users@wicket.apache.org
Betreff: Re: Best Practices for Using JavaScript With Wicket

Thanks Jeremy.

I had been using component.setMarkupId(..); which is not recommended... so I
was wondering what is the standard.
I need to get hands-on JS-Wicket integration, so I was looking for a good
organized documentation/resource (other than WIA).

 So, what's the objection to using it?

:) Nothing against wiQuery and I, probably, will go with wiQuery... I was
worried if I can integrate various the plug-ins available like jNice (
http://www.whitespace-creative.com/jquery/jNice/) and likes.

Thanks for pointers.
Nishant

On Tue, Apr 6, 2010 at 4:26 AM, Jeremy Thomerson
jer...@wickettraining.comwrote:

 
  I am finding it very cumbersome to integrate JavaScript/JS-library. Can
  someone point to (or probably write a blog-post on :-)  the best
 practices
  of integrating JS/JS-library with Wicket.
 

 Wicket is pretty flexible in that you can integrate your JS a dozen
 different ways.  jQuery is especially easy to integrate with because the
 programming model matches Wicket's fairly nicely.  The primary thing is
 that
 if you want to use element IDs to tie in to jQuery, you'll need to do this
 from behaviors in your java code so that you get the correct ID.


 
  I am using JQuery but I would like to know the best approach without
 using
  WiQuery or jWicket. (Unless, I have to write my own jWicket to get this
  done.)
 

 I'm not sure I understand.  wiQuery has been fairly well recognized as a
 very nice Wicket/jQuery integration.  It has active development and a
 helpful mailing list.  So, what's the objection to using it?  I'm not
 saying
 that you can't have an objection, I just wonder what it is.  It's an open
 source project, so you can use it as a base and add your own functionality
 as needed (hopefully contributing back).

 Even if you don't want to use it, you can see some of the things they are
 doing with it - it has some very nice features, including mergin all the JS
 header contributions into a common (single) resource file.

 --
 Jeremy Thomerson
 http://www.wickettraining.com


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



Re: Best Practices for Using JavaScript With Wicket

2010-04-06 Thread Nishant Neeraj
ah, great! Thanks Stefan.
This is what I was looking for.

- Nishant

On Tue, Apr 6, 2010 at 9:45 PM, Stefan Lindner lind...@visionet.de wrote:

 Hi Nishant,

 you should use

component.setOutputMarkupId(true);

 this tells wicket to generate a unique markup id. You can refer to the
 generated id with

 component.getMerkupId();

 later.

 If you want to add some javascript to your page, you may use two different
 tricks:

 A: Ajax-related
 If you have an AjaxTrigger (e.g. an AjaxLink) do the following

AjaxLink() {
onClick(AjaxRequestTarget target) {
target.appendJavaScript(put your javascript here);
// e.g. doSomethingWithDomelementWithId('+
 component.getmarkupId()+ ');
}
}

 B. during page creation
 If you want to bind some javascript during page creation/HTML render time
 try this

Class MyPanel extends Panel {
...

@Override
public void renderHead(HtmlHeaderContainer container) {

  container.getHeaderResponse().renderJavascriptReference(add a resource
 reference to your js library here);

  container.getHeaderResponse().renderOnDomReadyJavascript(soSomethingWith('
 + getMarkupId() + '););
}
}

 And: Please have a look at the javadocs.

 Stefan

 -Ursprüngliche Nachricht-
 Von: Nishant Neeraj [mailto:nishant.has.a.quest...@gmail.com]
 Gesendet: Dienstag, 6. April 2010 18:02
 An: users@wicket.apache.org
 Betreff: Re: Best Practices for Using JavaScript With Wicket

 Thanks Jeremy.

 I had been using component.setMarkupId(..); which is not recommended... so
 I
 was wondering what is the standard.
 I need to get hands-on JS-Wicket integration, so I was looking for a good
 organized documentation/resource (other than WIA).

  So, what's the objection to using it?

 :) Nothing against wiQuery and I, probably, will go with wiQuery... I was
 worried if I can integrate various the plug-ins available like jNice (
 http://www.whitespace-creative.com/jquery/jNice/) and likes.

 Thanks for pointers.
 Nishant

 On Tue, Apr 6, 2010 at 4:26 AM, Jeremy Thomerson
 jer...@wickettraining.comwrote:

  
   I am finding it very cumbersome to integrate JavaScript/JS-library. Can
   someone point to (or probably write a blog-post on :-)  the best
  practices
   of integrating JS/JS-library with Wicket.
  
 
  Wicket is pretty flexible in that you can integrate your JS a dozen
  different ways.  jQuery is especially easy to integrate with because the
  programming model matches Wicket's fairly nicely.  The primary thing is
  that
  if you want to use element IDs to tie in to jQuery, you'll need to do
 this
  from behaviors in your java code so that you get the correct ID.
 
 
  
   I am using JQuery but I would like to know the best approach without
  using
   WiQuery or jWicket. (Unless, I have to write my own jWicket to get this
   done.)
  
 
  I'm not sure I understand.  wiQuery has been fairly well recognized as a
  very nice Wicket/jQuery integration.  It has active development and a
  helpful mailing list.  So, what's the objection to using it?  I'm not
  saying
  that you can't have an objection, I just wonder what it is.  It's an open
  source project, so you can use it as a base and add your own
 functionality
  as needed (hopefully contributing back).
 
  Even if you don't want to use it, you can see some of the things they are
  doing with it - it has some very nice features, including mergin all the
 JS
  header contributions into a common (single) resource file.
 
  --
  Jeremy Thomerson
  http://www.wickettraining.com
 

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




Best Practices for Using JavaScript With Wicket

2010-04-05 Thread Nishant Neeraj
Hi,

I am working on an application that's very rich in UI. Most of the input
validation, unless it requires back-end support, are done at UI level. There
are drag-and-drop, multiple file uploader (not the one in wicket
extensions), and customized warning message (much like Stack-overflow's top
info-panel that slides-in the page) and Tiny-MCE etc.

I am finding it very cumbersome to integrate JavaScript/JS-library. Can
someone point to (or probably write a blog-post on :-)  the best practices
of integrating JS/JS-library with Wicket.

I am using JQuery but I would like to know the best approach without using
WiQuery or jWicket. (Unless, I have to write my own jWicket to get this
done.)

Thanks
Nishant


Re: Best Practices for Using JavaScript With Wicket

2010-04-05 Thread Jeremy Thomerson

 I am finding it very cumbersome to integrate JavaScript/JS-library. Can
 someone point to (or probably write a blog-post on :-)  the best practices
 of integrating JS/JS-library with Wicket.


Wicket is pretty flexible in that you can integrate your JS a dozen
different ways.  jQuery is especially easy to integrate with because the
programming model matches Wicket's fairly nicely.  The primary thing is that
if you want to use element IDs to tie in to jQuery, you'll need to do this
from behaviors in your java code so that you get the correct ID.



 I am using JQuery but I would like to know the best approach without using
 WiQuery or jWicket. (Unless, I have to write my own jWicket to get this
 done.)


I'm not sure I understand.  wiQuery has been fairly well recognized as a
very nice Wicket/jQuery integration.  It has active development and a
helpful mailing list.  So, what's the objection to using it?  I'm not saying
that you can't have an objection, I just wonder what it is.  It's an open
source project, so you can use it as a base and add your own functionality
as needed (hopefully contributing back).

Even if you don't want to use it, you can see some of the things they are
doing with it - it has some very nice features, including mergin all the JS
header contributions into a common (single) resource file.

--
Jeremy Thomerson
http://www.wickettraining.com


Re: Simple javascript from wicket

2010-03-22 Thread marioosh.net
2010/3/18 Jeremy Thomerson jer...@wickettraining.com:
 Wicket is just java, just html.  Just add the JS to your HTML file.  Don't
 add an AjaxEventBehavior in java - because you don't want Ajax, and you
 don't need to do it in the java.

 --
 Jeremy Thomerson
 http://www.wickettraining.com


Thanks...
I did that in that way:

WebMarkupContainer container = new 
WebMarkupContainer(container){
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);

// prototype'owo hide and show
tag.put(onmouseover, $('+ 
buttons.getMarkupId() +').show());
tag.put(onmouseout, $('+ 
buttons.getMarkupId() +').hide());
}   
};

-- 
Greetings,
marioosh

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



Simple javascript from wicket

2010-03-17 Thread marioosh.net
I have container and buttons element in my template:

div wicket:id=container
span
...
/span
span wicket:id=buttons style=display: none;
a href=# wicket:id=editE/a
a href=# wicket:id=deleteD/a
/span
/div

and java:
container.add(new AjaxEventBehavior(onmouseover) {
protected void onEvent(AjaxRequestTarget target) {
buttons.add(new 
SimpleAttributeModifier(style, display: ;));
target.addComponent(buttons);
}
});

On mouseover container i show buttons, but i think it sends request to
server in that way.
Is possible to change style in js only (but programming in wicket),
not sending request to server ?
How in wicket do some js work, but not interacting with server ?

-- 
Greetings,
marioosh

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



Re: Simple javascript from wicket

2010-03-17 Thread Jeremy Thomerson
Wicket is just java, just html.  Just add the JS to your HTML file.  Don't
add an AjaxEventBehavior in java - because you don't want Ajax, and you
don't need to do it in the java.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Mar 17, 2010 at 4:05 AM, marioosh.net marioosh@gmail.comwrote:

 I have container and buttons element in my template:

div wicket:id=container
span
...
/span
span wicket:id=buttons style=display: none;
a href=# wicket:id=editE/a
a href=# wicket:id=deleteD/a
/span
/div

 and java:
container.add(new AjaxEventBehavior(onmouseover) {
protected void onEvent(AjaxRequestTarget target) {
buttons.add(new
 SimpleAttributeModifier(style, display: ;));
target.addComponent(buttons);
}
});

 On mouseover container i show buttons, but i think it sends request to
 server in that way.
 Is possible to change style in js only (but programming in wicket),
 not sending request to server ?
 How in wicket do some js work, but not interacting with server ?

 --
 Greetings,
 marioosh

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




Re: Customize generating javascript in wicket

2010-03-07 Thread Martin Makundi
Something like this might work:

public class GenericTailJavaScriptBehavior extends AbstractBehavior {
  private final String javaScript;
  /**
   * @param javaScript
   */
  public GenericTailJavaScriptBehavior(String javaScript) {
this.javaScript = javaScript;
  }
  /**
   * @see 
org.apache.wicket.behavior.AbstractBehavior#onRendered(org.apache.wicket.Component)
   */
  @Override
  public void onRendered(Component component) {
super.onRendered(component);
JavascriptUtils.writeOpenTag(component.getResponse());
component.getResponse().write(javaScript);
JavascriptUtils.writeCloseTag(component.getResponse());
  }
}


2010/3/6 marioosh.net marioosh@gmail.com:
 How to force wicket to generate javascript at the end of html, not inline ?
 I'm using SortableListView and addContainment method, but containtment
 option doesn't work.

 I think not work because of that important note - from scriptaculous docs: 
 containment
 Enables dragging and dropping between Sortables. Takes an array of
 elements or element-ids (of the containers). Important note: To ensure
 that two way dragging between containers is possible, place all
 Sortable.create calls after the container elements.

 --
 Greetings,
 marioosh

 -
 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



Customize generating javascript in wicket

2010-03-06 Thread marioosh.net
How to force wicket to generate javascript at the end of html, not inline ?
I'm using SortableListView and addContainment method, but containtment
option doesn't work.

I think not work because of that important note - from scriptaculous docs: 
containment 
Enables dragging and dropping between Sortables. Takes an array of
elements or element-ids (of the containers). Important note: To ensure
that two way dragging between containers is possible, place all
Sortable.create calls after the container elements.

-- 
Greetings,
marioosh

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



Question about Javascript DOM + Wicket

2009-10-15 Thread Erik Pragt

Hi all,

I'm relatively new to Wicket, and I have a small question. I have a  
dynamic form in Javascript, which can have an unlimited set of input  
fields. For example, I can have a form to manage persons, and the user  
can enter multiple addresses, which are currently handled by a jQuery  
clone of a piece of HTML.


My question is: is this also possible with Wicket? I don't want to use  
Ajax forms, I'd rather do everything in the DOM of the browser and  
then submit it. This doesn't sound like a unique situation to me, but  
I have a hard time finding the information how to handle this from a  
Wicket perspective. I did found this tutorial:


http://utku-utkan.blogspot.com/2007/07/dynamic-forms-in-wicket.html,  
but the form there is managed by Wicket, and I want the browser to  
manage this.


Is this possible?

Thanks in advance,

Erik Pragt

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



Re: Question about Javascript DOM + Wicket

2009-10-15 Thread Pedro Santos
My question is: is this also possible with Wicket? I don't want to use Ajax
forms, I'd rather do everything in the DOM of the browser and then submit it

yes, you can work on your form dom, adding form components with known names,
and dial with then on your onSubmit method like:
  getRequest().getParameter(streetNameOnGeneratedFormComponentX);

Sometimes I send to browse form components that the user may want to use or
not, inside an div, that I show conditionally based on javascript
conditions. May to be an interesting solution if you know an limit to those
dynamic forms components number.

BTW, why you don't want to use ajax? This work can be extremely simple using
it...

On Wed, Oct 14, 2009 at 4:24 PM, Erik Pragt erik.pr...@jworks.nl wrote:

 Hi all,

 I'm relatively new to Wicket, and I have a small question. I have a dynamic
 form in Javascript, which can have an unlimited set of input fields. For
 example, I can have a form to manage persons, and the user can enter
 multiple addresses, which are currently handled by a jQuery clone of a piece
 of HTML.

 My question is: is this also possible with Wicket? I don't want to use Ajax
 forms, I'd rather do everything in the DOM of the browser and then submit
 it. This doesn't sound like a unique situation to me, but I have a hard time
 finding the information how to handle this from a Wicket perspective. I did
 found this tutorial:

 http://utku-utkan.blogspot.com/2007/07/dynamic-forms-in-wicket.html, but
 the form there is managed by Wicket, and I want the browser to manage this.

 Is this possible?

 Thanks in advance,

 Erik Pragt

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




-- 
Pedro Henrique Oliveira dos Santos


Adding Javascript using Wicket onto a page that is not the header

2009-05-19 Thread Patrick Fong
Hi

I want to add Javascript which loads Javascript client side variables when a
page loads. It would call a Javascript function and pass in server-side
values. 

Typically to add HTML text I would do a add(new Label(id, Blah));

However, I want to add a Javascript function that would be enclosed in
script tags and after the form. This Javascript is not part of the header.

I've tried to add variables using the new Label(id, new
Model(alert('hello');)), but the single quotes are escaped.

I've looked into the following for some hints
*  
http://www.nabble.com/legacy-javascript-integration-td8454107.html#a8460179
* http://cwiki.apache.org/WICKET/adding-javascript-from-wicket.html

I know it is something to do with JavascriptTemplate. But I was hoping that
someone would shed some light into how to use. The Javascript goes something
like this ­ setVariables(Œ3¹, Œ1¹);

Cheers
Patrick


Re: JavaScript and Wicket

2009-01-16 Thread Sniffer

Thanx, I think I understand you, but still I'm not sure how to contribute
client custom JS script with WebPage class.
Additional code (JS) is:

function showUpdate(id) {
itemId = id;
var maskDiv = document.getElementById('maskDiv');
var asModalWindow = document.getElementById('asModalUpdate');
if (maskDiv) {
if (maskDiv.style.display == 'none' || maskDiv.style.display == )
{
$(#maskDiv).fadeIn(fast, function() {
var theTop=(document.height/2)-(250/2);
var theLeft=(document.width/2)-(600/2);
asModalWindow.style.top = theTop;
asModalWindow.style.left = theLeft;
$(#asModalUpdate).fadeIn(fast);
});
}
}
return true;
}

asModalUpdate is :

div id=asModalUpdate onclick=closeModal('asModalUpdate')
ul
li wicket:id=updateFirst
Alle Arbeiten wurden erledigt
/li
li
Moment kein Zeit hierfur
/li
li
Warte auf info
/li
li
In Bearbeitung
/li
li onclick=updateManual()
Manuelles Update
/li
br
li onclick=closeModal('asModalUpdate')
Cancel
/li
/ul
/div

When first li tag is clicked which has wicket:id='updateFirst', I need to
get request to server with already defined itemId value in
showUpdate(id) function.

How that is possible to do with Wicket?!

Best regards,
Aleksandar Cajic
-- 
View this message in context: 
http://www.nabble.com/JavaScript-and-Wicket-tp21481992p21495435.html
Sent from the Wicket - User 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: JavaScript and Wicket

2009-01-16 Thread Richard Allen
See: http://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html
Or more generally: http://cwiki.apache.org/WICKET/ajax.html

-Richard

On Fri, Jan 16, 2009 at 4:29 AM, Sniffer cajic_aleksan...@yahoo.com wrote:


 Thanx, I think I understand you, but still I'm not sure how to contribute
 client custom JS script with WebPage class.
 Additional code (JS) is:

 function showUpdate(id) {
itemId = id;
var maskDiv = document.getElementById('maskDiv');
var asModalWindow = document.getElementById('asModalUpdate');
if (maskDiv) {
if (maskDiv.style.display == 'none' || maskDiv.style.display == )
 {
$(#maskDiv).fadeIn(fast, function() {
var theTop=(document.height/2)-(250/2);
var theLeft=(document.width/2)-(600/2);
asModalWindow.style.top = theTop;
asModalWindow.style.left = theLeft;
$(#asModalUpdate).fadeIn(fast);
});
}
}
return true;
 }

 asModalUpdate is :

 div id=asModalUpdate onclick=closeModal('asModalUpdate')
ul
li wicket:id=updateFirst
Alle Arbeiten wurden erledigt
/li
li
Moment kein Zeit hierfur
/li
li
Warte auf info
/li
li
In Bearbeitung
/li
li onclick=updateManual()
Manuelles Update
/li
br
li onclick=closeModal('asModalUpdate')
Cancel
/li
/ul
/div

 When first li tag is clicked which has wicket:id='updateFirst', I need to
 get request to server with already defined itemId value in
 showUpdate(id) function.

 How that is possible to do with Wicket?!

 Best regards,
 Aleksandar Cajic
 --
 View this message in context:
 http://www.nabble.com/JavaScript-and-Wicket-tp21481992p21495435.html
 Sent from the Wicket - User 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




JavaScript and Wicket

2009-01-15 Thread Sniffer

Hi,
I'm a beginner about Wicket and the main issue which I have is JavaScript
and Wicket integration. My question is is it possible to pass JavaScript
variable value to Wicket as Wicket link parameter? 

Here are some part of code which I have:

// Set link on data cell
Link callUpdateWindow = new Link(callUpdateWindow, item.getModel()) {
public void onClick() {
}
};
String call = String.format(showUpdate('%s');, item.getIndex());
callUpdateWindow.add(new AttributeModifier(onclick, true, new
Model(call)));


HTML:
td align=center valign=middle class=dotCell
wicket:id=callUpdateWindow
img/icon/dot_green.png 
/td

And this is working fine, Wicket set onclick attribute with desired value to
JavaScript function, but then from HTML I don't know how to return
JavaScript set value to Wicket.

Please any kind of help!

Best regards,
Aleksandar Cajic
-- 
View this message in context: 
http://www.nabble.com/JavaScript-and-Wicket-tp21481992p21481992.html
Sent from the Wicket - User 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: JavaScript and Wicket

2009-01-15 Thread Jeremy Thomerson
Do you mean that you want to call back to Wicket from client-side JS?  If
so, see any of the AbstractAjaxBehavior implementations - you'll see how
they generate a callback to server-side.

On Thu, Jan 15, 2009 at 11:04 AM, Sniffer cajic_aleksan...@yahoo.comwrote:


 Hi,
 I'm a beginner about Wicket and the main issue which I have is JavaScript
 and Wicket integration. My question is is it possible to pass JavaScript
 variable value to Wicket as Wicket link parameter?

 Here are some part of code which I have:

 // Set link on data cell
 Link callUpdateWindow = new Link(callUpdateWindow, item.getModel()) {
public void onClick() {
}
 };
 String call = String.format(showUpdate('%s');, item.getIndex());
 callUpdateWindow.add(new AttributeModifier(onclick, true, new
 Model(call)));


 HTML:
 td align=center valign=middle class=dotCell
 wicket:id=callUpdateWindow
img/icon/dot_green.png
 /td

 And this is working fine, Wicket set onclick attribute with desired value
 to
 JavaScript function, but then from HTML I don't know how to return
 JavaScript set value to Wicket.

 Please any kind of help!

 Best regards,
 Aleksandar Cajic
 --
 View this message in context:
 http://www.nabble.com/JavaScript-and-Wicket-tp21481992p21481992.html
 Sent from the Wicket - User 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




-- 
Jeremy Thomerson
http://www.wickettraining.com