You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Parson (JIRA)" <ji...@apache.org> on 2009/12/08 15:13:18 UTC

[jira] Created: (WICKET-2601) Proposal: remove final modifier for Component#getModel

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.


[jira] Resolved: (WICKET-2601) Proposal: remove final modifier for Component#getModel

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2601.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

doesnt make sense? why have an indirection for a model which is already itself an indirection.

> 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
>            Assignee: Igor Vaynberg
>            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.


[jira] Commented: (WICKET-2601) Proposal: remove final modifier for Component#getModel

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ 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.