Refactored DayPane;
This commit is contained in:
parent
31dbeec55a
commit
d980edeaad
@ -137,17 +137,18 @@ public class MainController {
|
||||
|
||||
private void createWeek() {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
DayPane dayPane = new DayPane(dayNames[i]);
|
||||
DayPane dayPane = new DayPane();
|
||||
this.dayLabel[i] = dayPane.getDayLabel();
|
||||
calendarGrid.add(dayPane.getDayLabel(), i, 0);
|
||||
dayVBoxes[i] = dayPane.getDayVBox();
|
||||
calendarGrid.add(dayPane.getScrollPane(), i, 1);
|
||||
calendarGrid.add(dayPane, i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void addEvent(Event event) {
|
||||
EventPane eventPane = new EventPane(event);
|
||||
eventPane.getEditBtn().setOnAction(event1 -> MainApplication.loadScene(
|
||||
eventPane.getEditBtn().setOnAction(event1 -> {
|
||||
MainApplication.loadScene(
|
||||
"Termin bearbeiten",
|
||||
"edit-event.fxml",
|
||||
"create-event.css",
|
||||
@ -157,7 +158,9 @@ public class MainController {
|
||||
EditEventController editEventController = fxmlLoader.getController();
|
||||
editEventController.setCurrentEvent(event);
|
||||
}
|
||||
));
|
||||
);
|
||||
updateEvents();
|
||||
});
|
||||
|
||||
eventPane.getDeleteBtn().setOnAction(e -> {
|
||||
DataController dataController = new DataController();
|
||||
|
@ -4,30 +4,28 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
public class DayPane {
|
||||
public class DayPane extends ScrollPane {
|
||||
|
||||
private Label dayLabel;
|
||||
private VBox dayVBox;
|
||||
private ScrollPane scrollPane;
|
||||
private final Label dayLabel;
|
||||
private final VBox dayVBox;
|
||||
|
||||
public DayPane(String name) {
|
||||
public DayPane() {
|
||||
dayLabel = new Label();
|
||||
dayLabel.setText(name);
|
||||
dayLabel.setMaxHeight(Double.MAX_VALUE);
|
||||
dayLabel.setMaxWidth(Double.MAX_VALUE);
|
||||
dayLabel.getStyleClass().add("labelDays");
|
||||
|
||||
scrollPane = new ScrollPane();
|
||||
|
||||
dayVBox = new VBox();
|
||||
|
||||
dayVBox.getStyleClass().add("vBoxDays");
|
||||
dayVBox.setSpacing(10);
|
||||
scrollPane.setContent(dayVBox);
|
||||
|
||||
scrollPane.setFitToWidth(true);
|
||||
scrollPane.setFitToHeight(true);
|
||||
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
|
||||
scrollPane.getStyleClass().add("scrollDays");
|
||||
setContent(dayVBox);
|
||||
setFitToWidth(true);
|
||||
setFitToHeight(true);
|
||||
setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
|
||||
getStyleClass().add("scrollDays");
|
||||
getStyleClass().add("scrollDays");
|
||||
}
|
||||
|
||||
public Label getDayLabel() {
|
||||
@ -37,8 +35,4 @@ public class DayPane {
|
||||
public VBox getDayVBox() {
|
||||
return dayVBox;
|
||||
}
|
||||
|
||||
public ScrollPane getScrollPane() {
|
||||
return scrollPane;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user