Skip to content

Commit

Permalink
Merge pull request #164 from jiayushe/master
Browse files Browse the repository at this point in the history
Update UI and Fix Minor Bugs
  • Loading branch information
jiayushe authored Oct 31, 2019
2 parents 8e8ad5d + 4785665 commit 74e4b5e
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 74 deletions.
14 changes: 8 additions & 6 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ Examples:
==== Deleting a problem : `delete`

Deletes an existing problem. +
Format: `delete INDEX`
Format: `delete INDEX [f/]`

* Deletes the problem at the specified `INDEX`.
* The index refers to the index number shown in the displayed problem list.
* The index *must be a positive integer* 1, 2, 3, ...
* The command will fail if the problem identified by `INDEX` is used in some task(s) in existing plans.
Add `f/` to force AlgoBase to delete all tasks associated with the problem.

Examples:

Expand Down Expand Up @@ -343,9 +345,9 @@ Format: `findplan [n/NAME] [d/DESCRIPTION] [start/RANGE_START] [end/RANGE_END] [
==== Adding a new task to a plan: `addtask`

Adds a task to a specified plan. +
Format: `addtask plan/PLAN_INDEX prob/PROBLEM_INDEX [due/TARGET_DATE]`
Format: `addtask plan/PLAN_INDEX prob/PROBLEM_INDEX [due/DUE_DATE]`

* `DUE_DATE` should be after or equal to plan's `START_DATE` and before or equal to plan's `END_DATE`.
* `DUE_DATE` should be in between plan's `startDate` and `endDate` (inclusive).

Examples:

Expand All @@ -356,7 +358,7 @@ Examples:
Copies a specified task from one plan to another. +
Format: `copytask task/TASK_INDEX from/PLAN_INDEX to/PLAN_INDEX`

* `DUE_DATE` should be after or equal to plan's `START_DATE` and before or equal to plan's `END_DATE`.
* Task identified by `TASK_INDEX` should have a due date in between plan's `startDate` and `endDate` (inclusive).

Examples:

Expand Down Expand Up @@ -385,7 +387,7 @@ Examples:
Edits the due date of a specified task from a specified plan. +
Format: `edittask plan/PLAN_INDEX task/TASK_INDEX due/DUE_DATE`

* `DUE_DATE` should be after or equal to plan's `START_DATE` and before or equal to plan's `END_DATE`.
* `DUE_DATE` should be in between plan's `startDate` and `endDate` (inclusive).

Examples:

Expand All @@ -405,7 +407,7 @@ Examples:
Moves a specified task from a specified plan to another. +
Format: `movetask task/TASK_INDEX from/PLAN_INDEX to/PLAN_INDEX`

* `DUE_DATE` should be after or equal to plan's `START_DATE` and before or equal to plan's `END_DATE`.
* Task identified by `TASK_INDEX` should have a due date in between plan's `startDate` and `endDate` (inclusive).

Examples:

Expand Down
Binary file modified docs/images/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/UiStartPlan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class AddPlanCommand extends Command {
+ ": Adds a Plan to AlgoBase.\n"
+ "Parameters:\n"
+ PREFIX_NAME + "NAME "
+ PREFIX_DESCRIPTION + "DESCRIPTION "
+ PREFIX_START_DATE + "START_DATE "
+ PREFIX_END_DATE + "END_DATE\n"
+ "[" + PREFIX_DESCRIPTION + "DESCRIPTION] "
+ "[" + PREFIX_START_DATE + "START_DATE] "
+ "[" + PREFIX_END_DATE + "END_DATE]\n"
+ "Example:\n"
+ COMMAND_WORD + " "
+ PREFIX_NAME + "CS2040 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public class AddCommand extends Command {
+ ": Adds a Problem to AlgoBase.\n"
+ "Parameters:\n"
+ PREFIX_NAME + "NAME "
+ PREFIX_AUTHOR + "AUTHOR "
+ PREFIX_WEBLINK + "WEBLINK "
+ PREFIX_DESCRIPTION + "DESCRIPTION "
+ PREFIX_DIFFICULTY + "DIFFICULTY "
+ PREFIX_SOURCE + "SOURCE "
+ "[" + PREFIX_AUTHOR + "AUTHOR] "
+ "[" + PREFIX_WEBLINK + "WEBLINK] "
+ "[" + PREFIX_DESCRIPTION + "DESCRIPTION] "
+ "[" + PREFIX_DIFFICULTY + "DIFFICULTY] "
+ "[" + PREFIX_SOURCE + "SOURCE] "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ "Example:\n"
+ COMMAND_WORD + " "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class DeleteCommand extends Command {

public static final String MESSAGE_DELETE_PROBLEM_SUCCESS = "Problem [%1$s] deleted.";
public static final String MESSAGE_PROBLEM_USED_IN_PLAN = "Problem [%1$s] is used in existing plans. "
+ "Add " + FLAG_FORCE + " to the end of your command if you want to delete it from all plans";
+ "Add " + FLAG_FORCE + " to the end of your command if you want to delete it from all plans.";

private final Index targetIndex;
private final boolean isForced;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class AddTaskCommand extends Command {
+ "Parameters:\n"
+ PREFIX_PLAN + "PLAN_INDEX "
+ PREFIX_PROBLEM + "PROBLEM_INDEX "
+ PREFIX_DUE_DATE + "DUE_DATE\n"
+ "[" + PREFIX_DUE_DATE + "DUE_DATE]\n"
+ "Example:\n"
+ COMMAND_WORD + " "
+ PREFIX_PLAN + "1 "
Expand Down Expand Up @@ -98,7 +98,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
model.setPlan(planToUpdate, updatedPlan);
model.updateFilteredPlanList(PREDICATE_SHOW_ALL_PLANS);
return new CommandResult(
String.format(MESSAGE_SUCCESS, task.getProblem().getName(), updatedPlan.getPlanName()));
String.format(MESSAGE_SUCCESS, task.getName(), updatedPlan.getPlanName()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command

return new CommandResult(
String.format(MESSAGE_MOVE_TASK_SUCCESS,
taskToCopy.getProblem().getName(),
taskToCopy.getName(),
planFrom.getPlanName(),
updatedPlanTo.getPlanName()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
model.updateFilteredPlanList(PREDICATE_SHOW_ALL_PLANS);

return new CommandResult(
String.format(MESSAGE_DELETE_TASK_SUCCESS, task.getProblem().getName(), updatedPlan.getPlanName()));
String.format(MESSAGE_DELETE_TASK_SUCCESS, task.getName(), updatedPlan.getPlanName()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
}
Task taskToUpdate = taskList.get(taskIndex);
if (taskToUpdate.getIsSolved()) {
throw new CommandException(Messages.MESSAGE_TASK_ALREADY_DONE);
throw new CommandException(String.format(Messages.MESSAGE_TASK_ALREADY_DONE, taskToUpdate.getName()));
}
taskList.remove(taskIndex);
Set<Task> taskSet = new HashSet<>(taskList);
Expand All @@ -77,7 +77,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
model.updateFilteredPlanList(PREDICATE_SHOW_ALL_PLANS);

return new CommandResult(
String.format(MESSAGE_DONE_TASK_SUCCESS, taskToUpdate.getProblem().getName(),
String.format(MESSAGE_DONE_TASK_SUCCESS, taskToUpdate.getName(),
updatedPlan.getPlanName()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command

return new CommandResult(
String.format(MESSAGE_EDIT_TASK_SUCCESS,
taskToUpdate.getProblem().getName(),
taskToUpdate.getName(),
editTaskDescriptor.targetDate,
updatedPlan.getPlanName()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
Set<Task> taskSetTo = new HashSet<>(taskListTo);
if (taskSetTo.contains(taskToMove)) {
throw new CommandException(
String.format(MESSAGE_DUPLICATE_TASK, taskToMove.getProblem().getName(), planTo.getPlanName()));
String.format(MESSAGE_DUPLICATE_TASK, taskToMove.getName(), planTo.getPlanName()));
}
if (!planTo.checkWithinDateRange(taskToMove.getTargetDate())) {
throw new CommandException(Messages.MESSAGE_INVALID_TASK_DATE);
Expand All @@ -92,7 +92,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command

return new CommandResult(
String.format(MESSAGE_MOVE_TASK_SUCCESS,
taskToMove.getProblem().getName(),
taskToMove.getName(),
updatedPlanFrom.getPlanName(),
updatedPlanTo.getPlanName()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class SetPlanCommand extends Command {
+ "Example:\n"
+ COMMAND_WORD + " 1";

public static final String MESSAGE_DELETE_PROBLEM_SUCCESS = "Plan [%1$s] set as current plan.";
public static final String MESSAGE_SET_PLAN_SUCCESS = "Plan [%1$s] set as current plan.";

private final Index targetIndex;

Expand All @@ -41,12 +41,12 @@ public CommandResult execute(Model model, CommandHistory history) throws Command

List<Plan> lastShownList = model.getFilteredPlanList();
if (targetIndex.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PROBLEM_DISPLAYED_INDEX);
throw new CommandException(Messages.MESSAGE_INVALID_PLAN_DISPLAYED_INDEX);
}
Plan plan = lastShownList.get(targetIndex.getZeroBased());
model.setCurrentPlan(plan);

return new CommandResult(String.format(MESSAGE_DELETE_PROBLEM_SUCCESS, plan.getPlanName()));
return new CommandResult(String.format(MESSAGE_SET_PLAN_SUCCESS, plan.getPlanName()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
}
Task taskToUpdate = taskList.get(taskIndex);
if (!taskToUpdate.getIsSolved()) {
throw new CommandException(Messages.MESSAGE_TASK_NOT_YET_DONE);
throw new CommandException(String.format(Messages.MESSAGE_TASK_NOT_YET_DONE, taskToUpdate.getName()));
}
taskList.remove(taskIndex);
Set<Task> taskSet = new HashSet<>(taskList);
Expand All @@ -77,7 +77,7 @@ public CommandResult execute(Model model, CommandHistory history) throws Command
model.updateFilteredPlanList(PREDICATE_SHOW_ALL_PLANS);

return new CommandResult(
String.format(MESSAGE_UNDONE_TASK_SUCCESS, taskToUpdate.getProblem().getName(),
String.format(MESSAGE_UNDONE_TASK_SUCCESS, taskToUpdate.getName(),
updatedPlan.getPlanName()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public AddPlanCommand parse(String args) throws ParseException {
if (arePrefixesPresent(argMultimap, PREFIX_END_DATE)) {
endDate = ParserUtil.parseDate(argMultimap.getValue(PREFIX_END_DATE).get());
} else {
endDate = LocalDate.now().plusMonths(1);
endDate = startDate.plusMonths(1);
}

if (!isValidRange(startDate, endDate)) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/algobase/model/plan/PlanList.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public void setPlans(List<Plan> plans) {
if (plans.size() > 0) {
// Default to first plan in list
setCurrentPlan(plans.get(0));
} else {
currentPlan.set("");
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/main/java/seedu/algobase/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public class MainWindow extends UiPart<Stage> {
private ResultDisplay resultDisplay;
private HelpWindow helpWindow;

@FXML
private SplitPane mainDisplayPlaceholder;

@FXML
private StackPane commandBoxPlaceholder;

Expand Down Expand Up @@ -130,8 +133,6 @@ void fillInnerParts() {

layoutPanePlaceholder.getItems().add(displayTabPane.getRoot());
layoutPanePlaceholder.getItems().add(detailsTabPane.getRoot());
layoutPanePlaceholder.getItems().add(taskManagementPane.getRoot());
layoutPanePlaceholder.setDividerPositions(0.33, 0.66);

resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
Expand All @@ -141,6 +142,9 @@ void fillInnerParts() {

CommandBox commandBox = new CommandBox(this::executeCommand, logic.getHistory());
commandBoxPlaceholder.getChildren().add(commandBox.getRoot());

mainDisplayPlaceholder.getItems().add(taskManagementPane.getRoot());
mainDisplayPlaceholder.setDividerPositions(0.66);
}

private DisplayTabPane getDisplayTabPane(WriteOnlyTabManager writeOnlyTabManager) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/seedu/algobase/ui/TaskCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ public TaskCard(Task task, int displayedIndex) {
name.setText(task.getName().fullName);
name.setWrapText(true);
name.setTextAlignment(TextAlignment.JUSTIFY);
name.setStyle(task.getIsSolved() ? "-fx-text-fill: #96b946;" : "-fx-text-fill: #ff6973;");
status.setText(task.getStatusIcon());
status.setStyle(task.getIsSolved() ? "-fx-text-fill: #96b946;" : "-fx-text-fill: #ff6973;");
status.setStyle(task.getIsSolved() ? "-fx-background-color: #96b946;" : "-fx-background-color: #ff6973;");
targetDate.setText(task.getTargetDate().format(ParserUtil.FORMATTER));
targetDate.setWrapText(true);
targetDate.setTextAlignment(TextAlignment.JUSTIFY);
Expand Down
16 changes: 12 additions & 4 deletions src/main/java/seedu/algobase/ui/TaskManagementPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ public class TaskManagementPane extends UiPart<Region> {
public TaskManagementPane(ObservableList<Task> taskList, ObservableStringValue plan,
ObservableIntegerValue solvedCount, ObservableIntegerValue unsolvedCount) {
super(FXML);
currentPlan.setText("Current Plan: " + plan.getValue());
if (!plan.getValue().equals("")) {
currentPlan.setText("Current Plan: " + plan.getValue());
} else {
currentPlan.setText("No Current Plan");
}
taskListView.setItems(taskList);
taskListView.setCellFactory(listView -> new TaskListViewCell());
taskProgressChart.setData(getChartData((int) solvedCount.getValue(), (int) unsolvedCount.getValue()));
taskProgressChart.setClockwise(true);
taskProgressChart.setLabelsVisible(true);
taskProgressChart.setLegendVisible(false);
taskProgressChart.setLabelsVisible(false);
taskProgressChart.setLegendVisible(true);
taskProgressChart.setStartAngle(90);
addListenerForPlanName(plan);
addListenerForPieChart(solvedCount, unsolvedCount);
Expand Down Expand Up @@ -79,7 +83,11 @@ private ObservableList<Data> getChartData(int solvedCount, int unsolvedCount) {
*/
private void addListenerForPlanName(ObservableStringValue s) {
s.addListener((observable, oldValue, newValue) -> {
currentPlan.setText("Current Plan: " + newValue);
if (!newValue.equals("")) {
currentPlan.setText("Current Plan: " + newValue);
} else {
currentPlan.setText("No Current Plan");
}
});
}

Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/view/DarkTheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,15 @@
-fx-font-size: 16;
}

#status {
-fx-text-fill: white;
-fx-background-color: #ff6973;
-fx-padding: 1 3 1 3;
-fx-border-radius: 2;
-fx-background-radius: 2;
-fx-font-size: 16;
}

.default-color0.chart-pie { -fx-pie-color: #96b946; }
.default-color1.chart-pie { -fx-pie-color: #ff6973; }

Expand Down
39 changes: 21 additions & 18 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,29 @@
</Menu>
</MenuBar>

<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>
<SplitPane fx:id="mainDisplayPlaceholder">
<VBox>
<StackPane VBox.vgrow="NEVER" fx:id="commandBoxPlaceholder" styleClass="pane-with-border">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>

<StackPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border"
minHeight="100" prefHeight="100" maxHeight="100">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>
<StackPane VBox.vgrow="NEVER" fx:id="resultDisplayPlaceholder" styleClass="pane-with-border"
minHeight="100" prefHeight="100" maxHeight="100">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
</StackPane>

<StackPane VBox.vgrow="ALWAYS" styleClass="pane-with-border">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
<SplitPane fx:id="layoutPanePlaceholder">
</SplitPane>
</StackPane>
<StackPane VBox.vgrow="ALWAYS" styleClass="pane-with-border">
<padding>
<Insets top="5" right="10" bottom="5" left="10" />
</padding>
<SplitPane fx:id="layoutPanePlaceholder"/>
</StackPane>
</VBox>
</SplitPane>

<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
</VBox>
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/view/TagListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/view/TaskListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<Region fx:constant="USE_PREF_SIZE" />
</minWidth>
</Label>
<Label fx:id="name" text="\$first" styleClass="cell_big_label" />
<Label fx:id="status" text="\$first" styleClass="cell_big_label" />
<Label fx:id="name" styleClass="cell_big_label" text="\$name" />
<Label fx:id="status" text="\$status" />
</HBox>
<FlowPane fx:id="tags" />
<HBox>
Expand Down
Loading

0 comments on commit 74e4b5e

Please sign in to comment.