MyFaces Core
  1. MyFaces Core
  2. MYFACES-2824

Improve invokeOnComponent and visitTree methods in UILeaf

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.2
    • Component/s: General
    • Labels:
      None

      Description

      UILeaf components are stateless. They have no children and no facets. Therefore, the invokeOnComponent and visitTree methods should not go through all the children and facets. Moreover, they do not have any callback invocations through these methods or through a system event. The invokeOnComponent and visitTree methods should be overridden accordingly.

      1. uiLeafImprovements3.patch
        1 kB
        Marius Petoi
      2. uiLeafImprovements2.patch
        2 kB
        Marius Petoi
      3. uiLeafImprovements.patch
        2 kB
        Marius Petoi

        Activity

        Hide
        Jakob Korherr added a comment -

        Thanks to Marius Petoi for this patch!

        Show
        Jakob Korherr added a comment - Thanks to Marius Petoi for this patch!
        Hide
        Marius Petoi added a comment -

        Ok. Then invokeOnComponent shall always return false.

        Show
        Marius Petoi added a comment - Ok. Then invokeOnComponent shall always return false.
        Hide
        Leonardo Uribe added a comment -

        I think compare the client id on invoke on component is not necessary, because UILeaf will never be target for any callback.

        Show
        Leonardo Uribe added a comment - I think compare the client id on invoke on component is not necessary, because UILeaf will never be target for any callback.
        Hide
        Marius Petoi added a comment -

        You are right. I misunderstood the fact that once true is returned the entire visiting is stopped. My mistake. Sorry! The new patch I attached contains the right version.

        Show
        Marius Petoi added a comment - You are right. I misunderstood the fact that once true is returned the entire visiting is stopped. My mistake. Sorry! The new patch I attached contains the right version.
        Hide
        Jakob Korherr added a comment -

        I have a question regarding your patch:

        Why do you return true in visitTree()? Returning true makes the tree visit to stop completely and not just for this component, see UIComponent.visitTree():

        if (getChildCount() > 0) {
        for (UIComponent child : getChildren()) {
        if (child.visitTree(context, callback))

        { return true; }

        }
        }

        I think visitTree() should return false in this case, or is there something I am missing?

        Show
        Jakob Korherr added a comment - I have a question regarding your patch: Why do you return true in visitTree()? Returning true makes the tree visit to stop completely and not just for this component, see UIComponent.visitTree(): if (getChildCount() > 0) { for (UIComponent child : getChildren()) { if (child.visitTree(context, callback)) { return true; } } } I think visitTree() should return false in this case, or is there something I am missing?
        Hide
        Marius Petoi added a comment -

        This is the patch with the overriding of the two methods in UILeaf.

        Show
        Marius Petoi added a comment - This is the patch with the overriding of the two methods in UILeaf.

          People

          • Assignee:
            Jakob Korherr
            Reporter:
            Marius Petoi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development