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

2015-02-06 Thread Martin Grigorov
Hi,

On Fri, Feb 6, 2015 at 10:13 PM, Chris  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 AjaxFallbackLink("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 :
> >
> > 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  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(ListItem 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 :
> >>>
> >>> I've opened the issue:
> >>> https://github.com/sebfz1/wicket-jquery-ui/issues/153
> >>>
> >>>
> >>> On Thu, Feb 5, 2015 at 10:29 AM, Sebastien  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  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 :
> >>
> >> 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(Sorta

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

2015-02-06 Thread Chris
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 AjaxFallbackLink("link") {

@Override
public void onClick(AjaxRequestTarget target) {   
}

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

Chris



> Am 06.02.2015 um 19:56 schrieb Sebastien :
> 
> 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  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(ListItem 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 :
>>> 
>>> I've opened the issue:
>>> https://github.com/sebfz1/wicket-jquery-ui/issues/153
>>> 
>>> 
>>> On Thu, Feb 5, 2015 at 10:29 AM, Sebastien  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  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 :
>> 
>> 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
> 
>> org.apache.wicket.ComponentEventSender.access$100(ComponentEventSender.java:36)
>>>at
> 
>> org.apach

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

2015-02-06 Thread Sebastien
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  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(ListItem 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 :
> >
> > I've opened the issue:
> > https://github.com/sebfz1/wicket-jquery-ui/issues/153
> >
> >
> > On Thu, Feb 5, 2015 at 10:29 AM, Sebastien  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  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 :
> 
>  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
> >>>
> org.apache.wicket.ComponentEventSender.access$100(ComponentEventSender.java:36)
> > at
> >>>
> org.apache.wicket.ComponentEventSender$ComponentEventVisitor.component(ComponentEventSender.java:329)
> > at
> >>>
> org.apache.wicket.ComponentEventSender$ComponentEventVisitor.component(ComponentEventSender.java:306)
> > at
> >>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144)
> > at
> >>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
> > at
> >>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
> > at
> >>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
> > at
> >>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:192)
> > at
> >>>
> org.apache.wicket.Markup

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

2015-02-06 Thread Chris
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(ListItem 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 :
> 
> I've opened the issue:
> https://github.com/sebfz1/wicket-jquery-ui/issues/153
> 
> 
> On Thu, Feb 5, 2015 at 10:29 AM, Sebastien  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  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 :
 
 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
>>> org.apache.wicket.ComponentEventSender.access$100(ComponentEventSender.java:36)
> at
>>> org.apache.wicket.ComponentEventSender$ComponentEventVisitor.component(ComponentEventSender.java:329)
> at
>>> org.apache.wicket.ComponentEventSender$ComponentEventVisitor.component(ComponentEventSender.java:306)
> at
>>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:144)
> at
>>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
> at
>>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:162)
> at
>>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:123)
> at
>>> org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:192)
> at
>>> org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:875)
> at
>>> org.apache.wicket.ComponentEventSender.breadth(ComponentEventSender.java:160)
> at
>>> org.apache.wicket.ComponentEventSender.send(ComponentEventSender.java:68)
> at org.apache.wicket.Component.send(Component.java:4429)
> at
>>> mycompany.panels.SuitcasePanel$1$1.onSelect(SuitcasePanel.java:92)
> at
>>> com.googlecode.wicket.jquery.ui.interaction.selectable.SelectableBehavior.onAjax(SelectableBehavior.java:122)
> at
>>> com.googlecode.wicket.jquery.core.ajax.JQueryAjaxBehavior.respond(JQueryAjaxBehavior.java:171)
> at
>>> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaul

Re: Sortable - ConcurrentModificationException

2015-02-06 Thread Sebastien
Hi Chris,

Right, you probably you can use an iterator instead of the "foreach"
statement...
Thanks for letting know you solved it! :)

Best regards,
Sebastien.

On Fri, Feb 6, 2015 at 6:05 PM, Chris  wrote:

