[ 
https://issues.apache.org/jira/browse/WICKET-5470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13869400#comment-13869400
 ] 

Martin Grigorov commented on WICKET-5470:
-----------------------------------------

#postprocess() was there just to give the developer a chance to manipulate the 
value returned from the i18n related logic.
But if the application don't want to use Wicket's default i18n mechanisms then 
there is no other way but roll your own EnumChoiceRenderer. It is not a big 
and/or complex class so it is not a big deal but I see no reason why Wicket has 
to be so protective in this particular case.

> Remove 'final' from 
> org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue
> -----------------------------------------------------------------------------------------
>
>                 Key: WICKET-5470
>                 URL: https://issues.apache.org/jira/browse/WICKET-5470
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.13.0
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>            Priority: Minor
>             Fix For: 6.14.0, 7.0.0
>
>
> org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue() adds 
> unnecessary indirection by providing overrideable #postprocess() method.
> If an application doesn't want to use the default implementation to resolve a 
> display value by using i18n resources then it should provide its own custom 
> implementation of IChoiceRenderer because 
> org.apache.wicket.markup.html.form.EnumChoiceRenderer#getDisplayValue is 
> final and it will throw MissingResourceException.
> If an application needs to use different logic it should be able to override 
> #getDisplayValue(). If it needs to do something like #postprocess() then it 
> can do:
> public Object getDisplayValue() {
>   Object orig = super.getDisplayValue();
>   return manipulate(orig);
> }



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to