Skip to content

Commit

Permalink
Merge pull request CS2113-AY1819S1-T09-1#50 from Ftywan/for_merging
Browse files Browse the repository at this point in the history
  • Loading branch information
Saif Uddin Mahmud authored Oct 17, 2018
2 parents 6422de8 + fd718c5 commit 02d9445
Show file tree
Hide file tree
Showing 50 changed files with 1,180 additions and 78 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"appTitle" : "Address App",
"appTitle" : "Maker Manager",
"logLevel" : "INFO",
"userPrefsFilePath" : "preferences.json"
}
Binary file modified docs/diagrams/ModelComponentClassDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/StorageComponentClassDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/UiComponentClassDiagram.pptx
Binary file not shown.
Binary file removed docs/images/ftywan.jpg
Binary file not shown.
Binary file added docs/images/ftywan.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 removed docs/images/psyf.jpg
Binary file not shown.
Binary file added docs/images/psyf.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 removed docs/images/teojunjie.jpg
Binary file not shown.
Binary file added docs/images/teojunjie.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 removed docs/images/trufflepirate.jpg
Binary file not shown.
Binary file added docs/images/trufflepirate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions preferences.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"guiSettings" : {
"windowWidth" : 1550.4000244140625,
"windowHeight" : 838.4000244140625,
"windowWidth" : 1070.857177734375,
"windowHeight" : 714.2857055664062,
"windowCoordinates" : {
"x" : -7,
"y" : -7
"x" : 161,
"y" : 18
}
},
"addressBookFilePath" : "data\\addressbook.xml",
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/seedu/address/commons/core/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ public class Messages {
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_INVALID_MACHINE_DISPLAYED_INDEX = "The machine index provided is invalid";
public static final String MESSAGE_INVALID_JOB_DISPLAYED_INDEX = "The job index provided is invalid";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_MACHINE_LISTED_OVERVIEW = "%1$d machines listed!";
public static final String MESSAGE_JOBS_LISTED_OVERVIEW = "%1$d jobs listed!";


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package seedu.address.commons.events.ui;

import seedu.address.commons.events.BaseEvent;
import seedu.address.model.job.Job;

/**
* Represents a selection change in the Job List Panel
*/
public class JobPanelSelectionChangedEvent extends BaseEvent {

private final Job newSelection;

public JobPanelSelectionChangedEvent(Job newSelection) {
this.newSelection = newSelection;
}

@Override
public String toString() {
return getClass().getSimpleName();
}

public Job getNewSelection() {
return newSelection;
}
}

74 changes: 74 additions & 0 deletions src/main/java/seedu/address/logic/commands/job/AddJobCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package seedu.address.logic.commands.job;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_JOB_NOTE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_JOB_OWNER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_JOB_PRIORITY;
import static seedu.address.logic.parser.CliSyntax.PREFIX_MACHINE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import seedu.address.logic.CommandHistory;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.job.Job;

/**
* Adds a job to the address book.
*/
public class AddJobCommand extends Command {

public static final String COMMAND_WORD = "addJob";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a job to the address book. "
+ "Parameters: "
+ PREFIX_NAME + "JOB NAME "
+ PREFIX_MACHINE + "MACHINE NAME "
+ PREFIX_JOB_OWNER + "JOB OWNER NAME "
+ PREFIX_JOB_PRIORITY + "JOB PRIORITY "
+ PREFIX_JOB_NOTE + "JOB NOTE "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "iDCP project "
+ PREFIX_MACHINE + "PRINTER1 "
+ PREFIX_JOB_OWNER + "TIAN YUAN "
+ PREFIX_JOB_PRIORITY + "HIGH "
+ PREFIX_JOB_NOTE + "This is for the iDCP project "
+ PREFIX_TAG + "iDCP";


public static final String MESSAGE_SUCCESS = "New job added: %1$s";
public static final String MESSAGE_DUPLICATE_JOB = "This job already exists in the address book";

private final Job jobToAdd;

/**
* Creates an AddJobCommand to add the specified {@code Job}
*/
public AddJobCommand(Job job) {
requireNonNull(job);
jobToAdd = job;
}

@Override
public CommandResult execute(Model model, CommandHistory history) throws CommandException {
requireNonNull(model);

if (model.hasJob(jobToAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_JOB);
}

model.addJob(jobToAdd);
model.commitAddressBook();
return new CommandResult(String.format(MESSAGE_SUCCESS, jobToAdd));
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof seedu.address.logic.commands.job.AddJobCommand // instanceof handles nulls
&& jobToAdd.equals(((seedu.address.logic.commands.job.AddJobCommand) other).jobToAdd));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package seedu.address.logic.commands.job;

import static java.util.Objects.requireNonNull;

import java.util.List;

import seedu.address.commons.core.Messages;
import seedu.address.commons.core.index.Index;
import seedu.address.logic.CommandHistory;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.job.Job;

/**
* Deletes a job identified using it's displayed index from the address book.
*/
public class DeleteJobCommand extends Command {
public static final String COMMAND_WORD = "deleteJob";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the job identified by the index number used in the displayed job list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_DELETE_JOB_SUCCESS = "Deleted Job: %1$s";

private final Index targetIndex;

public DeleteJobCommand(Index targetIndex) {
this.targetIndex = targetIndex;
}

@Override
public CommandResult execute(Model model, CommandHistory history) throws CommandException {
requireNonNull(model);
List<Job> lastShownList = model.getFilteredJobList();

if (targetIndex.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_JOB_DISPLAYED_INDEX);
}

Job jobToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deleteJob(jobToDelete);
model.commitAddressBook();
return new CommandResult(String.format(MESSAGE_DELETE_JOB_SUCCESS, jobToDelete));
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof DeleteJobCommand // instanceof handles nulls
&& targetIndex.equals(((DeleteJobCommand) other).targetIndex)); // state check
}
}
45 changes: 45 additions & 0 deletions src/main/java/seedu/address/logic/commands/job/FindJobCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package seedu.address.logic.commands.job;

