On Wed, Apr 24, 2013 at 10:43 AM, Per Newgro <per.new...@gmx.ch> wrote:

> Thank you so much Martin. Adding the script seems to be the soultion. At
> least it works now as i expect it :-).
>
> I would say yes to your question. I don't know if it bubbles up. But in
> the requestcycle the requestedUri is always the event listener one.
>
> I've added a test, but that is green :-(
> <code>
>         @Test
>         public void
> shouldPrioritizeBookmarkableLinkClickOverClickableDiv() {
>                 tester.startPage(Page.class);
>                 tester.clickLink("outer:inner");
>                 tester.assertRenderedPage(OtherPage.class);
>         }
> </code>
>

The problem is JavaScript related. WicketTester doesn't support JavaScript.


>
> Thanks
> Per
>
> > Gesendet: Mittwoch, 24. April 2013 um 09:19 Uhr
> > Von: "Martin Grigorov" <mgrigo...@apache.org>
> > An: "users@wicket.apache.org" <users@wicket.apache.org>
> > Betreff: Re: Can i control event execution order?
> >
> > Hi,
> >
> > Are you saying that the event of clicking the bookmarkable link (the <a>)
> > bubbles to the <div> ?
> > I think it should not happen. Clicking the link changes the document
> > location... But I may be wrong.
> >
> > A simple solution is to add onclick="Wicket.Event.stop(event); return
> > true;" to the <a> element.
> > This calls event.stopPropagation().
> >
> >
> > On Wed, Apr 24, 2013 at 10:03 AM, Per Newgro <per.new...@gmx.ch> wrote:
> >
> > > Hi,
> > >
> > > i would like to add a bookmarkable page link to a clickable div.
> > > But the event behavior of the div is always executed. Is there a
> > > way to prioritize the event coming from the link?
> > >
> > > Thanks
> > > Per
> > >
> > > <code>
> > > Page.java
> > > public class Page extends WebPage {
> > >     public Page(final PageParameters parameters) {
> > >         super(parameters);
> > >
> > >         final Label marker;
> > >         add(marker = new Label("marker", new Model<String>()));
> > >         marker.setOutputMarkupId(true);
> > >
> > >         WebMarkupContainer outer;
> > >         add(outer = (WebMarkupContainer) new
> > > WebMarkupContainer("outer").add(new AjaxEventBehavior("onclick") {
> > >
> > >             @Override
> > >             protected void onEvent(AjaxRequestTarget target) {
> > >                 marker.setDefaultModelObject("outer at " +
> > > System.currentTimeMillis());
> > >                 target.add(marker);
> > >             }
> > >         }));
> > >
> > >         BookmarkablePageLink<Void> inner;
> > >         outer.add(inner = new BookmarkablePageLink<Void>("inner",
> > > OtherPage.class));
> > >     }
> > > }
> > >
> > > Page.html
> > >         <div>
> > >             <span wicket:id="marker">Present the event</span>
> > >             <div wicket:id="outer">
> > >                 <a wicket:id="inner">Click</a>
> > >             </div>
> > >         </div>
> > > </code>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to