> I have fixed it - it was because of calling the method within the for loop.
>
> br, Chris
>
>
>
> > Am 06.02.2015 um 17:56 schrieb Chris :
> >
> > Hi Sebastian,
> >
> > I am using the method #ListUtils.move to sort a list of domain objects
> as soon as the method #onUpdate is called within a sortable object:
> > In the first request, everything is fine, but in the second request I am
> receiving following error:
> > Root cause:
> >
> > java.util.ConcurrentModificationException
> > at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
> > at java.util.ArrayList$Itr.next(ArrayList.java:851)
> >
> > Can you give me a hint why this error occurs and how to fix it?
> >
> > @Override
> > public void onUpdate(AjaxRequestTarget target, String item, int index) {
> >super.onUpdate(target, item, index);
> >user.sortObj(item, index);
> >
> > }
> > *
> > Class User:
> > private final List selectedItems = Lists.newArrayList();
> > public void sortItems(String itemName, int index) {
> >for (Item currentItem : selectedItems) {
> >  if (itemName.equals(currentItem.getName())) {
> >  ListUtils.move(currentItem, index, selectedItems);
> >  }
> >}
> > }
> >
> > Thanks a lot,
> > Chris
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Sortable - ConcurrentModificationException

2015-02-06 Thread Chris
I have fixed it - it was because of calling the method within the for loop.

br, Chris



> Am 06.02.2015 um 17:56 schrieb Chris :
> 
> Hi Sebastian,
> 
> I am using the method #ListUtils.move to sort a list of domain objects as 
> soon as the method #onUpdate is called within a sortable object:
> In the first request, everything is fine, but in the second request I am 
> receiving following error:
> Root cause:
> 
> java.util.ConcurrentModificationException
> at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
> at java.util.ArrayList$Itr.next(ArrayList.java:851)
> 
> Can you give me a hint why this error occurs and how to fix it?
> 
> @Override
> public void onUpdate(AjaxRequestTarget target, String item, int index) {
>super.onUpdate(target, item, index);
>user.sortObj(item, index);
> 
> }
> *
> Class User:
> private final List selectedItems = Lists.newArrayList();
> public void sortItems(String itemName, int index) {
>for (Item currentItem : selectedItems) {
>  if (itemName.equals(currentItem.getName())) {
>  ListUtils.move(currentItem, index, selectedItems);
>  }
>}
> }
> 
> Thanks a lot,
> Chris
> 


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



Sortable - ConcurrentModificationException

2015-02-06 Thread Chris
Hi Sebastian,

I am using the method #ListUtils.move to sort a list of domain objects as soon 
as the method #onUpdate is called within a sortable object:
In the first request, everything is fine, but in the second request I am 
receiving following error:
Root cause:

java.util.ConcurrentModificationException
 at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
 at java.util.ArrayList$Itr.next(ArrayList.java:851)

Can you give me a hint why this error occurs and how to fix it?

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

}
*
Class User:
private final List selectedItems = Lists.newArrayList();
public void sortItems(String itemName, int index) {
for (Item currentItem : selectedItems) {
  if (itemName.equals(currentItem.getName())) {
  ListUtils.move(currentItem, index, selectedItems);
  }
}
}

Thanks a lot,
Chris



Wicket CDI and Asynchronous (and Websockets)

2015-02-06 Thread Sebastien
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


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

2015-02-06 Thread Per Newgro
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


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);
}


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: Removing table coloumn headers in wicket pageablelistview when list is empty

2015-02-06 Thread K
Hi lucast

Thanks for the response. i have tried the exact same thing and had success
with it.

Cheers

On Fri, Feb 6, 2015 at 3:13 PM, lucast [via Apache Wicket] <
ml-node+s1842946n4669328...@n4.nabble.com> wrote:

