ICEfaces
  1. ICEfaces
  2. ICE-1235

Rendering of PassThruAttributes need to be fixed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All

      Description

      The passThruAttributes rendering strategy needs to be revisited.

        Issue Links

          Activity

          Hide
          Adnan Durrani added a comment -

          Initial check-in 13105

          Show
          Adnan Durrani added a comment - Initial check-in 13105
          Hide
          Adnan Durrani added a comment -

          We found 2 problems with existing strategy:

          1- In the RenderResponse phase each component iterate the list of 68
          passThruAttributes to render the passThruAttribute on root element even if there
          wasn't any pass thru attribute set on the component.

          2- In couple of renderers there is a check to see if there is some
          passThruAttribute being set on the component but it gives wrong information in
          most of the cases.

          Show
          Adnan Durrani added a comment - We found 2 problems with existing strategy: 1- In the RenderResponse phase each component iterate the list of 68 passThruAttributes to render the passThruAttribute on root element even if there wasn't any pass thru attribute set on the component. 2- In couple of renderers there is a check to see if there is some passThruAttribute being set on the component but it gives wrong information in most of the cases.
          Hide
          Adnan Durrani added a comment -

          We have added new strategy to deal with above issues.

          In order to keep existing approach and add new one, we ended up adding an
          interface called com.icesoft.faces.component.IcePassThruAttribute under core branch.

          So if any component wants to use new approach of writing passThru attributes,
          the component need to be implement the IcePassThruAttribute interface and have
          to override two methods in the component class.
          Let say if the inputText wants to use new strategy.

          ------------------
          public class HtmlInputText
          extends UIInput
          implements IcePassThruAttributes {
          //Due to the fact that every component extends Sun's UIComponentBase class that
          //prevent us to override the following methods in some base class.
          //so we have to add these two methods in component class exclusively.
          //NOTE: These methods do not need any modification, they just require copy and past

          public Map getAttributes() {
          Map attMap = super.getAttributes();
          if (!attMap.containsKey(IcePassThruAttributes.ICE_ATTRIBUTE_MAP))

          { Map newMap = new AttributesMap(attMap); attMap.put(IcePassThruAttributes.ICE_ATTRIBUTE_MAP,newMap); return newMap; }

          else

          { return (Map)attMap.get(IcePassThruAttributes.ICE_ATTRIBUTE_MAP); }


          }

          public void setValueBinding(String name, ValueBinding vb) {
          Map iceAttributeMap =
          (Map)getAttributes().get(IcePassThruAttributes.ICE_ATTRIBUTE_MAP);
          if (name != null && iceAttributeMap != null) {
          if (PassThruAttributeRenderer.passThruAttributeNames.contains(name))

          { ((List)iceAttributeMap.get(IcePassThruAttributes.PASS_THRU_NON_BOOLEAN_ATT_LIST)).add(name); }

          else if
          (PassThruAttributeRenderer.booleanPassThruAttributeNames.contains(name))

          { ((List)iceAttributeMap.get(IcePassThruAttributes.PASS_THRU_BOOLEAN_ATT_LIST)).add(name); }

          }
          //you can put your code here if any
          //......
          super.setValueBinding(name, vb);
          }

          }
          }
          -----------------
          Renderer does not require any changes. TO render passThruAttributes the
          following method need to be called as before.
          PassThruAttributeRenderer
          .renderAttributes(facesContext, uiComponent, null);

          You can also exclude passthru attributes, as before.
          excludes.add("style");
          excludes.add("readonly");
          excludes.add("disabled");

          PassThruAttributeRenderer.
          renderAttributes(
          facesContext, uiComponent, getExcludesArray(excludes));

          Show
          Adnan Durrani added a comment - We have added new strategy to deal with above issues. In order to keep existing approach and add new one, we ended up adding an interface called com.icesoft.faces.component.IcePassThruAttribute under core branch. So if any component wants to use new approach of writing passThru attributes, the component need to be implement the IcePassThruAttribute interface and have to override two methods in the component class. Let say if the inputText wants to use new strategy. ------------------ public class HtmlInputText extends UIInput implements IcePassThruAttributes { //Due to the fact that every component extends Sun's UIComponentBase class that //prevent us to override the following methods in some base class. //so we have to add these two methods in component class exclusively. //NOTE: These methods do not need any modification, they just require copy and past public Map getAttributes() { Map attMap = super.getAttributes(); if (!attMap.containsKey(IcePassThruAttributes.ICE_ATTRIBUTE_MAP)) { Map newMap = new AttributesMap(attMap); attMap.put(IcePassThruAttributes.ICE_ATTRIBUTE_MAP,newMap); return newMap; } else { return (Map)attMap.get(IcePassThruAttributes.ICE_ATTRIBUTE_MAP); } } public void setValueBinding(String name, ValueBinding vb) { Map iceAttributeMap = (Map)getAttributes().get(IcePassThruAttributes.ICE_ATTRIBUTE_MAP); if (name != null && iceAttributeMap != null) { if (PassThruAttributeRenderer.passThruAttributeNames.contains(name)) { ((List)iceAttributeMap.get(IcePassThruAttributes.PASS_THRU_NON_BOOLEAN_ATT_LIST)).add(name); } else if (PassThruAttributeRenderer.booleanPassThruAttributeNames.contains(name)) { ((List)iceAttributeMap.get(IcePassThruAttributes.PASS_THRU_BOOLEAN_ATT_LIST)).add(name); } } //you can put your code here if any //...... super.setValueBinding(name, vb); } } } ----------------- Renderer does not require any changes. TO render passThruAttributes the following method need to be called as before. PassThruAttributeRenderer .renderAttributes(facesContext, uiComponent, null); You can also exclude passthru attributes, as before. excludes.add("style"); excludes.add("readonly"); excludes.add("disabled"); PassThruAttributeRenderer. renderAttributes( facesContext, uiComponent, getExcludesArray(excludes));
          Hide
          Adnan Durrani added a comment -

          Created an attachment (id=142)
          Analysis on renering of passThruAttributes

          The document contains solution of the problem as well.

          Show
          Adnan Durrani added a comment - Created an attachment (id=142) Analysis on renering of passThruAttributes The document contains solution of the problem as well.
          Hide
          Adnan Durrani added a comment -

          The core nugget has been checked in. The inputText is using new strategy for
          now. I would like to implement it to other components when we have a dedicated
          tester available.

          Show
          Adnan Durrani added a comment - The core nugget has been checked in. The inputText is using new strategy for now. I would like to implement it to other components when we have a dedicated tester available.
          Hide
          Ken Fyten added a comment -

          Let's do ice:commandButton as well for 1.6.

          Please create a new JIRA issue for the rest of the components and we'll tackle those in a later release.

          Show
          Ken Fyten added a comment - Let's do ice:commandButton as well for 1.6. Please create a new JIRA issue for the rest of the components and we'll tackle those in a later release.
          Hide
          Adnan Durrani added a comment -

          It came across that Facelets uses different path for setting the value of the attribute which does not have any setter defined in the component class. However JSF uses only a single path regardless of existence of the setter. So we are losing single entry point. Mark is corresponding with facelets team on this issue.

          Show
          Adnan Durrani added a comment - It came across that Facelets uses different path for setting the value of the attribute which does not have any setter defined in the component class. However JSF uses only a single path regardless of existence of the setter. So we are losing single entry point. Mark is corresponding with facelets team on this issue.
          Hide
          Adnan Durrani added a comment -

          Out of scope for 1.6DR#3, The changes has been reverted that was applied before: -revision 13461

          Show
          Adnan Durrani added a comment - Out of scope for 1.6DR#3, The changes has been reverted that was applied before: -revision 13461
          Hide
          Adnan Durrani added a comment -

          Due to the fact that developer may want to set attributes dynamically using setters, in this case the list of passThru attribute must be iterated. So it has been concluded that instead of dealing with different paths, we should iterate through all attributes. However we need to fix the issues with existing passThru strategy.

          Show
          Adnan Durrani added a comment - Due to the fact that developer may want to set attributes dynamically using setters, in this case the list of passThru attribute must be iterated. So it has been concluded that instead of dealing with different paths, we should iterate through all attributes. However we need to fix the issues with existing passThru strategy.
          Hide
          Mark Collette added a comment -

          ICE-3729 is how we're going to solve this particular issue.

          Show
          Mark Collette added a comment - ICE-3729 is how we're going to solve this particular issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Adnan Durrani
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: