Package org.richfaces.component

Examples of org.richfaces.component.UIDatascroller


  public static UIDataScroller buildDatascroller(
      String dyn_datascroller)
  {
    Application application = FacesContext.getCurrentInstance().getApplication();

    UIDataScroller datascroller = (UIDataScroller) application.createComponent(UIDataScroller.COMPONENT_TYPE);
   
    datascroller.setId(dyn_datascroller);
    datascroller.setTransient(true);
   
    return datascroller;
  }
View Full Code Here


    public void doDecode(FacesContext context, UIComponent component) {
      Map paramMap = getParamMap(context);
      String clientId = component.getClientId(context);
      String param = (String) paramMap.get(clientId);
      if (param != null) {
        UIDatascroller scroller = (UIDatascroller) component;
        int newPage = scroller.getPageForFacet(param);
        int page = scroller.getPage();
        if (newPage != 0 && newPage != page) {
          DataScrollerEvent event = new DataScrollerEvent(scroller,
              String.valueOf(page), param, newPage);
          event.queue();
View Full Code Here

    }

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

        int maxPages = scroller.getMaxPages();
        if (maxPages <= 1) {
            maxPages = 1;
        }
       
        int pageCount = count;
        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

  return "Event.fire(this, 'rich:datascroller:onscroll', {'page': '" + string + "'});";
    }

    public void renderPages(FacesContext context, UIComponent component, int pageIndex, int count)
            throws IOException {
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = pageIndex;

        int pageCount = count;
        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 void doDecode(FacesContext context, UIComponent component) {
      Map paramMap = getParamMap(context);
      String clientId = component.getClientId(context);
      String param = (String) paramMap.get(clientId);
      if (param != null) {
        UIDatascroller scroller = (UIDatascroller) component;
        int newPage = scroller.getPageForFacet(param);
        int page = scroller.getPage();
        if (newPage != 0 && newPage != page) {
          DataScrollerEvent event = new DataScrollerEvent(scroller,
              String.valueOf(page), param, newPage);
          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, int pageIndex, int count)
            throws IOException {
        ResponseWriter out = context.getResponseWriter();
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = pageIndex;

        int maxPages = scroller.getMaxPages();
        if (maxPages <= 1) {
            maxPages = 1;
        }
       
        int pageCount = count;
        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

  return "Event.fire(this, 'rich:datascroller:onscroll', {'page': '" + string + "'});";
    }

    public void renderPages(FacesContext context, UIComponent component, int pageIndex, int count)
            throws IOException {
        UIDatascroller scroller = (UIDatascroller) component;
        int currentPage = pageIndex;

        int pageCount = count;
        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

        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

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.