Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Chris
Update:

When setting #setAllowDefault(false), the #onevent method of the web markup 
container is called, but in addition also the #on select method of sortable.
When setting #setAllowDefault(true), the #onevent method is not called at all, 
only the #on select method.

It seems that setAllowDefault(false or true) does not prevent the event 
bubbling to parents. What might be missing?


@Override
protected void populateItem(ListItemString item) {
...
WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
infoLink.add(new AjaxEventBehavior(onclick) {

@Override
protected void onEvent(AjaxRequestTarget target) {
  
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes 
attributes) {
super.updateAjaxAttributes(attributes);
attributes.setAllowDefault(false);
}
});


@Override
public void onSelect(AjaxRequestTarget target, ListString items) {
…..


Chris


 Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org:
 
 Hi,
 
 On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 thanks for your help. Has that the method signature recently changed? The
 method #setPreventDefault is not available on the object #attributes.
 
 
 Link link = new AjaxFallbackLinkString(link) {
 
@Override
public void onClick(AjaxRequestTarget target) {
}
 
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
super.updateAjaxAttributes(attributes);
attributes.setPreventDefault(true);
 
 
 In Wicket 6.x it is wrongly named setAllowDefault().
 
 
}
};
 
 Chris
 
 
 
 Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Yes, generally speaking, you have to cancel bubbling events to parent
 elements.
 For a [Ajax]Link (or any event-behavior related) you have to set the
 preventDefault property to true;
 
   protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
   {
   super.updateAjaxAttributes(attributes);
 
   attributes.setPreventDefault(true); // cancel bubbling
   }
 
 Hope this helps,
 Best regards,
 Sebastien
 
 On Fri, Feb 6, 2015 at 6:59 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 I would have a follow-up question regarding the #Sortable:
 
 
 Is it possible to add an AjaxLink to the item with its own behavior so
 that if the user clicks on this link, then its on-click behavior should
 be
 called instead of the #onselect method from the sortable. At the moment,
 the #onselect method would be called for this link.
 
 Thanks a lot,
 Chris
 
 @Override
 protected void populateItem(ListItemString item)
 {
  item.add(new EmptyPanel(icon).add(AttributeModifier.append(class,
 ui-icon  + JQueryIcon.ARROW_2_N_S)));
  item.add(new Label(item, item.getModelObject()));
  item.add(AttributeModifier.append(class, ui-state-default));
 }
 
 
 
 
 Am 05.02.2015 um 14:30 schrieb Sebastien seb...@gmail.com:
 
 I've opened the issue:
 https://github.com/sebfz1/wicket-jquery-ui/issues/153
 
 
 On Thu, Feb 5, 2015 at 10:29 AM, Sebastien seb...@gmail.com wrote:
 
 Hi Chris,
 
 Right, Sortable is processing events thought the Event Bus, that's
 because
 2 sortables can be connected and then, these should be able to
 communicate
 
 As you are sending the event from the Sortable, you enter the
 condition:
 if (event.getSource() instanceof Sortable?)
 
 I will try to find out how I can add a check, but as Sortable is
 using a
 generic model object (typeof T)...
 I think the correct solution/workaround would be that you change the
 broadcast type to EXACT, so Sortable#onEvent will not be triggered.
 
 Thanks  best regards,
 Sebastien.
 
 
 
 On Wed, Feb 4, 2015 at 8:55 PM, Chris chris...@gmx.at wrote:
 
 Hi Sven, thanks.
 
 The onRemove method is from the class
 com.googlecode.wicket.jquery.ui.interaction.sortable.Sortable:
 
 @Override
 public void onRemove(AjaxRequestTarget target, String item) {
  super.onRemove(target, item);
 }
 Why is the payload processed in this method, as it takes the target
 as
 parameter? Is there another way to render the other panel or rewrite
 the
 payload?
 
 br, Chris
 
 
 Am 04.02.2015 um 20:41 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 you're using a DeleteItem as payload of the event:
 
send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
 
 Yet in #onRemove() you're casting the payload to a String:
 
java.lang.ClassCastException: tripplanner.mycompany.DeleteItem
 cannot be cast to java.lang.String
 at
 mycompany.panels.SuitcasePanel$1.onRemove(SuitcasePanel.java:54)
 
 
 Regards
 Sven
 
 
 On 04.02.2015 20:32, Chris wrote:
 Hi Tobias - sorry, here it is:
 
 Last cause: mycompany.DeleteItem cannot be cast to java.lang.String
 WicketMessage: Method onRequest 

Re: Wicket CDI and Asynchronous (and Websockets)

2015-02-08 Thread Sebastien
Dear all,

I think I've now a full working version of my usecase: in EJB/@Asynchronous
mode (stateless and stateful) and in CDI using Executors.
It is not yet usable because it requires a change in wicket-cdi-1.1 which
should be discussed in dev@.

Anyhow, I would never be able to achieve it without the invaluable help of
Martin I thank (once again) a lot!
I also would like to say thank you to the few people that tried to solve
this puzzle; I know there are because I saw fork(s) !..

Best regards,
Sebastien.


On Fri, Feb 6, 2015 at 5:22 PM, Sebastien seb...@gmail.com wrote:

 Dear all,

 In a usecase I've explained in a recent discussion [1], I would like to
 enhance it a little to finally obtain:

 1/ An ajax button that launch 2/
 2/ A CDI injected EJB that executes an *asynchronous* time consuming
 operation
 3/ Getting back to the wicket side to complete the ajax operation.
 4/ A listener that has been provided to the EJB which, when events are
 fired, retrieve websockets information from the wicket Session (previously
 stored) and send a notification to the UI/user trough the websocket.

 For me, that's a very nice usecase: Imagine the user clicks on a button
 for a long running operation, then he continues using the site, navigate
 between pages etc... and is notified from time to time on the progress of
 the operation through websockets...

 I can make work either 3/ or 4/ but not both in conjunction, I get this
 (now famous) error:
 *There is no application attached to current thread EJB default*

 I unfortunately have to say I am not a CDI expert, and there is a lot of
 XxxScoped possible annotation, I tried all possible combination that would
 be logical IMO regarding the doc, read everything I could, but now I'm
 stuck... I am almost sure this is feasible, but maybe not as so easy as it
 seems

 I've prepared a concrete quickstart [2], it just need to be compiled and
 deployed in WidlyFly (JBoss 8), due to the websockets...

 I know I am asking for a real favor but I would be very thankful to the
 person(s) who would be able to make it work! I will leave the quickstart in
 my github's repo so any other user whiling to achieve the same usecase
 would already have a starting point...

 Thanks a lot in advance,
 Sebastien.

 [1]
 http://mail-archives.apache.org/mod_mbox/wicket-dev/201410.mbox/%3CCAAJwaYWCTTQDmu2pg3K=qyvgvhujgndaytjubc8sn+7fz-d...@mail.gmail.com%3E
 [2] https://github.com/sebfz1/wicket-quickstart-cdi-async




Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

Sorry for the mistake, its
attributes.setEventPropagation(EventPropagation.STOP);

Best regards,
Sebastien.


On Fri, Feb 6, 2015 at 10:12 PM, Chris chris...@gmx.at wrote:

 Update:

 When setting #setAllowDefault(false), the #onevent method of the web
 markup container is called, but in addition also the #on select method of
 sortable.
 When setting #setAllowDefault(true), the #onevent method is not called at
 all, only the #on select method.

 It seems that setAllowDefault(false or true) does not prevent the event
 bubbling to parents. What might be missing?


 @Override
 protected void populateItem(ListItemString item) {
 ...
 WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
 infoLink.add(new AjaxEventBehavior(onclick) {

 @Override
 protected void onEvent(AjaxRequestTarget target) {

 }

 @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setAllowDefault(false);
 }
 });


 @Override
 public void onSelect(AjaxRequestTarget target, ListString items) {
 …..


 Chris


  Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org:
 
  Hi,
 
  On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at wrote:
 
  Hi Sebastian,
 
  thanks for your help. Has that the method signature recently changed?
 The
  method #setPreventDefault is not available on the object #attributes.
 
 
  Link link = new AjaxFallbackLinkString(link) {
 
 @Override
 public void onClick(AjaxRequestTarget target) {
 }
 
 @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setPreventDefault(true);
 
 
  In Wicket 6.x it is wrongly named setAllowDefault().
 
 
 }
 };
 
  Chris
 
 
 
  Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Yes, generally speaking, you have to cancel bubbling events to parent
  elements.
  For a [Ajax]Link (or any event-behavior related) you have to set the
  preventDefault property to true;
 
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);
 
