Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6946

isVisibleInHierarchy/isEnabledInHierarchy broken by isVisible/isEnabled override

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 10.0.0-M1, 9.8.0
    • wicket-core
    • None

    Description

      Currently, isVisibleInHierarchy and isEnabledInHierarchy can return invalid values when isVisible or isEnabled is overridden. The problem is caused by the caching done in isVisibleInHierarchy/isEnabledInHierarchy. Currently, the cache is invalidated in setVisible/setEnabled. The cache invalidation is not done when components are overriding isVisible/isEnabled.

      Additionally, the documentation mentions impacts of overriding isVisible/isEnabled when using "non-trivial" code, as the methods are called multiple times and can slow down page rendering.
      The best practices chapter mentions overriding isVisible/isEnabled as the appropriate approach. Another best practices page mentions that a component factory should not be used because it prevents overriding isVisible/isEnabled in an anonymous class.

      There is no clear warning that overriding isVisible/isEnabled can break isVisibleInHierarchy/isEnabledInHierarchy when the returned value can change.

      There is also no indication that overriding isVisible/isEnabled is not recommended.

      Attachments

        Issue Links

          Activity

            People

              svenmeier Sven Meier
              mat128 Mathieu Mitchell
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: