1 Reply Latest reply on Dec 10, 2012 3:47 PM by Eric Wittmann

    Idea: Transition hyperlinks/anchors (errai navigation)

    Eric Wittmann Apprentice

      I was thinking that a nice feature to have in the navigation framework would be a way to have a Transition based hyperlink or anchor.  The reason that would be nice is to be able to easily create links in pages that would be populated with the right history token and thus would support "open in new tab".

       

      Currently I can do this:

       

        @Inject

        TransitionTo<BrowsePage> toBrowsePage;

       

        @Inject

        @DataField("navBrowse")

        private Anchor navBrowse;

       

        @EventHandler("navBrowse")

        public void onNavBrowseClicked(ClickEvent event) {

          toBrowsePage.go();

          event.preventDefault();

        }

       

      That's pretty good, but if I want to support "open in new tab" then I need to add something that will update the Anchor's href with a history token.  Not the end of the world, but wouldn't this be cool?

       

        @Inject

        @DataField("navBrowse")

        @Transition(BrowsePage.class)

        private Anchor navBrowse;

      Now I just have to annotate my Anchor (or Hyperlink?) with @Transition so that the navigation boilerplate stuff can be taken care of.  Ideally the anchor's href would just be set to the proper history token.  If that can't be done, then we could inject the navigation code instead.

       

      Thoughts?