Package org.primefaces.util

Examples of org.primefaces.util.WidgetBuilder


    writer.endElement(tag);
    }
   
    protected void encodeScript(FacesContext context, OutputPanel panel) throws IOException {
        String clientId = panel.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("OutputPanel", panel.resolveWidgetVar(), clientId);
       
        if(panel.isDeferred()) {
            String delay = panel.getDelay();
           
            wb.attr("deferred", true)
                .attr("deferredMode", panel.getDeferredMode())
                .attr("global", panel.isGlobal(), false);
       
            if(!ComponentUtils.isValueBlank(delay) && !delay.equals("none")) {
                wb.attr("delay", delay);
            }
        }
       
        wb.finish();
    }
View Full Code Here


   
    protected void encodeScript(FacesContext context, ScrollPanel panel) throws IOException {
        boolean nativeMode = panel.getMode().equals("native");       
        if(!nativeMode) {
            String clientId = panel.getClientId(context);
            WidgetBuilder wb = getWidgetBuilder(context);
            wb.init("ScrollPanel", panel.resolveWidgetVar(), clientId).finish();
        }
    }
View Full Code Here

    protected void encodeScript(FacesContext context, FileUpload fileUpload) throws IOException {
        String clientId = fileUpload.getClientId(context);
        String update = fileUpload.getUpdate();
        String process = fileUpload.getProcess();
        WidgetBuilder wb = getWidgetBuilder(context);

        if(fileUpload.getMode().equals("advanced")) {
            wb.initWithDomReady("FileUpload", fileUpload.resolveWidgetVar(), clientId, "fileupload");
           
            wb.attr("auto", fileUpload.isAuto(), false)
                .attr("dnd", fileUpload.isDragDropSupport(), true)
                .attr("update", SearchExpressionFacade.resolveComponentsForClient(context, fileUpload, update), null)
                .attr("process", SearchExpressionFacade.resolveComponentsForClient(context, fileUpload, process), null)
                .attr("maxFileSize", fileUpload.getSizeLimit(), Long.MAX_VALUE)
                .attr("fileLimit", fileUpload.getFileLimit(), Integer.MAX_VALUE)
                .attr("invalidFileMessage", fileUpload.getInvalidFileMessage(), null)
                .attr("invalidSizeMessage", fileUpload.getInvalidSizeMessage(), null)
                .attr("fileLimitMessage", fileUpload.getFileLimitMessage(), null)
                .attr("messageTemplate", fileUpload.getMessageTemplate(), null)
                .attr("previewWidth", fileUpload.getPreviewWidth(), 80)
                .attr("disabled", fileUpload.isDisabled(), false)
                .callback("onstart", "function()", fileUpload.getOnstart())
                .callback("onerror", "function()", fileUpload.getOnerror())
                .callback("oncomplete", "function()", fileUpload.getOncomplete());

            if(fileUpload.getAllowTypes() != null) {
                wb.append(",allowTypes:").append(fileUpload.getAllowTypes());
            }
        }
        else {
            wb.init("SimpleFileUpload", fileUpload.resolveWidgetVar(), clientId)
               .attr("skinSimple", fileUpload.isSkinSimple(), false);
        }

        wb.finish();
  }
View Full Code Here

        writer.endElement("div");
    }

    protected void encodeScript(FacesContext context, DataList list) throws IOException {
        String clientId = list.getClientId();
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("DataList", list.resolveWidgetVar(), clientId);
       
        if(list.isPaginator()) {
            encodePaginatorConfig(context, list, wb);
        }

        wb.finish();
    }
