Page History
...
In some cases you may want to return an HTML string from your formatter. This may be useful to customize the displayed text (eg. with embedded bold/italic tags), or present a link. This can be achieved by overriding the following method:
Code Block | ||||
---|---|---|---|---|
| ||||
publicbooleanreturnsHtml() { return false; } |
...
By default, this method returns false, indicating that any HTML entities in the formatted values should be escaped when outputting to HTML. By overriding this to return true, Yellowfin will not do any HTML escaping. An example of a formatter that includes HTML output is provided below:
Code Block | ||||
---|---|---|---|---|
| ||||
public boolean returnsHtml() { return true; } public String render(Object value, int renderType) throws Exception { if (value == null) return null; if (renderType == RENDER_LINK) { return value.toString(); } else if (renderType == RENDER_HTML) { return "<b>" + value.toString() + "</b>"; } else { // rendering to non-html output return value.toString(); } } |
...