package com.ecep.contract.controller.vendor.approved_list;

import java.time.LocalDate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ecep.contract.controller.AbstManagerWindowController;
import com.ecep.contract.model.CompanyVendorApprovedList;
import com.ecep.contract.service.CompanyVendorApprovedListService;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;

import javafx.event.ActionEvent;
import javafx.scene.control.TableColumn;
import javafx.stage.WindowEvent;

/**
 *
 */
@Lazy
@Scope("prototype")
@Component
@FxmlPath("/ui/company/vendor/vendor_approved_list_manager.fxml")
public class CompanyVendorApprovedListManagerWindowController
        extends AbstManagerWindowController<CompanyVendorApprovedList, CompanyVendorApprovedListViewModel, CompanyVendorApprovedListManagerSkin> {

    public TableColumn<CompanyVendorApprovedListViewModel, Number> idColumn;
    public TableColumn<CompanyVendorApprovedListViewModel, String> titleColumn;
    public TableColumn<CompanyVendorApprovedListViewModel, LocalDate> publishDateColumn;
    public TableColumn<CompanyVendorApprovedListViewModel, String> descriptionColumn;

    @Autowired
    private CompanyVendorApprovedListService service;

    @Override
    protected CompanyVendorApprovedListManagerSkin createDefaultSkin() {
        CompanyVendorApprovedListManagerSkin skin = new CompanyVendorApprovedListManagerSkin(this);
        skin.setService(service);
        return skin;
    }

    @Override
    public void onShown(WindowEvent windowEvent) {
        super.onShown(windowEvent);
        getTitle().set("供应商名录管理");
    }

    @Override
    public CompanyVendorApprovedListService getViewModelService() {
        return service;
    }


    public void onCreateNewAction(ActionEvent event) {
        getSkin().onTableCreateNewAction(event);
    }
}
