Click
  1. Click
  2. CLK-592 Refactor Menu control
  3. CLK-405

Menu improvements - allow setting the cache strategy.

    Details

    • Type: Sub-task Sub-task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: extras
    • Labels:
      None

      Description

      Please improve the Menu Control, by allowing the user to set the chache stragety.
      Right now the cache strategy seems to be "application" (or JVM instance) only.
      This is very limiting, making the existing Menu Control useless for most user applications, thus forcing the users
      to make their own menu controls (or the hack the original one).

      Please allow setting the cache strategy also to "session", and "request" (or "page" if the page is stateful).
      (even if the default remains to "application" - the ensure the compatibility with existing applications).

      Thank you,

      Demetrios.

        Activity

        Hide
        Adrian A. added a comment -

        +1.
        Because of this "application" wide cache-ing, this control was useless for me in most Click applications .
        It might be nice for demonstration purposes, but to be really useful, it should be more flexible, e.g. having what's described in this request, plus the better role support https://issues.apache.org/click/browse/CLK-406

        Thank you,

        A.

        Show
        Adrian A. added a comment - +1. Because of this "application" wide cache-ing, this control was useless for me in most Click applications . It might be nice for demonstration purposes, but to be really useful, it should be more flexible, e.g. having what's described in this request, plus the better role support https://issues.apache.org/click/browse/CLK-406 Thank you, A.
        Hide
        Malcolm Edgar added a comment -

        I think introducing a MenuFactory concept so people can control the Menu object lifecycle themselves is the solution for this question. How we achieve this will be interesting, as this stuff sounds like a service.

        Show
        Malcolm Edgar added a comment - I think introducing a MenuFactory concept so people can control the Menu object lifecycle themselves is the solution for this question. How we achieve this will be interesting, as this stuff sounds like a service.
        Hide
        Bob Schellink added a comment -

        Haven't looked at the code yet but removing the static menu variable should make scopes easier. Perhaps different factory methods could be used:

        // Application wide scope
        public static Menu getRootMenu(ServletContext context)

        // Session scoped
        public static Menu getRootMenu(HttpSession session)

        Show
        Bob Schellink added a comment - Haven't looked at the code yet but removing the static menu variable should make scopes easier. Perhaps different factory methods could be used: // Application wide scope public static Menu getRootMenu(ServletContext context) // Session scoped public static Menu getRootMenu(HttpSession session)
        Hide
        Malcolm Edgar added a comment -

        I think we need a MenuFactory to support alternative caching strategies.

        // Application wide scope
        public static Menu getRootMenu()

        // Application wide scope
        public static Menu getRootMenu(AccessController accessController)

        // Application wide scope
        public static Menu getRootMenu(String xmlPath)

        // Application wide scope
        public static Menu getRootMenu(AccessController accessController, String xmlPath)

        // Session scoped
        public static Menu getRootMenu(HttpSession session)

        // Session scoped
        public static Menu getRootMenu(HttpSession session, AccessController accessController)

        // Session scoped
        public static Menu getRootMenu(HttpSession session, String xmlPath)

        // Session scoped
        public static Menu getRootMenu(HttpSession session, AccessController accessController, String xmlPath)

        We could refactor the existing static Menu factory methods to use the MenuFactory class static metthods.

        Show
        Malcolm Edgar added a comment - I think we need a MenuFactory to support alternative caching strategies. // Application wide scope public static Menu getRootMenu() // Application wide scope public static Menu getRootMenu(AccessController accessController) // Application wide scope public static Menu getRootMenu(String xmlPath) // Application wide scope public static Menu getRootMenu(AccessController accessController, String xmlPath) // Session scoped public static Menu getRootMenu(HttpSession session) // Session scoped public static Menu getRootMenu(HttpSession session, AccessController accessController) // Session scoped public static Menu getRootMenu(HttpSession session, String xmlPath) // Session scoped public static Menu getRootMenu(HttpSession session, AccessController accessController, String xmlPath) We could refactor the existing static Menu factory methods to use the MenuFactory class static metthods.
        Hide
        Adrian A. added a comment -

        > I think we need a MenuFactory to support alternative caching strategies.
        Whatever solution solves the actual problem (together with CLK-407 to make the component usable) would be OK.
        Right now, most uses simply make their own Menu by hacking this class: in fact, in all Click based web applications, I've never seen the "official" click Menu used, but always a hack (except of course click-examples )

        Show
        Adrian A. added a comment - > I think we need a MenuFactory to support alternative caching strategies. Whatever solution solves the actual problem (together with CLK-407 to make the component usable) would be OK. Right now, most uses simply make their own Menu by hacking this class: in fact, in all Click based web applications, I've never seen the "official" click Menu used, but always a hack (except of course click-examples )
        Hide
        Bob Schellink added a comment -

        MenuFactory allows for creating non-cached menu. Users can then cache the menu in whatever scope they want.

        Show
        Bob Schellink added a comment - MenuFactory allows for creating non-cached menu. Users can then cache the menu in whatever scope they want.

          People

          • Assignee:
            Adrian A.
            Reporter:
            Demetrios Kyriakis
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development