Package org.primefaces.component.column

Examples of org.primefaces.component.column.Column


          writer.startElement("tr", null);
          writer.writeAttribute("class", "ui-widget-header", null);

          for (UIComponent headerRowChild : headerRow.getChildren()) {
            if (headerRowChild.isRendered() && headerRowChild instanceof Column) {
              Column footerColumn = (Column) headerRowChild;
                            encodeFacetColumn(context, table, footerColumn, "header", DataTable.COLUMN_HEADER_CLASS, footerColumn.getHeaderText());
            }
          }

          writer.endElement("tr");
        }
View Full Code Here


        writer.startElement("tr", null);
        writer.writeAttribute("class", "ui-widget-header", null);

        for (UIComponent footerRowChild : footerRow.getChildren()) {
          if (footerRowChild.isRendered() && footerRowChild instanceof Column) {
                        Column footerColumn = (Column) footerRowChild;
                        encodeFacetColumn(context, table, footerColumn, "footer", DataTable.COLUMN_FOOTER_CLASS, footerColumn.getFooterText());
          }
        }

        writer.endElement("tr");
      }
View Full Code Here

                    writer.endElement("td");
                }
                       
                for(UIComponent kid : pickList.getChildren()) {
                    if(kid instanceof Column && kid.isRendered()) {
                        Column column = (Column) kid;

                        writer.startElement("td", null);
                        if(column.getStyle() != null) writer.writeAttribute("style", column.getStyle(), null);
                        if(column.getStyleClass() != null) writer.writeAttribute("class", column.getStyleClass(), null);

                        renderChildren(context, column);
                        writer.endElement("td");
                    }
                }
View Full Code Here

            for(UIComponent child : group.getChildren()) {
               Row headerRow = (Row) child;
              
               if(headerRow.isRendered()) {
                   for(UIComponent headerRowChild : headerRow.getChildren()) {
                      Column column= (Column) headerRowChild;

                      if(column.isRendered() && column.getValueExpression("filterBy") != null) {
                         filterMap.put(column.getClientId(FacesContext.getCurrentInstance()) + "_filter", column);
                      }
                   }
               }
            }
         } else {
            //single header row
            for(Column column : getColumns()) {
               if(column.getValueExpression("filterBy") != null) {
                  filterMap.put(column.getClientId(FacesContext.getCurrentInstance()) + "_filter", column);
               }
            }
         }
      }
