Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update remove class command to hide filepath in UI (bottom left corner) #213

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ public class RemoveClassCommand extends Command {
public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Class: %1$s";

private final Index targetIndex;
private ViewClassesCommand viewClassesCommand;

public RemoveClassCommand(Index targetIndex) {
this.targetIndex = targetIndex;
this.viewClassesCommand = new ViewClassesCommand();
}

@Override
Expand All @@ -46,8 +44,11 @@ public CommandResult execute(Model model) throws CommandException {

Classes classToDelete = lastShownList.get(targetIndex.getZeroBased());
model.removeClass(classToDelete);
return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.classFormat(classToDelete)));
return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS,
Messages.classFormat(classToDelete)) +
"\nUse the 'view' command to see your remaining classes!"

);
}

@Override
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -181,6 +182,7 @@ public void createClass(Classes classes) {
public void removeClass(Classes classes) {
hideStudentsUi();
classBook.removeClass(classes);
userPrefs.setAddressBookFilePath(Paths.get(""));
notifyUiUpdateListeners();
}

Expand Down Expand Up @@ -230,6 +232,7 @@ public void updateFilteredPersonList(Predicate<Person> predicate) {
requireNonNull(predicate);
filteredPersons.setPredicate(predicate);
notifyUiUpdateListeners();

}

@Override
Expand Down Expand Up @@ -267,7 +270,6 @@ public void selectClass(Classes classes) {
requireNonNull(classes);

selectedClass = classes;
// selectedClassAddressBook = selectedClass.getAddressBook();
this.storage = new JsonAddressBookStorage(selectedClass.getFilePath());
userPrefs.setAddressBookFilePath(selectedClass.getFilePath());

Expand All @@ -287,12 +289,7 @@ public void selectClass(Classes classes) {
}

filteredPersons = new FilteredList<>(this.selectedClassAddressBook.getPersonList());

// Predicate<Person> predicate = person -> selectedClassAddressBook.getPersonList().contains(person);
updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
for (UiUpdateListener listener : uiUpdateListeners) {
listener.updateUi();
}
notifyUiUpdateListeners();
}

Expand Down
11 changes: 0 additions & 11 deletions src/main/java/seedu/address/ui/UiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,4 @@ public void updateUi() {
logger.severe("Error updating UI on class selection: " + e.getMessage());
}
}


// @Override
// public void updateUiOnView() {
// try {
// mainWindow.fillInnerParts(); // Fill the inner parts of the main window
// } catch (Exception e) {
// logger.severe("Error updating UI on view command: " + e.getMessage());
// }
// }

}
Loading