ICEfaces
  1. ICEfaces
  2. ICE-7321

Generator: avoid using client ids for state saving

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-Beta
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Any
    • Assignee Priority:
      P1

      Description

      Currently, the generated getter and setter methods use the client id of the component as a key to a map stored in the StateHelper to store values. The purpose of this is to differentiate among instances inside UIData, ui:repeat, etc. Using the client id leads to problems when building component programmatically or from a model, as in the case of the menu component. The problem is that the client id is tried to be determined when creating the component object, but since the component object is not yet attached to the component tree, the client ids turn out to be wrong in the rendered page. It is necessary to implement a different approach to save the component values without requiring to determine the client id at the moment of setting values that would still be able to differentiate among different instances of the same component in UIData, etc.

        Activity

        Hide
        Arturo Zambrano added a comment -

        The idea of avoiding the use of client ids in the generator for state saving has now been abandoned in favor for a simpler solution.

        Initially, an alternative approach was implemented where, instead of client ids, a generic numeric id was used. While, this temporarily solved the problem that originated this issue (ICE-7302), it could cause problems when a component is repeated inside a UIData container or ui:repeat. Therefore, this change was reverted and a simpler solution was implemented to avoid using client ids when setting properties of programmatically-generated components, in general, not just menus.

        The approach consists in checking if the component is attached to the component tree or if it is disconnected. If it is disconnected, then no client ids will be used as keys for state saving, and instead, the same approach used when setting a property during the Render Response or Restore View phases is applied, which consists in setting the default values of the component. There is no intrinsic differentiation among instances of the same component in this scenario, but since the components are already created programmatically in the bean on a per-instance basis, then there's no need to handle different instances in the setter methods in this case.

        Show
        Arturo Zambrano added a comment - The idea of avoiding the use of client ids in the generator for state saving has now been abandoned in favor for a simpler solution. Initially, an alternative approach was implemented where, instead of client ids, a generic numeric id was used. While, this temporarily solved the problem that originated this issue ( ICE-7302 ), it could cause problems when a component is repeated inside a UIData container or ui:repeat. Therefore, this change was reverted and a simpler solution was implemented to avoid using client ids when setting properties of programmatically-generated components, in general, not just menus. The approach consists in checking if the component is attached to the component tree or if it is disconnected. If it is disconnected, then no client ids will be used as keys for state saving, and instead, the same approach used when setting a property during the Render Response or Restore View phases is applied, which consists in setting the default values of the component. There is no intrinsic differentiation among instances of the same component in this scenario, but since the components are already created programmatically in the bean on a per-instance basis, then there's no need to handle different instances in the setter methods in this case.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arturo Zambrano
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: