forked from CS2113-AY1819S1-T09-1/main
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request CS2113-AY1819S1-T09-1#50 from Ftywan/for_merging
- Loading branch information
Showing
50 changed files
with
1,180 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/seedu/address/commons/events/ui/JobPanelSelectionChangedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
74
src/main/java/seedu/address/logic/commands/job/AddJobCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/seedu/address/logic/commands/job/DeleteJobCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
45
src/main/java/seedu/address/logic/commands/job/FindJobCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/seedu/address/logic/commands/job/ListJobsCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.