package com.ecep.contract.controller.table.cell;

import static com.ecep.contract.SpringApp.getBean;

import com.ecep.contract.SpringApp;
import com.ecep.contract.service.CustomerCatalogService;
import com.ecep.contract.vo.CustomerCatalogVo;

import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public class CustomerCatalogTableCell<T> extends AsyncUpdateTableCell<T, Integer, CustomerCatalogVo> {
    public CustomerCatalogTableCell(CustomerCatalogService service) {
        setService(service);
    }

    @Override
    protected CustomerCatalogService getServiceBean() {
        return SpringApp.getBean(CustomerCatalogService.class);
    }
    
    public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn() {
        return forTableColumn(getBean(CustomerCatalogService.class));
    }

    public static <S> Callback<TableColumn<S, Integer>, TableCell<S, Integer>> forTableColumn(CustomerCatalogService service) {
        return param -> new CustomerCatalogTableCell<S>(service);
    }

}