/*
 * Copyright 2012 s_wolff.
 *
 * 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.aegee.runanddine.util.forms;

import java.io.Serializable;
import java.util.Date;

import org.aegee.runanddine.util.forms.behaviours.CssDateFieldResizer;
import org.aegee.runanddine.util.forms.behaviours.DatePicker;

/**
 * Class providing a date field based on a text field.
 *
 * @author s_wolff
 * @see TextField
 */
public class DateField<T extends Serializable> extends TextField<T> {

    /**
     * Create a new date field for date input. Date picker and date validators
     * are added automatically.
     *
     * @param id the component markup id
     * @param obj the object that backens the form field
     * @param fieldName the field name of the object that backens the form field
     * @param labelText the label text that shall be displayed for this field
     * @param required whether this field is required or optional
     */
    public DateField(String id, T obj, String fieldName, String labelText, boolean required) {
        super(id, obj, fieldName, labelText, required);
        super.addInputBehaviour(new CssDateFieldResizer(), new DatePicker());
    }
}
