You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris <ch...@gmx.at> on 2015/02/04 14:11:09 UTC

Ajax - render Webmarkup-Container based on Wicket Events

Hi,

When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.

-> update.getTarget().add(container);

Can someone help me to fix this?

*********************
***** PANEL *****
final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
icon.setOutputMarkupId(true);
icon.add(new AjaxEventBehavior("onclick") {
	protected void onEvent(AjaxRequestTarget target) {
		send(getPage(), Broadcast.BREADTH, new AddItem(target));
  	}
});

*********************
***** PAGE *****
...
WebMarkupContainer container;
public HomePage() {
	container = new WebMarkupContainer("container");
	add(container);
}

@Override
public void onEvent(IEvent<?> event) {
	super.onEvent(event);
	if (event.getPayload() instanceof AddItem) {
    	AddItem update = (AddItem) event.getPayload();
    	update.getTarget().add(container);
    }
}

*********************
***** AddItem *****
public class AddItem {
    private final AjaxRequestTarget target;

    public AddItem(AjaxRequestTarget target) {
        this.target = target;
    }

    public AjaxRequestTarget getTarget() {
        return target;
    }
}

Thanks.
Chris

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

Posted by Sebastien <se...@gmail.com>.
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 <ch...@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
>
>

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

Posted by Chris <ch...@gmx.at>.
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 <se...@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 <ch...@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 list<string> and
>> render the sortable again,
>> instead of calling  MySortable.this.onRemove?
>> 
>> Best regards
>> 
>> 
>>> Am 08.02.2015 um 19:13 schrieb Sebastien <se...@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 AjaxLink<Void>("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 <se...@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-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


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


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

Posted by Sebastien <se...@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 <ch...@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 list<string> and
> render the sortable again,
> instead of calling  MySortable.this.onRemove?
>
> Best regards
>
>
> > Am 08.02.2015 um 19:13 schrieb Sebastien <se...@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 AjaxLink<Void>("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 <se...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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

Posted by Chris <ch...@gmx.at>.
Hi Sebastian,

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

Best regards


> Am 08.02.2015 um 19:13 schrieb Sebastien <se...@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 AjaxLink<Void>("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 <se...@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


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

Posted by Sebastien <se...@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 AjaxLink<Void>("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 <se...@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

Posted by Sebastien <se...@gmail.com>.
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

Posted by Sebastien <se...@gmail.com>.
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="remove">remove</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 Sortable<String> {

    public MySortable(String id, List<String> list, Options options)
    {
        super(id, list, options);
    }

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

        this.add(new
SelectableBehavior<String>(JQueryWidget.getSelector(this), new
Options("cancel", Options.asString(".handle"))) {

            private static final long serialVersionUID = 1L;

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

            @Override
            protected List<String> 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, List<String>
items)
            {
                info("selected " + items);
                target.add(feedback);
            }
        });
    }

    @Override
    protected HashListView<String> newListView(IModel<List<String>> model)
    {
        return new HashListView<String>("items", model) {

            @Override
            protected void populateItem(final ListItem<String> 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 AjaxLink<Void>("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 <se...@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 <ch...@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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <ch...@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(ListItem<String> 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, List<String> items) {
>> >>>> …..
>> >>>>
>> >>>>
>> >>>> Chris
>> >>>>
>> >>>>
>> >>>>> Am 06.02.2015 um 21:20 schrieb Martin Grigorov <
>> mgrigorov@apache.org>:
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> 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(AbstractDefaultAjaxBehavior.java:633)
>> >>>>>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>> >>>>>>>>>>>>> at
>> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>> >>>>>>>>>>>>> at
>> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>
>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>> >>>>>>>>>>>>> at
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>
>> >>
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>> >>>>>>>>>>>>> at java.lang.Thread.run(Thread.java:745)
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> br, Chris
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>> >>>>>>>>>>> tobiassoloschenko@googlemail.com>:
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Hi,
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> would you be so kind and apply some more information like
>> >>>>>> StackTrace
>> >>>>>>>>>>> of the interal server error.
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Thanks a lot.
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> kind regards
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Tobias.
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>> >>>>>>>>>>>>>>> Sven, I have an additional situation where I am getting an
>> >>>>>> internal
>> >>>>>>>>>>> error. Could you help me in figuring out the problem?
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>> Panel A senses the selection of an item from a user and
>> adds
>> >>>> the
>> >>>>>>>>>>> „sortable“ as container to the ajax target.
>> >>>>>>>>>>>>>>> In addition, Panel B should be added to the ajax target,
>> >> using
>> >>>>>>>>>>> Wicket events.
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>> The internal error is thrown when using Wicket events to
>> add
>> >>>> the
>> >>>>>>>>>>> additional panel. Without the event, just calling
>> >>>>>>>> #target.add(sortable) it
>> >>>>>>>>>>> works.
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>> Panel A
>> >>>>>>>>>>>>>>> *************
>> >>>>>>>>>>>>>>> @Override
>> >>>>>>>>>>>>>>> public void onSelect(AjaxRequestTarget target,
>> List<String>
>> >>>>>> items)
>> >>>>>>>> {
>> >>>>>>>>>>>>>>> sortable.onRemove(target, items.get(0));
>> >>>>>>>>>>>>>>>       target.add(sortable);
>> >>>>>>>>>>>>>>>       send(getPage(), Broadcast.BREADTH, new
>> >>>>>>>>>>> DeleteItem(target));
>> >>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>> Panel B
>> >>>>>>>>>>>>>>> *************
>> >>>>>>>>>>>>>>> public class PoiListPanel extends Panel {
>> >>>>>>>>>>>>>>> @Override
>> >>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>> >>>>>>>>>>>>>>>               super.onEvent(event);
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>               if (event.getPayload() instanceof
>> DeleteItem)
>> >> {
>> >>>>>>>>>>>>>>>               DeleteItem update = (DeleteItem)
>> >>>>>>>>>>> event.getPayload();
>> >>>>>>>>>>>>>>>               update.getTarget().add(this);
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>       }
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>> Chris
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>> >>>>>>>>>>> christoph@ec.tuwien.ac.at>:
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>> Sven - thank you. That solved it!
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <
>> sven@meiers.net
>> >>> :
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> Your container has to output its markup id:
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> container.setOutputMarkupId()
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> Regards
>> >>>>>>>>>>>>>>>>> Sven
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>> >>>>>>>>>>>>>>>>>> Hi,
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific
>> part of
>> >>>> the
>> >>>>>>>>>>> page should be reloaded through ajax. The icon is part of a
>> >> panel,
>> >>>>>> the
>> >>>>>>>>>>> specific part is a webmarkupcontainer added directly to the
>> >> page. I
>> >>>>>> am
>> >>>>>>>>>>> using Wicket Events to push the click event. However, when
>> adding
>> >>>> the
>> >>>>>>>> web
>> >>>>>>>>>>> markup container as target, I am getting an internal error.
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> -> update.getTarget().add(container);
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> Can someone help me to fix this?
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> *********************
>> >>>>>>>>>>>>>>>>>> ***** PANEL *****
>> >>>>>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>> >>>>>>>>>>> WebMarkupContainer("icon");
>> >>>>>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
>> >>>>>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>> >>>>>>>>>>>>>>>>>>    protected void onEvent(AjaxRequestTarget target) {
>> >>>>>>>>>>>>>>>>>>            send(getPage(), Broadcast.BREADTH, new
>> >>>>>>>>>>> AddItem(target));
>> >>>>>>>>>>>>>>>>>>    }
>> >>>>>>>>>>>>>>>>>> });
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> *********************
>> >>>>>>>>>>>>>>>>>> ***** PAGE *****
>> >>>>>>>>>>>>>>>>>> ...
>> >>>>>>>>>>>>>>>>>> WebMarkupContainer container;
>> >>>>>>>>>>>>>>>>>> public HomePage() {
>> >>>>>>>>>>>>>>>>>>    container = new WebMarkupContainer("container");
>> >>>>>>>>>>>>>>>>>>    add(container);
>> >>>>>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> @Override
>> >>>>>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>> >>>>>>>>>>>>>>>>>>    super.onEvent(event);
>> >>>>>>>>>>>>>>>>>>    if (event.getPayload() instanceof AddItem) {
>> >>>>>>>>>>>>>>>>>>    AddItem update = (AddItem) event.getPayload();
>> >>>>>>>>>>>>>>>>>>    update.getTarget().add(container);
>> >>>>>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> *********************
>> >>>>>>>>>>>>>>>>>> ***** AddItem *****
>> >>>>>>>>>>>>>>>>>> public class AddItem {
>> >>>>>>>>>>>>>>>>>> private final AjaxRequestTarget target;
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
>> >>>>>>>>>>>>>>>>>>   this.target = target;
>> >>>>>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
>> >>>>>>>>>>>>>>>>>>   return target;
>> >>>>>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>>>>> }
>> >>>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>>> Thanks.
>> >>>>>>>>>>>>>>>>>> Chris
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>> ---------------------------------------------------------------------
>> >>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>> >> users-unsubscribe@wicket.apache.org
>> >>>>>>>>>>>>>>>>> For additional commands, e-mail:
>> >>>> users-help@wicket.apache.org
>> >>>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>> ---------------------------------------------------------------------
>> >>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>> users-unsubscribe@wicket.apache.org
>> >>>>>>>>>>>>>>>> For additional commands, e-mail:
>> >> users-help@wicket.apache.org
>> >>>>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>>
>> >>>>>>>>
>> >> ---------------------------------------------------------------------
>> >>>>>>>>>>>>>> To unsubscribe, e-mail:
>> users-unsubscribe@wicket.apache.org
>> >>>>>>>>>>>>>> For additional commands, e-mail:
>> users-help@wicket.apache.org
>> >>>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >>>>>>>>>>>> For additional commands, e-mail:
>> users-help@wicket.apache.org
>> >>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>> >>>>>>
>> >>>>>>
>> >>>>
>> >>>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

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

Posted by Sebastien <se...@gmail.com>.
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 <ch...@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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <ch...@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(ListItem<String> 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, List<String> items) {
> >>>> …..
> >>>>
> >>>>
> >>>> Chris
> >>>>
> >>>>
> >>>>> Am 06.02.2015 um 21:20 schrieb Martin Grigorov <mgrigorov@apache.org
> >:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> 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(AbstractDefaultAjaxBehavior.java:633)
> >>>>>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
> >>>>>>>>>>>>> at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> >>>>>>>>>>>>> at
> >> javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>>>>>>>>>>>> at
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >>>>>>>>>>>>> at java.lang.Thread.run(Thread.java:745)
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> br, Chris
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
> >>>>>>>>>>> tobiassoloschenko@googlemail.com>:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> would you be so kind and apply some more information like
> >>>>>> StackTrace
> >>>>>>>>>>> of the interal server error.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Thanks a lot.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> kind regards
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Tobias.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
> >>>>>>>>>>>>>>> Sven, I have an additional situation where I am getting an
> >>>>>> internal
> >>>>>>>>>>> error. Could you help me in figuring out the problem?
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Panel A senses the selection of an item from a user and
> adds
> >>>> the
> >>>>>>>>>>> „sortable“ as container to the ajax target.
> >>>>>>>>>>>>>>> In addition, Panel B should be added to the ajax target,
> >> using
> >>>>>>>>>>> Wicket events.
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> The internal error is thrown when using Wicket events to
> add
> >>>> the
> >>>>>>>>>>> additional panel. Without the event, just calling
> >>>>>>>> #target.add(sortable) it
> >>>>>>>>>>> works.
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Panel A
> >>>>>>>>>>>>>>> *************
> >>>>>>>>>>>>>>> @Override
> >>>>>>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
> >>>>>> items)
> >>>>>>>> {
> >>>>>>>>>>>>>>> sortable.onRemove(target, items.get(0));
> >>>>>>>>>>>>>>>       target.add(sortable);
> >>>>>>>>>>>>>>>       send(getPage(), Broadcast.BREADTH, new
> >>>>>>>>>>> DeleteItem(target));
> >>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>> Panel B
> >>>>>>>>>>>>>>> *************
> >>>>>>>>>>>>>>> public class PoiListPanel extends Panel {
> >>>>>>>>>>>>>>> @Override
> >>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>>>>>               super.onEvent(event);
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>               if (event.getPayload() instanceof DeleteItem)
> >> {
> >>>>>>>>>>>>>>>               DeleteItem update = (DeleteItem)
> >>>>>>>>>>> event.getPayload();
> >>>>>>>>>>>>>>>               update.getTarget().add(this);
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>       }
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>> Chris
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
> >>>>>>>>>>> christoph@ec.tuwien.ac.at>:
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Sven - thank you. That solved it!
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <
> sven@meiers.net
> >>> :
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Your container has to output its markup id:
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> container.setOutputMarkupId()
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> Regards
> >>>>>>>>>>>>>>>>> Sven
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
> >>>>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part
> of
> >>>> the
> >>>>>>>>>>> page should be reloaded through ajax. The icon is part of a
> >> panel,
> >>>>>> the
> >>>>>>>>>>> specific part is a webmarkupcontainer added directly to the
> >> page. I
> >>>>>> am
> >>>>>>>>>>> using Wicket Events to push the click event. However, when
> adding
> >>>> the
> >>>>>>>> web
> >>>>>>>>>>> markup container as target, I am getting an internal error.
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> -> update.getTarget().add(container);
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Can someone help me to fix this?
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>>>>>> ***** PANEL *****
> >>>>>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
> >>>>>>>>>>> WebMarkupContainer("icon");
> >>>>>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
> >>>>>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
> >>>>>>>>>>>>>>>>>>    protected void onEvent(AjaxRequestTarget target) {
> >>>>>>>>>>>>>>>>>>            send(getPage(), Broadcast.BREADTH, new
> >>>>>>>>>>> AddItem(target));
> >>>>>>>>>>>>>>>>>>    }
> >>>>>>>>>>>>>>>>>> });
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>>>>>> ***** PAGE *****
> >>>>>>>>>>>>>>>>>> ...
> >>>>>>>>>>>>>>>>>> WebMarkupContainer container;
> >>>>>>>>>>>>>>>>>> public HomePage() {
> >>>>>>>>>>>>>>>>>>    container = new WebMarkupContainer("container");
> >>>>>>>>>>>>>>>>>>    add(container);
> >>>>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> @Override
> >>>>>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>>>>>>>>    super.onEvent(event);
> >>>>>>>>>>>>>>>>>>    if (event.getPayload() instanceof AddItem) {
> >>>>>>>>>>>>>>>>>>    AddItem update = (AddItem) event.getPayload();
> >>>>>>>>>>>>>>>>>>    update.getTarget().add(container);
> >>>>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>>>>>> ***** AddItem *****
> >>>>>>>>>>>>>>>>>> public class AddItem {
> >>>>>>>>>>>>>>>>>> private final AjaxRequestTarget target;
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
> >>>>>>>>>>>>>>>>>>   this.target = target;
> >>>>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
> >>>>>>>>>>>>>>>>>>   return target;
> >>>>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>>> Thanks.
> >>>>>>>>>>>>>>>>>> Chris
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
> >> users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>>>>>>> For additional commands, e-mail:
> >>>> users-help@wicket.apache.org
> >>>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>>>>>>>> To unsubscribe, e-mail:
> users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>>>>>> For additional commands, e-mail:
> >> users-help@wicket.apache.org
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>>>> For additional commands, e-mail:
> users-help@wicket.apache.org
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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

Posted by Chris <ch...@gmx.at>.
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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <ch...@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(ListItem<String> 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, List<String> items) {
>>>> …..
>>>> 
>>>> 
>>>> Chris
>>>> 
>>>> 
>>>>> Am 06.02.2015 um 21:20 schrieb Martin Grigorov <mg...@apache.org>:
>>>>> 
>>>>> Hi,
>>>>> 
>>>>> On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> 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(AbstractDefaultAjaxBehavior.java:633)
>>>>>>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>>>>>>>>>>>> at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>>>>>>>>>>>> at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>>>>>>>> at
>>>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>>>>>>>>>>>> at java.lang.Thread.run(Thread.java:745)
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> br, Chris
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>>>>>>>>>>> tobiassoloschenko@googlemail.com>:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> would you be so kind and apply some more information like
>>>>>> StackTrace
>>>>>>>>>>> of the interal server error.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Thanks a lot.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> kind regards
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Tobias.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>>>>>>>>>>>>> Sven, I have an additional situation where I am getting an
>>>>>> internal
>>>>>>>>>>> error. Could you help me in figuring out the problem?
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Panel A senses the selection of an item from a user and adds
>>>> the
>>>>>>>>>>> „sortable“ as container to the ajax target.
>>>>>>>>>>>>>>> In addition, Panel B should be added to the ajax target,
>> using
>>>>>>>>>>> Wicket events.
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> The internal error is thrown when using Wicket events to add
>>>> the
>>>>>>>>>>> additional panel. Without the event, just calling
>>>>>>>> #target.add(sortable) it
>>>>>>>>>>> works.
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Panel A
>>>>>>>>>>>>>>> *************
>>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
>>>>>> items)
>>>>>>>> {
>>>>>>>>>>>>>>> sortable.onRemove(target, items.get(0));
>>>>>>>>>>>>>>>       target.add(sortable);
>>>>>>>>>>>>>>>       send(getPage(), Broadcast.BREADTH, new
>>>>>>>>>>> DeleteItem(target));
>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>> Panel B
>>>>>>>>>>>>>>> *************
>>>>>>>>>>>>>>> public class PoiListPanel extends Panel {
>>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>>>>               super.onEvent(event);
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>               if (event.getPayload() instanceof DeleteItem)
>> {
>>>>>>>>>>>>>>>               DeleteItem update = (DeleteItem)
>>>>>>>>>>> event.getPayload();
>>>>>>>>>>>>>>>               update.getTarget().add(this);
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>       }
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>> Chris
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>>>>>>>>>>> christoph@ec.tuwien.ac.at>:
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Sven - thank you. That solved it!
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sven@meiers.net
>>> :
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> Your container has to output its markup id:
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> container.setOutputMarkupId()
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of
>>>> the
>>>>>>>>>>> page should be reloaded through ajax. The icon is part of a
>> panel,
>>>>>> the
>>>>>>>>>>> specific part is a webmarkupcontainer added directly to the
>> page. I
>>>>>> am
>>>>>>>>>>> using Wicket Events to push the click event. However, when adding
>>>> the
>>>>>>>> web
>>>>>>>>>>> markup container as target, I am getting an internal error.
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> -> update.getTarget().add(container);
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Can someone help me to fix this?
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>>>>>> ***** PANEL *****
>>>>>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>>>>>>>>>>> WebMarkupContainer("icon");
>>>>>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
>>>>>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>>>>>>>>>>>>>    protected void onEvent(AjaxRequestTarget target) {
>>>>>>>>>>>>>>>>>>            send(getPage(), Broadcast.BREADTH, new
>>>>>>>>>>> AddItem(target));
>>>>>>>>>>>>>>>>>>    }
>>>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>>>>>> ***** PAGE *****
>>>>>>>>>>>>>>>>>> ...
>>>>>>>>>>>>>>>>>> WebMarkupContainer container;
>>>>>>>>>>>>>>>>>> public HomePage() {
>>>>>>>>>>>>>>>>>>    container = new WebMarkupContainer("container");
>>>>>>>>>>>>>>>>>>    add(container);
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>>>>>>>    super.onEvent(event);
>>>>>>>>>>>>>>>>>>    if (event.getPayload() instanceof AddItem) {
>>>>>>>>>>>>>>>>>>    AddItem update = (AddItem) event.getPayload();
>>>>>>>>>>>>>>>>>>    update.getTarget().add(container);
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>>>>>> ***** AddItem *****
>>>>>>>>>>>>>>>>>> public class AddItem {
>>>>>>>>>>>>>>>>>> private final AjaxRequestTarget target;
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
>>>>>>>>>>>>>>>>>>   this.target = target;
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
>>>>>>>>>>>>>>>>>>   return target;
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>>>>>> Chris
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>> To unsubscribe, e-mail:
>> users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>>> For additional commands, e-mail:
>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


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


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

Posted by Sebastien <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <ch...@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(ListItem<String> 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, List<String> items) {
> >> …..
> >>
> >>
> >> Chris
> >>
> >>
> >>> Am 06.02.2015 um 21:20 schrieb Martin Grigorov <mg...@apache.org>:
> >>>
> >>> Hi,
> >>>
> >>> On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> 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(AbstractDefaultAjaxBehavior.java:633)
> >>>>>>>>>>>  at java.lang.reflect.Method.invoke(Method.java:483)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
> >>>>>>>>>>>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> >>>>>>>>>>>  at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>>>>>>>>>>  at
> >>>>>>>>>
> >>>>>>
> >>>>
> >>
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >>>>>>>>>>>  at java.lang.Thread.run(Thread.java:745)
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> br, Chris
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
> >>>>>>>>> tobiassoloschenko@googlemail.com>:
> >>>>>>>>>>>>
> >>>>>>>>>>>> Hi,
> >>>>>>>>>>>>
> >>>>>>>>>>>> would you be so kind and apply some more information like
> >>>> StackTrace
> >>>>>>>>> of the interal server error.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Thanks a lot.
> >>>>>>>>>>>>
> >>>>>>>>>>>> kind regards
> >>>>>>>>>>>>
> >>>>>>>>>>>> Tobias.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
> >>>>>>>>>>>>> Sven, I have an additional situation where I am getting an
> >>>> internal
> >>>>>>>>> error. Could you help me in figuring out the problem?
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Panel A senses the selection of an item from a user and adds
> >> the
> >>>>>>>>> „sortable“ as container to the ajax target.
> >>>>>>>>>>>>> In addition, Panel B should be added to the ajax target,
> using
> >>>>>>>>> Wicket events.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> The internal error is thrown when using Wicket events to add
> >> the
> >>>>>>>>> additional panel. Without the event, just calling
> >>>>>> #target.add(sortable) it
> >>>>>>>>> works.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Panel A
> >>>>>>>>>>>>> *************
> >>>>>>>>>>>>> @Override
> >>>>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
> >>>> items)
> >>>>>> {
> >>>>>>>>>>>>> sortable.onRemove(target, items.get(0));
> >>>>>>>>>>>>>        target.add(sortable);
> >>>>>>>>>>>>>        send(getPage(), Broadcast.BREADTH, new
> >>>>>>>>> DeleteItem(target));
> >>>>>>>>>>>>> }
> >>>>>>>>>>>>> Panel B
> >>>>>>>>>>>>> *************
> >>>>>>>>>>>>> public class PoiListPanel extends Panel {
> >>>>>>>>>>>>> @Override
> >>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>>>                super.onEvent(event);
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>                if (event.getPayload() instanceof DeleteItem)
> {
> >>>>>>>>>>>>>                DeleteItem update = (DeleteItem)
> >>>>>>>>> event.getPayload();
> >>>>>>>>>>>>>                update.getTarget().add(this);
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>        }
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> }
> >>>>>>>>>>>>> Chris
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
> >>>>>>>>> christoph@ec.tuwien.ac.at>:
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Sven - thank you. That solved it!
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sven@meiers.net
> >:
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Your container has to output its markup id:
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> container.setOutputMarkupId()
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> Regards
> >>>>>>>>>>>>>>> Sven
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
> >>>>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of
> >> the
> >>>>>>>>> page should be reloaded through ajax. The icon is part of a
> panel,
> >>>> the
> >>>>>>>>> specific part is a webmarkupcontainer added directly to the
> page. I
> >>>> am
> >>>>>>>>> using Wicket Events to push the click event. However, when adding
> >> the
> >>>>>> web
> >>>>>>>>> markup container as target, I am getting an internal error.
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> -> update.getTarget().add(container);
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Can someone help me to fix this?
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>>>> ***** PANEL *****
> >>>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
> >>>>>>>>> WebMarkupContainer("icon");
> >>>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
> >>>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
> >>>>>>>>>>>>>>>>     protected void onEvent(AjaxRequestTarget target) {
> >>>>>>>>>>>>>>>>             send(getPage(), Broadcast.BREADTH, new
> >>>>>>>>> AddItem(target));
> >>>>>>>>>>>>>>>>     }
> >>>>>>>>>>>>>>>> });
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>>>> ***** PAGE *****
> >>>>>>>>>>>>>>>> ...
> >>>>>>>>>>>>>>>> WebMarkupContainer container;
> >>>>>>>>>>>>>>>> public HomePage() {
> >>>>>>>>>>>>>>>>     container = new WebMarkupContainer("container");
> >>>>>>>>>>>>>>>>     add(container);
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> @Override
> >>>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>>>>>>     super.onEvent(event);
> >>>>>>>>>>>>>>>>     if (event.getPayload() instanceof AddItem) {
> >>>>>>>>>>>>>>>>     AddItem update = (AddItem) event.getPayload();
> >>>>>>>>>>>>>>>>     update.getTarget().add(container);
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>>>> ***** AddItem *****
> >>>>>>>>>>>>>>>> public class AddItem {
> >>>>>>>>>>>>>>>> private final AjaxRequestTarget target;
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
> >>>>>>>>>>>>>>>>    this.target = target;
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
> >>>>>>>>>>>>>>>>    return target;
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>>> Thanks.
> >>>>>>>>>>>>>>>> Chris
> >>>>>>>>>>>>>>>
> >>>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>>>>>>>>> To unsubscribe, e-mail:
> users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>>>>> For additional commands, e-mail:
> >> users-help@wicket.apache.org
> >>>>>>>>>>>>>>>
> >>>>>>>>>>>>>>
> >>>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>>>> For additional commands, e-mail:
> users-help@wicket.apache.org
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>
> >>>>
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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

Posted by Chris <ch...@gmx.at>.
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(ListItem<String> 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 <se...@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 <ch...@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(ListItem<String> 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, List<String> items) {
>> …..
>> 
>> 
>> Chris
>> 
>> 
>>> Am 06.02.2015 um 21:20 schrieb Martin Grigorov <mg...@apache.org>:
>>> 
>>> Hi,
>>> 
>>> On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>>>>>>>>> 
>>>>>> 
>>>> 
>> 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(AbstractDefaultAjaxBehavior.java:633)
>>>>>>>>>>>  at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>>>>>>>>>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>>>>>>>>>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>>>>>>  at
>>>>>>>>> 
>>>>>> 
>>>> 
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>>>>>>>>>>  at java.lang.Thread.run(Thread.java:745)
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> br, Chris
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>>>>>>>>> tobiassoloschenko@googlemail.com>:
>>>>>>>>>>>> 
>>>>>>>>>>>> Hi,
>>>>>>>>>>>> 
>>>>>>>>>>>> would you be so kind and apply some more information like
>>>> StackTrace
>>>>>>>>> of the interal server error.
>>>>>>>>>>>> 
>>>>>>>>>>>> Thanks a lot.
>>>>>>>>>>>> 
>>>>>>>>>>>> kind regards
>>>>>>>>>>>> 
>>>>>>>>>>>> Tobias.
>>>>>>>>>>>> 
>>>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>>>>>>>>>>> Sven, I have an additional situation where I am getting an
>>>> internal
>>>>>>>>> error. Could you help me in figuring out the problem?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Panel A senses the selection of an item from a user and adds
>> the
>>>>>>>>> „sortable“ as container to the ajax target.
>>>>>>>>>>>>> In addition, Panel B should be added to the ajax target, using
>>>>>>>>> Wicket events.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> The internal error is thrown when using Wicket events to add
>> the
>>>>>>>>> additional panel. Without the event, just calling
>>>>>> #target.add(sortable) it
>>>>>>>>> works.
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Panel A
>>>>>>>>>>>>> *************
>>>>>>>>>>>>> @Override
>>>>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
>>>> items)
>>>>>> {
>>>>>>>>>>>>> sortable.onRemove(target, items.get(0));
>>>>>>>>>>>>>        target.add(sortable);
>>>>>>>>>>>>>        send(getPage(), Broadcast.BREADTH, new
>>>>>>>>> DeleteItem(target));
>>>>>>>>>>>>> }
>>>>>>>>>>>>> Panel B
>>>>>>>>>>>>> *************
>>>>>>>>>>>>> public class PoiListPanel extends Panel {
>>>>>>>>>>>>> @Override
>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>>                super.onEvent(event);
>>>>>>>>>>>>> 
>>>>>>>>>>>>>                if (event.getPayload() instanceof DeleteItem) {
>>>>>>>>>>>>>                DeleteItem update = (DeleteItem)
>>>>>>>>> event.getPayload();
>>>>>>>>>>>>>                update.getTarget().add(this);
>>>>>>>>>>>>> 
>>>>>>>>>>>>>        }
>>>>>>>>>>>>> 
>>>>>>>>>>>>> }
>>>>>>>>>>>>> Chris
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>>>>>>>>> christoph@ec.tuwien.ac.at>:
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Sven - thank you. That solved it!
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Your container has to output its markup id:
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> container.setOutputMarkupId()
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of
>> the
>>>>>>>>> page should be reloaded through ajax. The icon is part of a panel,
>>>> the
>>>>>>>>> specific part is a webmarkupcontainer added directly to the page. I
>>>> am
>>>>>>>>> using Wicket Events to push the click event. However, when adding
>> the
>>>>>> web
>>>>>>>>> markup container as target, I am getting an internal error.
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> -> update.getTarget().add(container);
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Can someone help me to fix this?
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>>>> ***** PANEL *****
>>>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>>>>>>>>> WebMarkupContainer("icon");
>>>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
>>>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>>>>>>>>>>>     protected void onEvent(AjaxRequestTarget target) {
>>>>>>>>>>>>>>>>             send(getPage(), Broadcast.BREADTH, new
>>>>>>>>> AddItem(target));
>>>>>>>>>>>>>>>>     }
>>>>>>>>>>>>>>>> });
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>>>> ***** PAGE *****
>>>>>>>>>>>>>>>> ...
>>>>>>>>>>>>>>>> WebMarkupContainer container;
>>>>>>>>>>>>>>>> public HomePage() {
>>>>>>>>>>>>>>>>     container = new WebMarkupContainer("container");
>>>>>>>>>>>>>>>>     add(container);
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>>>>>     super.onEvent(event);
>>>>>>>>>>>>>>>>     if (event.getPayload() instanceof AddItem) {
>>>>>>>>>>>>>>>>     AddItem update = (AddItem) event.getPayload();
>>>>>>>>>>>>>>>>     update.getTarget().add(container);
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>>>> ***** AddItem *****
>>>>>>>>>>>>>>>> public class AddItem {
>>>>>>>>>>>>>>>> private final AjaxRequestTarget target;
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
>>>>>>>>>>>>>>>>    this.target = target;
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
>>>>>>>>>>>>>>>>    return target;
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> }
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>>>> Chris
>>>>>>>>>>>>>>> 
>>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>> For additional commands, e-mail:
>> users-help@wicket.apache.org
>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>>> 
>> 
>> 


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


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

Posted by Sebastien <se...@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 <ch...@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(ListItem<String> 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, List<String> items) {
> …..
>
>
> Chris
>
>
> > Am 06.02.2015 um 21:20 schrieb Martin Grigorov <mg...@apache.org>:
> >
> > Hi,
> >
> > On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
> >>>>>>>
> >>>>
> >>
> 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(AbstractDefaultAjaxBehavior.java:633)
> >>>>>>>>>   at java.lang.reflect.Method.invoke(Method.java:483)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
> >>>>>>>>>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> >>>>>>>>>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>>>   at
> >>>>>>>
> >> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>>>>>>>>   at
> >>>>>>>
> >>>>
> >>
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >>>>>>>>>   at java.lang.Thread.run(Thread.java:745)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> br, Chris
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
> >>>>>>> tobiassoloschenko@googlemail.com>:
> >>>>>>>>>>
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> would you be so kind and apply some more information like
> >> StackTrace
> >>>>>>> of the interal server error.
> >>>>>>>>>>
> >>>>>>>>>> Thanks a lot.
> >>>>>>>>>>
> >>>>>>>>>> kind regards
> >>>>>>>>>>
> >>>>>>>>>> Tobias.
> >>>>>>>>>>
> >>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
> >>>>>>>>>>> Sven, I have an additional situation where I am getting an
> >> internal
> >>>>>>> error. Could you help me in figuring out the problem?
> >>>>>>>>>>>
> >>>>>>>>>>> Panel A senses the selection of an item from a user and adds
> the
> >>>>>>> „sortable“ as container to the ajax target.
> >>>>>>>>>>> In addition, Panel B should be added to the ajax target, using
> >>>>>>> Wicket events.
> >>>>>>>>>>>
> >>>>>>>>>>> The internal error is thrown when using Wicket events to add
> the
> >>>>>>> additional panel. Without the event, just calling
> >>>> #target.add(sortable) it
> >>>>>>> works.
> >>>>>>>>>>>
> >>>>>>>>>>> Panel A
> >>>>>>>>>>> *************
> >>>>>>>>>>> @Override
> >>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
> >> items)
> >>>> {
> >>>>>>>>>>> sortable.onRemove(target, items.get(0));
> >>>>>>>>>>>         target.add(sortable);
> >>>>>>>>>>>         send(getPage(), Broadcast.BREADTH, new
> >>>>>>> DeleteItem(target));
> >>>>>>>>>>> }
> >>>>>>>>>>> Panel B
> >>>>>>>>>>> *************
> >>>>>>>>>>> public class PoiListPanel extends Panel {
> >>>>>>>>>>> @Override
> >>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>                 super.onEvent(event);
> >>>>>>>>>>>
> >>>>>>>>>>>                 if (event.getPayload() instanceof DeleteItem) {
> >>>>>>>>>>>                 DeleteItem update = (DeleteItem)
> >>>>>>> event.getPayload();
> >>>>>>>>>>>                 update.getTarget().add(this);
> >>>>>>>>>>>
> >>>>>>>>>>>         }
> >>>>>>>>>>>
> >>>>>>>>>>> }
> >>>>>>>>>>> Chris
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
> >>>>>>> christoph@ec.tuwien.ac.at>:
> >>>>>>>>>>>>
> >>>>>>>>>>>> Sven - thank you. That solved it!
> >>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Your container has to output its markup id:
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> container.setOutputMarkupId()
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Regards
> >>>>>>>>>>>>> Sven
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
> >>>>>>>>>>>>>> Hi,
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of
> the
> >>>>>>> page should be reloaded through ajax. The icon is part of a panel,
> >> the
> >>>>>>> specific part is a webmarkupcontainer added directly to the page. I
> >> am
> >>>>>>> using Wicket Events to push the click event. However, when adding
> the
> >>>> web
> >>>>>>> markup container as target, I am getting an internal error.
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> -> update.getTarget().add(container);
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Can someone help me to fix this?
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>> ***** PANEL *****
> >>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
> >>>>>>> WebMarkupContainer("icon");
> >>>>>>>>>>>>>> icon.setOutputMarkupId(true);
> >>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
> >>>>>>>>>>>>>>      protected void onEvent(AjaxRequestTarget target) {
> >>>>>>>>>>>>>>              send(getPage(), Broadcast.BREADTH, new
> >>>>>>> AddItem(target));
> >>>>>>>>>>>>>>      }
> >>>>>>>>>>>>>> });
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>> ***** PAGE *****
> >>>>>>>>>>>>>> ...
> >>>>>>>>>>>>>> WebMarkupContainer container;
> >>>>>>>>>>>>>> public HomePage() {
> >>>>>>>>>>>>>>      container = new WebMarkupContainer("container");
> >>>>>>>>>>>>>>      add(container);
> >>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> @Override
> >>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>>>>      super.onEvent(event);
> >>>>>>>>>>>>>>      if (event.getPayload() instanceof AddItem) {
> >>>>>>>>>>>>>>      AddItem update = (AddItem) event.getPayload();
> >>>>>>>>>>>>>>      update.getTarget().add(container);
> >>>>>>>>>>>>>> }
> >>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> *********************
> >>>>>>>>>>>>>> ***** AddItem *****
> >>>>>>>>>>>>>> public class AddItem {
> >>>>>>>>>>>>>> private final AjaxRequestTarget target;
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
> >>>>>>>>>>>>>>     this.target = target;
> >>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
> >>>>>>>>>>>>>>     return target;
> >>>>>>>>>>>>>> }
> >>>>>>>>>>>>>> }
> >>>>>>>>>>>>>>
> >>>>>>>>>>>>>> Thanks.
> >>>>>>>>>>>>>> Chris
> >>>>>>>>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>>> For additional commands, e-mail:
> users-help@wicket.apache.org
> >>>>>>>>>>>>>
> >>>>>>>>>>>>
> >>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>> ---------------------------------------------------------------------
> >>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>
>

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

Posted by Chris <ch...@gmx.at>.
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(ListItem<String> 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, List<String> items) {
…..


Chris


> Am 06.02.2015 um 21:20 schrieb Martin Grigorov <mg...@apache.org>:
> 
> Hi,
> 
> On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>>>>>>> 
>>>> 
>> 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(AbstractDefaultAjaxBehavior.java:633)
>>>>>>>>>   at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>>>>>>>>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>>>>>>>>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>   at
>>>>>>> 
>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>>>>>>>>   at java.lang.Thread.run(Thread.java:745)
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> br, Chris
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>>>>>>> tobiassoloschenko@googlemail.com>:
>>>>>>>>>> 
>>>>>>>>>> Hi,
>>>>>>>>>> 
>>>>>>>>>> would you be so kind and apply some more information like
>> StackTrace
>>>>>>> of the interal server error.
>>>>>>>>>> 
>>>>>>>>>> Thanks a lot.
>>>>>>>>>> 
>>>>>>>>>> kind regards
>>>>>>>>>> 
>>>>>>>>>> Tobias.
>>>>>>>>>> 
>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>>>>>>>>> Sven, I have an additional situation where I am getting an
>> internal
>>>>>>> error. Could you help me in figuring out the problem?
>>>>>>>>>>> 
>>>>>>>>>>> Panel A senses the selection of an item from a user and adds the
>>>>>>> „sortable“ as container to the ajax target.
>>>>>>>>>>> In addition, Panel B should be added to the ajax target, using
>>>>>>> Wicket events.
>>>>>>>>>>> 
>>>>>>>>>>> The internal error is thrown when using Wicket events to add the
>>>>>>> additional panel. Without the event, just calling
>>>> #target.add(sortable) it
>>>>>>> works.
>>>>>>>>>>> 
>>>>>>>>>>> Panel A
>>>>>>>>>>> *************
>>>>>>>>>>> @Override
>>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
>> items)
>>>> {
>>>>>>>>>>> sortable.onRemove(target, items.get(0));
>>>>>>>>>>>         target.add(sortable);
>>>>>>>>>>>         send(getPage(), Broadcast.BREADTH, new
>>>>>>> DeleteItem(target));
>>>>>>>>>>> }
>>>>>>>>>>> Panel B
>>>>>>>>>>> *************
>>>>>>>>>>> public class PoiListPanel extends Panel {
>>>>>>>>>>> @Override
>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>                 super.onEvent(event);
>>>>>>>>>>> 
>>>>>>>>>>>                 if (event.getPayload() instanceof DeleteItem) {
>>>>>>>>>>>                 DeleteItem update = (DeleteItem)
>>>>>>> event.getPayload();
>>>>>>>>>>>                 update.getTarget().add(this);
>>>>>>>>>>> 
>>>>>>>>>>>         }
>>>>>>>>>>> 
>>>>>>>>>>> }
>>>>>>>>>>> Chris
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>>>>>>> christoph@ec.tuwien.ac.at>:
>>>>>>>>>>>> 
>>>>>>>>>>>> Sven - thank you. That solved it!
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Your container has to output its markup id:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> container.setOutputMarkupId()
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> Sven
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of the
>>>>>>> page should be reloaded through ajax. The icon is part of a panel,
>> the
>>>>>>> specific part is a webmarkupcontainer added directly to the page. I
>> am
>>>>>>> using Wicket Events to push the click event. However, when adding the
>>>> web
>>>>>>> markup container as target, I am getting an internal error.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> -> update.getTarget().add(container);
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Can someone help me to fix this?
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>> ***** PANEL *****
>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>>>>>>> WebMarkupContainer("icon");
>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>>>>>>>>>      protected void onEvent(AjaxRequestTarget target) {
>>>>>>>>>>>>>>              send(getPage(), Broadcast.BREADTH, new
>>>>>>> AddItem(target));
>>>>>>>>>>>>>>      }
>>>>>>>>>>>>>> });
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>> ***** PAGE *****
>>>>>>>>>>>>>> ...
>>>>>>>>>>>>>> WebMarkupContainer container;
>>>>>>>>>>>>>> public HomePage() {
>>>>>>>>>>>>>>      container = new WebMarkupContainer("container");
>>>>>>>>>>>>>>      add(container);
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>>>      super.onEvent(event);
>>>>>>>>>>>>>>      if (event.getPayload() instanceof AddItem) {
>>>>>>>>>>>>>>      AddItem update = (AddItem) event.getPayload();
>>>>>>>>>>>>>>      update.getTarget().add(container);
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>> ***** AddItem *****
>>>>>>>>>>>>>> public class AddItem {
>>>>>>>>>>>>>> private final AjaxRequestTarget target;
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
>>>>>>>>>>>>>>     this.target = target;
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
>>>>>>>>>>>>>>     return target;
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>> Chris
>>>>>>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
>> 


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

Posted by Chris <ch...@gmx.at>.
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 <mg...@apache.org>:
> 
> Hi,
> 
> On Fri, Feb 6, 2015 at 10:13 PM, Chris <chris.gr@gmx.at <ma...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>>>>>>> 
>>>> 
>> 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(AbstractDefaultAjaxBehavior.java:633)
>>>>>>>>>   at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>>>>>>>>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>>>>>>>>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>   at
>>>>>>> 
>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>>>>   at
>>>>>>> 
>>>> 
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>>>>>>>>   at java.lang.Thread.run(Thread.java:745)
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> br, Chris
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>>>>>>> tobiassoloschenko@googlemail.com>:
>>>>>>>>>> 
>>>>>>>>>> Hi,
>>>>>>>>>> 
>>>>>>>>>> would you be so kind and apply some more information like
>> StackTrace
>>>>>>> of the interal server error.
>>>>>>>>>> 
>>>>>>>>>> Thanks a lot.
>>>>>>>>>> 
>>>>>>>>>> kind regards
>>>>>>>>>> 
>>>>>>>>>> Tobias.
>>>>>>>>>> 
>>>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>>>>>>>>> Sven, I have an additional situation where I am getting an
>> internal
>>>>>>> error. Could you help me in figuring out the problem?
>>>>>>>>>>> 
>>>>>>>>>>> Panel A senses the selection of an item from a user and adds the
>>>>>>> „sortable“ as container to the ajax target.
>>>>>>>>>>> In addition, Panel B should be added to the ajax target, using
>>>>>>> Wicket events.
>>>>>>>>>>> 
>>>>>>>>>>> The internal error is thrown when using Wicket events to add the
>>>>>>> additional panel. Without the event, just calling
>>>> #target.add(sortable) it
>>>>>>> works.
>>>>>>>>>>> 
>>>>>>>>>>> Panel A
>>>>>>>>>>> *************
>>>>>>>>>>> @Override
>>>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
>> items)
>>>> {
>>>>>>>>>>> sortable.onRemove(target, items.get(0));
>>>>>>>>>>>         target.add(sortable);
>>>>>>>>>>>         send(getPage(), Broadcast.BREADTH, new
>>>>>>> DeleteItem(target));
>>>>>>>>>>> }
>>>>>>>>>>> Panel B
>>>>>>>>>>> *************
>>>>>>>>>>> public class PoiListPanel extends Panel {
>>>>>>>>>>> @Override
>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>                 super.onEvent(event);
>>>>>>>>>>> 
>>>>>>>>>>>                 if (event.getPayload() instanceof DeleteItem) {
>>>>>>>>>>>                 DeleteItem update = (DeleteItem)
>>>>>>> event.getPayload();
>>>>>>>>>>>                 update.getTarget().add(this);
>>>>>>>>>>> 
>>>>>>>>>>>         }
>>>>>>>>>>> 
>>>>>>>>>>> }
>>>>>>>>>>> Chris
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>>>>>>> christoph@ec.tuwien.ac.at>:
>>>>>>>>>>>> 
>>>>>>>>>>>> Sven - thank you. That solved it!
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Your container has to output its markup id:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> container.setOutputMarkupId()
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> Sven
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of the
>>>>>>> page should be reloaded through ajax. The icon is part of a panel,
>> the
>>>>>>> specific part is a webmarkupcontainer added directly to the page. I
>> am
>>>>>>> using Wicket Events to push the click event. However, when adding the
>>>> web
>>>>>>> markup container as target, I am getting an internal error.
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> -> update.getTarget().add(container);
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Can someone help me to fix this?
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>> ***** PANEL *****
>>>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>>>>>>> WebMarkupContainer("icon");
>>>>>>>>>>>>>> icon.setOutputMarkupId(true);
>>>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>>>>>>>>>      protected void onEvent(AjaxRequestTarget target) {
>>>>>>>>>>>>>>              send(getPage(), Broadcast.BREADTH, new
>>>>>>> AddItem(target));
>>>>>>>>>>>>>>      }
>>>>>>>>>>>>>> });
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>> ***** PAGE *****
>>>>>>>>>>>>>> ...
>>>>>>>>>>>>>> WebMarkupContainer container;
>>>>>>>>>>>>>> public HomePage() {
>>>>>>>>>>>>>>      container = new WebMarkupContainer("container");
>>>>>>>>>>>>>>      add(container);
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> @Override
>>>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>>>      super.onEvent(event);
>>>>>>>>>>>>>>      if (event.getPayload() instanceof AddItem) {
>>>>>>>>>>>>>>      AddItem update = (AddItem) event.getPayload();
>>>>>>>>>>>>>>      update.getTarget().add(container);
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> *********************
>>>>>>>>>>>>>> ***** AddItem *****
>>>>>>>>>>>>>> public class AddItem {
>>>>>>>>>>>>>> private final AjaxRequestTarget target;
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> public AddItem(AjaxRequestTarget target) {
>>>>>>>>>>>>>>     this.target = target;
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> public AjaxRequestTarget getTarget() {
>>>>>>>>>>>>>>     return target;
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> }
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>>> Chris
>>>>>>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org


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

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Fri, Feb 6, 2015 at 10:13 PM, Chris <ch...@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 AjaxFallbackLink<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
> >>>>>
> >>
> 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(AbstractDefaultAjaxBehavior.java:633)
> >>>>>>>    at java.lang.reflect.Method.invoke(Method.java:483)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
> >>>>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> >>>>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>    at
> >>>>>
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
> >>>>>>>    at
> >>>>>
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>>>>>>    at
> >>>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>>>>>>    at
> >>>>>
> >>
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >>>>>>>    at java.lang.Thread.run(Thread.java:745)
> >>>>>>>
> >>>>>>>
> >>>>>>> br, Chris
> >>>>>>>
> >>>>>>>
> >>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
> >>>>> tobiassoloschenko@googlemail.com>:
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> would you be so kind and apply some more information like
> StackTrace
> >>>>> of the interal server error.
> >>>>>>>>
> >>>>>>>> Thanks a lot.
> >>>>>>>>
> >>>>>>>> kind regards
> >>>>>>>>
> >>>>>>>> Tobias.
> >>>>>>>>
> >>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
> >>>>>>>>> Sven, I have an additional situation where I am getting an
> internal
> >>>>> error. Could you help me in figuring out the problem?
> >>>>>>>>>
> >>>>>>>>> Panel A senses the selection of an item from a user and adds the
> >>>>> „sortable“ as container to the ajax target.
> >>>>>>>>> In addition, Panel B should be added to the ajax target, using
> >>>>> Wicket events.
> >>>>>>>>>
> >>>>>>>>> The internal error is thrown when using Wicket events to add the
> >>>>> additional panel. Without the event, just calling
> >> #target.add(sortable) it
> >>>>> works.
> >>>>>>>>>
> >>>>>>>>> Panel A
> >>>>>>>>> *************
> >>>>>>>>> @Override
> >>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String>
> items)
> >> {
> >>>>>>>>>  sortable.onRemove(target, items.get(0));
> >>>>>>>>>          target.add(sortable);
> >>>>>>>>>          send(getPage(), Broadcast.BREADTH, new
> >>>>> DeleteItem(target));
> >>>>>>>>> }
> >>>>>>>>> Panel B
> >>>>>>>>> *************
> >>>>>>>>> public class PoiListPanel extends Panel {
> >>>>>>>>>  @Override
> >>>>>>>>>  public void onEvent(IEvent<?> event) {
> >>>>>>>>>                  super.onEvent(event);
> >>>>>>>>>
> >>>>>>>>>                  if (event.getPayload() instanceof DeleteItem) {
> >>>>>>>>>                  DeleteItem update = (DeleteItem)
> >>>>> event.getPayload();
> >>>>>>>>>                  update.getTarget().add(this);
> >>>>>>>>>
> >>>>>>>>>          }
> >>>>>>>>>
> >>>>>>>>> }
> >>>>>>>>> Chris
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
> >>>>> christoph@ec.tuwien.ac.at>:
> >>>>>>>>>>
> >>>>>>>>>> Sven - thank you. That solved it!
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
> >>>>>>>>>>>
> >>>>>>>>>>> Your container has to output its markup id:
> >>>>>>>>>>>
> >>>>>>>>>>> container.setOutputMarkupId()
> >>>>>>>>>>>
> >>>>>>>>>>> Regards
> >>>>>>>>>>> Sven
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
> >>>>>>>>>>>> Hi,
> >>>>>>>>>>>>
> >>>>>>>>>>>> When the user clicks on a certain icon, a specific part of the
> >>>>> page should be reloaded through ajax. The icon is part of a panel,
> the
> >>>>> specific part is a webmarkupcontainer added directly to the page. I
> am
> >>>>> using Wicket Events to push the click event. However, when adding the
> >> web
> >>>>> markup container as target, I am getting an internal error.
> >>>>>>>>>>>>
> >>>>>>>>>>>> -> update.getTarget().add(container);
> >>>>>>>>>>>>
> >>>>>>>>>>>> Can someone help me to fix this?
> >>>>>>>>>>>>
> >>>>>>>>>>>> *********************
> >>>>>>>>>>>> ***** PANEL *****
> >>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
> >>>>> WebMarkupContainer("icon");
> >>>>>>>>>>>> icon.setOutputMarkupId(true);
> >>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
> >>>>>>>>>>>>       protected void onEvent(AjaxRequestTarget target) {
> >>>>>>>>>>>>               send(getPage(), Broadcast.BREADTH, new
> >>>>> AddItem(target));
> >>>>>>>>>>>>       }
> >>>>>>>>>>>> });
> >>>>>>>>>>>>
> >>>>>>>>>>>> *********************
> >>>>>>>>>>>> ***** PAGE *****
> >>>>>>>>>>>> ...
> >>>>>>>>>>>> WebMarkupContainer container;
> >>>>>>>>>>>> public HomePage() {
> >>>>>>>>>>>>       container = new WebMarkupContainer("container");
> >>>>>>>>>>>>       add(container);
> >>>>>>>>>>>> }
> >>>>>>>>>>>>
> >>>>>>>>>>>> @Override
> >>>>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>>>       super.onEvent(event);
> >>>>>>>>>>>>       if (event.getPayload() instanceof AddItem) {
> >>>>>>>>>>>>       AddItem update = (AddItem) event.getPayload();
> >>>>>>>>>>>>       update.getTarget().add(container);
> >>>>>>>>>>>>  }
> >>>>>>>>>>>> }
> >>>>>>>>>>>>
> >>>>>>>>>>>> *********************
> >>>>>>>>>>>> ***** AddItem *****
> >>>>>>>>>>>> public class AddItem {
> >>>>>>>>>>>>  private final AjaxRequestTarget target;
> >>>>>>>>>>>>
> >>>>>>>>>>>>  public AddItem(AjaxRequestTarget target) {
> >>>>>>>>>>>>      this.target = target;
> >>>>>>>>>>>>  }
> >>>>>>>>>>>>
> >>>>>>>>>>>>  public AjaxRequestTarget getTarget() {
> >>>>>>>>>>>>      return target;
> >>>>>>>>>>>>  }
> >>>>>>>>>>>> }
> >>>>>>>>>>>>
> >>>>>>>>>>>> Thanks.
> >>>>>>>>>>>> Chris
> >>>>>>>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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

Posted by Chris <ch...@gmx.at>.
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<String>("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 <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>>>>> 
>> 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(AbstractDefaultAjaxBehavior.java:633)
>>>>>>>    at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>>>>>>    at
>>>>> 
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>>>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>>>>>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>    at
>>>>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>>>>>>    at
>>>>> 
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>>>>>>    at
>>>>> 
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>>>>>>    at
>>>>> 
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>>>>>    at
>>>>> 
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>>>>>>    at
>>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>>>>>>    at
>>>>> 
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>>>>>>    at
>>>>> 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>>>    at
>>>>> 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>>>    at
>>>>> 
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>>>>>>    at java.lang.Thread.run(Thread.java:745)
>>>>>>> 
>>>>>>> 
>>>>>>> br, Chris
>>>>>>> 
>>>>>>> 
>>>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>>>>> tobiassoloschenko@googlemail.com>:
>>>>>>>> 
>>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> would you be so kind and apply some more information like StackTrace
>>>>> of the interal server error.
>>>>>>>> 
>>>>>>>> Thanks a lot.
>>>>>>>> 
>>>>>>>> kind regards
>>>>>>>> 
>>>>>>>> Tobias.
>>>>>>>> 
>>>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>>>>>>> Sven, I have an additional situation where I am getting an internal
>>>>> error. Could you help me in figuring out the problem?
>>>>>>>>> 
>>>>>>>>> Panel A senses the selection of an item from a user and adds the
>>>>> „sortable“ as container to the ajax target.
>>>>>>>>> In addition, Panel B should be added to the ajax target, using
>>>>> Wicket events.
>>>>>>>>> 
>>>>>>>>> The internal error is thrown when using Wicket events to add the
>>>>> additional panel. Without the event, just calling
>> #target.add(sortable) it
>>>>> works.
>>>>>>>>> 
>>>>>>>>> Panel A
>>>>>>>>> *************
>>>>>>>>> @Override
>>>>>>>>> public void onSelect(AjaxRequestTarget target, List<String> items)
>> {
>>>>>>>>>  sortable.onRemove(target, items.get(0));
>>>>>>>>>          target.add(sortable);
>>>>>>>>>          send(getPage(), Broadcast.BREADTH, new
>>>>> DeleteItem(target));
>>>>>>>>> }
>>>>>>>>> Panel B
>>>>>>>>> *************
>>>>>>>>> public class PoiListPanel extends Panel {
>>>>>>>>>  @Override
>>>>>>>>>  public void onEvent(IEvent<?> event) {
>>>>>>>>>                  super.onEvent(event);
>>>>>>>>> 
>>>>>>>>>                  if (event.getPayload() instanceof DeleteItem) {
>>>>>>>>>                  DeleteItem update = (DeleteItem)
>>>>> event.getPayload();
>>>>>>>>>                  update.getTarget().add(this);
>>>>>>>>> 
>>>>>>>>>          }
>>>>>>>>> 
>>>>>>>>> }
>>>>>>>>> Chris
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>>>>> christoph@ec.tuwien.ac.at>:
>>>>>>>>>> 
>>>>>>>>>> Sven - thank you. That solved it!
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>>>>>>> 
>>>>>>>>>>> Your container has to output its markup id:
>>>>>>>>>>> 
>>>>>>>>>>> container.setOutputMarkupId()
>>>>>>>>>>> 
>>>>>>>>>>> Regards
>>>>>>>>>>> Sven
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>>>>>>> Hi,
>>>>>>>>>>>> 
>>>>>>>>>>>> When the user clicks on a certain icon, a specific part of the
>>>>> page should be reloaded through ajax. The icon is part of a panel, the
>>>>> specific part is a webmarkupcontainer added directly to the page. I am
>>>>> using Wicket Events to push the click event. However, when adding the
>> web
>>>>> markup container as target, I am getting an internal error.
>>>>>>>>>>>> 
>>>>>>>>>>>> -> update.getTarget().add(container);
>>>>>>>>>>>> 
>>>>>>>>>>>> Can someone help me to fix this?
>>>>>>>>>>>> 
>>>>>>>>>>>> *********************
>>>>>>>>>>>> ***** PANEL *****
>>>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>>>>> WebMarkupContainer("icon");
>>>>>>>>>>>> icon.setOutputMarkupId(true);
>>>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>>>>>>>       protected void onEvent(AjaxRequestTarget target) {
>>>>>>>>>>>>               send(getPage(), Broadcast.BREADTH, new
>>>>> AddItem(target));
>>>>>>>>>>>>       }
>>>>>>>>>>>> });
>>>>>>>>>>>> 
>>>>>>>>>>>> *********************
>>>>>>>>>>>> ***** PAGE *****
>>>>>>>>>>>> ...
>>>>>>>>>>>> WebMarkupContainer container;
>>>>>>>>>>>> public HomePage() {
>>>>>>>>>>>>       container = new WebMarkupContainer("container");
>>>>>>>>>>>>       add(container);
>>>>>>>>>>>> }
>>>>>>>>>>>> 
>>>>>>>>>>>> @Override
>>>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>>>       super.onEvent(event);
>>>>>>>>>>>>       if (event.getPayload() instanceof AddItem) {
>>>>>>>>>>>>       AddItem update = (AddItem) event.getPayload();
>>>>>>>>>>>>       update.getTarget().add(container);
>>>>>>>>>>>>  }
>>>>>>>>>>>> }
>>>>>>>>>>>> 
>>>>>>>>>>>> *********************
>>>>>>>>>>>> ***** AddItem *****
>>>>>>>>>>>> public class AddItem {
>>>>>>>>>>>>  private final AjaxRequestTarget target;
>>>>>>>>>>>> 
>>>>>>>>>>>>  public AddItem(AjaxRequestTarget target) {
>>>>>>>>>>>>      this.target = target;
>>>>>>>>>>>>  }
>>>>>>>>>>>> 
>>>>>>>>>>>>  public AjaxRequestTarget getTarget() {
>>>>>>>>>>>>      return target;
>>>>>>>>>>>>  }
>>>>>>>>>>>> }
>>>>>>>>>>>> 
>>>>>>>>>>>> Thanks.
>>>>>>>>>>>> Chris
>>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>> 
>> 


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


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

Posted by Sebastien <se...@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 <ch...@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(ListItem<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
> >>>
> 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(AbstractDefaultAjaxBehavior.java:633)
> >>>>>     at java.lang.reflect.Method.invoke(Method.java:483)
> >>>>>     at
> >>>
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> >>>>>     at
> >>>
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> >>>>>     at
> >>>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> >>>>>     at
> >>>
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> >>>>>     at
> >>>
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> >>>>>     at
> >>>
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>>>>     at
> >>>
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> >>>>>     at
> >>>
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> >>>>>     at
> >>>
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> >>>>>     at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> >>>>>     at
> >>>
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >>>>>     at
> >>>
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
> >>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> >>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >>>>>     at
> >>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> >>>>>     at
> >>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>     at
> >>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>>>>     at
> >>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> >>>>>     at
> >>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>>>>     at
> >>>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
> >>>>>     at
> >>>
> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
> >>>>>     at
> >>>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
> >>>>>     at
> >>>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
> >>>>>     at
> >>>
> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
> >>>>>     at
> >>>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
> >>>>>     at
> >>>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >>>>>     at
> >>>
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
> >>>>>     at
> >>>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >>>>>     at
> >>>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
> >>>>>     at
> >>>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
> >>>>>     at
> >>>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>>>>     at
> >>>
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
> >>>>>     at
> >>>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
> >>>>>     at
> >>>
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
> >>>>>     at
> >>>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>>>>     at
> >>>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>>>>     at
> >>>
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >>>>>     at java.lang.Thread.run(Thread.java:745)
> >>>>>
> >>>>>
> >>>>> br, Chris
> >>>>>
> >>>>>
> >>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
> >>> tobiassoloschenko@googlemail.com>:
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> would you be so kind and apply some more information like StackTrace
> >>> of the interal server error.
> >>>>>>
> >>>>>> Thanks a lot.
> >>>>>>
> >>>>>> kind regards
> >>>>>>
> >>>>>> Tobias.
> >>>>>>
> >>>>>> Am 04.02.15 um 20:05 schrieb Chris:
> >>>>>>> Sven, I have an additional situation where I am getting an internal
> >>> error. Could you help me in figuring out the problem?
> >>>>>>>
> >>>>>>> Panel A senses the selection of an item from a user and adds the
> >>> „sortable“ as container to the ajax target.
> >>>>>>> In addition, Panel B should be added to the ajax target, using
> >>> Wicket events.
> >>>>>>>
> >>>>>>> The internal error is thrown when using Wicket events to add the
> >>> additional panel. Without the event, just calling
> #target.add(sortable) it
> >>> works.
> >>>>>>>
> >>>>>>> Panel A
> >>>>>>> *************
> >>>>>>> @Override
> >>>>>>> public void onSelect(AjaxRequestTarget target, List<String> items)
> {
> >>>>>>>   sortable.onRemove(target, items.get(0));
> >>>>>>>           target.add(sortable);
> >>>>>>>           send(getPage(), Broadcast.BREADTH, new
> >>> DeleteItem(target));
> >>>>>>> }
> >>>>>>> Panel B
> >>>>>>> *************
> >>>>>>> public class PoiListPanel extends Panel {
> >>>>>>>   @Override
> >>>>>>>   public void onEvent(IEvent<?> event) {
> >>>>>>>                   super.onEvent(event);
> >>>>>>>
> >>>>>>>                   if (event.getPayload() instanceof DeleteItem) {
> >>>>>>>                   DeleteItem update = (DeleteItem)
> >>> event.getPayload();
> >>>>>>>                   update.getTarget().add(this);
> >>>>>>>
> >>>>>>>           }
> >>>>>>>
> >>>>>>> }
> >>>>>>> Chris
> >>>>>>>
> >>>>>>>
> >>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
> >>> christoph@ec.tuwien.ac.at>:
> >>>>>>>>
> >>>>>>>> Sven - thank you. That solved it!
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
> >>>>>>>>>
> >>>>>>>>> Your container has to output its markup id:
> >>>>>>>>>
> >>>>>>>>> container.setOutputMarkupId()
> >>>>>>>>>
> >>>>>>>>> Regards
> >>>>>>>>> Sven
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> On 04.02.2015 14:11, Chris wrote:
> >>>>>>>>>> Hi,
> >>>>>>>>>>
> >>>>>>>>>> When the user clicks on a certain icon, a specific part of the
> >>> page should be reloaded through ajax. The icon is part of a panel, the
> >>> specific part is a webmarkupcontainer added directly to the page. I am
> >>> using Wicket Events to push the click event. However, when adding the
> web
> >>> markup container as target, I am getting an internal error.
> >>>>>>>>>>
> >>>>>>>>>> -> update.getTarget().add(container);
> >>>>>>>>>>
> >>>>>>>>>> Can someone help me to fix this?
> >>>>>>>>>>
> >>>>>>>>>> *********************
> >>>>>>>>>> ***** PANEL *****
> >>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
> >>> WebMarkupContainer("icon");
> >>>>>>>>>> icon.setOutputMarkupId(true);
> >>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
> >>>>>>>>>>        protected void onEvent(AjaxRequestTarget target) {
> >>>>>>>>>>                send(getPage(), Broadcast.BREADTH, new
> >>> AddItem(target));
> >>>>>>>>>>        }
> >>>>>>>>>> });
> >>>>>>>>>>
> >>>>>>>>>> *********************
> >>>>>>>>>> ***** PAGE *****
> >>>>>>>>>> ...
> >>>>>>>>>> WebMarkupContainer container;
> >>>>>>>>>> public HomePage() {
> >>>>>>>>>>        container = new WebMarkupContainer("container");
> >>>>>>>>>>        add(container);
> >>>>>>>>>> }
> >>>>>>>>>>
> >>>>>>>>>> @Override
> >>>>>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>>>>        super.onEvent(event);
> >>>>>>>>>>        if (event.getPayload() instanceof AddItem) {
> >>>>>>>>>>        AddItem update = (AddItem) event.getPayload();
> >>>>>>>>>>        update.getTarget().add(container);
> >>>>>>>>>>   }
> >>>>>>>>>> }
> >>>>>>>>>>
> >>>>>>>>>> *********************
> >>>>>>>>>> ***** AddItem *****
> >>>>>>>>>> public class AddItem {
> >>>>>>>>>>   private final AjaxRequestTarget target;
> >>>>>>>>>>
> >>>>>>>>>>   public AddItem(AjaxRequestTarget target) {
> >>>>>>>>>>       this.target = target;
> >>>>>>>>>>   }
> >>>>>>>>>>
> >>>>>>>>>>   public AjaxRequestTarget getTarget() {
> >>>>>>>>>>       return target;
> >>>>>>>>>>   }
> >>>>>>>>>> }
> >>>>>>>>>>
> >>>>>>>>>> Thanks.
> >>>>>>>>>> Chris
> >>>>>>>>>
> >>> ---------------------------------------------------------------------
> >>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>>
> >>>>>>>>
> >>> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>
> >>>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>
> >>>
> >>>
> >>
>
>

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

Posted by Chris <ch...@gmx.at>.
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<String> 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 <se...@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 <se...@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 <ch...@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 <sv...@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
>>> 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(AbstractDefaultAjaxBehavior.java:633)
>>>>>     at java.lang.reflect.Method.invoke(Method.java:483)
>>>>>     at
>>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>>>>     at
>>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>>>>     at
>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>>>>     at
>>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>>>>     at
>>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>>>>     at
>>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>>>>     at
>>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>>>>     at
>>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>>>>     at
>>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>>>>     at
>>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>>>>     at
>>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>>>>     at
>>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>>>>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>>>>     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>>>>     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>     at
>>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>>>>     at
>>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>>>>     at
>>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>>>>     at
>>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>>>>     at
>>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>>>>     at
>>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>>>>     at
>>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>>>>     at
>>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>>>>     at
>>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>>>>     at
>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>>>>     at
>>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>>>>     at
>>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>>>>     at
>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>>>>     at
>>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>>>>     at
>>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>>>>     at
>>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>>>>     at
>>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>>>>     at
>>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>>>>     at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>>>>     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>>>>     at
>>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>>>>     at java.lang.Thread.run(Thread.java:745)
>>>>> 
>>>>> 
>>>>> br, Chris
>>>>> 
>>>>> 
>>>>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>>> tobiassoloschenko@googlemail.com>:
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> would you be so kind and apply some more information like StackTrace
>>> of the interal server error.
>>>>>> 
>>>>>> Thanks a lot.
>>>>>> 
>>>>>> kind regards
>>>>>> 
>>>>>> Tobias.
>>>>>> 
>>>>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>>>>> Sven, I have an additional situation where I am getting an internal
>>> error. Could you help me in figuring out the problem?
>>>>>>> 
>>>>>>> Panel A senses the selection of an item from a user and adds the
>>> „sortable“ as container to the ajax target.
>>>>>>> In addition, Panel B should be added to the ajax target, using
>>> Wicket events.
>>>>>>> 
>>>>>>> The internal error is thrown when using Wicket events to add the
>>> additional panel. Without the event, just calling #target.add(sortable) it
>>> works.
>>>>>>> 
>>>>>>> Panel A
>>>>>>> *************
>>>>>>> @Override
>>>>>>> public void onSelect(AjaxRequestTarget target, List<String> items) {
>>>>>>>   sortable.onRemove(target, items.get(0));
>>>>>>>           target.add(sortable);
>>>>>>>           send(getPage(), Broadcast.BREADTH, new
>>> DeleteItem(target));
>>>>>>> }
>>>>>>> Panel B
>>>>>>> *************
>>>>>>> public class PoiListPanel extends Panel {
>>>>>>>   @Override
>>>>>>>   public void onEvent(IEvent<?> event) {
>>>>>>>                   super.onEvent(event);
>>>>>>> 
>>>>>>>                   if (event.getPayload() instanceof DeleteItem) {
>>>>>>>                   DeleteItem update = (DeleteItem)
>>> event.getPayload();
>>>>>>>                   update.getTarget().add(this);
>>>>>>> 
>>>>>>>           }
>>>>>>> 
>>>>>>> }
>>>>>>> Chris
>>>>>>> 
>>>>>>> 
>>>>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>>> christoph@ec.tuwien.ac.at>:
>>>>>>>> 
>>>>>>>> Sven - thank you. That solved it!
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>>>>> 
>>>>>>>>> Your container has to output its markup id:
>>>>>>>>> 
>>>>>>>>> container.setOutputMarkupId()
>>>>>>>>> 
>>>>>>>>> Regards
>>>>>>>>> Sven
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>>>>> Hi,
>>>>>>>>>> 
>>>>>>>>>> When the user clicks on a certain icon, a specific part of the
>>> page should be reloaded through ajax. The icon is part of a panel, the
>>> specific part is a webmarkupcontainer added directly to the page. I am
>>> using Wicket Events to push the click event. However, when adding the web
>>> markup container as target, I am getting an internal error.
>>>>>>>>>> 
>>>>>>>>>> -> update.getTarget().add(container);
>>>>>>>>>> 
>>>>>>>>>> Can someone help me to fix this?
>>>>>>>>>> 
>>>>>>>>>> *********************
>>>>>>>>>> ***** PANEL *****
>>>>>>>>>> final WebMarkupContainer suitcaseIcon = new
>>> WebMarkupContainer("icon");
>>>>>>>>>> icon.setOutputMarkupId(true);
>>>>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>>>>>        protected void onEvent(AjaxRequestTarget target) {
>>>>>>>>>>                send(getPage(), Broadcast.BREADTH, new
>>> AddItem(target));
>>>>>>>>>>        }
>>>>>>>>>> });
>>>>>>>>>> 
>>>>>>>>>> *********************
>>>>>>>>>> ***** PAGE *****
>>>>>>>>>> ...
>>>>>>>>>> WebMarkupContainer container;
>>>>>>>>>> public HomePage() {
>>>>>>>>>>        container = new WebMarkupContainer("container");
>>>>>>>>>>        add(container);
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> @Override
>>>>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>>>>>        super.onEvent(event);
>>>>>>>>>>        if (event.getPayload() instanceof AddItem) {
>>>>>>>>>>        AddItem update = (AddItem) event.getPayload();
>>>>>>>>>>        update.getTarget().add(container);
>>>>>>>>>>   }
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> *********************
>>>>>>>>>> ***** AddItem *****
>>>>>>>>>> public class AddItem {
>>>>>>>>>>   private final AjaxRequestTarget target;
>>>>>>>>>> 
>>>>>>>>>>   public AddItem(AjaxRequestTarget target) {
>>>>>>>>>>       this.target = target;
>>>>>>>>>>   }
>>>>>>>>>> 
>>>>>>>>>>   public AjaxRequestTarget getTarget() {
>>>>>>>>>>       return target;
>>>>>>>>>>   }
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> Thanks.
>>>>>>>>>> Chris
>>>>>>>>> 
>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>> 
>>>>>>>> 
>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> 
>> 


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

Posted by Sebastien <se...@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 <se...@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 <ch...@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 <sv...@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
>> 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(AbstractDefaultAjaxBehavior.java:633)
>> >>      at java.lang.reflect.Method.invoke(Method.java:483)
>> >>      at
>> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>> >>      at
>> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>> >>      at
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>> >>      at
>> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>> >>      at
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>> >>      at
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>> >>      at
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>> >>      at
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>> >>      at
>> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>> >>      at
>> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>> >>      at
>> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>> >>      at
>> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>> >>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>> >>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>> >>      at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>> >>      at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >>      at
>> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>> >>      at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>> >>      at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> >>      at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>> >>      at
>> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>> >>      at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>> >>      at
>> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>> >>      at
>> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>> >>      at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>> >>      at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>> >>      at
>> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>> >>      at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>> >>      at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>> >>      at
>> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>> >>      at
>> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>> >>      at
>> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>> >>      at
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>> >>      at
>> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>> >>      at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>> >>      at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>> >>      at
>> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>> >>      at java.lang.Thread.run(Thread.java:745)
>> >>
>> >>
>> >> br, Chris
>> >>
>> >>
>> >>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
>> tobiassoloschenko@googlemail.com>:
>> >>>
>> >>> Hi,
>> >>>
>> >>> would you be so kind and apply some more information like StackTrace
>> of the interal server error.
>> >>>
>> >>> Thanks a lot.
>> >>>
>> >>> kind regards
>> >>>
>> >>> Tobias.
>> >>>
>> >>> Am 04.02.15 um 20:05 schrieb Chris:
>> >>>> Sven, I have an additional situation where I am getting an internal
>> error. Could you help me in figuring out the problem?
>> >>>>
>> >>>> Panel A senses the selection of an item from a user and adds the
>> „sortable“ as container to the ajax target.
>> >>>> In addition, Panel B should be added to the ajax target, using
>> Wicket events.
>> >>>>
>> >>>> The internal error is thrown when using Wicket events to add the
>> additional panel. Without the event, just calling #target.add(sortable) it
>> works.
>> >>>>
>> >>>> Panel A
>> >>>> *************
>> >>>> @Override
>> >>>> public void onSelect(AjaxRequestTarget target, List<String> items) {
>> >>>>    sortable.onRemove(target, items.get(0));
>> >>>>            target.add(sortable);
>> >>>>            send(getPage(), Broadcast.BREADTH, new
>> DeleteItem(target));
>> >>>> }
>> >>>> Panel B
>> >>>> *************
>> >>>> public class PoiListPanel extends Panel {
>> >>>>    @Override
>> >>>>    public void onEvent(IEvent<?> event) {
>> >>>>                    super.onEvent(event);
>> >>>>
>> >>>>                    if (event.getPayload() instanceof DeleteItem) {
>> >>>>                    DeleteItem update = (DeleteItem)
>> event.getPayload();
>> >>>>                    update.getTarget().add(this);
>> >>>>
>> >>>>            }
>> >>>>
>> >>>> }
>> >>>> Chris
>> >>>>
>> >>>>
>> >>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
>> christoph@ec.tuwien.ac.at>:
>> >>>>>
>> >>>>> Sven - thank you. That solved it!
>> >>>>>
>> >>>>>
>> >>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>> >>>>>>
>> >>>>>> Your container has to output its markup id:
>> >>>>>>
>> >>>>>>  container.setOutputMarkupId()
>> >>>>>>
>> >>>>>> Regards
>> >>>>>> Sven
>> >>>>>>
>> >>>>>>
>> >>>>>> On 04.02.2015 14:11, Chris wrote:
>> >>>>>>> Hi,
>> >>>>>>>
>> >>>>>>> When the user clicks on a certain icon, a specific part of the
>> page should be reloaded through ajax. The icon is part of a panel, the
>> specific part is a webmarkupcontainer added directly to the page. I am
>> using Wicket Events to push the click event. However, when adding the web
>> markup container as target, I am getting an internal error.
>> >>>>>>>
>> >>>>>>> -> update.getTarget().add(container);
>> >>>>>>>
>> >>>>>>> Can someone help me to fix this?
>> >>>>>>>
>> >>>>>>> *********************
>> >>>>>>> ***** PANEL *****
>> >>>>>>> final WebMarkupContainer suitcaseIcon = new
>> WebMarkupContainer("icon");
>> >>>>>>> icon.setOutputMarkupId(true);
>> >>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>> >>>>>>>         protected void onEvent(AjaxRequestTarget target) {
>> >>>>>>>                 send(getPage(), Broadcast.BREADTH, new
>> AddItem(target));
>> >>>>>>>         }
>> >>>>>>> });
>> >>>>>>>
>> >>>>>>> *********************
>> >>>>>>> ***** PAGE *****
>> >>>>>>> ...
>> >>>>>>> WebMarkupContainer container;
>> >>>>>>> public HomePage() {
>> >>>>>>>         container = new WebMarkupContainer("container");
>> >>>>>>>         add(container);
>> >>>>>>> }
>> >>>>>>>
>> >>>>>>> @Override
>> >>>>>>> public void onEvent(IEvent<?> event) {
>> >>>>>>>         super.onEvent(event);
>> >>>>>>>         if (event.getPayload() instanceof AddItem) {
>> >>>>>>>         AddItem update = (AddItem) event.getPayload();
>> >>>>>>>         update.getTarget().add(container);
>> >>>>>>>    }
>> >>>>>>> }
>> >>>>>>>
>> >>>>>>> *********************
>> >>>>>>> ***** AddItem *****
>> >>>>>>> public class AddItem {
>> >>>>>>>    private final AjaxRequestTarget target;
>> >>>>>>>
>> >>>>>>>    public AddItem(AjaxRequestTarget target) {
>> >>>>>>>        this.target = target;
>> >>>>>>>    }
>> >>>>>>>
>> >>>>>>>    public AjaxRequestTarget getTarget() {
>> >>>>>>>        return target;
>> >>>>>>>    }
>> >>>>>>> }
>> >>>>>>>
>> >>>>>>> Thanks.
>> >>>>>>> Chris
>> >>>>>>
>> ---------------------------------------------------------------------
>> >>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>> >>>>>>
>> >>>>>
>> ---------------------------------------------------------------------
>> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
>> >>>>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >>> For additional commands, e-mail: users-help@wicket.apache.org
>> >>>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>>
>>
>

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

Posted by Sebastien <se...@gmail.com>.
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 <ch...@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 <sv...@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
> 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(AbstractDefaultAjaxBehavior.java:633)
> >>      at java.lang.reflect.Method.invoke(Method.java:483)
> >>      at
> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
> >>      at
> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
> >>      at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
> >>      at
> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
> >>      at
> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
> >>      at
> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
> >>      at
> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
> >>      at
> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
> >>      at
> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
> >>      at
> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
> >>      at
> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
> >>      at
> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
> >>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
> >>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
> >>      at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
> >>      at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>      at
> org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>      at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
> >>      at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> >>      at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
> >>      at
> org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
> >>      at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
> >>      at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
> >>      at
> org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
> >>      at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
> >>      at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
> >>      at
> org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
> >>      at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
> >>      at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
> >>      at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
> >>      at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
> >>      at
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
> >>      at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
> >>      at
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
> >>      at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> >>      at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> >>      at
> org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
> >>      at java.lang.Thread.run(Thread.java:745)
> >>
> >>
> >> br, Chris
> >>
> >>
> >>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <
> tobiassoloschenko@googlemail.com>:
> >>>
> >>> Hi,
> >>>
> >>> would you be so kind and apply some more information like StackTrace
> of the interal server error.
> >>>
> >>> Thanks a lot.
> >>>
> >>> kind regards
> >>>
> >>> Tobias.
> >>>
> >>> Am 04.02.15 um 20:05 schrieb Chris:
> >>>> Sven, I have an additional situation where I am getting an internal
> error. Could you help me in figuring out the problem?
> >>>>
> >>>> Panel A senses the selection of an item from a user and adds the
> „sortable“ as container to the ajax target.
> >>>> In addition, Panel B should be added to the ajax target, using Wicket
> events.
> >>>>
> >>>> The internal error is thrown when using Wicket events to add the
> additional panel. Without the event, just calling #target.add(sortable) it
> works.
> >>>>
> >>>> Panel A
> >>>> *************
> >>>> @Override
> >>>> public void onSelect(AjaxRequestTarget target, List<String> items) {
> >>>>    sortable.onRemove(target, items.get(0));
> >>>>            target.add(sortable);
> >>>>            send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
> >>>> }
> >>>> Panel B
> >>>> *************
> >>>> public class PoiListPanel extends Panel {
> >>>>    @Override
> >>>>    public void onEvent(IEvent<?> event) {
> >>>>                    super.onEvent(event);
> >>>>
> >>>>                    if (event.getPayload() instanceof DeleteItem) {
> >>>>                    DeleteItem update = (DeleteItem)
> event.getPayload();
> >>>>                    update.getTarget().add(this);
> >>>>
> >>>>            }
> >>>>
> >>>> }
> >>>> Chris
> >>>>
> >>>>
> >>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <
> christoph@ec.tuwien.ac.at>:
> >>>>>
> >>>>> Sven - thank you. That solved it!
> >>>>>
> >>>>>
> >>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
> >>>>>>
> >>>>>> Your container has to output its markup id:
> >>>>>>
> >>>>>>  container.setOutputMarkupId()
> >>>>>>
> >>>>>> Regards
> >>>>>> Sven
> >>>>>>
> >>>>>>
> >>>>>> On 04.02.2015 14:11, Chris wrote:
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> When the user clicks on a certain icon, a specific part of the
> page should be reloaded through ajax. The icon is part of a panel, the
> specific part is a webmarkupcontainer added directly to the page. I am
> using Wicket Events to push the click event. However, when adding the web
> markup container as target, I am getting an internal error.
> >>>>>>>
> >>>>>>> -> update.getTarget().add(container);
> >>>>>>>
> >>>>>>> Can someone help me to fix this?
> >>>>>>>
> >>>>>>> *********************
> >>>>>>> ***** PANEL *****
> >>>>>>> final WebMarkupContainer suitcaseIcon = new
> WebMarkupContainer("icon");
> >>>>>>> icon.setOutputMarkupId(true);
> >>>>>>> icon.add(new AjaxEventBehavior("onclick") {
> >>>>>>>         protected void onEvent(AjaxRequestTarget target) {
> >>>>>>>                 send(getPage(), Broadcast.BREADTH, new
> AddItem(target));
> >>>>>>>         }
> >>>>>>> });
> >>>>>>>
> >>>>>>> *********************
> >>>>>>> ***** PAGE *****
> >>>>>>> ...
> >>>>>>> WebMarkupContainer container;
> >>>>>>> public HomePage() {
> >>>>>>>         container = new WebMarkupContainer("container");
> >>>>>>>         add(container);
> >>>>>>> }
> >>>>>>>
> >>>>>>> @Override
> >>>>>>> public void onEvent(IEvent<?> event) {
> >>>>>>>         super.onEvent(event);
> >>>>>>>         if (event.getPayload() instanceof AddItem) {
> >>>>>>>         AddItem update = (AddItem) event.getPayload();
> >>>>>>>         update.getTarget().add(container);
> >>>>>>>    }
> >>>>>>> }
> >>>>>>>
> >>>>>>> *********************
> >>>>>>> ***** AddItem *****
> >>>>>>> public class AddItem {
> >>>>>>>    private final AjaxRequestTarget target;
> >>>>>>>
> >>>>>>>    public AddItem(AjaxRequestTarget target) {
> >>>>>>>        this.target = target;
> >>>>>>>    }
> >>>>>>>
> >>>>>>>    public AjaxRequestTarget getTarget() {
> >>>>>>>        return target;
> >>>>>>>    }
> >>>>>>> }
> >>>>>>>
> >>>>>>> Thanks.
> >>>>>>> Chris
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>>
> >>>>> ---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>

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

Posted by Chris <ch...@gmx.at>.
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 <sv...@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 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(AbstractDefaultAjaxBehavior.java:633)
>>      at java.lang.reflect.Method.invoke(Method.java:483)
>>      at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>>      at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>>      at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>>      at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>>      at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>>      at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>>      at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>>      at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>>      at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>>      at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>>      at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>>      at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>>      at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>>      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>>      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>>      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>>      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>>      at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>>      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>>      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>>      at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>>      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>>      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>>      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>>      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>>      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>>      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>>      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>>      at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>>      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>>      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>>      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>>      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>>      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>>      at java.lang.Thread.run(Thread.java:745)
>> 
>> 
>> br, Chris
>> 
>> 
>>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <to...@googlemail.com>:
>>> 
>>> Hi,
>>> 
>>> would you be so kind and apply some more information like StackTrace of the interal server error.
>>> 
>>> Thanks a lot.
>>> 
>>> kind regards
>>> 
>>> Tobias.
>>> 
>>> Am 04.02.15 um 20:05 schrieb Chris:
>>>> Sven, I have an additional situation where I am getting an internal error. Could you help me in figuring out the problem?
>>>> 
>>>> Panel A senses the selection of an item from a user and adds the „sortable“ as container to the ajax target.
>>>> In addition, Panel B should be added to the ajax target, using Wicket events.
>>>> 
>>>> The internal error is thrown when using Wicket events to add the additional panel. Without the event, just calling #target.add(sortable) it works.
>>>> 
>>>> Panel A
>>>> *************
>>>> @Override
>>>> public void onSelect(AjaxRequestTarget target, List<String> items) {
>>>> 	sortable.onRemove(target, items.get(0));
>>>>     	target.add(sortable);
>>>>     	send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
>>>> }
>>>> Panel B
>>>> *************
>>>> public class PoiListPanel extends Panel {
>>>> 	@Override
>>>> 	public void onEvent(IEvent<?> event) {
>>>>     		super.onEvent(event);
>>>> 
>>>>     		if (event.getPayload() instanceof DeleteItem) {
>>>>         		DeleteItem update = (DeleteItem) event.getPayload();
>>>>         		update.getTarget().add(this);
>>>> 
>>>>     	}	
>>>> 
>>>> }
>>>> Chris
>>>> 
>>>> 
>>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <ch...@ec.tuwien.ac.at>:
>>>>> 
>>>>> Sven - thank you. That solved it!
>>>>> 
>>>>> 
>>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>> 
>>>>>> Your container has to output its markup id:
>>>>>> 
>>>>>> 	container.setOutputMarkupId()
>>>>>> 
>>>>>> Regards
>>>>>> Sven
>>>>>> 
>>>>>> 
>>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>>>>>>> 
>>>>>>> -> update.getTarget().add(container);
>>>>>>> 
>>>>>>> Can someone help me to fix this?
>>>>>>> 
>>>>>>> *********************
>>>>>>> ***** PANEL *****
>>>>>>> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
>>>>>>> icon.setOutputMarkupId(true);
>>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>>> 	protected void onEvent(AjaxRequestTarget target) {
>>>>>>> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>>>>>>>  	}
>>>>>>> });
>>>>>>> 
>>>>>>> *********************
>>>>>>> ***** PAGE *****
>>>>>>> ...
>>>>>>> WebMarkupContainer container;
>>>>>>> public HomePage() {
>>>>>>> 	container = new WebMarkupContainer("container");
>>>>>>> 	add(container);
>>>>>>> }
>>>>>>> 
>>>>>>> @Override
>>>>>>> public void onEvent(IEvent<?> event) {
>>>>>>> 	super.onEvent(event);
>>>>>>> 	if (event.getPayload() instanceof AddItem) {
>>>>>>>    	AddItem update = (AddItem) event.getPayload();
>>>>>>>    	update.getTarget().add(container);
>>>>>>>    }
>>>>>>> }
>>>>>>> 
>>>>>>> *********************
>>>>>>> ***** AddItem *****
>>>>>>> public class AddItem {
>>>>>>>    private final AjaxRequestTarget target;
>>>>>>> 
>>>>>>>    public AddItem(AjaxRequestTarget target) {
>>>>>>>        this.target = target;
>>>>>>>    }
>>>>>>> 
>>>>>>>    public AjaxRequestTarget getTarget() {
>>>>>>>        return target;
>>>>>>>    }
>>>>>>> }
>>>>>>> 
>>>>>>> Thanks.
>>>>>>> Chris
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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

Posted by Sven Meier <sv...@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 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(AbstractDefaultAjaxBehavior.java:633)
>       at java.lang.reflect.Method.invoke(Method.java:483)
>       at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
>       at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
>       at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
>       at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
>       at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
>       at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>       at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
>       at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
>       at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
>       at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
>       at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
>       at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
>       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
>       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
>       at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
>       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
>       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
>       at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
>       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
>       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
>       at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
>       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
>       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
>       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
>       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
>       at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
>       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
>       at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
>       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>       at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
>       at java.lang.Thread.run(Thread.java:745)
>
>
> br, Chris
>
>
>> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <to...@googlemail.com>:
>>
>> Hi,
>>
>> would you be so kind and apply some more information like StackTrace of the interal server error.
>>
>> Thanks a lot.
>>
>> kind regards
>>
>> Tobias.
>>
>> Am 04.02.15 um 20:05 schrieb Chris:
>>> Sven, I have an additional situation where I am getting an internal error. Could you help me in figuring out the problem?
>>>
>>> Panel A senses the selection of an item from a user and adds the „sortable“ as container to the ajax target.
>>> In addition, Panel B should be added to the ajax target, using Wicket events.
>>>
>>> The internal error is thrown when using Wicket events to add the additional panel. Without the event, just calling #target.add(sortable) it works.
>>>
>>> Panel A
>>> *************
>>> @Override
>>> public void onSelect(AjaxRequestTarget target, List<String> items) {
>>> 	sortable.onRemove(target, items.get(0));
>>>      	target.add(sortable);
>>>      	send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
>>> }
>>> Panel B
>>> *************
>>> public class PoiListPanel extends Panel {
>>> 	@Override
>>> 	public void onEvent(IEvent<?> event) {
>>>      		super.onEvent(event);
>>>
>>>      		if (event.getPayload() instanceof DeleteItem) {
>>>          		DeleteItem update = (DeleteItem) event.getPayload();
>>>          		update.getTarget().add(this);
>>>
>>>      	}	
>>>
>>> }
>>> Chris
>>>
>>>
>>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <ch...@ec.tuwien.ac.at>:
>>>>
>>>> Sven - thank you. That solved it!
>>>>
>>>>
>>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>>>
>>>>> Your container has to output its markup id:
>>>>>
>>>>> 	container.setOutputMarkupId()
>>>>>
>>>>> Regards
>>>>> Sven
>>>>>
>>>>>
>>>>> On 04.02.2015 14:11, Chris wrote:
>>>>>> Hi,
>>>>>>
>>>>>> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>>>>>>
>>>>>> -> update.getTarget().add(container);
>>>>>>
>>>>>> Can someone help me to fix this?
>>>>>>
>>>>>> *********************
>>>>>> ***** PANEL *****
>>>>>> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
>>>>>> icon.setOutputMarkupId(true);
>>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>>> 	protected void onEvent(AjaxRequestTarget target) {
>>>>>> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>>>>>>   	}
>>>>>> });
>>>>>>
>>>>>> *********************
>>>>>> ***** PAGE *****
>>>>>> ...
>>>>>> WebMarkupContainer container;
>>>>>> public HomePage() {
>>>>>> 	container = new WebMarkupContainer("container");
>>>>>> 	add(container);
>>>>>> }
>>>>>>
>>>>>> @Override
>>>>>> public void onEvent(IEvent<?> event) {
>>>>>> 	super.onEvent(event);
>>>>>> 	if (event.getPayload() instanceof AddItem) {
>>>>>>     	AddItem update = (AddItem) event.getPayload();
>>>>>>     	update.getTarget().add(container);
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> *********************
>>>>>> ***** AddItem *****
>>>>>> public class AddItem {
>>>>>>     private final AjaxRequestTarget target;
>>>>>>
>>>>>>     public AddItem(AjaxRequestTarget target) {
>>>>>>         this.target = target;
>>>>>>     }
>>>>>>
>>>>>>     public AjaxRequestTarget getTarget() {
>>>>>>         return target;
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> Thanks.
>>>>>> Chris
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>


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


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

Posted by Chris <ch...@gmx.at>.
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(AbstractDefaultAjaxBehavior.java:633)
     at java.lang.reflect.Method.invoke(Method.java:483)
     at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
     at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
     at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:250)
     at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
     at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
     at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
     at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
     at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
     at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
     at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
     at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
     at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:618)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
     at org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:106)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java)
     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
     at org.apache.catalina.core.StandardHostValve.__invoke(StandardHostValve.java:142)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
     at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
     at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
     at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
     at java.lang.Thread.run(Thread.java:745)


br, Chris


> Am 04.02.2015 um 20:09 schrieb Tobias Soloschenko <to...@googlemail.com>:
> 
> Hi,
> 
> would you be so kind and apply some more information like StackTrace of the interal server error.
> 
> Thanks a lot.
> 
> kind regards
> 
> Tobias.
> 
> Am 04.02.15 um 20:05 schrieb Chris:
>> Sven, I have an additional situation where I am getting an internal error. Could you help me in figuring out the problem?
>> 
>> Panel A senses the selection of an item from a user and adds the „sortable“ as container to the ajax target.
>> In addition, Panel B should be added to the ajax target, using Wicket events.
>> 
>> The internal error is thrown when using Wicket events to add the additional panel. Without the event, just calling #target.add(sortable) it works.
>> 
>> Panel A
>> *************
>> @Override
>> public void onSelect(AjaxRequestTarget target, List<String> items) {
>> 	sortable.onRemove(target, items.get(0));
>>     	target.add(sortable);
>>     	send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
>> }
>> Panel B
>> *************
>> public class PoiListPanel extends Panel {
>> 	@Override
>> 	public void onEvent(IEvent<?> event) {
>>     		super.onEvent(event);
>> 
>>     		if (event.getPayload() instanceof DeleteItem) {
>>         		DeleteItem update = (DeleteItem) event.getPayload();
>>         		update.getTarget().add(this);
>> 
>>     	}	
>> 
>> }
>> Chris
>> 
>> 
>>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <ch...@ec.tuwien.ac.at>:
>>> 
>>> Sven - thank you. That solved it!
>>> 
>>> 
>>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>> 
>>>> Your container has to output its markup id:
>>>> 
>>>> 	container.setOutputMarkupId()
>>>> 
>>>> Regards
>>>> Sven
>>>> 
>>>> 
>>>> On 04.02.2015 14:11, Chris wrote:
>>>>> Hi,
>>>>> 
>>>>> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>>>>> 
>>>>> -> update.getTarget().add(container);
>>>>> 
>>>>> Can someone help me to fix this?
>>>>> 
>>>>> *********************
>>>>> ***** PANEL *****
>>>>> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
>>>>> icon.setOutputMarkupId(true);
>>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>>> 	protected void onEvent(AjaxRequestTarget target) {
>>>>> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>>>>>  	}
>>>>> });
>>>>> 
>>>>> *********************
>>>>> ***** PAGE *****
>>>>> ...
>>>>> WebMarkupContainer container;
>>>>> public HomePage() {
>>>>> 	container = new WebMarkupContainer("container");
>>>>> 	add(container);
>>>>> }
>>>>> 
>>>>> @Override
>>>>> public void onEvent(IEvent<?> event) {
>>>>> 	super.onEvent(event);
>>>>> 	if (event.getPayload() instanceof AddItem) {
>>>>>    	AddItem update = (AddItem) event.getPayload();
>>>>>    	update.getTarget().add(container);
>>>>>    }
>>>>> }
>>>>> 
>>>>> *********************
>>>>> ***** AddItem *****
>>>>> public class AddItem {
>>>>>    private final AjaxRequestTarget target;
>>>>> 
>>>>>    public AddItem(AjaxRequestTarget target) {
>>>>>        this.target = target;
>>>>>    }
>>>>> 
>>>>>    public AjaxRequestTarget getTarget() {
>>>>>        return target;
>>>>>    }
>>>>> }
>>>>> 
>>>>> Thanks.
>>>>> Chris
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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

Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi,

would you be so kind and apply some more information like StackTrace of 
the interal server error.

Thanks a lot.

kind regards

Tobias.

Am 04.02.15 um 20:05 schrieb Chris:
> Sven, I have an additional situation where I am getting an internal error. Could you help me in figuring out the problem?
>
> Panel A senses the selection of an item from a user and adds the „sortable“ as container to the ajax target.
> In addition, Panel B should be added to the ajax target, using Wicket events.
>
> The internal error is thrown when using Wicket events to add the additional panel. Without the event, just calling #target.add(sortable) it works.
>
> Panel A
> *************
> @Override
> public void onSelect(AjaxRequestTarget target, List<String> items) {
> 	sortable.onRemove(target, items.get(0));
>      	target.add(sortable);
>      	send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
> }
> Panel B
> *************
> public class PoiListPanel extends Panel {
> 	@Override
> 	public void onEvent(IEvent<?> event) {
>      		super.onEvent(event);
>
>      		if (event.getPayload() instanceof DeleteItem) {
>          		DeleteItem update = (DeleteItem) event.getPayload();
>          		update.getTarget().add(this);
>
>      	}	
>
> }
> Chris
>
>
>> Am 04.02.2015 um 14:32 schrieb Grün Christoph <ch...@ec.tuwien.ac.at>:
>>
>> Sven - thank you. That solved it!
>>
>>
>>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>>>
>>> Your container has to output its markup id:
>>>
>>> 	container.setOutputMarkupId()
>>>
>>> Regards
>>> Sven
>>>
>>>
>>> On 04.02.2015 14:11, Chris wrote:
>>>> Hi,
>>>>
>>>> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>>>>
>>>> -> update.getTarget().add(container);
>>>>
>>>> Can someone help me to fix this?
>>>>
>>>> *********************
>>>> ***** PANEL *****
>>>> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
>>>> icon.setOutputMarkupId(true);
>>>> icon.add(new AjaxEventBehavior("onclick") {
>>>> 	protected void onEvent(AjaxRequestTarget target) {
>>>> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>>>>   	}
>>>> });
>>>>
>>>> *********************
>>>> ***** PAGE *****
>>>> ...
>>>> WebMarkupContainer container;
>>>> public HomePage() {
>>>> 	container = new WebMarkupContainer("container");
>>>> 	add(container);
>>>> }
>>>>
>>>> @Override
>>>> public void onEvent(IEvent<?> event) {
>>>> 	super.onEvent(event);
>>>> 	if (event.getPayload() instanceof AddItem) {
>>>>     	AddItem update = (AddItem) event.getPayload();
>>>>     	update.getTarget().add(container);
>>>>     }
>>>> }
>>>>
>>>> *********************
>>>> ***** AddItem *****
>>>> public class AddItem {
>>>>     private final AjaxRequestTarget target;
>>>>
>>>>     public AddItem(AjaxRequestTarget target) {
>>>>         this.target = target;
>>>>     }
>>>>
>>>>     public AjaxRequestTarget getTarget() {
>>>>         return target;
>>>>     }
>>>> }
>>>>
>>>> Thanks.
>>>> Chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>


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


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

Posted by Chris <ch...@gmx.at>.
Sven, I have an additional situation where I am getting an internal error. Could you help me in figuring out the problem?

Panel A senses the selection of an item from a user and adds the „sortable“ as container to the ajax target.
In addition, Panel B should be added to the ajax target, using Wicket events.

The internal error is thrown when using Wicket events to add the additional panel. Without the event, just calling #target.add(sortable) it works.

Panel A
*************
@Override
public void onSelect(AjaxRequestTarget target, List<String> items) {
	sortable.onRemove(target, items.get(0));
    	target.add(sortable);
    	send(getPage(), Broadcast.BREADTH, new DeleteItem(target));
}
Panel B
*************
public class PoiListPanel extends Panel {
	@Override
	public void onEvent(IEvent<?> event) {
    		super.onEvent(event);

    		if (event.getPayload() instanceof DeleteItem) {
        		DeleteItem update = (DeleteItem) event.getPayload();
        		update.getTarget().add(this);

    	}	

}
Chris


> Am 04.02.2015 um 14:32 schrieb Grün Christoph <ch...@ec.tuwien.ac.at>:
> 
> Sven - thank you. That solved it!
> 
> 
>> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
>> 
>> Your container has to output its markup id:
>> 
>> 	container.setOutputMarkupId()
>> 
>> Regards
>> Sven
>> 
>> 
>> On 04.02.2015 14:11, Chris wrote:
>>> Hi,
>>> 
>>> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>>> 
>>> -> update.getTarget().add(container);
>>> 
>>> Can someone help me to fix this?
>>> 
>>> *********************
>>> ***** PANEL *****
>>> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
>>> icon.setOutputMarkupId(true);
>>> icon.add(new AjaxEventBehavior("onclick") {
>>> 	protected void onEvent(AjaxRequestTarget target) {
>>> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>>>  	}
>>> });
>>> 
>>> *********************
>>> ***** PAGE *****
>>> ...
>>> WebMarkupContainer container;
>>> public HomePage() {
>>> 	container = new WebMarkupContainer("container");
>>> 	add(container);
>>> }
>>> 
>>> @Override
>>> public void onEvent(IEvent<?> event) {
>>> 	super.onEvent(event);
>>> 	if (event.getPayload() instanceof AddItem) {
>>>    	AddItem update = (AddItem) event.getPayload();
>>>    	update.getTarget().add(container);
>>>    }
>>> }
>>> 
>>> *********************
>>> ***** AddItem *****
>>> public class AddItem {
>>>    private final AjaxRequestTarget target;
>>> 
>>>    public AddItem(AjaxRequestTarget target) {
>>>        this.target = target;
>>>    }
>>> 
>>>    public AjaxRequestTarget getTarget() {
>>>        return target;
>>>    }
>>> }
>>> 
>>> Thanks.
>>> Chris
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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

Posted by Grün Christoph <ch...@ec.tuwien.ac.at>.
Sven - thank you. That solved it!


> Am 04.02.2015 um 14:14 schrieb Sven Meier <sv...@meiers.net>:
> 
> Your container has to output its markup id:
> 
> 	container.setOutputMarkupId()
> 
> Regards
> Sven
> 
> 
> On 04.02.2015 14:11, Chris wrote:
>> Hi,
>> 
>> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>> 
>> -> update.getTarget().add(container);
>> 
>> Can someone help me to fix this?
>> 
>> *********************
>> ***** PANEL *****
>> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
>> icon.setOutputMarkupId(true);
>> icon.add(new AjaxEventBehavior("onclick") {
>> 	protected void onEvent(AjaxRequestTarget target) {
>> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>>   	}
>> });
>> 
>> *********************
>> ***** PAGE *****
>> ...
>> WebMarkupContainer container;
>> public HomePage() {
>> 	container = new WebMarkupContainer("container");
>> 	add(container);
>> }
>> 
>> @Override
>> public void onEvent(IEvent<?> event) {
>> 	super.onEvent(event);
>> 	if (event.getPayload() instanceof AddItem) {
>>     	AddItem update = (AddItem) event.getPayload();
>>     	update.getTarget().add(container);
>>     }
>> }
>> 
>> *********************
>> ***** AddItem *****
>> public class AddItem {
>>     private final AjaxRequestTarget target;
>> 
>>     public AddItem(AjaxRequestTarget target) {
>>         this.target = target;
>>     }
>> 
>>     public AjaxRequestTarget getTarget() {
>>         return target;
>>     }
>> }
>> 
>> Thanks.
>> Chris
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 


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


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

Posted by Sven Meier <sv...@meiers.net>.
Your container has to output its markup id:

	container.setOutputMarkupId()

Regards
Sven


On 04.02.2015 14:11, Chris wrote:
> Hi,
>
> When the user clicks on a certain icon, a specific part of the page should be reloaded through ajax. The icon is part of a panel, the specific part is a webmarkupcontainer added directly to the page. I am using Wicket Events to push the click event. However, when adding the web markup container as target, I am getting an internal error.
>
> -> update.getTarget().add(container);
>
> Can someone help me to fix this?
>
> *********************
> ***** PANEL *****
> final WebMarkupContainer suitcaseIcon = new WebMarkupContainer("icon");
> icon.setOutputMarkupId(true);
> icon.add(new AjaxEventBehavior("onclick") {
> 	protected void onEvent(AjaxRequestTarget target) {
> 		send(getPage(), Broadcast.BREADTH, new AddItem(target));
>    	}
> });
>
> *********************
> ***** PAGE *****
> ...
> WebMarkupContainer container;
> public HomePage() {
> 	container = new WebMarkupContainer("container");
> 	add(container);
> }
>
> @Override
> public void onEvent(IEvent<?> event) {
> 	super.onEvent(event);
> 	if (event.getPayload() instanceof AddItem) {
>      	AddItem update = (AddItem) event.getPayload();
>      	update.getTarget().add(container);
>      }
> }
>
> *********************
> ***** AddItem *****
> public class AddItem {
>      private final AjaxRequestTarget target;
>
>      public AddItem(AjaxRequestTarget target) {
>          this.target = target;
>      }
>
>      public AjaxRequestTarget getTarget() {
>          return target;
>      }
> }
>
> Thanks.
> Chris


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