Skip to content

Commit

Permalink
Merge pull request #165 from LuWenQ/master
Browse files Browse the repository at this point in the history
Fix UI bugs
  • Loading branch information
jiayushe authored Nov 1, 2019
2 parents 74e4b5e + 63f6d4d commit 858f344
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
}

Tag tagToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deleteTag(tagToDelete);
model.deleteTags(tagToDelete);
model.deleteTag(tagToDelete);
return new CommandResult(String.format(MESSAGE_DELETE_TAG_SUCCESS, tagToDelete.getName()));
}

Expand Down
14 changes: 5 additions & 9 deletions src/main/java/seedu/algobase/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ public void deleteTag(Tag target) {
public void deleteTags(Tag target) {
for (Problem problem : filteredProblems) {
Set<Tag> targetTags = problem.getTags();
for (Tag tag : targetTags) {
if (tag.getName().equals(target.getName())) {
problem.deleteTag(tag);
}
if (targetTags.contains(target)) {
problem.deleteTag(target);
}
}
}
Expand Down Expand Up @@ -224,11 +222,9 @@ public void setTags(Tag target, Tag editedTag) {
requireAllNonNull(target, editedTag);
for (Problem problem : filteredProblems) {
Set<Tag> targetTags = problem.getTags();
for (Tag tag : targetTags) {
if (tag.getName().equals(target.getName())) {
problem.addTag(editedTag);
problem.deleteTag(tag);
}
if (targetTags.contains(target)) {
problem.deleteTag(target);
problem.addTag(editedTag);
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/seedu/algobase/model/tag/UniqueTagList.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ public boolean contains(Tag toCheck) {
*/
public void add(Tag toAdd) {
requireNonNull(toAdd);
if (contains(toAdd)) {
throw new DuplicateTagException();
if (!contains(toAdd)) {
internalList.add(toAdd);
}
internalList.add(toAdd);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</Menu>
</MenuBar>

<SplitPane fx:id="mainDisplayPlaceholder">
<SplitPane fx:id="mainDisplayPlaceholder" VBox.vgrow="ALWAYS">
<VBox>
<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<padding>
Expand Down

0 comments on commit 858f344

Please sign in to comment.