Search in sources :

Example 31 with Handler

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);
}
Also used : UIViewRoot(javax.faces.component.UIViewRoot) Handler(com.sun.jsftemplating.annotation.Handler)

Example 32 with Handler

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);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Handler(com.sun.jsftemplating.annotation.Handler)

Example 33 with Handler

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);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Handler(com.sun.jsftemplating.annotation.Handler)

Example 34 with Handler

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));
}
Also used : Locale(java.util.Locale) ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) Handler(com.sun.jsftemplating.annotation.Handler)

Example 35 with Handler

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));
}
Also used : Locale(java.util.Locale) ConsolePluginService(org.glassfish.admingui.plugin.ConsolePluginService) Handler(com.sun.jsftemplating.annotation.Handler)

Aggregations

Handler (com.sun.jsftemplating.annotation.Handler)167 ArrayList (java.util.ArrayList)85 Map (java.util.Map)85 List (java.util.List)82 HashMap (java.util.HashMap)81 TreeMap (java.util.TreeMap)14 IOException (java.io.IOException)12 Date (java.util.Date)9 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)8 LayoutViewHandler (com.sun.jsftemplating.layout.LayoutViewHandler)8 Image (com.sun.pkg.client.Image)8 ListIterator (java.util.ListIterator)8 UnsupportedEncodingException (java.io.UnsupportedEncodingException)7 FacesContext (javax.faces.context.FacesContext)7 AttributeList (javax.management.AttributeList)7 RestResponse (org.glassfish.admingui.common.util.RestResponse)7 URL (java.net.URL)6 IntegrationPoint (org.glassfish.admingui.connector.IntegrationPoint)6 MultipleListDataProvider (com.sun.jsftemplating.component.dataprovider.MultipleListDataProvider)5 TableRowGroup (com.sun.webui.jsf.component.TableRowGroup)5