Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Best practice: Navigation Bar handling

    Hi Isomorphic,

    I'm refactoring an old colleague's mobile code that uses NavigationBar.
    It has a ton of click handlers with
    Code:
    if(event.getDirection().equals(NavigationDirection.BACK)
      && navBar.getLeftButtonTitle().equals(I18nEdited.directAllocationOneRowMobile()))
    or similar in the onNavigationClick().

    This does not seem right to me. Am I really supposed to find out the current state of the navigation bar like this?
    Also, is there no auto-mechanism for back-clicks? Do you have a best practice here and/or could make the online sample more complex?

    Another question:
    The current code adds a lot of NavigationClickHandlers to the NavigationBar. Only one of those "if" then is true and does actually do something.
    But is this correct usage? Am I allowed to have multiple ClickHandlers on an widget like this?

    Thank you & Best regards
    Blama

    #2
    We would agree that that's not a good approach to using the NavigationBar, and certainly is not required.

    If your app doesn't fit neatly into the SplitPane pattern, which handles the NavigationBar for you, then typically, you would pair a NavigationBar with a Deck, and base your navigation on the currently visible pane in the Deck.

    We don't have something like a pre-integrated Deck and NavigationBar, but it does make sense as a future sample.

    Comment


      #3
      Hi Isomorphic,

      thanks for the fast answer.
      Yes, a Deck + NavigationBar would surly be good, it seems there is no Deck sample yet.

      Regarding my post #1, is it correct usage/allowed to have multiple ClickHandlers (here NavigationClickHandler) on an widget like this?

      Thank you & Best regards
      Blama

      Comment


        #4
        Not sure we understand the question, but you can indeed attach multiple event handlers, or just do everything in one handler; neither is a preferred practice, it just depends on the application.

        Comment


          #5
          Hi Isomorphic,

          yes, that is what I meant. Thanks.

          Best regards
          Blama

          Comment

          Working...
          X