💄 Prepare view

main
Alexis Drai 3 years ago
parent 88be7b00fb
commit 3505f380ec

@ -1,11 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml">
<center>
<ListView fx:id="promLV"/>
</center>
<bottom>
<HBox>
<Button text="add student" onAction="#clickAddStudent"/>
<Button text="remove student" onAction="#clickRemoveStudent"/>
<Button text="QUIT" onAction="#clickQuit"/>
</HBox>
</bottom>
<right>
<VBox>
<HBox>
<Label text="last name: "/>
<TextField fx:id="lastnameTF"/>
</HBox>
<HBox>
<Label text="first name: "/>
<TextField fx:id="firstnameTF"/>
</HBox>
</VBox>
</right>
</BorderPane>

@ -1,11 +1,42 @@
package view;
import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import viewmodel.PromotionVM;
import viewmodel.StudentVM;
public class MainWindow {
@FXML
private ListView<StudentVM> promLV;
@FXML
private TextField lastnameTF;
@FXML
private TextField firstnameTF;
@FXML
private void clickAddStudent() {
VM.addStudent();
}
@FXML
private void clickRemoveStudent() {
VM.removeStudent(promLV.getSelectionModel().getSelectedItem());
}
@FXML
private void clickQuit() {
lastnameTF.getScene().getWindow().hide();
}
private final PromotionVM VM;
public MainWindow(PromotionVM VM) {
this.VM = VM;
}
@FXML
private void initialize() {
}
}

@ -17,4 +17,12 @@ public class PromotionVM {
public Promotion getModel() {
return model;
}
public void addStudent(StudentVM toAdd) {
}
public void addStudent() { addStudent(new StudentVM()); }
public void removeStudent(StudentVM toRemove) {
}
}

Loading…
Cancel
Save