Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.cdlflex.ui.markup.html.repeater.data.table;
A PropertyConvertingColumn that lets you explicitly state a date transformation using a DateFormat.

Parameters:
<T> The Model object type
<S> The type of the sort property
public class DatePropertyColumn<T, S> extends PropertyConvertingColumn<T, S, Date> {
    private static final long serialVersionUID = 1L;

    
The date format used to convert the date
    private DateFormat dateFormat;
    public DatePropertyColumn(IModel<StringdisplayModelString propertyExpression) {
        super(displayModelpropertyExpression);
        setConverter(new DateConverter0());
    }
    public DatePropertyColumn(IModel<StringdisplayModel, S sortPropertyString propertyExpression) {
        super(displayModelsortPropertypropertyExpression);
        setConverter(new DateConverter0());
    }
    public DatePropertyColumn(IModel<StringdisplayModelString propertyExpressionDateFormat dateFormat) {
        super(displayModelpropertyExpression);
        setConverter(new DateConverter0());
        setDateFormat(dateFormat);
    }
    public DatePropertyColumn(IModel<StringdisplayModel, S sortPropertyString propertyExpression,
            DateFormat dateFormat) {
        super(displayModelsortPropertypropertyExpression);
        setConverter(new DateConverter0());
        setDateFormat(dateFormat);
    }

    
Sets the DateFormat being used to display the date.

Parameters:
dateFormat a DateFormat
    public void setDateFormat(DateFormat dateFormat) {
        this. = dateFormat;
    }

    
Returns the DateFormat being used to display the date.

Returns:
a DateFormat
    public DateFormat getDateFormat() {
        return ;
    }

    
DateConverter that ignores the Locale and prefers the DateFormat set in this DatePropertyColumn instance.
    private class DateConverter0 extends DateConverter {
        private static final long serialVersionUID = 1L;
        @Override
        public DateFormat getDateFormat(Locale locale) {
            return ( == null) ? super.getDateFormat(locale) : DatePropertyColumn.this.getDateFormat();
        }
    }
New to GrepCode? Check out our FAQ X