> Hi K,
>
> If you want to hide the headers when the table is empty, you could use
>  as suggested on the wicket guide
> .
>
> I have used the PagingPage from Wicket Examples (you can download it from
> Apache Wicket page) to illustrate this.
>
> I don't know how you check if the table is empty. I just went for
> dataView.getItemCount().
>
> If you want the table with headers hidden, just call
> dataView.setVisible(false);
> And on HTML, use .
>
> Example:
>
> 
>   
>   
>   Actions
>   ID
>   First Name
>   Last Name
>   Home Phone
>   Cell Phone
>   
>   
>wicket:id="actions">[actions]
>wicket:id="contactid">[contactid]
>wicket:id="firstname">[firstname]
>wicket:id="lastname">[lastname]
>wicket:id="homephone">[homephone]
>wicket:id="cellphone">[cellphone]
>   
>   
>   
>
>
> Note that on wicket:enclosure tag, I had to name the child it was
> referring to: pageable. Otherwise, it will throw an exception because
> wicket will not know which element you are referring to, in this case.
>
> Let me know if that works,
>
> Kind regards,
> Lucas
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/Removing-table-coloumn-headers-in-wicket-pageablelistview-when-list-is-empty-tp4669246p4669328.html
>  To unsubscribe from Removing table coloumn headers in wicket
> pageablelistview when list is empty, click here
> 
> .
> NAML
> 
>


-
K
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Removing-table-coloumn-headers-in-wicket-pageablelistview-when-list-is-empty-tp4669246p4669330.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: JSR356 Websocket with Wicket 6.18

2015-02-06 Thread Martin Grigorov
Done.
https://github.com/wicketstuff/core/commit/bf312d35d6a3972b1bc625fca117e569daadcc65
It will be part of 6.19.0

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

On Wed, Jan 28, 2015 at 6:16 PM, Martin Grigorov 
wrote:

