Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: Components/Renderers
    • Labels:
      None

      Description

      this is typical implementation of custom component's method:

      MyComponent.java
      MyComponent.processDecodes:
      
      if (!isRendered()) {
        return;
      }
      super.processDecodes(context);
      // do specific stuff
      
      

      If MyComponent extends UIInput, then if component has ValueExpression for "rendered" (and VE resolves to true), it is evaluated 3x:

      1. MyComponent.processDecodes
      2. javax.faces.component.UIInput.processDecodes(FacesContext)
      3. javax.faces.component.UIComponentBase.processDecodes(FacesContext)


      Suggestion:
      add a useful return value for execute and render lifecycle methods like visitTree has already. Then code can be optimized:

      MyComponent.java
      MyComponent.processDecodes:
      
      
      if (!super.processDecodes(context))
       return;
      
      // do specific stuff
      

      Considerations:

      • Blake's Axiom of Boolean Properties: You will regret making your property a boolean (http://www.mail-archive.com/dev@myfaces.apache.org/msg52753.html). Create new Enum or reuse existing VisitResult as return value
      • if change to exiting API is not possible, add new method like "UIComponent.isXYZPhaseExecutable"
      • if change to API is not possible at all, find a way similar as ELContext.setPropertyResolved(boolean): a property on context "current execute/render method is executable on this component"

        Activity

        Martin Kočí created issue -
        Ed Burns made changes -
        Field Original Value New Value
        Assignee rogerk [ rogerk ]
        Ed Burns made changes -
        Priority Major [ 3 ] Trivial [ 5 ]
        Manfred Riem made changes -
        Priority Trivial [ 5 ] Minor [ 4 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Martin Kočí
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: