Calling wicket from javascript

2012-05-07 Thread jcf1974
Hello, 
 I'm new in this forum, and i love wicket!!!
My question is: 
What wrong with this code?

   @Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new
AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {
private static final long serialVersionUID = 1L;

@Override
public CharSequence preDecorateScript(CharSequence
script) {
return function callWicket(){ + script + };
$('.search-div').slideDown('slow',callWicket());;
}
};
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Calling-wicket-from-javascript-tp4614627.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: Calling wicket from javascript

2012-05-07 Thread Richard W. Adams
Hard to say without details. Are you not getting the behavior you expect 
(and what is that behavior?). Are you getting an error message?

RAM /abr./: Rarely Adequate Memory. 



From:   jcf1974 eslae...@eresmas.com
To: users@wicket.apache.org
Date:   05/07/2012 07:07 AM
Subject:Calling wicket from javascript



Hello, 
 I'm new in this forum, and i love wicket!!!
My question is: 
What wrong with this code?

   @Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new
AjaxPreprocessingCallDecorator(super.getAjaxCallDecorator()) {
private static final long serialVersionUID = 1L;

@Override
public CharSequence preDecorateScript(CharSequence
script) {
return function callWicket(){ + script + };
$('.search-div').slideDown('slow',callWicket());;
}
};
}


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Calling-wicket-from-javascript-tp4614627.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




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Calling wicket from javascript

2012-05-07 Thread jcf1974
I tried to call wicket from javascript without using a wicket behaviour,
 and the error/warning i get is  wcall is not defined.




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Calling-wicket-from-javascript-tp4614627p4614859.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



Wrong path to wicket-event.js resulting in 404 after calling wicket from javascript

2009-09-30 Thread rozkovec . wl
Hallo,
I came across strange problem I do not know whether it is mine fault or 
wicket's problem.

On a page, there is a widget, which list news records.
Each record has an edit and delete link. Edit link opens new dialog in jquery's 
thickbox window, which is practically IFrame.

The code for page, which holds form and which is displayed in the thickbox 
window:
http://pastebin.com/m5ca60e78

The code for a link, which shows the thickbox window with a page in it:
http://pastebin.com/m6339b3a

En example usage:
http://pastebin.com/m768350aa
here on line 72 when I do:
target.addComponent(ShopNewsWidgetPanel.this.get(news-container));

after ajax refresh of the component, which contains news records, each record 
containing edit link, there is 404 error found in the Ajax debug window.
From firebug console I can find out that if I add a some component (here it is 
edit link, which is held by news-container), which also contains 
AbstractDefaultAjaxBehavior, then upon rendering head of the response, there 
is wrong path to wicket ajax resources:

Correct path:
http://localhost:8080/cz.madewithlove/app/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js

Wrong path after ajax call:
http://localhost:8080/cz.madewithlove/app/shop/rozkovec/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js

The page is mounted like so:
mount(new IndexedHybridUrlCodingStrategy(shop, ShopModulePage.class));

An ajax function, which is called in the page's ajax button onSubmit() method:

function thickbox_window_close(url)
{
   tb_remove(); //removes thickbox window

   // call url of the behavior, this behavior is attached to the link, which 
opens the page in thickbox window
   var wcall=wicketAjaxGet(url, null, null, function() {return true;});

   return !wcall;
}

I could solve it by visiting all components of the parent container except 
behaviors and add them to the ajax request target, but it would be better to 
not bother about it and just add the parent container. Any pointers?


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



Re: Wrong path to wicket-event.js resulting in 404 after calling wicket from javascript

2009-09-30 Thread Vladimir K

I believe the code that causes the problem is

#
@Override
#
protected CharSequence getURL()
#
{
#
return super.getURL() +
String.format(TB_iframe=trueheight=%dwidth=%dmodal=false, getHeight(),
getWidth());
#
}

IFAIK wicket encodes URL parameters in a special form. And the last part is
the number of ../ required for prepending the resource urls. In your app
it might be zero so wicket do not generate appropriate ../../.. for your
app/shop/rozkovec mount string.


