Package org.richfaces.component

Examples of org.richfaces.component.UIDatascroller


    }

    public void renderPager(FacesContext context, UIComponent component, UIData data)
            throws IOException {
        ResponseWriter out = context.getResponseWriter();
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = scroller.getPageIndex(data);

        int maxPages = scroller.getMaxPages();
        if (maxPages <= 1) {
            maxPages = 1;
        }
        int pageCount = scroller.getPageCount(data);
        if (pageCount <= 1) {
            return;
        }

        int delta = maxPages / 2;

        int pages;
        int start;
        if (pageCount > maxPages && currentPage > delta) {
            pages = maxPages;
            start = currentPage - pages / 2 - 1;
            if (start + pages > pageCount) {
                start = pageCount - pages;
            }
        } else {
            pages = pageCount < maxPages ? pageCount : maxPages;
            start = 0;
        }

        for (int i = start, size = start + pages; i < size; i++) {

            boolean isCurrentPage = (i + 1 == currentPage);
            String styleClass;
            String style;
      if (isCurrentPage) {
          styleClass = scroller.getSelectedStyleClass();
          style = scroller.getSelectedStyle();
      } else {
        styleClass = scroller.getInactiveStyleClass();
          style = scroller.getInactiveStyle();
      }
      if (styleClass==null){
          styleClass="";
      }
View Full Code Here


    }

    public void renderPages(FacesContext context, UIComponent component, UIData data)
            throws IOException {
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = scroller.getPageIndex(data);

        int pageCount = scroller.getPageCount(data);
        if (pageCount <= 1) {
            pageCount = 1;
        }
        String varName = (String) scroller.getAttributes().get("pageIndexVar");
        if (varName != null && varName.length() > 0) {
            context.getExternalContext()
                    .getRequestMap().put(varName, new Integer(currentPage));
        }
        varName = (String) scroller.getAttributes().get("pagesVar");
        if (varName != null && varName.length() > 0) {
            context.getExternalContext()
                    .getRequestMap().put(varName, new Integer(pageCount));
        }
    }
View Full Code Here

    public String getOnClick(FacesContext context, UIComponent component,
            String value) {

        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component,
                context);
        UIDatascroller scroller = (UIDatascroller) component;
        Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
                component);
        Map parameters = (Map) eventOptions.get("parameters");
        parameters.put(scroller.getClientId(context), value);
        function.addParameter(eventOptions);
        StringBuffer buffer = new StringBuffer();
        function.appendScript(buffer);
        buffer.append("; return false;");
        String script = buffer.toString();
View Full Code Here

        return (scroller.getPageCount(dataTable) != 1 || scroller.isRenderIfSinglePage());
    }

    public void doDecode(FacesContext context, UIComponent component) {

        UIDatascroller scroller = (UIDatascroller) component;

        if (isRenderedOnSinglePage(scroller, scroller.getDataTable())) {
            String param = (String) getParamMap(context).get(
                    component.getClientId(context));
            if (param != null) {
                DataScrollerEvent event = new DataScrollerEvent(scroller,
                        String.valueOf(scroller.getPageIndex()), param);
                if (scroller.isImmediate()) {
                    event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                } else {
                    event.setPhaseId(PhaseId.INVOKE_APPLICATION);
                }
View Full Code Here

    }

    public void renderPager(FacesContext context, UIComponent component, UIData data)
            throws IOException {
        ResponseWriter out = context.getResponseWriter();
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = scroller.getPageIndex(data);

        int maxPages = scroller.getMaxPages();
        if (maxPages <= 1) {
            maxPages = 1;
        }
        int pageCount = scroller.getPageCount(data);
        if (pageCount <= 1) {
            return;
        }

        int delta = maxPages / 2;

        int pages;
        int start;
        if (pageCount > maxPages && currentPage > delta) {
            pages = maxPages;
            start = currentPage - pages / 2 - 1;
            if (start + pages > pageCount) {
                start = pageCount - pages;
            }
        } else {
            pages = pageCount < maxPages ? pageCount : maxPages;
            start = 0;
        }

        for (int i = start, size = start + pages; i < size; i++) {

            boolean isCurrentPage = (i + 1 == currentPage);
            String styleClass;
            String style;
      if (isCurrentPage) {
          styleClass = scroller.getSelectedStyleClass();
          style = scroller.getSelectedStyle();
      } else {
        styleClass = scroller.getInactiveStyleClass();
          style = scroller.getInactiveStyle();
      }
      if (styleClass==null){
          styleClass="";
      }
View Full Code Here

    }

    public void renderPages(FacesContext context, UIComponent component, UIData data)
            throws IOException {
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = scroller.getPageIndex(data);

        int pageCount = scroller.getPageCount(data);
        if (pageCount <= 1) {
            pageCount = 1;
        }
        String varName = (String) scroller.getAttributes().get("pageIndexVar");
        if (varName != null && varName.length() > 0) {
            context.getExternalContext()
                    .getRequestMap().put(varName, new Integer(currentPage));
        }
        varName = (String) scroller.getAttributes().get("pagesVar");
        if (varName != null && varName.length() > 0) {
            context.getExternalContext()
                    .getRequestMap().put(varName, new Integer(pageCount));
        }
    }
View Full Code Here

    //get UIParameter's Map
    protected Map getParameters(FacesContext context, UIComponent component){
      Map parameters = new HashMap();
     
      if(component instanceof UIDatascroller){
        UIDatascroller datascroller = (UIDatascroller)component;
        List children = datascroller.getChildren();
        for (Iterator iterator = children.iterator(); iterator.hasNext();) {
        UIComponent child = (UIComponent) iterator.next();
        if(child instanceof UIParameter) {
          UIParameter param = (UIParameter)child;
          String name = param.getName();
View Full Code Here

    public String getOnClick(FacesContext context, UIComponent component,
            String value) {

        JSFunction function = AjaxRendererUtils.buildAjaxFunction(component,
                context);
        UIDatascroller scroller = (UIDatascroller) component;
        Map eventOptions = AjaxRendererUtils.buildEventOptions(context,
                component);
        Map parameters = (Map) eventOptions.get("parameters");
        parameters.put(scroller.getClientId(context), value);
       
        Map params = getParameters(context,component);
        if(!params.isEmpty()){
          parameters.putAll(params);
        }
View Full Code Here

TOP

Related Classes of org.richfaces.component.UIDatascroller

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.