Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright ${year}, Red Hat, Inc. and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.richfaces.component;
 
 
 import  javax.faces.context.FacesContext;
 
 import  org.richfaces.application.configuration.ConfigurationServiceHelper;
 import  org.richfaces.model.Filter;
 import  org.richfaces.model.FilterField;
 import  org.richfaces.model.SortField;

The <rich:column> component facilitates columns in a table. It supports merging columns and rows, sorting, filtering, and customized skinning.

Author(s):
Anton Belevich
 
         @Facet(name = "header", description = @Description("Column header")),
         @Facet(name = "footer", description = @Description("Column footer")) }, generate = "org.richfaces.component.UIColumn", tag = @Tag(name = "column"))
 public abstract class AbstractColumn extends javax.faces.component.UIColumn implements Column {
     public static final String COMPONENT_TYPE = "org.richfaces.Column";
     public static final String COMPONENT_FAMILY = "org.richfaces.Column";
     private static Boolean builtInSortControlsEnabled;
     private static Boolean builtInFilterControlsEnabled;

    
if "true" next column begins from the first row
 
     @Attribute
     public abstract boolean isBreakRowBefore();

    
Defines order which will be used for sorting column: unsorted (default), ascending, descending
 
     @Attribute
     public abstract SortOrder getSortOrder();

    
Provides Filter instance which determines if given row value will be displayed.
 
     @Attribute
     public abstract Filter<?> getFilter();

    
Defines current filtering value
 
     @Attribute
     public abstract Object getFilterValue();

    
Defines current filter type. Possible values: string, custom. If custom is used, no filter box is created, you are responsible for e creating your own filter input Default: string
 
     @Attribute(defaultValue = "string")
     public abstract String getFilterType();

    
The message to be displayed when the filter expression is not able to be evaluated using the provided filter value.
 
     @Attribute
     public abstract String getFilterConverterMessage();

    
The submitted filter value. Set when the evaluation of the filter expression fails.
 
     @Attribute(hidden = true)
     public abstract String getSubmittedFilterValue();

    
Defines current filtering value. Possible values: string, custom. If custom is used, no filter box is created, you are responsible for e creating your own filter input Default: string
    @Attribute(defaultValue = "string")
    public abstract String getSortType();

    
Corresponds to the HTML rowspan attribute
    @Attribute
    public abstract int getRowspan();

    
Corresponds to the HTML colspan attribute
    @Attribute
    public abstract int getColspan();

    
Defines value binding to the comparator that is used to compare the values
    @Attribute
    public abstract Comparator<?> getComparator();

    
Defines EL expression which returns true if given row should be displayed (EL expressions should use variable defined in filterVar attribute of dataTable)
    @Attribute
    public abstract Object getFilterExpression();

    
Defines a bean property which is used for sorting of a column.
    @Attribute
    public abstract Object getSortBy();

    
Assigns one or more space-separated CSS class names to any footer generated for this component
    @Attribute
    public abstract String getFooterClass();

    
Assigns one or more space-separated CSS class names to any header generated for this component
    @Attribute
    public abstract String getHeaderClass();

    
Attribute defines width of column.
    @Attribute
    public abstract String getWidth();

    
CSS style rules to be applied to the component
    @Attribute
    public abstract String getStyle();

    
Assigns one or more CSS class names to the component. Corresponds to the HTML "class" attribute.
    @Attribute
    public abstract String getStyleClass();
    public FilterField getFilterField() {
        FilterField field = null;
        Filter<?> filter = getFilter();
        ValueExpression filterExpression = getValueExpression("filterExpression");
        if (filter != null || filterExpression != null) {
            field = new FilterField(filterExpressionfiltergetFilterValue());
        }
        return field;
    }
    public SortField getSortField() {
        SortField field = null;
        SortOrder sortOrder = getSortOrder();
        if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
            Comparator<?> comparator = getComparator();
            ValueExpression sortBy = getValueExpression("sortBy");
            if (comparator != null || sortBy != null) {
                field = new SortField(sortBycomparatorsortOrder);
            }
        }
        return field;
    }
    public boolean useBuiltInFilter() {
        return isBuiltInFilterControlsEnabled() && getFilterField() != null &&  ! "custom".equals(getFilterType());
    }
    public boolean useBuiltInSort() {
        return isBuiltInSortControlsEnabled() && getValueExpression("sortBy") != null && ! "custom".equals(getSortType());
    }
    public static boolean isBuiltInSortControlsEnabled(){
        if(== null){
            FacesContext context = FacesContext.getCurrentInstance();
             =  ConfigurationServiceHelper.getBooleanConfigurationValue(context..);
        }
    }
    public static boolean isBuiltInFilterControlsEnabled(){
        if(== null){
            FacesContext context = FacesContext.getCurrentInstance();
             =  ConfigurationServiceHelper.getBooleanConfigurationValue(context..);
        }
    }
New to GrepCode? Check out our FAQ X