[
https://issues.apache.org/jira/browse/WICKET-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12787474#action_12787474
]
Johan Compagner commented on WICKET-2601:
-----------------------------------------
what about not overriding getModel() of Component
but overrirde getObject() from a Model?
> Proposal: remove final modifier for Component#getModel
> ------------------------------------------------------
>
> Key: WICKET-2601
> URL: https://issues.apache.org/jira/browse/WICKET-2601
> Project: Wicket
> Issue Type: Wish
> Components: wicket
> Affects Versions: 1.3.4
> Reporter: Peter Parson
> Priority: Minor
>
> Would be handy, e.g. for labels which are to display different strings
> depending on runtime logic.
> Ex:
> new Label("conditionalLabel") {
> public IModel getModel() {
> return new StringResourceModel(condition?"mystring.yes":"mystring.no", this,
> null);
> }
> }
> Workarounds I can think of are:
> * using a PropertyModel, pointing to a getter outside conditionalLabel
> * overriding onBeforeRender in order to re-set the model before each time
> the component is rendered
> Both options do not seem very straightforward to me.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.