Search in sources :

Example 6 with TableRowGroup

use of com.sun.webui.jsf.component.TableRowGroup in project Payara by payara.

the class TableHandlers method getAllSingleMapRows.

/**
 *	<p> This handler takes TableRowGroup as input and returns a List of Map objects.
 *  <p> The List returned contains Map objects with each Map representing one single row.
 *  <p> This method only works for tables where each row consists of one single map
 *
 *  <p> Input  value: "TableRowGroup" -- Type: <code> com.sun.webui.jsf.component.TableRowGroup</code></p>
 *  <p> Output  value: "Rows" -- Type: <code> java.util.List</code></p>
 *	@param	handlerCtx	The HandlerContext.
 */
@Handler(id = "getAllSingleMapRows", input = { @HandlerInput(name = "TableRowGroup", type = TableRowGroup.class, required = true) }, output = { @HandlerOutput(name = "Rows", type = List.class) })
public static void getAllSingleMapRows(HandlerContext handlerCtx) {
    TableRowGroup trg = (TableRowGroup) handlerCtx.getInputValue("TableRowGroup");
    MultipleListDataProvider dp = (MultipleListDataProvider) trg.getSourceData();
    List data = dp.getLists();
    try {
        handlerCtx.setOutputValue("Rows", data.get(0));
    } catch (Exception ex) {
        // TODO alert user, log exception
        System.out.println("!!!! getAllSingleMapRows() Throws Exception: " + ex.toString());
    }
}
Also used : MultipleListDataProvider(com.sun.jsftemplating.component.dataprovider.MultipleListDataProvider) ArrayList(java.util.ArrayList) List(java.util.List) TableRowGroup(com.sun.webui.jsf.component.TableRowGroup) Handler(com.sun.jsftemplating.annotation.Handler)

Aggregations

Handler (com.sun.jsftemplating.annotation.Handler)6 TableRowGroup (com.sun.webui.jsf.component.TableRowGroup)6 MultipleListDataProvider (com.sun.jsftemplating.component.dataprovider.MultipleListDataProvider)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 RowKey (com.sun.data.provider.RowKey)2 HashMap (java.util.HashMap)1 ListIterator (java.util.ListIterator)1