/*
 * ICESOFT COMMERCIAL SOURCE CODE LICENSE V 1.1
 *
 * The contents of this file are subject to the ICEsoft Commercial Source
 * Code License Agreement V1.1 (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.icesoft.com/license/commercial-source-v1.1.html
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations under
 * the License.
 *
 * Copyright 2009-2015 ICEsoft Technologies Canada, Corp. All Rights Reserved.
 */
package com.icesoft.faces.facelets.component.table.richdatagrid;

import javax.faces.convert.DateTimeConverter;
import java.util.TimeZone;

public class RichDataDateColumn extends BaseRichDataColumn {

    private DateTimeConverter dateTimeConverter;

    public RichDataDateColumn(String property, String title, boolean editable, boolean moveable,
                              boolean shownByDefault, boolean sortable, DateTimeConverter dateTimeConverter) {
        super(property, title, COLUMN_TYPE_DATE, editable, moveable, shownByDefault, sortable, false, true);
        this.dateTimeConverter = dateTimeConverter;
        init();
    }

    public RichDataDateColumn(String property, String title, boolean editable, boolean moveable,
                              boolean shownByDefault, boolean sortable, DateTimeConverter dateTimeConverter, boolean hideable) {
        super(property, title, COLUMN_TYPE_DATE, editable, moveable, shownByDefault, sortable, false, hideable);
        this.dateTimeConverter = dateTimeConverter;
        init();
    }

    public RichDataDateColumn(String property, String title, DateTimeConverter dateTimeConverter) {
        super(property, title, COLUMN_TYPE_DATE);
        init();
    }

    public RichDataDateColumn(String property, String title) {
        super(property, title, COLUMN_TYPE_DATE);
        this.dateTimeConverter = new DateTimeConverter();
        this.dateTimeConverter.setDateStyle("short");
        init();
    }

    private void init() {
        width = "135px";
        filterable = false;
    }


    public DateTimeConverter getDateTimeConverter() {
        return dateTimeConverter;
    }

    public TimeZone getDefaultTimeZone() {
        return TimeZone.getDefault();
    }


}