Vit Rozkovec wrote:
 
 Hallo,
 I came across strange problem I do not know whether it is mine fault or
 wicket's problem.
 
 On a page, there is a widget, which list news records.
 Each record has an edit and delete link. Edit link opens new dialog in
 jquery's thickbox window, which is practically IFrame.
 
 The code for page, which holds form and which is displayed in the thickbox
 window:
 http://pastebin.com/m5ca60e78
 
 The code for a link, which shows the thickbox window with a page in it:
 http://pastebin.com/m6339b3a
 
 En example usage:
 http://pastebin.com/m768350aa
 here on line 72 when I do:
 target.addComponent(ShopNewsWidgetPanel.this.get(news-container));
 
 after ajax refresh of the component, which contains news records, each
 record containing edit link, there is 404 error found in the Ajax debug
 window.
 From firebug console I can find out that if I add a some component (here
 it is edit link, which is held by news-container), which also contains
 AbstractDefaultAjaxBehavior, then upon rendering head of the response,
 there is wrong path to wicket ajax resources:
 
 Correct path:
 http://localhost:8080/cz.madewithlove/app/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
 
 Wrong path after ajax call:
 http://localhost:8080/cz.madewithlove/app/shop/rozkovec/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
 
 The page is mounted like so:
 mount(new IndexedHybridUrlCodingStrategy(shop, ShopModulePage.class));
 
 An ajax function, which is called in the page's ajax button onSubmit()
 method:
 
 function thickbox_window_close(url)
 {
tb_remove(); //removes thickbox window
 
// call url of the behavior, this behavior is attached to the link,
 which opens the page in thickbox window
var wcall=wicketAjaxGet(url, null, null, function() {return true;});
 
return !wcall;
 }
 
 I could solve it by visiting all components of the parent container except
 behaviors and add them to the ajax request target, but it would be better
 to not bother about it and just add the parent container. Any pointers?
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Wrong-path-to-wicket-event.js-resulting-in-404-after-calling-wicket-from-javascript-tp25678997p25681934.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: Wrong path to wicket-event.js resulting in 404 after calling wicket from javascript

2009-09-30 Thread rozkovec . wl
I have tried removing the override completely, but it did not help. I just 
would like to know, whether I am doing something obviously stupid, or if I 
should start debugging deeper or make a quickstart.

Vit

 
 I believe the code that causes the problem is
 
 #
 @Override
 #
 protected CharSequence getURL()
 #
 {
 #
 return super.getURL() +
 String.format(TB_iframe=trueheight=%dwidth=%dmodal=false, getHeight(),
 getWidth());
 #
 }
 
 IFAIK wicket encodes URL parameters in a special form. And the last part is
 the number of ../ required for prepending the resource urls. In your app
 it might be zero so wicket do not generate appropriate ../../.. for your
 app/shop/rozkovec mount string.
 
 
 Vit Rozkovec wrote:
  
  Hallo,
  I came across strange problem I do not know whether it is mine fault or
  wicket's problem.
  
  On a page, there is a widget, which list news records.
  Each record has an edit and delete link. Edit link opens new dialog in
  jquery's thickbox window, which is practically IFrame.
  
  The code for page, which holds form and which is displayed in the thickbox
  window:
  http://pastebin.com/m5ca60e78
  
  The code for a link, which shows the thickbox window with a page in it:
  http://pastebin.com/m6339b3a
  
  En example usage:
  http://pastebin.com/m768350aa
  here on line 72 when I do:
  target.addComponent(ShopNewsWidgetPanel.this.get(news-container));
  
  after ajax refresh of the component, which contains news records, each
  record containing edit link, there is 404 error found in the Ajax debug
  window.
  From firebug console I can find out that if I add a some component (here
  it is edit link, which is held by news-container), which also contains
  AbstractDefaultAjaxBehavior, then upon rendering head of the response,
  there is wrong path to wicket ajax resources:
  
  Correct path:
 
 http://localhost:8080/cz.madewithlove/app/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
  
  Wrong path after ajax call:
 
 http://localhost:8080/cz.madewithlove/app/shop/rozkovec/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js
  
  The page is mounted like so:
  mount(new IndexedHybridUrlCodingStrategy(shop, ShopModulePage.class));
  
  An ajax function, which is called in the page's ajax button onSubmit()
  method:
  
  function thickbox_window_close(url)
  {
 tb_remove(); //removes thickbox window
  
 // call url of the behavior, this behavior is attached to the link,
  which opens the page in thickbox window
 var wcall=wicketAjaxGet(url, null, null, function() {return true;});
  
 return !wcall;
  }
  
  I could solve it by visiting all components of the parent container except
  behaviors and add them to the ajax request target, but it would be better
  to not bother about it and just add the parent container. Any pointers?
  
  
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
  
  
  
 
 -- 
 View this message in context:
 http://www.nabble.com/Wrong-path-to-wicket-event.js-resulting-in-404-after-calling-wicket-from-javascript-tp25678997p25681934.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
 
 
 
 
 

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



