Component is optional so it can be given optionally to the renderer.

I have attached a patch. However, it should still be coupled with
TypeChoiceModel so that they fetch the localized label using the same
method. I uploaded that too.

I also provided factory methods so that it is easier to construct these objects.

**
Martin

2009/11/12 Olivier Croisier <olivier.crois...@gmail.com>:
> The Localizer methods also require a Component as a parameter, so we're back
> to square one : we must provide a Component.
> Also, it would be helpful if you provided your alternative implementation as
> a well-formed patch instead of plain-text code in the Jira comment.
>
>
> On Wed, Nov 11, 2009 at 8:44 PM, Martin Makundi <
> martin.maku...@koodaripalvelut.com> wrote:
>
>> > I admit the EnumDropDownChoice is more of a convenient class that a
>> > real new feature.
>>
>> It's simply an overkill for the purpose. I loved the idea of a
>> TypeChoiceModel, though. Maybe it should also be tuned to be non
>> enum-specific, like the TypeChoiceRenderer.
>>
>> > A standalone EnumChoiceRenderer would need to take a Component as a
>> > constructor parameter, to call getString() on,
>>
>> This is not true. Localizer is available everywhere.
>>
>> Application.get().getResourceSettings().getLocalizer();
>>
>>
>> **
>> Martin
>> >
>> >
>> >
>> >
>> > On Wed, Nov 11, 2009 at 7:58 PM, Martin Makundi <
>> > martin.maku...@koodaripalvelut.com> wrote:
>> >
>> >> I vote for EnumChoiceRender instead of full DropDownChoice.
>> >>
>> >> However. EnumChoiceRenderer can render any TYPE so that's why I have
>> >> proposed TypeChoiceRenderer. You can directly use it with existing
>> >> wicket and no need for specific dropdown.
>> >>
>> >> **
>> >> Martin
>> >>
>> >> 2009/11/11 Olivier Croisier <olivier.crois...@gmail.com>:
>> >> > Hi,
>> >> >
>> >> > I just submitted a patch to the very old
>> >> > WICKET-1157<https://issues.apache.org/jira/browse/WICKET-1157>JIRA
>> (no
>> >> > activity for the last 2 years).
>> >> > It provides a simple and flexible way to internationalize enums :
>> >> > - An EnumMessageKeyProvided that implements a Strategy pattern to
>> >> generate
>> >> > I18N keys from enums.
>> >> > - An EnumDropDownChoice to render HTML <select> components
>> >> > - An EnumModel to internationalize any enum provided by another Model
>> (so
>> >> > there is no need of EnumLabels and such).
>> >> >
>> >> > Hope that helps,
>> >> >
>> >> > Olivier
>> >> >
>> >>
>> >
>>
>

Reply via email to