You could build a custom component, e.g.:

public class OutputEnum
{
    @Inject
    private Messages messages;

    @Parameter(required = true)
    private Enum<?> value;

    @BeginRender
    void begin(MarkupWriter writer)
    {
        if (value == null)
        {
            return;
        }

        Element element = writer.element("span");

        element.text(getLabelForEnum(messages, value));

        writer.end(); // span
    }
}


On Thu, Aug 26, 2021 at 3:31 AM Paul Stanton <pa...@mapshed.com.au> wrote:

> Using ${object.enumValue} renders the enum in raw form ie ENUM1
>
> How do I leverage "TapestryInternalUtils.getLabelForEnum" without having
> to use a BeanDisplay or Grid etc?
>
> Or is there super easy way to just render the Enum value formatted
> without rendering any wrapping html etc?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Reply via email to