Package org.primefaces.util

Examples of org.primefaces.util.WidgetBuilder


    protected void encodeScript(FacesContext context, OverlayPanel panel) throws IOException {
        UIComponent target = SearchExpressionFacade.resolveComponent(context, panel, panel.getFor());
        String targetClientId = (target == null) ? null: target.getClientId(context);
        String clientId = panel.getClientId(context);

        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("OverlayPanel", panel.resolveWidgetVar(), clientId)
            .attr("targetId", targetClientId, null)
            .attr("showEvent", panel.getShowEvent(), null)
            .attr("hideEvent", panel.getHideEvent(), null)
            .attr("showEffect", panel.getShowEffect(), null)
            .callback("onShow", "function()", panel.getOnShow())
            .callback("onHide", "function()", panel.getOnHide())
            .attr("at", panel.getAt(), null)
            .attr("dynamic", panel.isDynamic(), false)
            .attr("dismissable", panel.isDismissable(), true);

        wb.finish();
    }
View Full Code Here


    protected void encodeScript(FacesContext context, Calendar calendar, String value) throws IOException {
        String clientId = calendar.getClientId(context);
        Locale locale = calendar.calculateLocale(context);
        String pattern = calendar.isTimeOnly() ? calendar.calculateTimeOnlyPattern() : calendar.calculatePattern();
        String mask = calendar.getMask();
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Calendar", calendar.resolveWidgetVar(), clientId);
       
        wb.attr("popup", calendar.isPopup())
            .attr("locale", locale.toString())
            .attr("dateFormat", CalendarUtils.convertPattern(pattern));
       
        //default date
        Object pagedate = calendar.getPagedate();
        String defaultDate = null;
       
        if(calendar.isConversionFailed()) {
            defaultDate = CalendarUtils.getValueAsString(context, calendar, new Date());
        }
        else if(!isValueBlank(value)) {
            defaultDate = value;
        }
        else if(pagedate != null) {
            defaultDate = CalendarUtils.getValueAsString(context, calendar, pagedate);
        }
       
        wb.attr("defaultDate", defaultDate, null)
            .attr("numberOfMonths", calendar.getPages(), 1)
            .attr("minDate", CalendarUtils.getValueAsString(context, calendar, calendar.getMindate()), null)
            .attr("maxDate", CalendarUtils.getValueAsString(context, calendar, calendar.getMaxdate()), null)
            .attr("showButtonPanel", calendar.isShowButtonPanel(), false)
            .attr("showWeek", calendar.isShowWeek(), false)
            .attr("disabledWeekends", calendar.isDisabledWeekends(), false)
            .attr("disabled", calendar.isDisabled(), false)
            .attr("yearRange", calendar.getYearRange(), null);
       
        if(calendar.isNavigator()) {
            wb.attr("changeMonth", true).attr("changeYear", true);
        }
       
        if(calendar.getEffect() != null) {
            wb.attr("showAnim", calendar.getEffect()).attr("duration", calendar.getEffectDuration());
        }
       
        String beforeShowDay = calendar.getBeforeShowDay();
        if(beforeShowDay != null) {
            wb.nativeAttr("preShowDay", beforeShowDay);
        }
       
        String showOn = calendar.getShowOn();
        if(!showOn.equalsIgnoreCase("focus")) {
            wb.attr("showOn", showOn);
        }
       
        if(calendar.isShowOtherMonths()) {
            wb.attr("showOtherMonths", true).attr("selectOtherMonths", true);
        }
       
        if(calendar.hasTime()) {
            wb.attr("timeOnly", calendar.isTimeOnly())
                .attr("stepHour", calendar.getStepHour())
                .attr("stepMinute", calendar.getStepMinute())
                .attr("stepSecond", calendar.getStepSecond())
                .attr("hourMin", calendar.getMinHour())
                .attr("hourMax", calendar.getMaxHour())
                .attr("minuteMin", calendar.getMinMinute())
                .attr("minuteMax", calendar.getMaxMinute())
                .attr("secondMin", calendar.getMinSecond())
                .attr("secondMax", calendar.getMaxSecond())
                .attr("controlType", calendar.getTimeControlType(), null);
        }
       
        if(mask != null && !mask.equals("false")) {
            String maskTemplate = (mask.equals("true")) ? pattern.replaceAll("[a-zA-Z]", "9"): mask;
            wb.attr("mask", maskTemplate);
        }
       
        encodeClientBehaviors(context, calendar);
       
        wb.finish();
    }
