Details
Description
Currently some components create all sub components structure in their constructors. This causes the whole component to become static. I.e. once the page loads the components will no change. This creates adverse effect on the locale changing mechanism since the components do not 'recalculate' the labels that are dynamically added. Therefore to improve this we need to move logic in constructors to onBeforeRender() thus allowing natural wicket page lifecycle that allows to refresh object models.
Note that some components such as stateful forms need to be carefully refactored as reading the form also destroys its state which may cause unexpected behaviour where state must be preserved (e.g. address add/edit page). For forms that must be stateful we need a different approach by supplying model objects that are locale aware and therefore can render correct value when refreshed.
E.g.
final Label rez = new Label(NAME, "myLabel");
can be rewritten to honour locale through locale aware model.
final Label rez = new Label(NAME, new AbstractReadOnlyModel<String>() {
@Override
public String getObject()
});