Package org.xulfaces.component.listbox

Examples of org.xulfaces.component.listbox.DataListBoxComponent


 
  private static final Log log = LogFactory.getLog(DataListBoxRenderer.class);

  public void decode(FacesContext facesContext, UIComponent component) {

    DataListBoxComponent listBoxComponent = (DataListBoxComponent) component;
    listBoxComponent.setSelectedRows(null);

    if (isSubmitted(facesContext, component)) {

      Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
      String clientId = component.getClientId(facesContext);

      String selection = (String) paramMap.get(clientId);
     
      if(log.isDebugEnabled()){
        log.debug("DataListBoxComponent " + component.getId() + " selection is " + selection);
      }
     
      if ((selection != null) && (selection.length() > 0)) {

        String selections[] = selection.split(" ");
        if (selections != null) {
          List<Integer> selectedRows = new ArrayList<Integer>();
          for(int i= 0; i < selections.length;i++){
            String rowId = selections[i];
            int lastIndex = rowId.lastIndexOf(":");
            if(lastIndex != -1){
              int rowIndex = Integer.parseInt(rowId.substring(lastIndex+1));
              listBoxComponent.setRowIndex(rowIndex);
              if(listBoxComponent.isRowAvailable()){
                selectedRows.add(rowIndex);
              }
            }
          }
          listBoxComponent.setSelectedRows(selectedRows);           
        }
      }     
    }
  }       
View Full Code Here


    ResponseWriter responseWriter = facesContext.getResponseWriter();
    responseWriter.endElement("listbox");
  }

  public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
    DataListBoxComponent listBoxComponent = (DataListBoxComponent) component;     
    encodeListHead(facesContext,listBoxComponent);
    encodeListCols(facesContext,listBoxComponent);
    encodeListItem(facesContext,listBoxComponent);           
  }
View Full Code Here

TOP

Related Classes of org.xulfaces.component.listbox.DataListBoxComponent

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.