View Full Code Here

       
        UIComponent target = SearchExpressionFacade.resolveComponent(
            context, resizable, resizable.getFor(), SearchExpressionFacade.PARENT_FALLBACK);
        String targetId = target.getClientId(context);
       
        WidgetBuilder wb = getWidgetBuilder(context);
       
        if(target instanceof UIGraphic)
          wb.initWithComponentLoad("Resizable", resizable.resolveWidgetVar(), clientId, targetId);
        else
          wb.initWithDomReady("Resizable", resizable.resolveWidgetVar(), clientId);

        wb.attr("target", targetId)
            .attr("minWidth", resizable.getMinWidth(), Integer.MIN_VALUE)
            .attr("maxWidth", resizable.getMaxWidth(), Integer.MAX_VALUE)
            .attr("minHeight", resizable.getMinHeight(), Integer.MIN_VALUE)
            .attr("maxHeight", resizable.getMaxHeight(), Integer.MAX_VALUE);
       
        if(resizable.isAnimate()) {
            wb.attr("animate", true)
                .attr("animateEasing", resizable.getEffect())
                .attr("animateDuration", resizable.getEffectDuration());
        }
       
        if(resizable.isProxy()) {
            wb.attr("helper", "ui-resizable-proxy");
        }
       
        wb.attr("handles", resizable.getHandles(), null)
            .attr("grid", resizable.getGrid(), 1)
            .attr("aspectRatio", resizable.isAspectRatio(), false)
            .attr("ghost", resizable.isGhost(), false);
       
        if(resizable.isContainment()) {
          wb.attr("isContainment", true);
            wb.attr("parentComponentId", resizable.getParent().getClientId(context));
        }
       
        wb.callback("onStart", "function(event,ui)", resizable.getOnStart())
            .callback("onResize", "function(event,ui)", resizable.getOnResize())
            .callback("onStop", "function(event,ui)", resizable.getOnStop());
           
        encodeClientBehaviors(context, resizable);

        wb.finish();
  }
View Full Code Here

        writer.endElement("li");
    }

    protected void encodeScript(FacesContext context, SelectOneMenu menu) throws IOException {
        String clientId = menu.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("SelectOneMenu", menu.resolveWidgetVar(), clientId)
                .attr("effect", menu.getEffect(), null)
                .attr("effectSpeed", menu.getEffectSpeed(), null)
                .attr("editable", menu.isEditable(), false)
                .attr("appendTo", SearchExpressionFacade.resolveComponentForClient(context, menu, menu.getAppendTo()), null)
                .attr("syncTooltip", menu.isSyncTooltip(), false);
       
        if(menu.isFilter()) {
            wb.attr("filter", true)
                .attr("filterMatchMode", menu.getFilterMatchMode(), null)
                .nativeAttr("filterFunction", menu.getFilterFunction(), null)
                .attr("caseSensitive", menu.isCaseSensitive(), false);
        }
               
        wb.finish();
    }
View Full Code Here

        writer.writeAttribute("id", clientId, "id");
        writer.endElement("div");
    }

    protected void encodeScript(FacesContext context, ColumnToggler columnToggler) throws IOException {
        WidgetBuilder wb = getWidgetBuilder(context);
       
        wb.initWithDomReady("ColumnToggler", columnToggler.resolveWidgetVar(), columnToggler.getClientId(context));
        wb.attr("trigger", SearchExpressionFacade.resolveComponentsForClient(context, columnToggler, columnToggler.getTrigger()))
            .attr("datasource", SearchExpressionFacade.resolveComponentsForClient(context, columnToggler, columnToggler.getDatasource()));
       
        encodeClientBehaviors(context, columnToggler);
       
        wb.finish();
    }
View Full Code Here

    @Override
  protected void encodeScript(FacesContext context, AccordionPanel acco) throws IOException {
    String clientId = acco.getClientId(context);
        boolean multiple = acco.isMultiple();
       
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("AccordionPanel", acco.resolveWidgetVar(), clientId);
            
        if(acco.isDynamic()) {
            wb.attr("dynamic", true).attr("cache", acco.isCache());
        }
       
        wb.attr("multiple", multiple, false)
        .callback("onTabChange", "function(panel)", acco.getOnTabChange())
        .callback("onTabShow", "function(panel)", acco.getOnTabShow());
       
        encodeClientBehaviors(context, acco);
       
        wb.finish();
  }
View Full Code Here

        UIComponent form = ComponentUtils.findParentForm(context, button);
    if(form == null) {
      throw new FacesException("MenuButton : \"" + clientId + "\" must be inside a form element");
    }

        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("MenuButton", button.resolveWidgetVar(), clientId);       
        wb.attr("appendTo", SearchExpressionFacade.resolveComponentForClient(context, button, button.getAppendTo()), null);
        wb.finish();
  }
View Full Code Here

    protected void encodeScript(FacesContext context, SelectOneRadio radio) throws IOException {
        String clientId = radio.getClientId(context);
        String layout = radio.getLayout();
        boolean custom = layout != null && layout.equals("custom");
      
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("SelectOneRadio", radio.resolveWidgetVar(), clientId)
            .attr("custom", custom, false).finish();
    }
View Full Code Here

    protected void encodeScript(FacesContext context, AbstractMenu abstractMenu) throws IOException {
        Menu menu = (Menu) abstractMenu;
    String clientId = menu.getClientId(context);
       
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("PlainMenu", menu.resolveWidgetVar(), clientId)
            .attr("toggleable", menu.isToggleable(), false);
       
        if(menu.isOverlay()) {
            encodeOverlayConfig(context, menu, wb);
        }

        wb.finish();
  }
View Full Code Here

    }
   
    @Override
    protected void encodeScript(FacesContext context, SelectOneMenu menu) throws IOException {
        String clientId = menu.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("SelectOneMenu", menu.resolveWidgetVar(), clientId);              
        wb.finish();
    }
View Full Code Here

TOP

Related Classes of org.primefaces.util.WidgetBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.