> Sorry but this won't be reusable for the community.
> I've suggested to put it in WicketStuff, not in Wicket.
> If I spend time to help you now then next week perhaps another user will
> ask the same. It doesn't scale :-/
>
> I'll put it in WicketStuff (
> https://github.com/wicketstuff/core/tree/wicket-6.x) when I have some
> time.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Wed, Jan 28, 2015 at 5:51 PM, Alexander Landsnes Keül <
> alexander.landsnes.k...@visma.com> wrote:
>
>> https://github.com/alexanderlk/wicket
>>
>> It's under the wicket-6.x branch, same exact structure as the one in
>> 7.0.0-M4
>>
>> Alex
>>
>> On Wed, Jan 28, 2015 at 4:25 PM, Martin Grigorov 
>> wrote:
>>
>> > url to your github repo ?
>> >
>> > Martin Grigorov
>> > Wicket Training and Consulting
>> > https://twitter.com/mtgrigorov
>> >
>> > On Wed, Jan 28, 2015 at 5:02 PM, Alexander Landsnes Keül <
>> > alexander.landsnes.k...@visma.com> wrote:
>> >
>> > > I forked Wicket to my github repo and took a look at it. Compiling
>> > > wicket-native-websocket-javax with Java 6 and Wicket 6.19.0-SNAPSHOT
>> was
>> > no
>> > > problem at all, my problem popped up when I tried to get the embedded
>> > jetty
>> > > server to run the test case. It fails with "WebSocket connection to
>> > >
>> > >
>> >
>> 'ws://localhost:8080/wicket/websocket?pageId=6&wicket-ajax-baseurl=behavior%3F6&wicket-app-name=jsr356.websockets'
>> > > failed: Error during WebSocket handshake: Unexpected response code:
>> 404"
>> > >
>> > > Setting breakpoints in AbstractUpgradeFilter confirms that requests
>> for
>> > > css/html/js files get processed, but it never intercepts the WebSocket
>> > > request and I'll be damned if I can figure out why. This is running
>> with
>> > > Jetty 9.2.2 (from Wicket 7.0.0-M4).
>> > >
>> > > I pretty much just copied the -javax project from master, switched to
>> the
>> > > wicket-6.x branch and copied it in. Then downgraded dependencies to
>> > Wicket
>> > > 6.19-SNAPSHOT and Java 6 and fixed the 4-5 compilation issues, so no
>> > > witchcraft or wizardry has been attempted. If you do have a few
>> pointers
>> > > I'll be happy to see if I can manage to get it running, however
>> > WebSockets
>> > > are hardly my forte.
>> > >
>> > > Alex
>> > >
>> > > On Tue, Jan 27, 2015 at 1:26 PM, Martin Grigorov <
>> mgrigo...@apache.org>
>> > > wrote:
>> > >
>> > > > The needed changes to make -javax module working with Wicket 6.x are
>> > not
>> > > > too big.
>> > > > I think the easiest way to make it available for Wicket 6.x is to
>> add
>> > (a
>> > > > clone/copy of) the module to WicketStuff project. This way it could
>> be
>> > > part
>> > > > of 6.19.0 too.
>> > > > Is this something you are interested to help with ?
>> > > >
>> > > > On Tue, Jan 27, 2015 at 2:11 PM, Alexander Landsnes Keül <
>> > > > alexander.landsnes.k...@visma.com> wrote:
>> > > >
>> > > > > I checked out Wicket 6.18 and fiddled a bit with it, but it seems
>> > there
>> > > > > are a few minor API breaks. One of the most pervasive ones is
>> > > > > Application#setMetaData(...), in 6.18.0 it's a void function while
>> > > > > 7.0.0-M4
>> > > > > returns this for chaining. I'm not sure JSR356 should be listed
>> as an
>> > > > > option for Wicket 6.x. It's certainly possible to fix it without
>> too
>> > > much
>> > > > > effort, but since it changes a few signatures in wicket-core it
>> > > requires
>> > > > > all the projects checked out and modified. I don't have the time
>> for
>> > it
>> > > > > right now, and I do quite understand it if no one else feels like
>> > > > spending
>> > > > > the time either.
>> > > > >
>> > > > > Naming conventions are the spice of policies. Milestones are
>> viewed
>> > as
>> > > > > dangerously buggy and unstable, and hence unfit for the hallowed
>> > halls
>> > > of
>> > > > > shippable code. I may try to sneak it in nonetheless, since I do
>> need
>> > > > > websocket support and the stable release is weeks away.
>> > > > >
>> > > > > Alex
>> > > > >
>> > > > > -Original Message-
>> > > > > From: Martin Grigorov [mailto:mgrigo...@apache.org]
>> > > > > Sent: 27 January 2015 10:30
>> > > > > To: users@wicket.apache.org
>> > > > > Subject: Re: JSR356 Websocket with Wicket 6.18
>> > > > >
>> > > > > Hi,
>> > > > >
>> > > > > JSR356 API jar is built with Java 7. This is the main reason why
>> this
>> > > > > module is not part of Wicket 6.x.
>> > > > > If this single method is the only problem to use
>> > > > > wicket-native-websocket-javax:7.0.0-M4 with Wicket 6.18.0 then
>> please
>> > > > > create a ticket in JIRA and we will make it public for 6.20.0.
>> > > > >
>> > > > > I think 7.0.0-M5 (currently being in vote) is a

Re: Removing table coloumn headers in wicket pageablelistview when list is empty

2015-02-06 Thread lucast
Hi K,

If you want to hide the headers when the table is empty, you could use
 as suggested on the  wicket guide
  .

I have used the PagingPage from Wicket Examples (you can download it from
Apache Wicket page) to illustrate this.

I don't know how you check if the table is empty. I just went for
dataView.getItemCount().

If you want the table with headers hidden, just call
dataView.setVisible(false);
And on HTML, use .

Example:


Note that on wicket:enclosure tag, I had to name the child it was referring
to: pageable. Otherwise, it will throw an exception because wicket will not
know which element you are referring to, in this case.

Let me know if that works,

Kind regards,
Lucas


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Removing-table-coloumn-headers-in-wicket-pageablelistview-when-list-is-empty-tp4669246p4669328.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