attributes.setPreventDefault(true); // cancel bubbling
}
 
  Hope this helps,
  Best regards,
  Sebastien
 
  On Fri, Feb 6, 2015 at 6:59 PM, Chris chris...@gmx.at wrote:
 
  Hi Sebastian,
 
  I would have a follow-up question regarding the #Sortable:
 
 
  Is it possible to add an AjaxLink to the item with its own behavior so
  that if the user clicks on this link, then its on-click behavior
 should
  be
  called instead of the #onselect method from the sortable. At the
 moment,
  the #onselect method would be called for this link.
 
  Thanks a lot,
  Chris
 
  @Override
  protected void populateItem(ListItemString item)
  {
   item.add(new EmptyPanel(icon).add(AttributeModifier.append(class,
  ui-icon  + JQueryIcon.ARROW_2_N_S)));
   item.add(new Label(item, item.getModelObject()));
   item.add(AttributeModifier.append(class, ui-state-default));
  }
 
 
 
 
  Am 05.02.2015 um 14:30 schrieb Sebastien seb...@gmail.com:
 
  I've opened the issue:
  https://github.com/sebfz1/wicket-jquery-ui/issues/153
 
 
  On Thu, Feb 5, 2015 at 10:29 AM, Sebastien seb...@gmail.com wrote:
 
  Hi Chris,
 
  Right, Sortable is processing events thought the Event Bus, that's
  because
  2 sortables can be connected and then, these should be able to
  communicate
 
  As you are sending the event from the Sortable, you enter the
  condition:
  if (event.getSource() instanceof Sortable?)
 
  I will try to find out how I can add a check, but as Sortable is
  using a
  generic model object (typeof T)...
  I think the correct solution/workaround would be that you change the
  broadcast type to EXACT, so Sortable#onEvent will not be triggered.
 
  Thanks  best regards,
  Sebastien.
 
 
 
  On Wed, Feb 4, 2015 at 8:55 PM, Chris chris...@gmx.at wrote:
 
  Hi Sven, thanks.
 
  The onRemove method is from the class
  com.googlecode.wicket.jquery.ui.interaction.sortable.Sortable:
 
  @Override
  public void onRemove(AjaxRequestTarget target, String item) {
   super.onRemove(target, item);
  }
  Why is the payload processed in this method, as it takes the target
  as
  parameter? Is there another way to render the other panel or
 rewrite
  the
  payload?
 
  br, Chris
 
 
  Am 04.02.2015 um 20:41 schrieb Sven Meier s...@meiers.net:
 
  Hi,
 
  you're using a DeleteItem as payload of the event:
 
 send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
 
  Yet in #onRemove() you're casting the payload to a String:
 
 java.lang.ClassCastException: tripplanner.mycompany.DeleteItem
  cannot be cast to 

Re: wicketstuff examples site down?

2015-02-08 Thread Sebastien
It seems that it is down again... :s

On Fri, Feb 6, 2015 at 8:45 AM, Ernesto Reinaldo Barreiro 
reier...@gmail.com wrote:

 :-) That's why I did not have the problem. You are too fast :-)

 On Fri, Feb 6, 2015 at 7:43 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

  It is up again.
  Thanks!
 
  Martin Grigorov
  Wicket Training and Consulting
  https://twitter.com/mtgrigorov
 
  On Fri, Feb 6, 2015 at 9:26 AM, Erki erki.pub...@gmail.com wrote:
 
   Hi,
   I am having trouble accessing the wicketstuff demo site
   http://wicket-library.com/wicket-examples-6.0.x/
  
   I get the following error:
   502 Error:
  
  
   Proxy Error
   The server could not connect to the back-end Apache, Tomcat, Resin, or
   JBoss
   server. This is usually because it has either crashed, or has not been
   started properly. Usually all that is needed to fix this is a restart.
 If
   you have restarted your back-end server and you are still having
  problems,
   you can usually find the cause by checking the logfiles both in your
 home
   directory and in the server-wide log directory. If all else fails,
 please
   contact support at supp...@kattare.com.
  
   --
   View this message in context:
  
 
 http://apache-wicket.1842946.n4.nabble.com/wicketstuff-examples-site-down-tp4669324.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
  
  
 



 --
 Regards - Ernesto Reinaldo Barreiro



Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Chris
Hi Sebastian - thanks for your answer.

