ICEfaces
  1. ICEfaces
  2. ICE-6793

org.icefaces.autoid incompatible with dynamically added components

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1-Beta, 3.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces
    • Assignee Priority:
      P1

      Description


      When components are dynamically added, the id modification performed by autoid can get out of sync:

      In Mojarra StateManagementStrategyImpl:


              // handle dynamic adds/removes
              List<String> removeList = stateContext.getDynamicRemoves();
              if (null != removeList && !removeList.isEmpty()) {
                  stateMap.put(CLIENTIDS_TO_REMOVE_NAME, removeList);
              }
              Map<String, ComponentStruct> addList = stateContext.getDynamicAdds();
              if (null != addList && !addList.isEmpty()) {
                  List<Object> savedAddList = new ArrayList<Object>(addList.size());
                  for (ComponentStruct s : addList.values()) {
                      savedAddList.add(s.saveState(context));
                  }
                  stateMap.put(CLIENTIDS_TO_ADD_NAME, savedAddList.toArray());
              }

      "dynamic adds" are populated with the original IDs set prior to autoid modification. When autoid modifies these IDs, they do not match the value expected by state saving.

        Activity

        Hide
        Ted Goddard added a comment -

        AbstractMenu.buildMenuFromModel() :

        for(UIComponent kid : model.getSubmenus())
        getChildren().add(kid);

        called during encodeEnd for a variety of menu Renderers.

        Show
        Ted Goddard added a comment - AbstractMenu.buildMenuFromModel() : for(UIComponent kid : model.getSubmenus()) getChildren().add(kid); called during encodeEnd for a variety of menu Renderers.
        Hide
        Ted Goddard added a comment -

        The strategy was to also listen for PreRenderViewEvent and to set a flag on the FacesContext. If the flag is set, subsequently added components will not have their IDs modified. This means that dynamically added components are not affected by autoid. The flag does not need to be cleared, as even if a postback occurs, the render process will only take place once.

        Show
        Ted Goddard added a comment - The strategy was to also listen for PreRenderViewEvent and to set a flag on the FacesContext. If the flag is set, subsequently added components will not have their IDs modified. This means that dynamically added components are not affected by autoid. The flag does not need to be cleared, as even if a postback occurs, the render process will only take place once.

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: