package edu.spbstu.hoteldb.admin.panel;
import java.sql.SQLException;
import java.util.List;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import edu.spbstu.hoteldb.Main;
import edu.spbstu.hoteldb.interfaces.Panel;
import edu.spbstu.hoteldb.panels.PanelType;
public class RootPanel extends GridPane implements Panel {
@Override
public void create(List<Object> args) {
final Main main = (Main) args.get(1);
this.setHgap(50);
this.setVgap(50);
this.setPadding(new Insets(10, 10, 10, 10));
Label lwelcome = new Label("Welcome to admin panel!");
Button btnfin = new Button("Finance");
btnfin.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
main.setPanel(PanelType.FinancePanel, null);
}
});
Button btnpers = new Button("Personnel");
btnpers.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
main.setPanel(PanelType.PersonnelPanel, null);
}
});
Button btnstat = new Button("Statistics");
btnstat.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
main.setPanel(PanelType.StatisticsPanel, null);
}
});
Button btnsearch = new Button("Search");
btnsearch.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
main.setPanel(PanelType.RootSearchPanel, null);
}
});
int w = 200;
btnfin.setMaxWidth(w);
btnpers.setMaxWidth(w);
btnstat.setMaxWidth(w);
btnsearch.setMaxWidth(w);
this.add(lwelcome, 0, 0);
this.add(btnfin, 0, 1);
this.add(btnpers, 0, 2);
this.add(btnstat, 0, 3);
this.add(btnsearch, 0, 4);
}
@Override
public void connect() throws ClassNotFoundException, SQLException {
}
@Override
public void close() throws SQLException {
}
}