Skip to content

Commit

Permalink
Merge branch 'master' into Check-Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
qinxutan authored Mar 19, 2024
2 parents 7754f1a + 360048b commit 910a397
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,5 @@ public interface Logic {
*/
void setGuiSettings(GuiSettings guiSettings);

/**
* Checks if the initial module list panel is displayed.
*/
boolean isInitialModuleListPanelDisplayed();
}
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/model/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public void setPersons(List<Person> persons) {
this.persons.setPersons(persons);
}

public void setModules(List<ModuleCode> modules) {
requireNonNull(modules);
this.modules.clear();
this.modules.addAll(modules);
}
/**
* Replaces the contents of the module list with {@code modules}.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public interface Model {
* @throws NullPointerException if {@code predicate} is null.
*/
void updateFilteredPersonList(Predicate<Person> predicate);

void updateFilteredModuleList(Predicate<ModuleCode> predicate);
/**
* Updates the filter of the filtered module list to filter by the given {@code predicate}.
*
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public ObservableList<ModuleCode> getFilteredModuleList() {
return filteredModules;
}

@Override
public ObservableList<ModuleCode> getFilteredModuleList() {
return filteredModules;
}

@Override
public void updateFilteredPersonList(Predicate<Person> predicate) {
requireNonNull(predicate);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/model/ReadOnlyAddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ public interface ReadOnlyAddressBook {
*
* @param moduleCode The module code to add.
*/
ObservableList<ModuleCode> getModuleList();
boolean hasModule(ModuleCode moduleCode);
void addModule(ModuleCode moduleCode);
}
17 changes: 17 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ void fillInnerParts() {
commandBoxPlaceholder.getChildren().add(commandBox.getRoot());
}

private boolean initiallyDisplayModuleListPanel() {
return logic.isInitialModuleListPanelDisplayed();
}

private void switchToPersonListPanel() {
personListPanel = new PersonListPanel(logic.getFilteredPersonList());
personListPanelPlaceholder.getChildren().add(personListPanel.getRoot());
}

private void switchToModuleListPanel() {
ObservableList<ModuleCode> moduleObservableList = FXCollections
.observableList(logic.getAddressBook().getModuleList());
moduleListPanel = new ModuleListPanel(moduleObservableList);
moduleListPanelPlaceholder.getChildren().add(moduleListPanel.getRoot());
}

/**
* Determines whether to initially display the module list panel.
*
Expand Down Expand Up @@ -241,6 +257,7 @@ private CommandResult executeCommand(String commandText) throws CommandException
throw e;
}
}

private void clearPanels() {
personListPanelPlaceholder.getChildren().clear();
moduleListPanelPlaceholder.getChildren().clear();
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/seedu/address/ui/JavaFxInitializer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package seedu.address.ui;

import org.junit.jupiter.api.BeforeAll;

import javafx.embed.swing.JFXPanel;
/**
* The JavaFxInitializer class provides a method to initialize the JavaFX environment
* before running any JavaFX-related tests.
*/
public class JavaFxInitializer {
@BeforeAll
public static void initializeJavaFX() {
new JFXPanel(); // Initializes JavaFX environment
}
}

0 comments on commit 910a397

Please sign in to comment.