package com.its.pis.ui;

import com.its.pis.entity.TbVdsCtlr;

import javax.swing.*;
import java.awt.*;

public class SubUIController extends JFrame {
    private SubUI view;
    private JFrame caller;

    public SubUIController(JFrame jFrame) {
        super("주차장 정보");
        String pathOfImage = "C:\\DEV\\ITS\\01.WINDOWS\\22.05.GUMI\\JAVA\\pis-comm-server\\src\\main\\resources\\static\\image\\application.png";
        setIconImage(Toolkit.getDefaultToolkit().getImage(pathOfImage));
        this.caller = jFrame;
        this.view = new SubUI() {
            @Override
            protected void actionButtonClicked() {
                doAction();
            }
        };
        this.setContentPane(view.$$$getRootComponent$$$());
        this.setDefaultCloseOperation(HIDE_ON_CLOSE);
        this.pack();
    }

    private void doAction() {
        this.view.updateInfo(null);
        this.setVisible(false);
        caller.validate();
    }

    public void updateInfo(TbVdsCtlr selObj) {
        this.view.updateInfo(selObj);
    }
}