View Full Code Here

    String clientId = table.getClientId(context);
        String selectionMode = table.resolveSelectionMode();
        String widgetClass = (table.getFrozenColumns() == Integer.MIN_VALUE) ? "DataTable" : "FrozenDataTable";
        String initMode = table.getInitMode();
       
        WidgetBuilder wb = getWidgetBuilder(context);

        if(initMode.equals("load"))
            wb.initWithDomReady(widgetClass, table.resolveWidgetVar(), clientId);
        else if(initMode.equals("immediate"))
            wb.init(widgetClass, table.resolveWidgetVar(), clientId);
        else
            throw new FacesException(initMode + " is not a valid value for initMode, possible values are \"load\" and \"immediate.");
       
        //Pagination
        if(table.isPaginator()) {
            encodePaginatorConfig(context, table, wb);
        }
       
        //Selection
        wb.attr("selectionMode", selectionMode, null)
            .attr("rowSelectMode", table.getRowSelectMode(), "new")
            .attr("nativeElements", table.isNativeElements(), false)
            .attr("disabledTextSelection", table.isDisabledTextSelection(), true);
       
        //Filtering
        if(table.isFilteringEnabled()) {
            wb.attr("filter", true)
                .attr("filterEvent", table.getFilterEvent(), null)
                .attr("filterDelay", table.getFilterDelay(), Integer.MAX_VALUE);
        }
       
        //Row expansion
        if(table.getRowExpansion() != null) {
            wb.attr("expansion", true).attr("rowExpandMode", table.getRowExpandMode());
        }

        //Scrolling
        if(table.isScrollable()) {
            wb.attr("scrollable", true)
                .attr("liveScroll", table.isLiveScroll())
                .attr("scrollStep", table.getScrollRows())
                .attr("scrollLimit", table.getRowCount())
                .attr("scrollWidth", table.getScrollWidth(), null)
                .attr("scrollHeight", table.getScrollHeight(), null)
                .attr("frozenColumns", table.getFrozenColumns(), Integer.MIN_VALUE);
        }

        //Resizable/Draggable Columns
        wb.attr("resizableColumns", table.isResizableColumns(), false)
            .attr("liveResize", table.isLiveResize(), false)
            .attr("draggableColumns", table.isDraggableColumns(), false);
       
        //Draggable Rows
        wb.attr("draggableRows", table.isDraggableRows(), false);
       
        //Editing
        if(table.isEditable()) {
            wb.attr("editable", true).attr("editMode", table.getEditMode()).attr("cellSeparator", table.getCellSeparator(), null);
        }
       
        //MultiColumn Sorting
        if(table.isMultiSort()) {
            wb.attr("multiSort", true);
        }
       
        if(table.isStickyHeader()) {
            wb.attr("stickyHeader", true);
        }

        //Behaviors
        encodeClientBehaviors(context, table);

        wb.finish();
  }
View Full Code Here

        ResponseWriter writer = context.getResponseWriter();
        int slideshowSpeed = imageSwitch.isSlideshowAuto() ? imageSwitch.getSlideshowSpeed() : 0;
       
        writer.endElement("div");
       
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("ImageSwitch", imageSwitch.resolveWidgetVar(), clientId, "imageswitch")            .attr("fx", imageSwitch.getEffect())
            .attr("speed", imageSwitch.getSpeed())
            .attr("timeout", slideshowSpeed);

        wb.finish();
  }
View Full Code Here

  }

    protected void encodeScript(FacesContext context, Message uiMessage, String targetClientId) throws IOException {
        if(uiMessage.getDisplay().equals("tooltip")) {
            String clientId = uiMessage.getClientId(context);
            WidgetBuilder wb = getWidgetBuilder(context);

            wb.initWithDomReady("Message", uiMessage.resolveWidgetVar(), clientId)
                .attr("target", targetClientId)
                .finish();
        }
    }   
View Full Code Here

  }

    public void encodeScript(FacesContext context, Ring ring) throws IOException {
        String clientId = ring.getClientId(context);
       
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.initWithDomReady("Ring", ring.resolveWidgetVar(), clientId, "ring")
            .attr("startingChild", ring.getFirst())
            .attr("easing", ring.getEasing(), null);
        wb.finish();
  }
View Full Code Here

    writer.endElement("div");
  }
 
  protected void encodeScript(FacesContext context, Dashboard dashboard) throws IOException {
    String clientId = dashboard.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("Dashboard", dashboard.resolveWidgetVar(), clientId)
            .attr("disabled", dashboard.isDisabled(), false);
       
        encodeClientBehaviors(context, dashboard);
       
        wb.finish();
  }
View Full Code Here

        writer.endElement("div");
    }
   
    public void encodeScript(FacesContext context, UISwitch uiswitch) throws IOException {
        String clientId = uiswitch.getClientId(context);
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("UISwitch", uiswitch.resolveWidgetVar(), clientId).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.