Refactor
This commit is contained in:
parent
d41abdbad9
commit
2fbf3895c5
@ -2,7 +2,8 @@ package main;
|
||||
|
||||
import config.Config;
|
||||
import config.ConfigLoader;
|
||||
import helper.SvgBtnCreator;
|
||||
import ui.DayPane;
|
||||
import ui.SvgBtnCreator;
|
||||
import helper.HttpRequestException;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
@ -151,28 +152,11 @@ public class MainController {
|
||||
|
||||
private void createWeek() {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
Label label = new Label();
|
||||
label.setText(dayNames[i]);
|
||||
label.setMaxHeight(Double.MAX_VALUE);
|
||||
label.setMaxWidth(Double.MAX_VALUE);
|
||||
label.getStyleClass().add("labelDays");
|
||||
dayLabel[i] = label;
|
||||
calendarGrid.add(label, i, 0);
|
||||
|
||||
ScrollPane scrollPane = new ScrollPane();
|
||||
|
||||
VBox vBox = new VBox();
|
||||
vBox.getStyleClass().add("vBoxDays");
|
||||
vBox.setSpacing(10);
|
||||
dayVBoxes[i] = vBox;
|
||||
scrollPane.setContent(vBox);
|
||||
|
||||
scrollPane.setFitToWidth(true);
|
||||
scrollPane.setFitToHeight(true);
|
||||
scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
|
||||
scrollPane.getStyleClass().add("scrollDays");
|
||||
|
||||
calendarGrid.add(scrollPane, i, 1);
|
||||
DayPane dayPane = new DayPane(dayNames[i]);
|
||||
this.dayLabel[i] = dayPane.getDayLabel();
|
||||
calendarGrid.add(dayPane.getDayLabel(), i, 0);
|
||||
dayVBoxes[i] = dayPane.getDayVBox();
|
||||
calendarGrid.add(dayPane.getScrollPane(), i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
44
client/app/src/main/java/ui/DayPane.java
Normal file
44
client/app/src/main/java/ui/DayPane.java
Normal file
@ -0,0 +1,44 @@
|
||||
package ui;
|
||||
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
public class DayPane {
|
||||
|
||||
private Label dayLabel;
|
||||
private VBox dayVBox;
|
||||
private ScrollPane scrollPane;
|
||||
|
||||
public DayPane(String name) {
|
||||
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");
|
||||
}
|
||||
|
||||
public Label getDayLabel() {
|
||||
return dayLabel;
|
||||
}
|
||||
|
||||
public VBox getDayVBox() {
|
||||
return dayVBox;
|
||||
}
|
||||
|
||||
public ScrollPane getScrollPane() {
|
||||
return scrollPane;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package helper;
|
||||
package ui;
|
||||
|
||||
import javafx.geometry.Bounds;
|
||||
import javafx.scene.Group;
|
Loading…
Reference in New Issue
Block a user