Package org.primefaces.util

Examples of org.primefaces.util.WidgetBuilder


       
        UIComponent target = SearchExpressionFacade.resolveComponent(
            context, draggable, draggable.getFor(), SearchExpressionFacade.PARENT_FALLBACK);
       
        String dashboard = draggable.getDashboard();
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Draggable", draggable.resolveWidgetVar(), clientId)
                .attr("target", target.getClientId(context))
                .attr("cursor", draggable.getCursor())
                .attr("disabled", draggable.isDisabled(), false)
                .attr("axis", draggable.getAxis(), null)
                .attr("containment", draggable.getContainment(), null)
                .attr("appendTo", SearchExpressionFacade.resolveComponentForClient(context, draggable, draggable.getAppendTo()), null)
                .attr("helper", draggable.getHelper(), null)
                .attr("zIndex", draggable.getZindex(), -1)
                .attr("handle", draggable.getHandle(), null)
                .attr("opacity", draggable.getOpacity(), 1.0)
                .attr("stack", draggable.getStack(), null)
                .attr("scope", draggable.getScope(), null);
       
        if(draggable.isRevert())
            wb.attr("revert", "invalid");
       
        if(draggable.getGrid() != null)
            wb.append(",grid:[").append(draggable.getGrid()).append("]");
       
        if(draggable.isSnap()) {
            wb.attr("snap", true)
                .attr("snapTolerance", draggable.getSnapTolerance())
                .attr("snapMode", draggable.getSnapMode(), null);
        }
       
        //Dashboard support
        if(dashboard != null) {
            Dashboard db = (Dashboard) SearchExpressionFacade.resolveComponent(context, draggable, dashboard);
           
            String selector = ComponentUtils.escapeJQueryId(db.getClientId(context)) + " .ui-dashboard-column";
            wb.attr("connectToSortable", selector);
        }

        wb.finish();
    }
View Full Code Here


    protected void encodeScript(FacesContext context, TabView tabView) throws IOException {
        String clientId = tabView.getClientId(context);
        boolean dynamic = tabView.isDynamic();
       
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("TabView", tabView.resolveWidgetVar(), clientId);
       
        if(dynamic) {
            wb.attr("dynamic", true).attr("cache", tabView.isCache());
        }
       
        wb.callback("onTabChange", "function(index)", tabView.getOnTabChange())
            .callback("onTabShow", "function(index)", tabView.getOnTabShow())
            .callback("onTabClose", "function(index)", tabView.getOnTabClose());

        wb.attr("effect", tabView.getEffect(), null)
            .attr("effectDuration", tabView.getEffectDuration(), null)
            .attr("scrollable", tabView.isScrollable());
       
        encodeClientBehaviors(context, tabView);

        wb.finish();
    }
View Full Code Here

        writer.endElement("div");
  }
 
  private void encodeScript(FacesContext context, Editor editor) throws IOException{
    String clientId = editor.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Editor", editor.resolveWidgetVar(), clientId, "editor")
                .attr("disabled", editor.isDisabled(), false)
                .attr("invalid", editor.isValid(), true)
                .attr("controls", editor.getControls(), null)
                .attr("width", editor.getWidth(), Integer.MIN_VALUE)
                .attr("height", editor.getHeight(), Integer.MIN_VALUE)
                .attr("maxlength", editor.getMaxlength(), Integer.MAX_VALUE)
                .callback("change", "function(e)", editor.getOnchange());
       
        if(AgentUtils.isIE(context)) {
            Resource resource = context.getApplication().getResourceHandler().createResource("editor/editor-ie.css", "primefaces");
            wb.attr("docCSSFile", resource.getRequestPath());
        }

        wb.finish();
  }
View Full Code Here

public class DialogRenderer extends org.primefaces.component.dialog.DialogRenderer {
   
