package com.ecep.contract.util;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

import com.ecep.contract.service.SysConfService;

import javafx.beans.property.Property;
import javafx.scene.control.DatePicker;
import javafx.util.StringConverter;
import javafx.util.converter.LocalDateStringConverter;

public class LocalDateConfig extends AbstractConfigBounder<LocalDate> {

    public LocalDateConfig(String string) {
        super(string);
    }

    @Override
    public DatePicker getControl() {
        return (DatePicker) super.getControl();
    }

    @Override
    public StringConverter<LocalDate> getConverter() {
        StringConverter<LocalDate> converter = super.getConverter();
        if (converter == null) {
            converter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
            setConverter(converter);
        }
        return converter;
    }

    @Override
    void bindBidirectional(Property<LocalDate> property) {
        getControl().valueProperty().bindBidirectional(property);
    }

    @Override
    public void setConfService(SysConfService confService) {
        // TODO Auto-generated method stub
        throw new UnsupportedOperationException("Unimplemented method 'setConfService'");
    }

}