Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY2324S1#120 from jianrong7/feat/clear-…
Browse files Browse the repository at this point in the history
…command

Add clear command
  • Loading branch information
jianrong7 authored Nov 2, 2023
2 parents b1b9327 + 791c0e0 commit 6c5294d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/seedu/address/logic/commands/ClearCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@

import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.PropertyBook;

/**
* Clears the address book.
*/
public class ClearCommand extends Command {

public static final String COMMAND_WORD = "clear";
public static final String MESSAGE_SUCCESS = "Address book has been cleared!";
public static final String MESSAGE_SUCCESS = "Customer List and Property List have been cleared!";


@Override
public CommandResult execute(Model model) {
requireNonNull(model);
model.setAddressBook(new AddressBook());
model.setPropertyBook(new PropertyBook());
return new CommandResult(MESSAGE_SUCCESS);
}
}
2 changes: 1 addition & 1 deletion src/main/resources/view/PropertyListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<FlowPane fx:id="tags" />
<Label fx:id="phone" styleClass="cell_small_label" text="\$propPhone" />
<Label fx:id="address" styleClass="cell_small_label" text="\$propAddress" />
<Label fx:id="budget" styleClass="cell_small_label" text="\$budget" />
<Label fx:id="price" styleClass="cell_small_label" text="\$budget" />
</VBox>
</GridPane>
</HBox>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import seedu.address.model.AddressBook;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.PropertyBook;
import seedu.address.model.UserPrefs;

public class ClearCommandTest {
Expand All @@ -26,6 +27,7 @@ public void execute_nonEmptyAddressBook_success() {
Model model = new ModelManager(getTypicalAddressBook(), getTypicalPropertyBook(), new UserPrefs());
Model expectedModel = new ModelManager(getTypicalAddressBook(), getTypicalPropertyBook(), new UserPrefs());
expectedModel.setAddressBook(new AddressBook());
expectedModel.setPropertyBook(new PropertyBook());

assertCommandSuccess(new ClearCommand(), model, ClearCommand.MESSAGE_SUCCESS, expectedModel);
}
Expand Down

0 comments on commit 6c5294d

Please sign in to comment.