Class GuiUtil
java.lang.Object
org.glassfish.admingui.common.util.GuiUtil
- Author:
- anilam
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarrayToString(String[] str, String delimiter) This method concatenates the delimiter char to the end of each string in the array, and returns a single string with the concatenated string.static <T> T[]static StringcheckEmpty(String test) convertArrayToListOfMap(Object[] values, String key) convertMapToListOfMap(Map<String, String> values) static StringThis method encodes the given String with the specified type.static StringThis method generates an ID that is safe for JSF for the given String.static BooleangetBooleanValue(Map pMap, String name) static ResourceBundlestatic Throwable[]Get the chain of exceptions via getCause().static StringgetCommonMessage(String key) static StringgetCommonMessage(String key, Object[] args) static org.glassfish.hk2.api.ServiceLocatorstatic Localestatic Loggerstatic ObjectgetMapValue(Map map, String mapKeys) static StringgetMessage(String key) static StringgetMessage(String key, Object[] args) static StringgetMessage(String resourceName, String key) static StringgetMessage(String resourceName, String key, Object[] args) static StringgetMessage(ResourceBundle bundle, String key) static ThrowableGet the original troublemaker.static ObjectgetSessionValue(String key) static longstatic voidguiLog(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) static voidhandleError(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, String detail) static voidhandleException(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, Throwable ex) static voidstatic booleanstatic booleanisSelected(String name, List<Map> selectedList) static StringlistToString(List<String> list, String delimiter) static Stringstatic ListparseStringList(String line, String sep) Parses a string containing substrings separated from each other by the specified set of separator characters and returns a list of strings.static voidprepareAlert(String type, String summary, String detail) static voidprepareException(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, Throwable ex) static voidprepareSuccessful(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) static StringremoveToken(String line, String sep, String remove) static voidsetSessionValue(String key, Object value) static voidstatic String[]stringToArray(String str, String delimiter) This method converts a string into stringarray, uses the delimeter as the separator character.
-
Field Details
-
I18N_RESOURCE_BUNDLE
- See Also:
-
RESOURCE_NAME
- See Also:
-
COMMON_RESOURCE_NAME
- See Also:
-
LOGGER_NAME
- See Also:
-
guiLocale
-
-
Constructor Details
-
GuiUtil
public GuiUtil()Creates a new instance of GuiUtil
-
-
Method Details
-
getLogger
-
guiLog
public static void guiLog(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) -
isEmpty
-
getCommonMessage
-
getMessage
-
getMessage
-
initSessionAttributes
public static void initSessionAttributes() -
setTimeStamp
- Throws:
Exception
-
getTimeStamp
- Throws:
Exception
-
setSessionValue
-
getSessionValue
-
encode
This method encodes the given String with the specified type.
If type is not specified then it defaults to UTF-8.
- Parameters:
value- String to be encodeddelim- Reserved Characters don't want to be encodedtype- Encoding type. Default is UTF-8
-
genId
This method generates an ID that is safe for JSF for the given String. It does not guarantee that the id is unique, it is the responsibility of the caller to pass in a String that will result in a UID. All non-ascii characters will be replaced with an '_'. This method will also ensure an alpha character (or '_') is the first character in the id.
- Parameters:
uid- A non-null String.
-
getBundle
-
getMessage
-
getCommonMessage
-
getMessage
-
getMessage
-
getLocale
-
prepareSuccessful
public static void prepareSuccessful(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) -
prepareException
public static void prepareException(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, Throwable ex) -
prepareAlert
-
handleException
public static void handleException(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, Throwable ex) -
handleError
public static void handleError(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx, String detail) -
notNull
-
convertListOfStrings
-
parseStringList
Parses a string containing substrings separated from each other by the specified set of separator characters and returns a list of strings. Splits the stringlineinto individual string elements separated by the field separators specified insep, and returns these individual strings as a list of strings. The individual string elements are trimmed of leading and trailing whitespace. Only non-empty strings are returned in the list.- Parameters:
line- The string to splitsep- The list of separators to use for determining where the string should be split. If null, then the standard separators (see StringTokenizer javadocs) are used.- Returns:
- Returns the list containing the individual strings that the input string was split into.
-
removeToken
-
stringToArray
This method converts a string into stringarray, uses the delimeter as the separator character. If the delimiter is null, uses space as default. -
arrayToString
This method concatenates the delimiter char to the end of each string in the array, and returns a single string with the concatenated string. -
listToString
-
asArray
-
isSelected
-
checkEmpty
-
getBooleanValue
-
getHabitat
public static org.glassfish.hk2.api.ServiceLocator getHabitat() -
convertArrayToListOfMap
-
convertMapToListOfMap
-
getMapValue
-
getCauses
Get the chain of exceptions via getCause(). The first element is the Exception passed.- Parameters:
start- the Exception to traverse- Returns:
- a Throwable[] or an Exception[] as appropriate
-
getRootCause
Get the original troublemaker.- Parameters:
e- the Exception to dig into- Returns:
- the original Throwable that started the problem
-