Package de.xima.fc.gui.common.converter
Class HtmlStringTrimConverter
- java.lang.Object
-
- de.xima.fc.gui.common.converter.HtmlStringTrimConverter
-
- All Implemented Interfaces:
javax.faces.convert.Converter<String>
public class HtmlStringTrimConverter extends Object implements javax.faces.convert.Converter<String>
A converter that trims empty HTML strings to the empty string. Useful e.g. for rich text editors that may return HTML such strings such as<p></p>
that represent no content.It is quite hard to define what an empty HTML string is. For example,
<p class="foo"></p>
has no text content, but it does have a class attribute that may be used by CSS or JavaScript. This converter considers the following HTML strings as empty:- When the value is null, null is returned. If the string is empty or blank, it is considered empty. Otherwise, the strings is considered empty if all of the following hold:
- The string is a valid HTML string.
- The text content of the HTML is empty or blank.
- All nodes in the DOM tree contain no attributes, except for possibly
style
.
- Since:
- 8.2.0
-
-
Constructor Summary
Constructors Constructor Description HtmlStringTrimConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)
String
getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent cmp, String value)
-