package com.ecep.contract.controller.permission;

import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.model.Function;
import com.ecep.contract.vm.FunctionViewModel;

import javafx.scene.control.Tab;

public class FunctionTabSkinBase
        extends AbstEntityBasedTabSkin<FunctionWindowController, Function, FunctionViewModel> {

    public FunctionTabSkinBase(FunctionWindowController controller) {
        super(controller);
    }

    @Override
    public Tab getTab() {
        return controller.baseInfoTab;
    }

    @Override
    public void initializeTab() {
        // 绑定UI元素与viewModel的属性
        controller.nameField.textProperty().bindBidirectional(viewModel.getName());
        controller.keyField.textProperty().bindBidirectional(viewModel.getKey());
        controller.controllerField.textProperty().bindBidirectional(viewModel.getController());
        controller.iconField.textProperty().bindBidirectional(viewModel.getIcon());
        controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
        controller.activeField.selectedProperty().bindBidirectional(viewModel.getActive());
    }
}