Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-Alpha2
-
Component/s: ICE-Components
-
Labels:None
-
Environment:ICEfaces 2
-
Affects:Documentation (User Guide, Ref. Guide, etc.)
Description
In ICEfaces 1.8, we employ several strategies for saving component fields, when in a UIData container, so that the field value will be distinct per UIData row. Sometimes we keep a Map<String clientId, Object field> and sometimes we use the SeriesStateHolder interface. In OutputResource, we found that we could not use the clientId, since if the OutputResource was in a UIData whose data model was having insertions or deletions, then the clientIds would not match up any more, which would break both of the previously mentioned strategies. One strategy that seems to work well, in all scenarios, is using settable properties, and making the app store the value in the row level object. The worst strategy is doing nothing, and applications unexpectedly failing.
Whichever strategy we use, it would be nice if we could just specify that a property should be unique per UIData row, and have the generator create the appropriate getter and setter methods to handle that.
Whichever strategy we use, it would be nice if we could just specify that a property should be unique per UIData row, and have the generator create the appropriate getter and setter methods to handle that.
Issue Links
- blocks
-
ICE-2824 selectInputText in dataTable
- Closed
My recommendation is that we use a combination of settable properties and the Map<String clientId, Object value>. This all has to work with JSF 2's StateHelper class, which our properties use for storing their state in. The implementation of which is in: mojarra2\jsf-api\src\main\java\javax\faces\component\ComponentStateHelper.java
In the setter method, we could see if there's a ValueExpression, and if so use it. Otherwise we fall through to using the StateHelper. If we then use the PropertyKeys field as the key, we would get a Map<String clientId, Object value>. If that doesn't exist, create it and put it back into the StateHelper. Then put the value into the map using the clientId as the key.
In the getter method, first try seeing if the StateHelper has the Map, using the PropertyKeys field as the key, if so, see if there's a value in the Map, using the clientId as the key. If not, then fall back to seeing if there's a ValueExpression, and evaluating it. If not, return the default value.