I experience that when adding #attributes.setEventPropagation, the #onEvent 
method of infoLink is not called at all, and the #onselect method of the 
sortable is still called. It would be awesome if you know how to fix it.

@Override
protected void populateItem(ListItemString item) {
...
WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
infoLink.add(new AjaxEventBehavior(onclick) {

@Override
protected void onEvent(AjaxRequestTarget target) {

}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes 
attributes) {
super.updateAjaxAttributes(attributes);
attributes.setAllowDefault(false);

attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.STOP);

}
});

br, Chris

 Am 08.02.2015 um 11:15 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Sorry for the mistake, its
 attributes.setEventPropagation(EventPropagation.STOP);
 
 Best regards,
 Sebastien.
 
 
 On Fri, Feb 6, 2015 at 10:12 PM, Chris chris...@gmx.at wrote:
 
 Update:
 
 When setting #setAllowDefault(false), the #onevent method of the web
 markup container is called, but in addition also the #on select method of
 sortable.
 When setting #setAllowDefault(true), the #onevent method is not called at
 all, only the #on select method.
 
 It seems that setAllowDefault(false or true) does not prevent the event
 bubbling to parents. What might be missing?
 
 
 @Override
 protected void populateItem(ListItemString item) {
...
WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
infoLink.add(new AjaxEventBehavior(onclick) {
 
@Override
protected void onEvent(AjaxRequestTarget target) {
 
}
 
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
super.updateAjaxAttributes(attributes);
attributes.setAllowDefault(false);
}
 });
 
 
 @Override
 public void onSelect(AjaxRequestTarget target, ListString items) {
 …..
 
 
 Chris
 
 
 Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org:
 
 Hi,
 
 On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 thanks for your help. Has that the method signature recently changed?
 The
 method #setPreventDefault is not available on the object #attributes.
 
 
 Link link = new AjaxFallbackLinkString(link) {
 
   @Override
   public void onClick(AjaxRequestTarget target) {
   }
 
   @Override
   protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
   super.updateAjaxAttributes(attributes);
   attributes.setPreventDefault(true);
 
 
 In Wicket 6.x it is wrongly named setAllowDefault().
 
 
   }
   };
 
 Chris
 
 
 
 Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Yes, generally speaking, you have to cancel bubbling events to parent
 elements.
 For a [Ajax]Link (or any event-behavior related) you have to set the
 preventDefault property to true;
 
  protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
  {
  super.updateAjaxAttributes(attributes);
 
  attributes.setPreventDefault(true); // cancel bubbling
  }
 
 Hope this helps,
 Best regards,
 Sebastien
 
 On Fri, Feb 6, 2015 at 6:59 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 I would have a follow-up question regarding the #Sortable:
 
 
 Is it possible to add an AjaxLink to the item with its own behavior so
 that if the user clicks on this link, then its on-click behavior
 should
 be
 called instead of the #onselect method from the sortable. At the
 moment,
 the #onselect method would be called for this link.
 
 Thanks a lot,
 Chris
 
 @Override
 protected void populateItem(ListItemString item)
 {
 item.add(new EmptyPanel(icon).add(AttributeModifier.append(class,
 ui-icon  + JQueryIcon.ARROW_2_N_S)));
 item.add(new Label(item, item.getModelObject()));
 item.add(AttributeModifier.append(class, ui-state-default));
 }
 
 
 
 
 Am 05.02.2015 um 14:30 schrieb Sebastien seb...@gmail.com:
 
 I've opened the issue:
 https://github.com/sebfz1/wicket-jquery-ui/issues/153
 
 
 On Thu, Feb 5, 2015 at 10:29 AM, Sebastien seb...@gmail.com wrote:
 
 Hi Chris,
 
 Right, Sortable is processing events thought the Event Bus, that's
 because
 2 sortables can be connected and then, these should be able to
 communicate
 
 As you are sending the event from the Sortable, you enter the
 condition:
 if (event.getSource() instanceof Sortable?)
 
 I will try to find out how I can add a check, but as Sortable is
 using a
 generic model object (typeof T)...
 I think the correct solution/workaround would be that you change the
 

Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

Actually what you describe is the opposite of what is supposed to happen :)

I will try to look at this... There could be several reason: the region
occupied by the markup container can be misleading for instance, or there
could be a canceling bubble conflict between registered wicket ajax event
and pure jquery ones (I would be surprised but i will double check)

Btw IIRC, the event name should be click, not onclick
new AjaxEventBehavior(click)

Furthermore, is there any reason you preferred a container over a link?
Maybe you can try with a link instead, just to be sure it is not a matter
of the region being clicked...
Last point, depending of the resulting hierarchy level of elements, maybe
STOP_IMMEDIATE should be used instead of just STOP

Best regards,
Sebastien


On Sun, Feb 8, 2015 at 1:55 PM, Chris chris...@gmx.at wrote:

 Hi Sebastian - thanks for your answer.

 I experience that when adding #attributes.setEventPropagation, the
 #onEvent method of infoLink is not called at all, and the #onselect method
 of the sortable is still called. It would be awesome if you know how to fix
 it.

 @Override
 protected void populateItem(ListItemString item) {
 ...
 WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
 infoLink.add(new AjaxEventBehavior(onclick) {

 @Override
 protected void onEvent(AjaxRequestTarget target) {

 }

 @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setAllowDefault(false);

 attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.STOP);

 }
 });

 br, Chris

  Am 08.02.2015 um 11:15 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Sorry for the mistake, its
  attributes.setEventPropagation(EventPropagation.STOP);
 
  Best regards,
  Sebastien.
 
 
  On Fri, Feb 6, 2015 at 10:12 PM, Chris chris...@gmx.at wrote:
 
  Update:
 
  When setting #setAllowDefault(false), the #onevent method of the web
  markup container is called, but in addition also the #on select method
 of
  sortable.
  When setting #setAllowDefault(true), the #onevent method is not called
 at
  all, only the #on select method.
 
  It seems that setAllowDefault(false or true) does not prevent the event
  bubbling to parents. What might be missing?
 
 
  @Override
  protected void populateItem(ListItemString item) {
 ...
 WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
 infoLink.add(new AjaxEventBehavior(onclick) {
 
 @Override
 protected void onEvent(AjaxRequestTarget target) {
 
 }
 
 @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setAllowDefault(false);
 }
  });
 
 
  @Override
  public void onSelect(AjaxRequestTarget target, ListString items) {
  …..
 
 
  Chris
 
 
  Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org:
 
  Hi,
 
  On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at wrote:
 
  Hi Sebastian,
 
  thanks for your help. Has that the method signature recently changed?
  The
  method #setPreventDefault is not available on the object #attributes.
 
 
  Link link = new AjaxFallbackLinkString(link) {
 
@Override
public void onClick(AjaxRequestTarget target) {
}
 
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
super.updateAjaxAttributes(attributes);
attributes.setPreventDefault(true);
 
 
  In Wicket 6.x it is wrongly named setAllowDefault().
 
 
}
};
 
  Chris
 
 
 
  Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Yes, generally speaking, you have to cancel bubbling events to parent
  elements.
  For a [Ajax]Link (or any event-behavior related) you have to set the
  preventDefault property to true;
 
   protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes)
   {
   super.updateAjaxAttributes(attributes);
 
   attributes.setPreventDefault(true); // cancel bubbling
   }
 
  Hope this helps,
  Best regards,
  Sebastien
 
  On Fri, Feb 6, 2015 at 6:59 PM, Chris chris...@gmx.at wrote:
 
  Hi Sebastian,
 
  I would have a follow-up question regarding the #Sortable:
 
 
  Is it possible to add an AjaxLink to the item with its own behavior
 so
  that if the user clicks on this link, then its on-click behavior
  should
  be
  called instead of the #onselect method from the sortable. At the
  moment,
  the #onselect method would be called for this link.
 
  Thanks a lot,
  Chris
 
  @Override
  protected void populateItem(ListItemString 

Re: Can i render content (css) of ContextRelativeResource to markup?

2015-02-08 Thread Martin Grigorov
Hi,

You should use response.render(CssHeaderItem.forCSS(string)). This will
contribute it in style HTML element. With your approach it will be plain
text in the middle of the HTML.
To get the string you can use new
WebExternalResourceStream(report.css).getInputStream(),
read, convert to String, close.


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

On Fri, Feb 6, 2015 at 4:21 PM, Per Newgro per.new...@gmx.ch wrote:

 Hi,

 I like to render a PDF by my wicket page using flying-saucer. There i
 reference my css file by url (link). So far everything works.
 But if i switch to SSL flying-saucer breaks. Hmm.

 My solution to this issue would be to include content of my css file
 directly in the wicket-page used to render the pdf.

 I tried to get the resource and render it in markup like this

 code
 MyPage.java

 @Override
 public void renderHead(IHeaderResponse response) {
   IResource s = new SharedResourceReference(report.css).getResource();
   Attributes a = new Attributes(getRequest(), getResponse());
   s.respond(a);
   super.renderHead(response);
 }
 /code

 but i get
 at
 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
 at
 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
 at java.lang.Thread.run(Thread.java:722)
 Caused by: java.lang.UnsupportedOperationException
 at
 org.apache.wicket.response.StringResponse.write(StringResponse.java:88)
 at
 org.apache.wicket.request.Response$StreamAdapter.write(Response.java:148)
 at org.apache.wicket.util.io.Streams.copy(Streams.java:109)
 at org.apache.wicket.util.io.Streams.copy(Streams.java:76)
 at
 org.apache.wicket.request.resource.ContextRelativeResource$1.writeData(ContextRelativeResource.java:110)
 at
 org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:528)
 at de.MyPage.renderHead(MyPage.java:88)
 at org.apache.wicket.Component.renderHead(Component.java:4419)
 at org.apache.wicket.Component.renderHead(Component.java:2679)
 at
 org.apache.wicket.markup.renderStrategy.AbstractHeaderRenderStrategy.renderRootComponent(AbstractHeaderRenderStrategy.java:127)
 at
 org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:60)
 at
 org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:170)
 at
 org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
 at
 org.apache.wicket.Component.internalRenderComponent(Component.java:2529)
 ... 51 more

 It seems that my ContextRelativeResource only provides content as byte[]
 ans StringResponse not supporting this.
 Maybe i be off the track.

 Thanks for your support
 Per

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




Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Chris
Thanks a lot, with #setAllowDefault(true) the #onEvent(AjaxRequestTarget 
target) of the respective webmarkupcontainer is called. Nevertheless, after 
that, the #onselect method of the sortable is called as well. How to prevent 
this call?

br, Chris


 Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org:
 
 Hi,
 
 On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at 
 mailto:chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 thanks for your help. Has that the method signature recently changed? The
 method #setPreventDefault is not available on the object #attributes.
 
 
 Link link = new AjaxFallbackLinkString(link) {
 
@Override
public void onClick(AjaxRequestTarget target) {
}
 
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
super.updateAjaxAttributes(attributes);
attributes.setPreventDefault(true);
 
 
 In Wicket 6.x it is wrongly named setAllowDefault().
 
 
}
};
 
 Chris
 
 
 
 Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Yes, generally speaking, you have to cancel bubbling events to parent
 elements.
 For a [Ajax]Link (or any event-behavior related) you have to set the
 preventDefault property to true;
 
   protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
   {
   super.updateAjaxAttributes(attributes);
 
   attributes.setPreventDefault(true); // cancel bubbling
   }
 
 Hope this helps,
 Best regards,
 Sebastien
 
 On Fri, Feb 6, 2015 at 6:59 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 I would have a follow-up question regarding the #Sortable:
 
 
 Is it possible to add an AjaxLink to the item with its own behavior so
 that if the user clicks on this link, then its on-click behavior should
 be
 called instead of the #onselect method from the sortable. At the moment,
 the #onselect method would be called for this link.
 
 Thanks a lot,
 Chris
 
 @Override
 protected void populateItem(ListItemString item)
 {
  item.add(new EmptyPanel(icon).add(AttributeModifier.append(class,
 ui-icon  + JQueryIcon.ARROW_2_N_S)));
  item.add(new Label(item, item.getModelObject()));
  item.add(AttributeModifier.append(class, ui-state-default));
 }
 
 
 
 
 Am 05.02.2015 um 14:30 schrieb Sebastien seb...@gmail.com:
 
 I've opened the issue:
 https://github.com/sebfz1/wicket-jquery-ui/issues/153
 
 
 On Thu, Feb 5, 2015 at 10:29 AM, Sebastien seb...@gmail.com wrote:
 
 Hi Chris,
 
 Right, Sortable is processing events thought the Event Bus, that's
 because
 2 sortables can be connected and then, these should be able to
 communicate
 
 As you are sending the event from the Sortable, you enter the
 condition:
 if (event.getSource() instanceof Sortable?)
 
 I will try to find out how I can add a check, but as Sortable is
 using a
 generic model object (typeof T)...
 I think the correct solution/workaround would be that you change the
 broadcast type to EXACT, so Sortable#onEvent will not be triggered.
 
 Thanks  best regards,
 Sebastien.
 
 
 
 On Wed, Feb 4, 2015 at 8:55 PM, Chris chris...@gmx.at wrote:
 
 Hi Sven, thanks.
 
 The onRemove method is from the class
 com.googlecode.wicket.jquery.ui.interaction.sortable.Sortable:
 
 @Override
 public void onRemove(AjaxRequestTarget target, String item) {
  super.onRemove(target, item);
 }
 Why is the payload processed in this method, as it takes the target
 as
 parameter? Is there another way to render the other panel or rewrite
 the
 payload?
 
 br, Chris
 
 
 Am 04.02.2015 um 20:41 schrieb Sven Meier s...@meiers.net:
 
 Hi,
 
 you're using a DeleteItem as payload of the event:
 
send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
 
 Yet in #onRemove() you're casting the payload to a String:
 
java.lang.ClassCastException: tripplanner.mycompany.DeleteItem
 cannot be cast to java.lang.String
 at
 mycompany.panels.SuitcasePanel$1.onRemove(SuitcasePanel.java:54)
 
 
 Regards
 Sven
 
 
 On 04.02.2015 20:32, Chris wrote:
 Hi Tobias - sorry, here it is:
 
 Last cause: mycompany.DeleteItem cannot be cast to java.lang.String
 WicketMessage: Method onRequest of interface
 org.apache.wicket.behavior.IBehaviorListener targeted at
 
 
 com.googlecode.wicket.jquery.ui.interaction.selectable.SelectableBehavior$1@127d9785
 on component [Sortable [Component id = sortable]] threw an exception
 
 Root cause:
 
 java.lang.ClassCastException: tripplanner.mycompany.DeleteItem
 cannot
 be cast to java.lang.String
   at
 mycompany.panels.SuitcasePanel$1.onRemove(SuitcasePanel.java:54)
   at
 
 
 com.googlecode.wicket.jquery.ui.interaction.sortable.Sortable.onEvent(Sortable.java:126)
   at
 
 
 org.apache.wicket.settings.def.FrameworkSettings.dispatchEvent(FrameworkSettings.java:132)
   at
 
 
 org.apache.wicket.ComponentEventSender.dispatchToComponent(ComponentEventSender.java:282)
   at
 
 
 

Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Chris
Hi Sebastian,

thanks for the solution with #onConfigure - it works.
Would it also be an option to remove the item from the liststring and render 
the sortable again,
instead of calling  MySortable.this.onRemove?

Best regards


 Am 08.02.2015 um 19:13 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 As I told you earlier (but it seems it was in another post), in our case we
 need to retrieve the item's data-hash for retrieving and deleting the
 correct item
 So the code becomes:
 
 item.add(new AjaxLinkVoid(remove) {
 
private static final long serialVersionUID = 1L;
 
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);
 
attributes.getDynamicExtraParameters().add(return { hash:
 jQuery(attrs.event.target).parent('li').data('hash') });
}
 
@Override
public void onClick(AjaxRequestTarget target)
{
int hashCode =
 RequestCycleUtils.getQueryParameterValue(hash).toInt();
String removedItem = list.get(ListUtils.indexOf(hashCode, list));
 
MySortable.this.onRemove(target, removedItem);
MySortable.this.info(removed  + removedItem);
 
target.add(MySortable.this);
target.add(feedback);
}
 });
 
 Best regards,
 Sebastien
 
 
 On Sun, Feb 8, 2015 at 6:10 PM, Sebastien seb...@gmail.com wrote:
 
 Damned, I sent the mail a little bit to quickly... the button does not
 remove the correct item if it has moved... Will fix that.
 
 


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



Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

Not sure to understand. OnRemove already removes from the list but also
indicates that the model has changed...
target.add(MySortable.this) re-render the sortable with the updated list.

So everything should work, that's why I am not sure to understand the
question...

Thanks,
Sebastien



On Sun, Feb 8, 2015 at 7:38 PM, Chris chris...@gmx.at wrote:

 Hi Sebastian,

 thanks for the solution with #onConfigure - it works.
 Would it also be an option to remove the item from the liststring and
 render the sortable again,
 instead of calling  MySortable.this.onRemove?

 Best regards


  Am 08.02.2015 um 19:13 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  As I told you earlier (but it seems it was in another post), in our case
 we
  need to retrieve the item's data-hash for retrieving and deleting the
  correct item
  So the code becomes:
 
  item.add(new AjaxLinkVoid(remove) {
 
 private static final long serialVersionUID = 1L;
 
 @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
 {
 super.updateAjaxAttributes(attributes);
 
 attributes.getDynamicExtraParameters().add(return { hash:
  jQuery(attrs.event.target).parent('li').data('hash') });
 }
 
 @Override
 public void onClick(AjaxRequestTarget target)
 {
 int hashCode =
  RequestCycleUtils.getQueryParameterValue(hash).toInt();
 String removedItem = list.get(ListUtils.indexOf(hashCode, list));
 
 MySortable.this.onRemove(target, removedItem);
 MySortable.this.info(removed  + removedItem);
 
 target.add(MySortable.this);
 target.add(feedback);
 }
  });
 
  Best regards,
  Sebastien
 
 
  On Sun, Feb 8, 2015 at 6:10 PM, Sebastien seb...@gmail.com wrote:
 
  Damned, I sent the mail a little bit to quickly... the button does not
  remove the correct item if it has moved... Will fix that.
 
 


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




Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Chris
Hi Sebastian,

currently, I am deleting the element that should be removed from the list and 
render the view again.
I am not calling #onRemove, but the code works, too. Therefore, I wanted to ask 
you if it is better to call #onRemove.

