Unfortunaly you don't read my description correctly or the subject.
In the render phase:
SheetRenderer is calling ListDataModel.setRowIndex
ListDataModel.setRowIndex is calling ListDataModel.getRowData
Then SheetRenderer is calling getRowData.
This means a double call for data.get(index)
Maybe data.get(index) is call three times
but i only analyse the render phase.
Bernd
Simon Kitching schrieb:
Hi,
All input components (including tables) call the getter at least twice.
They need to call the getter during the validation phase, in order to
know whether to generate ValueChanged events.
And then they need to call it again at the start of the following render
phase, because the value may have changed as a result of the "update
model" phase.
There's really no way to avoid either of these calls. Possibly MyFaces
could add a "noValueChanged" property on every component, and users
could set that to true if they don't care about getting ValueChanged
events for that component, so the validation step can skip trying to
compare the current value against the model. Hmm..maybe the component
could look to see if it has any ValueChangeListeners attached, and not
try to generate the event in that case? I don't know if that's safe
though; there might be other ways to detect that event than a listener
(eg an ancestor component which overrides queueEvent). See method
UIInput.validate for details.
If you are sure that your list will *not* change as a result of the
"update model" phase, then you could do this:
<code>
private transient DataModel myModel;
public DataModel getMyModel() {
if (myModel == null) {
// create the model, including fetching data
}
return myModel;
}
</code>
This way, you'll create the model during the validation phase (ie when
the components are trying to determine whether ValueChanged events are
needed or not) and use the same object during the rendering phase. Of
course, as described above, that assumes your data won't change as a
result of the "update model" phase.
Regards,
Simon
Bernd Bohmann wrote:
Tobago doesn't call getter for the list twice.
SheetRenderer is calling ListDataModel.setRowIndex
ListDataModel.setRowIndex is calling ListDataModel.getRowData
Then SheetRenderer is calling getRowData.
Maybe we can impove the implementation of ListDataModel.
(I think we should) :-)
Bernd
Dennis Byrne schrieb:
I don't think it's a good idea, because writing getter is more logic.
Are you talking about actions and actionListeners?
Dennis Byrne
--
Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development
Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com
phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333