| java.lang.Object com.flexive.shared.FxFormatUtils
FxFormatUtils | final public class FxFormatUtils (Code) | | Miscellaneous formatting utility functions.
author: Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at) author: Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at) |
Method Summary | |
public static String | colorCodeToStyle(String code) Converts "#FF0000" or "FF0000" rgb values to style="color:#FF0000" and all other style values
to class="XXX". | public static String | encodeHex(byte[] bytes) Turns an array of bytes into a String representing each byte as an unsigned
hex number. | public static String | encodePassword(long accountId, String password) Checks the password and encodes it. | public static String | escapeForJavaScript(String value, boolean replaceNewlines, boolean filterHtml) Escape text content for output in a javascript function call parameter,
based on the Struts TagUtils#filter function. | public static String | escapeForJavaScript(String value, boolean replaceNewlines) Escape text content for output in a javascript function call parameter.
Parameters: value - the text content Parameters: replaceNewlines - replaces linebreaks with html tags if set to true,or simply removes them (replaces them with spaces) if set to false. | public static String | escapeForJavaScript(String value) Escape text content for output in a javascript function call parameter. | public static String | escapeForSql(Object value) Generic SQL escape method. | public static String | escapeTreePath(String path) | public static String | formatResource(String resource, long languageId, Object... values) Format a resource, replacing all {x} by the appropriate value in values. | public static SimpleDateFormat | getDateFormat() Returns a basic date format that is readable but not localized. | public static SimpleDateFormat | getDateTimeFormat() Returns a basic date/time format that is readable but not localized. | public static String | isEmail(String email) Checks the email. | public static boolean | isQuoted(String value) | public static boolean | isRGBCode(String value) Checks if a value is a RGB color code. | public static String | processColorString(String paramName, String value) Check if a color value is valid. | public static Date | toDate(String date, Locale locale) | public static String | toString(Date date, Locale locale) | public static String | unquote(String value) |
colorCodeToStyle | public static String colorCodeToStyle(String code)(Code) | | Converts "#FF0000" or "FF0000" rgb values to style="color:#FF0000" and all other style values
to class="XXX".
Parameters: code - the color code the style or class value |
encodeHex | public static String encodeHex(byte[] bytes)(Code) | | Turns an array of bytes into a String representing each byte as an unsigned
hex number.
Parameters: bytes - an array of bytes to convert to a hex-string generated hex string |
encodePassword | public static String encodePassword(long accountId, String password) throws FxInvalidParameterException(Code) | | Checks the password and encodes it.
Parameters: accountId - the account ID (needed for computing the hash) Parameters: password - unencoded the password the encoded password throws: FxInvalidParameterException - if the password is invalid (too short, too simple, ..) |
escapeForJavaScript | public static String escapeForJavaScript(String value, boolean replaceNewlines, boolean filterHtml)(Code) | | Escape text content for output in a javascript function call parameter,
based on the Struts TagUtils#filter function.
Parameters: value - the text content Parameters: replaceNewlines - replaces linebreaks with html tags if set to true,or simply removes them (replaces them with spaces) if set to false. Parameters: filterHtml - filter html? the escaped text |
escapeForJavaScript | public static String escapeForJavaScript(String value, boolean replaceNewlines)(Code) | | Escape text content for output in a javascript function call parameter.
Parameters: value - the text content Parameters: replaceNewlines - replaces linebreaks with html tags if set to true,or simply removes them (replaces them with spaces) if set to false. the escaped text |
escapeForJavaScript | public static String escapeForJavaScript(String value)(Code) | | Escape text content for output in a javascript function call parameter.
Parameters: value - the text content the escaped text |
escapeForSql | public static String escapeForSql(Object value)(Code) | | Generic SQL escape method.
Parameters: value - the value to be formatted the formatted value |
escapeTreePath | public static String escapeTreePath(String path)(Code) | | Escape a path to allow only a-zA-Z0-9/ and replace all other letters with underscores (_)
Parameters: path - the path to escape escaped path |
formatResource | public static String formatResource(String resource, long languageId, Object... values)(Code) | | Format a resource, replacing all {x} by the appropriate value in values.
If values is an instance of FxString the given localeId is used
Parameters: resource - String containing {0}..{n} placeholders Parameters: languageId - used locale if values contain FxString instances Parameters: values - either FxString, FxException or any Object using toString() formatted resource |
getDateFormat | public static SimpleDateFormat getDateFormat()(Code) | | Returns a basic date format that is readable but not localized.
a basic date format that is readable but not localized. |
getDateTimeFormat | public static SimpleDateFormat getDateTimeFormat()(Code) | | Returns a basic date/time format that is readable but not localized.
a basic date/time format that is readable but not localized. |
isQuoted | public static boolean isQuoted(String value)(Code) | | Is the value quoted by ' or " ?
Parameters: value - value to check if quoted by ' or " ? |
isRGBCode | public static boolean isRGBCode(String value)(Code) | | Checks if a value is a RGB color code.
The RGB color code my start with a '#', but is also recognized without it.
Parameters: value - the string to check true if the value is a valid RGB color code |
processColorString | public static String processColorString(String paramName, String value) throws FxInvalidParameterException(Code) | | Check if a color value is valid.
The color may be a RGB value (recognized by a starting '#') or a css class name.
The function returns the default color if value is empty.
If the value defines a invalid RGB value a FxInvalidParameterException is thrown.
Parameters: paramName - the name of the parameter that is used when a FxInvalidParameterException is thrown Parameters: value - the color alue the (corrected) color throws: FxInvalidParameterException - if the color is invalid |
unquote | public static String unquote(String value)(Code) | | Unquote a quoted value
Parameters: value - value to unquote unquoted calue |
|
|