[
https://issues.apache.org/jira/browse/ISIS-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16159792#comment-16159792
]
Andi Huber commented on ISIS-1616:
----------------------------------
Real world example of rendering STATE labels with color.
* We define an enum _State_ with title, icon and color.
* With the new Markup value type, we provide colored rendering of the state's
title.
* Colors are rendered both in forms and collection views (tables).
{code:java}
// -- STATE ENUM WITH COLOR
public static enum State {
pending("Pending Verification", "color: red;"),
verified("verified", "color: green;"),
;
public final String title;
public final String icon;
public final String webStyle;
private State(String title, String webStyle) {
this.icon = name();
this.title=title;
this.webStyle=webStyle;
}
public String html() {
return "<span style=\""+webStyle+"\">"+title+"</span>";
}
}
// -- VERIFICATION STATE PROPERTY
@PropertyLayout(hidden=Where.EVERYWHERE)
@Getter @Setter
private State verificationState;
@NotPersistent
@PropertyLayout(hidden=Where.OBJECT_FORMS, named="Verification")
public Markup getVerificationState(){
return new Markup(verificationState.html());
}
{code}
> Support URLs as a link / "As-is" HTML rendering
> -------------------------------------------------
>
> Key: ISIS-1616
> URL: https://issues.apache.org/jira/browse/ISIS-1616
> Project: Isis
> Issue Type: New Feature
> Components: Core
> Affects Versions: 1.14.0
> Reporter: Dan Haywood
> Priority: Minor
> Fix For: 2.1.0
>
> Attachments: Clipboard01.png, Clipboard02.png
>
>
> Reuse Kevin's work, https://github.com/kev-m/isis-wicket-url/
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)