View Full Code Here

                wrapperEvent = new PageEvent(this, behaviorEvent.getBehavior(), this.getPage());
                wrapperEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
            }
            else if(eventName.equals("sort")) {
                boolean asc = Boolean.valueOf(params.get(clientId + "_sortDir"));
                Column sortColumn = findColumn(params.get(clientId + "_sortKey"));

                wrapperEvent = new SortEvent(this, behaviorEvent.getBehavior(), sortColumn, asc);
                wrapperEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
            }
            else if(eventName.equals("filter")) {
View Full Code Here

        writer.endElement("th");
       
        int columnIndex = 0;
        for(UIComponent child : sheet.getChildren()) {
            if(child instanceof Column && child.isRendered()) {
                Column column = (Column) child;
                boolean sortable = column.getValueExpression("sortBy") != null;
               
                String style = column.getStyle();
                String styleClass = column.getStyleClass();
                styleClass = styleClass == null ? Sheet.CELL_CLASS : Sheet.CELL_CLASS  + " " + styleClass;
               
                String columnHeaderClass = sortable ? Sheet.COLUMN_HEADER_CLASS + " " + Sheet.SORTABLE_COLUMN : Sheet.COLUMN_HEADER_CLASS;
       
                writer.startElement("th", null);
                writer.writeAttribute("id", column.getClientId(context), style);
                writer.writeAttribute("class", columnHeaderClass, null);

                writer.startElement("div", null);
                writer.writeAttribute("class", styleClass, null);
                if(style != null) {
                    writer.writeAttribute("style", style, null);
                }
               
                if(sortable) {
                    writer.startElement("span", null);
                    writer.writeAttribute("class", Sheet.SORTABLE_COLUMN_ICON, null);
                    writer.endElement("span");
                }
               
                writer.write(Sheet.LETTERS[columnIndex]);

                writer.endElement("th");
               
                columnIndex++;
            }
        }
       
        writer.endElement("tr");
        writer.endElement("thead");
       
        //frozen headers
        writer.startElement("tbody", null);
        writer.startElement("tr", null);
        writer.writeAttribute("class", Sheet.ROW_CLASS, null);
       
        //index column header
        writer.startElement("td", null);
        writer.writeAttribute("class", Sheet.COLUMN_HEADER_CLASS, null);
        writer.startElement("div", null);
        writer.writeAttribute("class", Sheet.INDEX_CELL_CLASS, null);
        writer.write("1");
        writer.endElement("div");
        writer.endElement("td");
       
        for(UIComponent child : sheet.getChildren()) {
            if(child instanceof Column && child.isRendered()) {
                Column column = (Column) child;
                String style = column.getStyle();
                String styleClass = column.getStyleClass();
                styleClass = styleClass == null ? Sheet.CELL_CLASS : Sheet.CELL_CLASS  + " " + styleClass;
       
                writer.startElement("td", null);

                writer.startElement("div", null);
                writer.writeAttribute("class", styleClass, null);
                if(style != null) {
                    writer.writeAttribute("style", style, null);
                }
               
                if(column.getHeader() != null) {
                    column.getHeader().encodeAll(context);
                } else if(column.getHeaderText() != null) {
                    writer.write(column.getHeaderText());
                }

                writer.endElement("div");
               
                writer.endElement("td");
View Full Code Here

        writer.endElement("div");
        writer.endElement("td");
       
        for(UIComponent child : sheet.getChildren()) {
            if(child instanceof Column && child.isRendered()) {
                Column column = (Column) child;
                String style = column.getStyle();
                String styleClass = column.getStyleClass();
                styleClass = styleClass == null ? Sheet.CELL_CLASS : Sheet.CELL_CLASS  + " " + styleClass;
       
                writer.startElement("td", null);

                writer.startElement("div", null);
View Full Code Here

        String clientId = table.getClientId(context);
    Map<String,String> params = context.getExternalContext().getRequestParameterMap();
       
    String sortKey = params.get(clientId + "_sortKey");
    String sortDir  = params.get(clientId + "_sortDir");
        Column sortColumn = null;

        ColumnGroup group = table.getColumnGroup("header");
        if(group != null) {
            outer:
            for (UIComponent child : group.getChildren()) {
                Row headerRow = (Row) child;
                for (UIComponent headerRowChild : headerRow.getChildren()) {
                    Column column = (Column) headerRowChild;
                    if (column.getClientId(context).equals(sortKey)) {
                        sortColumn = column;
                        break outer;
                    }
                }
            }
        } else {
            //single header row
            for (Column column : table.getColumns()) {
                if (column.getClientId(context).equals(sortKey)) {
                    sortColumn = column;
                    break;
                }
            }
        }
View Full Code Here

    protected void sort(FacesContext context, Sheet sheet) {
        Map<String,String> params = context.getExternalContext().getRequestParameterMap();
        Object value = sheet.getValue();
        List list = null;
        String clientId = sheet.getClientId(context);
        Column sortColumn = sheet.findColumn(params.get(clientId + "_sortKey"));
        ValueExpression sortByVE = sortColumn.getValueExpression("sortBy");
        SortOrder sortOrder = SortOrder.valueOf(params.get(clientId + "_sortDir"));

        if(value instanceof List) {
            list = (List) value;
        } else if(value instanceof ListDataModel) {
View Full Code Here

        if(table.isLazy()) {
            Map<String,String> filters = new HashMap<String, String>();
            Map<String,Column> filterMap = table.getFilterMap();

            for(String filterName : filterMap.keySet()) {
                Column column = filterMap.get(filterName);
                String filterValue = params.get(filterName);

                if(!isValueBlank(filterValue)) {
                    String filterField = resolveField(column.getValueExpression("filterBy"));
                   
                    filters.put(filterField, filterValue);
                }
            }

            table.setFilters(filters);
        }
        else {
            Map<String,Column> filterMap = table.getFilterMap();
            List filteredData = new ArrayList();

            String globalFilter = params.get(clientId + UINamingContainer.getSeparatorChar(context) + "globalFilter");
            boolean hasGlobalFilter = !isValueBlank(globalFilter);
            if(hasGlobalFilter) {
                globalFilter = globalFilter.toLowerCase();
            }

            for(int i = 0; i < table.getRowCount(); i++) {
                table.setRowIndex(i);
                boolean localMatch = true;
                boolean globalMatch = false;

                for(String filterName : filterMap.keySet()) {
                    Column column = filterMap.get(filterName);
                    String columnFilter = params.get(filterName).toLowerCase();
                    String columnValue = String.valueOf(column.getValueExpression("filterBy").getValue(context.getELContext()));

                    if(hasGlobalFilter && !globalMatch) {
                        if(columnValue != null && columnValue.toLowerCase().contains(globalFilter))
                            globalMatch = true;
                    }

                    if(isValueBlank(columnFilter)) {
                        localMatch = true;
                    }
                    else if(columnValue == null || !column.getFilterConstraint().applies(columnValue.toLowerCase(), columnFilter)) {
                        localMatch = false;
                        break;
                    }

                }
View Full Code Here

TOP

Related Classes of org.primefaces.component.column.Column

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.