Implementing the cwiki's Calling Wicket from Javascript

2009-02-03 Thread insom

I'm trying to apply the concepts found here:
http://cwiki.apache.org/confluence/display/WICKET/Calling+Wicket+from+Javascript
. The code for my very simple test case is below. When I load the page, I
expect to see hi printed to my console. Instead I get a
NullPointerException (also shown below). What am I doing wrong?

public class AjaxTestPage extends WebPage implements IHeaderContributor {

final AbstractDefaultAjaxBehavior behave = new
AbstractDefaultAjaxBehavior() {
@Override
protected void respond(AjaxRequestTarget target) {
System.out.println(hi);   
}
};

public AjaxTestPage() {
add(behave);
}

@Override
public void renderHead(IHeaderResponse response) {
response.renderOnLoadJavascript(
 wicketAjaxGet(' + behave.getCallbackUrl() + 
', function() { },
function() { }); 
);  
}   
}


java.lang.NullPointerException
at com.insom.ErrorPage.init(ErrorPage.java:19)
at
com.insom.MyWebRequestCycle.onRuntimeException(MyWebRequestCycle.java:24)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.onRuntimeException(AbstractRequestCycleProcessor.java:217)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:119)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1302)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:497)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:387)
at
org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

-- 
View this message in context: 
http://www.nabble.com/Implementing-the-cwiki%27s-%22Calling-Wicket-from-Javascript%22-tp21815652p21815652.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: Implementing the cwiki's Calling Wicket from Javascript

2009-02-03 Thread Michael Sparer

if you fix the NullPointerException in your ErrorPage the original
RuntimeException (which would possibly tell you what you were doing wrong)
might had a chance to get through

regards,
Michael


insom wrote:
 
 I'm trying to apply the concepts found here:
 http://cwiki.apache.org/confluence/display/WICKET/Calling+Wicket+from+Javascript
 . The code for my very simple test case is below. When I load the page, I
 expect to see hi printed to my console. Instead I get a
 NullPointerException (also shown below). What am I doing wrong?
 
 public class AjaxTestPage extends WebPage implements IHeaderContributor {
   
   final AbstractDefaultAjaxBehavior behave = new
 AbstractDefaultAjaxBehavior() {
   @Override
   protected void respond(AjaxRequestTarget target) {
   System.out.println(hi);   
   }
   };
   
   public AjaxTestPage() {
   add(behave);
   }
   
   @Override
   public void renderHead(IHeaderResponse response) {
   response.renderOnLoadJavascript(
wicketAjaxGet(' + behave.getCallbackUrl() + 
 ', function() { },
 function() { }); 
   );  
   }   
 }
 
 
 java.lang.NullPointerException
   at com.insom.ErrorPage.init(ErrorPage.java:19)
   at
 com.insom.MyWebRequestCycle.onRuntimeException(MyWebRequestCycle.java:24)
   at
 org.apache.wicket.request.AbstractRequestCycleProcessor.onRuntimeException(AbstractRequestCycleProcessor.java:217)
   at
 org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:119)
   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1302)
   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
   at org.apache.wicket.RequestCycle.request(RequestCycle.java:497)
   at
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:387)
   at
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at
 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
   at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at
 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)
 
 


-
Michael Sparer
http://techblog.molindo.at
-- 
View this message in context: 
http://www.nabble.com/Implementing-the-cwiki%27s-%22Calling-Wicket-from-Javascript%22-tp21815652p21816483.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