Search in sources :

Example 1 with Calendar

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

the class WoodstockHandler method getDatePattern.

/**
 * <p>
 * Returns the date pattern for this calendar component.
 */
@Handler(id = "getDatePattern", input = { @HandlerInput(name = "calendarComponent", type = com.sun.webui.jsf.component.Calendar.class, required = true) }, output = { @HandlerOutput(name = "pattern", type = String.class) })
public static void getDatePattern(HandlerContext handlerCtx) {
    Calendar calendar = (Calendar) handlerCtx.getInputValue("calendarComponent");
    String pattern = calendar.getDateFormatPattern();
    if (pattern == null || pattern.length() == 0) {
        pattern = calendar.getDatePicker().getDateFormatPattern();
        if (pattern == null || pattern.length() == 0) {
            // default pattern
            pattern = "MM/dd/yyyy";
        }
    }
    handlerCtx.setOutputValue("pattern", pattern);
}
Also used : Calendar(com.sun.webui.jsf.component.Calendar) Handler(com.sun.jsftemplating.annotation.Handler)

Aggregations

Handler (com.sun.jsftemplating.annotation.Handler)1 Calendar (com.sun.webui.jsf.component.Calendar)1