br, Chris



 Am 08.02.2015 um 19:55 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Not sure to understand. OnRemove already removes from the list but also
 indicates that the model has changed...
 target.add(MySortable.this) re-render the sortable with the updated list.
 
 So everything should work, that's why I am not sure to understand the
 question...
 
 Thanks,
 Sebastien
 
 
 
 On Sun, Feb 8, 2015 at 7:38 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 thanks for the solution with #onConfigure - it works.
 Would it also be an option to remove the item from the liststring and
 render the sortable again,
 instead of calling  MySortable.this.onRemove?
 
 Best regards
 
 
 Am 08.02.2015 um 19:13 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 As I told you earlier (but it seems it was in another post), in our case
 we
 need to retrieve the item's data-hash for retrieving and deleting the
 correct item
 So the code becomes:
 
 item.add(new AjaxLinkVoid(remove) {
 
   private static final long serialVersionUID = 1L;
 
   @Override
   protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
   {
   super.updateAjaxAttributes(attributes);
 
   attributes.getDynamicExtraParameters().add(return { hash:
 jQuery(attrs.event.target).parent('li').data('hash') });
   }
 
   @Override
   public void onClick(AjaxRequestTarget target)
   {
   int hashCode =
 RequestCycleUtils.getQueryParameterValue(hash).toInt();
   String removedItem = list.get(ListUtils.indexOf(hashCode, list));
 
   MySortable.this.onRemove(target, removedItem);
   MySortable.this.info(removed  + removedItem);
 
   target.add(MySortable.this);
   target.add(feedback);
   }
 });
 
 Best regards,
 Sebastien
 
 
 On Sun, Feb 8, 2015 at 6:10 PM, Sebastien seb...@gmail.com wrote:
 
 Damned, I sent the mail a little bit to quickly... the button does not
 remove the correct item if it has moved... Will fix that.
 
 
 
 
 -
 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: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

Actually jquery ui's selectable provides the ability to prevent their
events to be fired. The option is cancel [1]

So, as I was testing, here is the full code to manage your remove button:

CSS
style type=text/css
.sortable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
.sortable li { margin: 0.3em; padding: 0.3em; font-size: 1.1em;
background-color: #fff; }
.sortable li .ui-icon { position: absolute; }
.sortable li .item { margin-left: 1.3em; }

.ui-selectable .ui-selecting { background: #FECA40; }
.ui-selectable .ui-selected { background: #F39814; color: white;
}
/style

HTML
ul wicket:id=sortable class=sortable
li wicket:id=items
span wicket:id=icon class=handle[icon]/span
div wicket:id=container
span wicket:id=item class=item[label]/span
a wicket:id=removeremove/a
/div
/li
/ul
br/
div wicket:id=feedback style=width: 60%;/div

JAVA
public MyPage extends WebPage()
{
// FeedbackPanel //
this.feedback = new JQueryFeedbackPanel(feedback);
this.add(this.feedback.setOutputMarkupId(true));

// Sortable //
final MySortable sortable = new MySortable(sortable, list, new
Options(handle, Options.asString(.handle)));
this.add(sortable);
}

class MySortable extends SortableString {

public MySortable(String id, ListString list, Options options)
{
super(id, list, options);
}

@Override
protected void onInitialize()
{
super.onInitialize();

this.add(new
SelectableBehaviorString(JQueryWidget.getSelector(this), new
Options(cancel, Options.asString(.handle))) {

private static final long serialVersionUID = 1L;

@Override
protected String getItemSelector()
{
return li;
}

@Override
protected ListString getItemList()
{
return list;
}

@Override
public void onConfigure(Component component)
{
super.onConfigure(component);

// this is the option to prevent events to be fired (on
A-link)
this.setOption(cancel, Options.asString(a));
}

@Override
public void onSelect(AjaxRequestTarget target, ListString
items)
{
info(selected  + items);
target.add(feedback);
}
});
}

@Override
protected HashListViewString newListView(IModelListString model)
{
return new HashListViewString(items, model) {

@Override
protected void populateItem(final ListItemString item)
{
item.add(new
EmptyPanel(icon).add(AttributeModifier.append(class, ui-icon  +
JQueryIcon.ARROW_2_N_S)));
item.add(AttributeModifier.append(class,
ui-state-default));

WebMarkupContainer container = new
WebMarkupContainer(container);
item.add(container);

container.add(new Label(item, item.getModelObject()));
container.add(new AjaxLinkVoid(remove) {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target)
{
String removedItem = item.getModelObject();

MySortable.this.onRemove(target, removedItem);
MySortable.this.info(removed  + removedItem);

target.add(feedback);
target.add(MySortable.this);
}
});
}
};
}

@Override
public void onUpdate(AjaxRequestTarget target, String item, int index)
{
super.onUpdate(target, item, index);

this.info(The list order is now:  + this.getModelObject());
target.add(feedback);
}
}



Hope this helps,
Sebastien


[1] http://api.jqueryui.com/selectable/#option-cancel

On Sun, Feb 8, 2015 at 4:51 PM, Sebastien seb...@gmail.com wrote:

 Hi Chris,

  So overriding the #updateAjaxAttributes may not help?
 Right, it seems that the selectable widget registers its event with a
 higher priority level somehow.
 The link's click event is just never fired, so we can forget about
 stopping propagation here. And worst, even an inline onclick statement is
 not executed.

 I am currently investigating for a solution/workaround...

 Best regards,
 Sebastien.

 On Sun, Feb 8, 2015 at 4:30 PM, Chris chris...@gmx.at wrote:

 Hi Sebastian,

 i also tried it with the AjaxLink. It seems that the #onselect method is
 always called first, and only after that the ajaxlink. So overriding the
 #updateAjaxAttributes may not help?

 thanks for your help!
 Chris

  Am 08.02.2015 um 14:17 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Actually what you describe is the opposite of what is 

Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Damned, I sent the mail a little bit to quickly... the button does not
remove the correct item if it has moved... Will fix that.


Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

As I told you earlier (but it seems it was in another post), in our case we
need to retrieve the item's data-hash for retrieving and deleting the
correct item
So the code becomes:

item.add(new AjaxLinkVoid(remove) {

private static final long serialVersionUID = 1L;

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
{
super.updateAjaxAttributes(attributes);

attributes.getDynamicExtraParameters().add(return { hash:
jQuery(attrs.event.target).parent('li').data('hash') });
}

@Override
public void onClick(AjaxRequestTarget target)
{
int hashCode =
RequestCycleUtils.getQueryParameterValue(hash).toInt();
String removedItem = list.get(ListUtils.indexOf(hashCode, list));

MySortable.this.onRemove(target, removedItem);
MySortable.this.info(removed  + removedItem);

target.add(MySortable.this);
target.add(feedback);
}
});

Best regards,
Sebastien


On Sun, Feb 8, 2015 at 6:10 PM, Sebastien seb...@gmail.com wrote:

 Damned, I sent the mail a little bit to quickly... the button does not
 remove the correct item if it has moved... Will fix that.




Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

 So overriding the #updateAjaxAttributes may not help?
