public class UtilHandlers extends Object
Constructor and Description |
---|
UtilHandlers()
Creates a new instance of UtilHandlers
|
Modifier and Type | Method and Description |
---|---|
static void |
addEmptyFirstElement(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
addHandler(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
calendarAdd(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Adds the specified (signed) amount of time to the given calendar
field, based on the calendar's rules and returns the resulting Date.
|
static void |
compare(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Compare if 2 objects is equal
|
static void |
containedIn(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Test if a list
List contains the string |
static void |
convertArrayToCommaString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
convertListToArray(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
convertListToCommaString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
convertMapToListOfMap(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method converts a Map into a list of Map with keyName and ValueName.
|
static void |
convertStringtoListHandler(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler takes in a string with delimiter and returns list
|
static void |
convertStringToMap(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
convertStrToBoolean(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
createDefaultViewRoot(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method returns a new UIViewRoot with the basic JSFT settings
from the current ViewRoot.
|
static void |
createPropertyString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
decodeString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method decodes a String using "UTF-8" as default
if scheme is not specified.
|
static void |
encodeId(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler invokes the
GuiUtil.genId(String) method and
returns the result. |
static String |
escapePropertyValue(String str) |
static void |
fileGetName(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the name of the file or directory denoted by this abstract
pathname.
|
static boolean |
foreach(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler provides the foreach loop functionality.
|
static boolean |
forLoop(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
A utility handler that resembles the for() method in Java.
|
static void |
formatPathSeperatorStringsforSaving(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
formatStringsforDisplay(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
getFile(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Creates a new File instance by converting the given pathname string
into an abstract pathname.
|
static void |
getListBoxOptions(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
getMapKeys(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the keys
|
static void |
javaToJSON(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler will convert a Java object to JSON by using
JsonUtil.getJsonValue(java.lang.Object) . |
static void |
listAdd(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Adds the given value to a
List |
static void |
listCombine(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Combine 2 lists
List by adding the object in the 2nd list to the first list |
static void |
listGet(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Get an element form a
List |
static void |
listRemove(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Remove the given value from a
List |
static void |
listSort(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
sort a
List |
static void |
logger(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
mapCopy(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns a duplicate copy of the source Map
|
static void |
mapEntrySet(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler returns the
Set of entries for the given
Map . |
static void |
mapGet(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the value to which the input map maps the input key.
|
static void |
mapJoin(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
mapValueNullToFalse(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler goes through all the Map entries, if the value is null, it will convert that to "false"
This is used usually to take care of un-checked checkbox which is set to 'null', but needs to be set to false when
the map is passed in as attrsMap for request.
|
static void |
mapValues(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler returns the
Set of keys for the given
Map . |
static void |
prepareAlertMsg(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method sets the attributes that will be used by the alert component
display the message to user.
|
static void |
prepareSuccessful(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method displays the save successful message when the page refresh.
|
static void |
resolveTokens(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
roundTo2DecimalPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx) |
static void |
serveResource(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext ctx)
This handler serves a resource via JSFTemplating's FileStreamer.
|
static void |
startsWith(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler will test if a String starts with another String.
|
public static void calendarAdd(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Adds the specified (signed) amount of time to the given calendar
field, based on the calendar's rules and returns the resulting Date.
See java.util.GregorianCalendar
add(int field, int amount).
Input value: "Field" -- Type: Integer
- java.util.Calendar
field
Input value: "Amount" -- Type: Integer
- the amount of date or time to be added to the field.
Output value: "Date" -- Type: java.util.Date
handlerCtx
- The HandlerContext.public static void getFile(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Creates a new File instance by converting the given pathname string into an abstract pathname. If the given string is the empty string, then the result is the empty abstract pathname.
Input value: "Pathname" -- Type: String
Output value: "File" -- Type: java.io.File
handlerCtx
- The HandlerContext.public static void serveResource(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext ctx) throws IOException
This handler serves a resource via JSFTemplating's FileStreamer.
ctx
- IOException
public static void fileGetName(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the name of the file or directory denoted by this abstract pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.
Input value: "File" -- Type: java.io.File
Output value: "Name" -- Type: String
handlerCtx
- The HandlerContext.public static void mapCopy(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns a duplicate copy of the source Map
Input value: "source" -- Type: java.util.Map
Output value: "dest" -- Type: java.util.Map
handlerCtx
- The HandlerContext.public static void mapGet(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the value to which the input map maps the input key.
Input value: "Map" -- Type: java.util.Map
Input value: "Key" -- Type: Object
Output value: "Value" -- Type: Object
handlerCtx
- The HandlerContext.public static void mapJoin(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void mapValueNullToFalse(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the map
Input value: "map" -- Type: java.util.Map
Input value: "key" -- Type: java.util.List
handlerCtx
- The HandlerContext.public static void getMapKeys(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Returns the keys
Input value: "Map" -- Type: java.util.Map
Output value: "Keys" -- Type: Object
handlerCtx
- The HandlerContext.public static void listAdd(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Adds the given value to a List
Input list: "list" -- Type: java.util.List
Input value: "value" -- Type: java.lang.Object
Input value: "index" -- Type: Integer
handlerCtx
- The HandlerContextpublic static void listRemove(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Remove the given value from a List
Input list: "list" -- Type: java.util.List
Input value: "value" -- Type: java.lang.Object
handlerCtx
- The HandlerContextpublic static void listGet(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Get an element form a List
Input list: "list" -- Type: java.util.List
Input index: "index" -- Type: java.lang.Integer
handlerCtx
- The HandlerContextpublic static void listSort(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
sort a List
Input list: "list" -- Type: java.util.List
handlerCtx
- The HandlerContextpublic static void listCombine(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Combine 2 lists List
by adding the object in the 2nd list to the first list
Input value: "list" -- Type: java.util.List
Input value: "list2" -- Type: java.util.List
handlerCtx
- The HandlerContextpublic static void containedIn(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Test if a list List
contains the string
Input value: "list" -- Type: java.util.List
Input value: "testStr" -- Type: String
Output value: "contain" -- Type: Boolean
handlerCtx
- public static void compare(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Compare if 2 objects is equal
Input value: "obj1" -- Type: Object
Input value: "obj2" -- Type: Object
Output value: "equal" -- Type: Object
handlerCtx
- The HandlerContext.public static void prepareSuccessful(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method displays the save successful message when the page refresh.
handlerCtx
- The HandlerContext.public static void prepareAlertMsg(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method sets the attributes that will be used by the alert component display the message to user. If type is not specifed, it will be 'info' by default.
Input value: "summary" -- Type: java.lang.String
Input value: "type" -- Type: java.lang.String
Input value: "detail" -- Type: java.lang.String
handlerCtx
- The HandlerContext.public static void startsWith(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler will test if a String starts with another String.
handlerCtx
- public static void decodeString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method decodes a String using "UTF-8" as default if scheme is not specified.
handlerCtx
- public static void roundTo2DecimalPoint(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void addEmptyFirstElement(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void getListBoxOptions(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void convertArrayToCommaString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void convertListToCommaString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void resolveTokens(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void convertListToArray(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void convertStringtoListHandler(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler takes in a string with delimiter and returns list
handlerCtx
- public static void convertStringToMap(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void formatStringsforDisplay(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void formatPathSeperatorStringsforSaving(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void addHandler(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
handlerCtx
- public static boolean forLoop(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
A utility handler that resembles the for() method in Java. Handler inside the for loop will be executed in a loop. start index is specified by "start", till less than "end". eg. forLoop(start="1" end="3" varName="foo"){}, handler inside the {} will be executed 2 times.
Input value: "start" -- Type: Integer
Start index, default to Zero is not specified
Input value: "end" -- Type: Integer
End index.
Input value: "varName" -- Type: String
Variable to be replaced in the for loop by the index.
handlerCtx
- The HandlerContext.public static boolean foreach(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler provides the foreach loop functionality. You should
specify a request attribute 'var' that will be used as the key for
storing each token in the list. You can then retrieve each value
as the loop iterates by requesting the request scoped attribute
keyed by the value you supplied for 'var'. You must also specify
the List<Object>
to iterate over.
handlerCtx
- public static void mapEntrySet(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler returns the Set
of entries for the given
Map
.
handlerCtx
- public static void mapValues(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler returns the Set
of keys for the given
Map
.
handlerCtx
- public static void convertStrToBoolean(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void logger(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
public static void createDefaultViewRoot(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This method returns a new UIViewRoot with the basic JSFT settings from the current ViewRoot. If you intend to set this before the current view is created (in an effort to swap out the UIViewRoot), you should do so during the initPage event (take care to only do this during the first request, or you might lose all child components).
handlerCtx
- public static void encodeId(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
This handler invokes the GuiUtil.genId(String)
method and
returns the result.
handlerCtx
- public static void convertMapToListOfMap(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
handlerCtx
- public static void javaToJSON(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
JsonUtil.getJsonValue(java.lang.Object)
.handlerCtx
- public static void createPropertyString(com.sun.jsftemplating.layout.descriptors.handler.HandlerContext handlerCtx)
Copyright © 2018. All rights reserved.