    @Override
    protected void encodeScript(FacesContext context, Dialog dialog) throws IOException {
        String clientId = dialog.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Dialog", dialog.resolveWidgetVar(), clientId);

        wb.attr("visible", dialog.isVisible(), false)
            .attr("modal", dialog.isModal(), false)
            .attr("dynamic", dialog.isDynamic(), false)
            .attr("showEffect", dialog.getShowEffect(), null)
            .attr("closeOnEscape", dialog.isCloseOnEscape(), false
            .callback("onHide", "function()", dialog.getOnHide())
            .callback("onShow", "function()", dialog.getOnShow());
       
        String focusExpressions = SearchExpressionFacade.resolveComponentsForClient(
            context, dialog, dialog.getFocus());
        if (focusExpressions != null) {
          wb.attr("focus", focusExpressions);
        }

        encodeClientBehaviors(context, dialog);
        
        wb.finish();
    }
View Full Code Here

       
        UIComponent target = SearchExpressionFacade.resolveComponent(
            context, droppable, droppable.getFor(), SearchExpressionFacade.PARENT_FALLBACK);

        String clientId = droppable.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Droppable", droppable.resolveWidgetVar(), clientId)
                .attr("target", target.getClientId(context))
                .attr("disabled", droppable.isDisabled(), false)
                .attr("hoverClass", droppable.getHoverStyleClass(), null)
                .attr("activeClass", droppable.getActiveStyleClass(), null)
                .attr("accept", droppable.getAccept(), null)
                .attr("scope", droppable.getScope(), null)
                .attr("tolerance", droppable.getTolerance(), null);
       
        if(droppable.getOnDrop() != null) {
            wb.append(",onDrop:").append(droppable.getOnDrop());
        }
       
        encodeClientBehaviors(context, droppable);

        wb.finish();
    }
View Full Code Here

   
    protected void encodeScript(FacesContext context, OverlayPanel panel) throws IOException {
        String target = SearchExpressionFacade.resolveComponentForClient(context, panel, panel.getFor());
        String clientId = panel.getClientId(context);
       
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("OverlayPanel", panel.resolveWidgetVar(), clientId)
            .attr("target", target)
            .attr("showEvent", panel.getShowEvent(), null)
            .attr("hideEvent", panel.getHideEvent(), null)
            .attr("showEffect", panel.getShowEffect(), null)
            .attr("hideEffect", panel.getHideEffect(), null)
            .callback("onShow", "function()", panel.getOnShow())
            .callback("onHide", "function()", panel.getOnHide())
            .attr("my", panel.getMy(), null)
            .attr("at", panel.getAt(), null)
            .attr("appendToBody", panel.isAppendToBody(), false)
            .attr("dynamic", panel.isDynamic(), false)
            .attr("dismissable", panel.isDismissable(), true)
            .attr("showCloseIcon", panel.isShowCloseIcon(), false);

        wb.finish();
    }
View Full Code Here

       
        writer.endElement("div");
    }

    protected void encodeScript(FacesContext context, ContentFlow cf) throws IOException {
        WidgetBuilder wb = getWidgetBuilder(context);
       
        if (context.isPostback()) {
          wb.initWithDomReady("ContentFlow", cf.resolveWidgetVar(), cf.getClientId(context), "contentflow");
        else {
          wb.initWithWindowLoad("ContentFlow", cf.resolveWidgetVar(), cf.getClientId(context), "contentflow");
        }
       
        wb.finish();
    }
View Full Code Here

    }

    protected void encodeScript(FacesContext context, Fieldset fieldset) throws IOException {
        String clientId = fieldset.getClientId(context);
        boolean toggleable = fieldset.isToggleable();
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("Fieldset", fieldset.resolveWidgetVar(), clientId);
       
        if(toggleable) {
            wb.attr("toggleable", true)
                .attr("collapsed", fieldset.isCollapsed())
                .attr("toggleSpeed", fieldset.getToggleSpeed());
        }
       
        encodeClientBehaviors(context, fieldset);
       
        wb.finish();
    }
View Full Code Here

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

        }
    }

  protected void encodeScript(FacesContext context, Tooltip tooltip, String target) throws IOException {
        String clientId = tooltip.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Tooltip", tooltip.resolveWidgetVar(), clientId)           
            .attr("showEvent", tooltip.getShowEvent(), null)
            .attr("hideEvent", tooltip.getHideEvent(), null)
            .attr("showEffect", tooltip.getShowEffect(), null)
            .attr("hideEffect", tooltip.getHideEffect(), null)
            .attr("showDelay", tooltip.getShowDelay(), 150)
            .attr("hideDelay", tooltip.getHideDelay(), 0)
            .attr("target", target, null)
            .attr("globalSelector", tooltip.getGlobalSelector(), null)
            .attr("escape", tooltip.isEscape(), true)
            .attr("trackMouse", tooltip.isTrackMouse(), false);
       
    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.