Right, it seems that the selectable widget registers its event with a
higher priority level somehow.
The link's click event is just never fired, so we can forget about stopping
propagation here. And worst, even an inline onclick statement is not
executed.

I am currently investigating for a solution/workaround...

Best regards,
Sebastien.

On Sun, Feb 8, 2015 at 4:30 PM, Chris chris...@gmx.at wrote:

 Hi Sebastian,

 i also tried it with the AjaxLink. It seems that the #onselect method is
 always called first, and only after that the ajaxlink. So overriding the
 #updateAjaxAttributes may not help?

 thanks for your help!
 Chris

  Am 08.02.2015 um 14:17 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Actually what you describe is the opposite of what is supposed to happen
 :)
 
  I will try to look at this... There could be several reason: the region
  occupied by the markup container can be misleading for instance, or there
  could be a canceling bubble conflict between registered wicket ajax
 event
  and pure jquery ones (I would be surprised but i will double check)
 
  Btw IIRC, the event name should be click, not onclick
  new AjaxEventBehavior(click)
 
  Furthermore, is there any reason you preferred a container over a link?
  Maybe you can try with a link instead, just to be sure it is not a matter
  of the region being clicked...
  Last point, depending of the resulting hierarchy level of elements, maybe
  STOP_IMMEDIATE should be used instead of just STOP
 
  Best regards,
  Sebastien
 
 
  On Sun, Feb 8, 2015 at 1:55 PM, Chris chris...@gmx.at wrote:
 
  Hi Sebastian - thanks for your answer.
 
  I experience that when adding #attributes.setEventPropagation, the
  #onEvent method of infoLink is not called at all, and the #onselect
 method
  of the sortable is still called. It would be awesome if you know how to
 fix
  it.
 
  @Override
  protected void populateItem(ListItemString item) {
 ...
 WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
 infoLink.add(new AjaxEventBehavior(onclick) {
 
 @Override
 protected void onEvent(AjaxRequestTarget target) {
 
 }
 
 @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setAllowDefault(false);
 
 
 attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.STOP);
 
 }
  });
 
  br, Chris
 
  Am 08.02.2015 um 11:15 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Sorry for the mistake, its
  attributes.setEventPropagation(EventPropagation.STOP);
 
  Best regards,
  Sebastien.
 
 
  On Fri, Feb 6, 2015 at 10:12 PM, Chris chris...@gmx.at wrote:
 
  Update:
 
  When setting #setAllowDefault(false), the #onevent method of the web
  markup container is called, but in addition also the #on select method
  of
  sortable.
  When setting #setAllowDefault(true), the #onevent method is not called
  at
  all, only the #on select method.
 
  It seems that setAllowDefault(false or true) does not prevent the
 event
  bubbling to parents. What might be missing?
 
 
  @Override
  protected void populateItem(ListItemString item) {
...
WebMarkupContainer infoLink = new
 WebMarkupContainer(infoLink);
infoLink.add(new AjaxEventBehavior(onclick) {
 
@Override
protected void onEvent(AjaxRequestTarget target) {
 
}
 
@Override
protected void
 updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
super.updateAjaxAttributes(attributes);
attributes.setAllowDefault(false);
}
  });
 
 
  @Override
  public void onSelect(AjaxRequestTarget target, ListString items) {
  …..
 
 
  Chris
 
 
  Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org
 :
 
  Hi,
 
  On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at wrote:
 
  Hi Sebastian,
 
  thanks for your help. Has that the method signature recently
 changed?
  The
  method #setPreventDefault is not available on the object
 #attributes.
 
 
  Link link = new AjaxFallbackLinkString(link) {
 
   @Override
   public void onClick(AjaxRequestTarget target) {
   }
 
   @Override
   protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
   super.updateAjaxAttributes(attributes);
   attributes.setPreventDefault(true);
 
 
  In Wicket 6.x it is wrongly named setAllowDefault().
 
 
   }
   };
 
  Chris
 
 
 
  Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
  Hi Chris,
 
  Yes, generally speaking, you have to cancel bubbling events to
 parent
  elements.
  For a [Ajax]Link (or any event-behavior related) 

Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Chris
Hi Sebastian,

i also tried it with the AjaxLink. It seems that the #onselect method is always 
called first, and only after that the ajaxlink. So overriding the 
#updateAjaxAttributes may not help?

thanks for your help!
Chris

 Am 08.02.2015 um 14:17 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Actually what you describe is the opposite of what is supposed to happen :)
 
 I will try to look at this... There could be several reason: the region
 occupied by the markup container can be misleading for instance, or there
 could be a canceling bubble conflict between registered wicket ajax event
 and pure jquery ones (I would be surprised but i will double check)
 
 Btw IIRC, the event name should be click, not onclick
 new AjaxEventBehavior(click)
 
 Furthermore, is there any reason you preferred a container over a link?
 Maybe you can try with a link instead, just to be sure it is not a matter
 of the region being clicked...
 Last point, depending of the resulting hierarchy level of elements, maybe
 STOP_IMMEDIATE should be used instead of just STOP
 
 Best regards,
 Sebastien
 
 
 On Sun, Feb 8, 2015 at 1:55 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian - thanks for your answer.
 
 I experience that when adding #attributes.setEventPropagation, the
 #onEvent method of infoLink is not called at all, and the #onselect method
 of the sortable is still called. It would be awesome if you know how to fix
 it.
 
 @Override
 protected void populateItem(ListItemString item) {
...
WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
infoLink.add(new AjaxEventBehavior(onclick) {
 
@Override
protected void onEvent(AjaxRequestTarget target) {
 
}
 
@Override
protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
super.updateAjaxAttributes(attributes);
attributes.setAllowDefault(false);
 
 attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.STOP);
 
}
 });
 
 br, Chris
 
 Am 08.02.2015 um 11:15 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Sorry for the mistake, its
 attributes.setEventPropagation(EventPropagation.STOP);
 
 Best regards,
 Sebastien.
 
 
 On Fri, Feb 6, 2015 at 10:12 PM, Chris chris...@gmx.at wrote:
 
 Update:
 
 When setting #setAllowDefault(false), the #onevent method of the web
 markup container is called, but in addition also the #on select method
 of
 sortable.
 When setting #setAllowDefault(true), the #onevent method is not called
 at
 all, only the #on select method.
 
 It seems that setAllowDefault(false or true) does not prevent the event
 bubbling to parents. What might be missing?
 
 
 @Override
 protected void populateItem(ListItemString item) {
   ...
   WebMarkupContainer infoLink = new WebMarkupContainer(infoLink);
   infoLink.add(new AjaxEventBehavior(onclick) {
 
   @Override
   protected void onEvent(AjaxRequestTarget target) {
 
   }
 
   @Override
   protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
   super.updateAjaxAttributes(attributes);
   attributes.setAllowDefault(false);
   }
 });
 
 
 @Override
 public void onSelect(AjaxRequestTarget target, ListString items) {
 …..
 
 
 Chris
 
 
 Am 06.02.2015 um 21:20 schrieb Martin Grigorov mgrigo...@apache.org:
 
 Hi,
 
 On Fri, Feb 6, 2015 at 10:13 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 thanks for your help. Has that the method signature recently changed?
 The
 method #setPreventDefault is not available on the object #attributes.
 
 
 Link link = new AjaxFallbackLinkString(link) {
 
  @Override
  public void onClick(AjaxRequestTarget target) {
  }
 
  @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
  super.updateAjaxAttributes(attributes);
  attributes.setPreventDefault(true);
 
 
 In Wicket 6.x it is wrongly named setAllowDefault().
 
 
  }
  };
 
 Chris
 
 
 
 Am 06.02.2015 um 19:56 schrieb Sebastien seb...@gmail.com:
 
 Hi Chris,
 
 Yes, generally speaking, you have to cancel bubbling events to parent
 elements.
 For a [Ajax]Link (or any event-behavior related) you have to set the
 preventDefault property to true;
 
 protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes)
 {
 super.updateAjaxAttributes(attributes);
 
 attributes.setPreventDefault(true); // cancel bubbling
 }
 
 Hope this helps,
 Best regards,
 Sebastien
 
 On Fri, Feb 6, 2015 at 6:59 PM, Chris chris...@gmx.at wrote:
 
 Hi Sebastian,
 
 I would have a follow-up question regarding the #Sortable:
 
 
 Is it possible to add an AjaxLink to the item with its own behavior
 so
 that if the user clicks on this link, then its on-click behavior
 should
 be
 

