Skip to content

Commit

Permalink
Merge pull request #108 from marcus-ny/branch-fix-stretching-placehol…
Browse files Browse the repository at this point in the history
…ders-gui

Implement dynamic vbox grow properties
  • Loading branch information
Joseph31416 authored Apr 4, 2024
2 parents 2cdf8d3 + 3a5d05a commit f504e9d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void fillInnerParts() {
personListPanelPlaceholder.getChildren().add(personListPanel.getRoot());
resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
initializePlaceholderSettings();

StatusBarFooter statusBarFooter = new StatusBarFooter(logic.getAddressBookFilePath());
statusbarPlaceholder.getChildren().add(statusBarFooter.getRoot());
Expand All @@ -155,6 +156,12 @@ void fillInnerParts() {
commandBoxPlaceholder.getChildren().add(commandBox.getRoot());
}

private void initializePlaceholderSettings() {
VBox.setVgrow(personList, Priority.ALWAYS);
VBox.setVgrow(loanList, Priority.NEVER);
VBox.setVgrow(analytics, Priority.NEVER);
}

private void initializeLocalListeners() {
// Add listener to update the loans panel when the tab is switched
this.isLoansTab = logic.getIsLoansTab();
Expand All @@ -178,14 +185,20 @@ private void toggleTabs() {
// Default to person list panel
clearAllPlaceholders();
VBox.setVgrow(personList, Priority.ALWAYS);
VBox.setVgrow(loanList, Priority.NEVER);
VBox.setVgrow(analytics, Priority.NEVER);
personListPanelPlaceholder.getChildren().add(personListPanel.getRoot());
} else if (this.isLoansTab.getValue()) {
clearAllPlaceholders();
VBox.setVgrow(loanList, Priority.ALWAYS);
VBox.setVgrow(personList, Priority.NEVER);
VBox.setVgrow(analytics, Priority.NEVER);
loanListPanelPlaceholder.getChildren().add(loanListPanel.getRoot());
} else {
clearAllPlaceholders();
VBox.setVgrow(analytics, Priority.ALWAYS);
VBox.setVgrow(personList, Priority.NEVER);
VBox.setVgrow(loanList, Priority.NEVER);
analyticsPanelPlaceholder.getChildren().add(analyticsPanel.getRoot());
}
}
Expand Down

0 comments on commit f504e9d

Please sign in to comment.