use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UtilHandlers method createDefaultViewRoot.
/**
* <p> 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).</p>
* @param handlerCtx
*/
@Handler(id = "createDefaultViewRoot", output = { @HandlerOutput(name = "viewRoot", type = UIViewRoot.class) })
public static void createDefaultViewRoot(HandlerContext handlerCtx) {
UIViewRoot oldVR = handlerCtx.getFacesContext().getViewRoot();
UIViewRoot newVR = new UIViewRoot();
newVR.setViewId(oldVR.getViewId());
ViewRootUtil.setLayoutDefinitionKey(newVR, ViewRootUtil.getLayoutDefinitionKey(oldVR));
newVR.setLocale(oldVR.getLocale());
newVR.setRenderKitId(oldVR.getRenderKitId());
handlerCtx.setOutputValue("viewRoot", newVR);
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UtilHandlers method listSort.
/**
* <p> sort a <code>List</code></p>
* <p> Input list: "list" -- Type: <code>java.util.List</code>
*
* @param handlerCtx The HandlerContext
*/
@Handler(id = "gf.listSort", input = { @HandlerInput(name = "list", type = List.class, required = true) })
public static void listSort(HandlerContext handlerCtx) {
List list = (List) handlerCtx.getInputValue("list");
Collections.sort(list);
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UtilHandlers method containedIn.
/**
* <p> Test if a list <code>List</code>contains the string </p>
* <p> Input value: "list" -- Type: <code>java.util.List</code>
* <p> Input value: "testStr" -- Type: <code>String</code>
* <p> Output value: "contain" -- Type: <code>Boolean</code>
* @param handlerCtx
*/
@Handler(id = "gf.containedIn", input = { @HandlerInput(name = "list", type = List.class, required = true), @HandlerInput(name = "testStr", type = String.class, required = true) }, output = { @HandlerOutput(name = "contain", type = Boolean.class) })
public static void containedIn(HandlerContext handlerCtx) {
List list = (List) handlerCtx.getInputValue("list");
boolean contain = (list == null) ? false : list.contains(handlerCtx.getInputValue("testStr"));
handlerCtx.setOutputValue("contain", contain);
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class HelpHandlers method getHelpTOC.
/**
* <p> This handler provides access to {@link IntegrationPoint}s for the
* requested key.</p>
*
* @param handlerCtx The <code>HandlerContext</code>.
*/
@Handler(id = "getHelpTOC", input = { @HandlerInput(name = "locale", type = Locale.class) }, output = { @HandlerOutput(name = "toc", type = TOC.class) })
public static void getHelpTOC(HandlerContext handlerCtx) {
// Get the desired Locale and the ConsolePluginService...
Locale locale = (Locale) handlerCtx.getInputValue("locale");
ConsolePluginService cps = PluginHandlers.getPluginService(handlerCtx.getFacesContext());
// Determine the correct locale for the path...
String localePath = getHelpLocalePath(locale, cps);
handlerCtx.setOutputValue("toc", cps.getHelpTOC(localePath));
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class HelpHandlers method getHelpIndex.
/**
* <p> This handler provides access to {@link IntegrationPoint}s for the
* requested key.</p>
*
* @param handlerCtx The <code>HandlerContext</code>.
*/
@Handler(id = "getHelpIndex", input = { @HandlerInput(name = "locale", type = Locale.class) }, output = { @HandlerOutput(name = "index", type = Index.class) })
public static void getHelpIndex(HandlerContext handlerCtx) {
// Get the desired Locale and the ConsolePluginService...
Locale locale = (Locale) handlerCtx.getInputValue("locale");
ConsolePluginService cps = PluginHandlers.getPluginService(handlerCtx.getFacesContext());
// Determine the correct locale for the path...
String localePath = getHelpLocalePath(locale, cps);
handlerCtx.setOutputValue("index", cps.getHelpIndex(localePath));
}
Aggregations