Re: Ajax - render Webmarkup-Container based on Wicket Events

2015-02-08 Thread Sebastien
Hi Chris,

Yes it works like you did but on a strict point of view, its better to
notify the component its modelobject changed (and the page is also aware
that a child component model has changed)... So event if it is not much
important yet, it is still better to call #onRemove because it already
handles modelChanging/modelChanged, and this could prevent you from having
unexpected surprises...

Thanks  best regards,
Sebastien.


On Sun, Feb 8, 2015 at 8:03 PM, Chris chris...@gmx.at wrote:

 Hi Sebastian,

 currently, I am deleting the element that should be removed from the list
 and render the view again.
 I am not calling #onRemove, but the code works, too. Therefore, I wanted
 to ask you if it is better to call #onRemove.

 br, Chris




wicketstuff gae-initializer-parent

2015-02-08 Thread Wicket und Cocoon

Hello Martin,
i tried  your gae-initializer-example but get the following  error
wnhem i try gae:run and ask localhost:8080:

java.lang.NoSuchMethodError: 
javax.servlet.http.HttpServletRequest.isAsyncStarted()Z

i use appengine-java-sdk-1.9.7
and your example under jdk 1.7

when i read the few google information about wicket and appengine i am not sure
if it is a good idea to transfer wicket to appengine.

Regards
Heiner




Re: wicketstuff gae-initializer-parent

2015-02-08 Thread Tobias Soloschenko
Hi Heiner,

the Server needs to support Servlet 3.0 Spec. It seems that you are using one 
which does not support that.

kind regards

Tobias

 Am 09.02.2015 um 07:46 schrieb Wicket und Cocoon hansheinrichbr...@yahoo.de:
 
 Hello Martin,
 i tried  your gae-initializer-example but get the following  error
 wnhem i try gae:run and ask localhost:8080:
 
 java.lang.NoSuchMethodError: 
 javax.servlet.http.HttpServletRequest.isAsyncStarted()Z
 
 i use appengine-java-sdk-1.9.7
 and your example under jdk 1.7
 
 when i read the few google information about wicket and appengine i am not 
 sure
 if it is a good idea to transfer wicket to appengine.
 
 Regards
 Heiner
 
 

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



Re: wicketstuff gae-initializer-parent

2015-02-08 Thread Tobias Soloschenko
Hi again,

I found a topic in which the implementation of Servlet 3.0 for Google AppEngine 
is requested by several users


https://code.google.com/p/googleappengine/issues/detail?id=3091

kind regards

Tobias

 Am 09.02.2015 um 07:46 schrieb Wicket und Cocoon hansheinrichbr...@yahoo.de:
 
 Hello Martin,
 i tried  your gae-initializer-example but get the following  error
 wnhem i try gae:run and ask localhost:8080:
 
 java.lang.NoSuchMethodError: 
 javax.servlet.http.HttpServletRequest.isAsyncStarted()Z
 
 i use appengine-java-sdk-1.9.7
 and your example under jdk 1.7
 
 when i read the few google information about wicket and appengine i am not 
 sure
 if it is a good idea to transfer wicket to appengine.
 
 Regards
 Heiner
 
 

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



Re: wicketstuff gae-initializer-parent

2015-02-08 Thread Martin Grigorov
Hi,

The error says that the container needs servlet-api:jar:3.0 while the
application comes with older version of the jar.
I don't use GAE myself so I have cannot give you more info.

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

On Mon, Feb 9, 2015 at 9:18 AM, Tobias Soloschenko 
tobiassolosche...@googlemail.com wrote:

 Hi again,

 I found a topic in which the implementation of Servlet 3.0 for Google
 AppEngine is requested by several users


 https://code.google.com/p/googleappengine/issues/detail?id=3091

 kind regards

 Tobias

  Am 09.02.2015 um 07:46 schrieb Wicket und Cocoon 
 hansheinrichbr...@yahoo.de:
 
  Hello Martin,
  i tried  your gae-initializer-example but get the following  error
  wnhem i try gae:run and ask localhost:8080:
 
  java.lang.NoSuchMethodError:
 javax.servlet.http.HttpServletRequest.isAsyncStarted()Z
 
  i use appengine-java-sdk-1.9.7
  and your example under jdk 1.7
 
  when i read the few google information about wicket and appengine i am
 not sure
  if it is a good idea to transfer wicket to appengine.
 
  Regards
  Heiner
 
 

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