Skip to content

Commit

Permalink
Use higher level check has customer/driver and fix UI display scroll …
Browse files Browse the repository at this point in the history
…bar missing
  • Loading branch information
Krit-K committed Nov 9, 2019
1 parent 7059c4d commit feeecd0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public ViewCustomerTaskCommand(int customerId) {
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

List<Customer> currentCustomerList = model.getFilteredCustomerList();

if (customerId > currentCustomerList.size()) {
if (!model.hasCustomer(customerId)) {
throw new CommandException(Messages.MESSAGE_INVALID_CUSTOMER_DISPLAYED_INDEX);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public ViewDriverTaskCommand(int driverId) {
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

List<Driver> currentDriverList = model.getFilteredDriverList();

if (driverId > currentDriverList.size()) {
if (!model.hasDriver(driverId)) {
throw new CommandException(Messages.MESSAGE_INVALID_DRIVER_DISPLAYED_INDEX);
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/parser/GoCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public class GoCommandParser implements Parser<GoCommand> {
public GoCommand parse(String args) throws ParseException {

String tabName = args.trim().toLowerCase();
if (tabName.equalsIgnoreCase(HOME_TAB)) {
if (tabName.equals(HOME_TAB)) {
return new GoCommand(HOME_TAB);
} else if (tabName.equalsIgnoreCase(HISTORY_TAB)) {
} else if (tabName.equals(HISTORY_TAB)) {
return new GoCommand(HISTORY_TAB);
} else {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, GoCommand.MESSAGE_USAGE));
Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@
</Menu>
</MenuBar>

<SplitPane minWidth="1600">
<SplitPane dividerPositions="0.7">
<VBox>
<padding>
<Insets bottom="20"/>
</padding>

<TabPane fx:id="tabPane" tabClosingPolicy="UNAVAILABLE">
<tabs>
<Tab text="Home">
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
<SplitPane>
<VBox fx:id="driverList" styleClass="pane-with-border" minWidth="150" prefWidth="150"
minHeight="520" VBox.vgrow="ALWAYS">
<VBox fx:id="driverList" styleClass="pane-with-border" minWidth="250" prefWidth="250" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="driverListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<VBox fx:id="customerList" styleClass="pane-with-border" minWidth="320" prefWidth="320" VBox.vgrow="ALWAYS">
<VBox fx:id="customerList" styleClass="pane-with-border" minWidth="300" prefWidth="300" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
Expand All @@ -64,7 +64,7 @@
</Tab>

<Tab text="History">
<SplitPane>
<SplitPane dividerPositions="0.4">
<VBox>
</VBox>
<VBox fx:id="completedTaskList" styleClass="pane-with-border" minWidth="200" prefWidth="200" VBox.vgrow="ALWAYS">
Expand Down Expand Up @@ -95,18 +95,18 @@
</VBox>
<SplitPane orientation="VERTICAL">

<VBox fx:id="taskList" styleClass="pane-with-border" minWidth="200" prefWidth="200" VBox.vgrow="ALWAYS">
<VBox fx:id="taskList" styleClass="pane-with-border" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="assignedTaskListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
<StackPane fx:id="assignedTaskListPanelPlaceholder"/>
</VBox>

<VBox fx:id="unassignedTaskList" styleClass="pane-with-border" minWidth="200" prefWidth="200" VBox.vgrow="ALWAYS">
<VBox fx:id="unassignedTaskList" styleClass="pane-with-border" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="unassignedTaskListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
<StackPane fx:id="unassignedTaskListPanelPlaceholder"/>
</VBox>

</SplitPane>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void hashcode() {

// different showHelp value -> returns different hashcode
assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", true,
false, "default").hashCode());
false).hashCode());

// different exit value -> returns different hashcode
assertNotEquals(commandResult.hashCode(), new CommandResult("feedback", false, true).hashCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ExitCommandTest {
@Test
public void execute_exit_success() {
CommandResult expectedCommandResult = new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false,
true, "default");
true);
assertCommandSuccess(new ExitCommand(), model, expectedCommandResult, expectedModel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HelpCommandTest {
@Test
public void execute_help_success() {
CommandResult expectedCommandResult = new CommandResult(SHOWING_HELP_MESSAGE,
true, false, "default");
true, false);
assertCommandSuccess(new HelpCommand(), model, expectedCommandResult, expectedModel);
}
}

0 comments on commit feeecd0

Please sign in to comment.