Refactor
This commit is contained in:
		| @@ -2,7 +2,8 @@ package main; | |||||||
|  |  | ||||||
| import config.Config; | import config.Config; | ||||||
| import config.ConfigLoader; | import config.ConfigLoader; | ||||||
| import helper.SvgBtnCreator; | import ui.DayPane; | ||||||
|  | import ui.SvgBtnCreator; | ||||||
| import helper.HttpRequestException; | import helper.HttpRequestException; | ||||||
| import javafx.fxml.FXML; | import javafx.fxml.FXML; | ||||||
| import javafx.fxml.FXMLLoader; | import javafx.fxml.FXMLLoader; | ||||||
| @@ -151,28 +152,11 @@ public class MainController { | |||||||
|  |  | ||||||
|     private void createWeek() { |     private void createWeek() { | ||||||
|         for (int i = 0; i < 7; i++) { |         for (int i = 0; i < 7; i++) { | ||||||
|             Label label = new Label(); |             DayPane dayPane = new DayPane(dayNames[i]); | ||||||
|             label.setText(dayNames[i]); |             this.dayLabel[i] = dayPane.getDayLabel(); | ||||||
|             label.setMaxHeight(Double.MAX_VALUE); |             calendarGrid.add(dayPane.getDayLabel(), i, 0); | ||||||
|             label.setMaxWidth(Double.MAX_VALUE); |             dayVBoxes[i] = dayPane.getDayVBox(); | ||||||
|             label.getStyleClass().add("labelDays"); |             calendarGrid.add(dayPane.getScrollPane(), i, 1); | ||||||
|             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); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										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.geometry.Bounds; | ||||||
| import javafx.scene.Group; | import javafx.scene.Group; | ||||||
		Reference in New Issue
	
	Block a user