|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sodius.mdw.core.model.RichText
public final class RichText
Holds a rich text representation, whose underlying format can either be XHTML or RTF. Conversion methods are provided to convert from one format to another (eg. RTF to XHTML).
It is worth noting it is not intended to be a general RTF-XHTML converter. Only a subset of the RTF and XHTML specifications are covered here. The converters have been designed to convert only what can be edited in the Model Editor. Any non-handled RTF or XHTML construct is simply ignored during the conversion process.
| Field Summary | |
|---|---|
static String |
DOCTYPE_OMIT
Doctype value to tell the converter to ignore the doctype. |
static String |
DOCTYPE_STRICT
XHTML Strict doctype. |
static String |
DOCTYPE_TRANSITIONAL
XHTML Transitional doctype |
static String |
OPTION_PLAIN_ORDERED_LIST_STRING
Option to specify the String used to prefix in plain text an ordered list item. |
static String |
OPTION_PLAIN_UNORDERED_LIST_STRING
Option to specify the String used to prefix in plain text an unordered list item. |
static String |
OPTION_XHTML_DOCTYPE
Options to specify the XHTML doctype to use. |
static String |
OPTION_XHTML_SHOW_BODY_ONLY
Option to determine if the converter should only output the contents of the body tag as an HTML fragment. |
| Method Summary | |
|---|---|
RichText |
convert(RichTextType type)
Converts the wrapped text into the specified format. |
RichText |
convert(RichTextType type,
Map<String,?> options)
Converts the wrapped text into the specified format. |
boolean |
equals(Object obj)
Return true if the argument is a RichText of same type wrapping the same text. |
RichTextType |
getType()
Return the format of the underlying text. |
String |
getValue()
Returns the wrapped text as is. |
int |
hashCode()
|
boolean |
isEmpty()
Returns true if the underlying value length is 0. |
RichText |
simplify()
Returns the most lightweight type of rich text that can represents the underlying value. |
String |
toPlainText()
Converts the wrapped text into a plain text format. |
String |
toPlainText(Map<String,?> options)
Converts the wrapped text into a plain text format. |
String |
toRTF()
Converts the wrapped text into a RTF format. |
String |
toRTF(Map<String,?> options)
Converts the wrapped text into a RTF format. |
String |
toString()
Returns the plain text version of the underlying text. |
String |
toXHTML()
Converts the wrapped text into an XHTML format. |
String |
toXHTML(Map<String,?> options)
Converts the wrapped text into an XHTML format. |
static RichText |
valueOf(String text)
Creates a new RichText instance wrapping the specified text. |
static RichText |
valueOf(String text,
RichTextType type)
Creates a new RichText instance wrapping the specified text, whose underlying format is known by the caller. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String OPTION_XHTML_DOCTYPE
public static final String DOCTYPE_OMIT
public static final String DOCTYPE_STRICT
public static final String DOCTYPE_TRANSITIONAL
public static final String OPTION_XHTML_SHOW_BODY_ONLY
false.
public static final String OPTION_PLAIN_ORDERED_LIST_STRING
String used to prefix in plain text an ordered list item.
Default value is .
public static final String OPTION_PLAIN_UNORDERED_LIST_STRING
String used to prefix in plain text an unordered list item.
Default value is -
| Method Detail |
|---|
public static RichText valueOf(String text)
text - the text to wrap as RichText
valueOf(String, RichTextType)
public static RichText valueOf(String text,
RichTextType type)
text - the text to wrap as RichTexttype - the underlying format of the text
valueOf(String)public String getValue()
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
true if the argument is a RichText of same type wrapping the same text.
equals in class Objectpublic RichTextType getType()
public boolean isEmpty()
true if the underlying value length is 0.
true if the underlying value length is 0, false otherwise.public String toPlainText()
public String toPlainText(Map<String,?> options)
options - Options that configure the conversion process
public final String toRTF()
public String toRTF(Map<String,?> options)
options - Options that configure the conversion process
public String toXHTML()
public String toXHTML(Map<String,?> options)
options - Options that configure the conversion process
public RichText convert(RichTextType type)
public final RichText convert(RichTextType type,
Map<String,?> options)
options - Options that configure the conversion process
public RichText simplify()
Returns the most lightweight type of rich text that can represents the underlying value.
If the underlying value if a non formatted RTF of XHTML text, it returns the plain text version. If the underlying value is a formatted RTF text, it returns the XHTML version.
public final String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||