import static java.util.Objects.requireNonNull;

import seedu.address.commons.core.Messages;
import seedu.address.logic.CommandHistory;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.model.Model;
import seedu.address.model.job.JobNameContainsKeywordsPredicate;

/**
* Finds and lists all jobs in address book whose name contains any of the argument keywords.
* Keyword matching is case insensitive.
*/
public class FindJobCommand extends Command {

public static final String COMMAND_WORD = "findJob";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Finds all jobs whose names contain any of "
+ "the specified keywords (case-insensitive) and displays them as a list with index numbers.\n"
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " alice bob charlie";

private final JobNameContainsKeywordsPredicate predicate;

public FindJobCommand(JobNameContainsKeywordsPredicate predicate) {
this.predicate = predicate;
}

@Override
public CommandResult execute(Model model, CommandHistory history) {
requireNonNull(model);
model.updateFilteredJobList(predicate);
return new CommandResult(
String.format(Messages.MESSAGE_JOBS_LISTED_OVERVIEW, model.getFilteredJobList().size()));
}

@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof FindJobCommand // instanceof handles nulls
&& predicate.equals(((FindJobCommand) other).predicate)); // state check
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package seedu.address.logic.commands.job;

import static java.util.Objects.requireNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_JOBS;

import seedu.address.logic.CommandHistory;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.model.Model;

/**
* Lists all jobs in the address book to the user.
*/
public class ListJobsCommand extends Command {

public static final String COMMAND_WORD = "listJobs";

public static final String MESSAGE_SUCCESS = "Listed all jobs";


@Override
public CommandResult execute(Model model, CommandHistory history) {
requireNonNull(model);
model.updateFilteredJobList(PREDICATE_SHOW_ALL_JOBS);
return new CommandResult(MESSAGE_SUCCESS);
}
}
19 changes: 19 additions & 0 deletions src/main/java/seedu/address/logic/parser/AddressBookParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
import seedu.address.logic.commands.admin.LogoutCommand;
import seedu.address.logic.commands.admin.RemoveAdminCommand;
import seedu.address.logic.commands.admin.UpdatePasswordCommand;
import seedu.address.logic.commands.job.AddJobCommand;
import seedu.address.logic.commands.job.DeleteJobCommand;
import seedu.address.logic.commands.job.FindJobCommand;
import seedu.address.logic.commands.job.ListJobsCommand;
import seedu.address.logic.commands.machine.AddMachineCommand;
import seedu.address.logic.commands.machine.EditMachineCommand;
import seedu.address.logic.commands.machine.FindMachineCommand;
Expand All @@ -33,6 +37,9 @@
import seedu.address.logic.parser.admin.RemoveAdminCommandParser;
import seedu.address.logic.parser.admin.UpdatePasswordCommandParser;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.logic.parser.job.AddJobCommandParser;
import seedu.address.logic.parser.job.DeleteJobCommandParser;
import seedu.address.logic.parser.job.FindJobCommandParser;
import seedu.address.logic.parser.machine.AddMachineCommandParser;
import seedu.address.logic.parser.machine.EditMachineCommandParser;
import seedu.address.logic.parser.machine.FindMachineCommandParser;
Expand Down Expand Up @@ -127,6 +134,18 @@ public Command parseCommand(String userInput) throws ParseException {
case EditMachineCommand.COMMAND_WORD:
return new EditMachineCommandParser().parse(arguments);

case AddJobCommand.COMMAND_WORD:
return new AddJobCommandParser().parse(arguments);

case DeleteJobCommand.COMMAND_WORD:
return new DeleteJobCommandParser().parse(arguments);

case FindJobCommand.COMMAND_WORD:
return new FindJobCommandParser().parse(arguments);

case ListJobsCommand.COMMAND_WORD:
return new ListJobsCommand();

default:
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ public class CliSyntax {
public static final Prefix PREFIX_TAG = new Prefix("t/");
public static final Prefix PREFIX_MACHINE_STATUS = new Prefix("ms/");
public static final Prefix PREFIX_MACHINE_JOBS = new Prefix("j/");
public static final Prefix PREFIX_MACHINE = new Prefix("m/");
public static final Prefix PREFIX_JOB_OWNER = new Prefix("on/");
public static final Prefix PREFIX_JOB_PRIORITY = new Prefix("pr/");
public static final Prefix PREFIX_JOB_NOTE = new Prefix("jn/");

}
Loading

0 comments on commit 02d9445

Please sign in to comment.