Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevan0102 committed Oct 28, 2015
2 parents 5940f14 + bc8b10d commit 5323f9e
Show file tree
Hide file tree
Showing 9 changed files with 445 additions and 228 deletions.
19 changes: 19 additions & 0 deletions bin/main/resources/layouts/TodaySummary.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>

<AnchorPane prefHeight="630.0" prefWidth="900.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="main.java.gui.SummaryController">
<!-- TODO Add Nodes -->
<children>
<Label prefHeight="30.0" prefWidth="880.0" text="Urgent Deadline Tasks" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="30.0" />
<Label prefHeight="30.0" prefWidth="880.0" text="Events" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="230.0" />
<Label prefHeight="30.0" prefWidth="880.0" text="Floating Tasks" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="430.0" />
<ListView fx:id="deadlineList" prefHeight="170.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="60.0" />
<ListView fx:id="eventList" prefHeight="170.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="260.0" />
<ListView fx:id="floatingList" prefHeight="170.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="460.0" />
<Label alignment="CENTER" prefHeight="30.0" text="Today's Summary" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
19 changes: 19 additions & 0 deletions bin/main/resources/layouts/TomorrowSummary.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>

<AnchorPane prefHeight="630.0" prefWidth="900.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2" fx:controller="main.java.gui.SummaryController">
<!-- TODO Add Nodes -->
<children>
<Label prefHeight="30.0" prefWidth="880.0" text="Urgent Deadline Tasks" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="30.0" />
<Label prefHeight="30.0" prefWidth="880.0" text="Events" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="230.0" />
<Label prefHeight="30.0" prefWidth="880.0" text="Floating Tasks" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="430.0" />
<ListView fx:id="deadlineList" prefHeight="170.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="60.0" />
<ListView fx:id="eventList" prefHeight="170.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="260.0" />
<ListView fx:id="floatingList" prefHeight="170.0" prefWidth="900.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="460.0" />
<Label alignment="CENTER" prefHeight="30.0" text="Tomorrow's Summary" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
212 changes: 105 additions & 107 deletions src/main/java/gui/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public void handleKeyPress(CommandBarController commandBarController,
}

public void handleEnterPress(CommandBarController commandBarController, String _userInput ) {
try {

_userInput = _userInput.toLowerCase();
Command command = Controller.createCommand(_userInput);
OutputToUI outputToUI = new OutputToUI();
Expand All @@ -444,118 +444,116 @@ public void handleEnterPress(CommandBarController commandBarController, String _

commandBarController.setFeedback(feedbackMsg);

if(userInput.equals("today")) {
createDeadlineList(itemList);
createEventList(itemList);
createFloatingList(itemList);
addTodaySummaryView();
//commandBarController.setFeedback(FEEDBACK_TODAY_SUMMARY);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("tomorrow")) {
createDeadlineList(itemList);
createEventList(itemList);
createFloatingList(itemList);
addTomorrowSummaryView();
//commandBarController.setFeedback(FEEDBACK_TMR_SUMMARY);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("help")) {
addHelpTable(this);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(_userInput.equals("exit")) {
commandBarController.setFeedback(FEEDBACK_EXIT);
commandBarController.clear();
delay = new PauseTransition(Duration.seconds(1)); //delay closing of GUI window by 1s
delay.setOnFinished(new EventHandler<ActionEvent> () {
@Override
public void handle(ActionEvent event) {
primaryStage.hide();
}
});
delay.play();
}

/*
* Display today and tomorrow's tasks individually
* @@author A0131300-unused due to change in plans
*
else if(userInput.equals("today")) {
addToday();
commandBarController.setFeedback(FEEDBACK_TODAY);
commandBarController.clear();
}
else if(userInput.equals("tomorrow") || userInput.equals("tmr")) {
addTmr();
commandBarController.setFeedback(FEEDBACK_TOMORROW);
commandBarController.clear();
}*/

else if(userInput.equals("deadline")) {
createDeadlineList(itemList);
addDeadline();
//commandBarController.setFeedback(FEEDBACK_DEADLINE);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("event")) {
createEventList(itemList);
addEvent();
//commandBarController.setFeedback(FEEDBACK_EVENT);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("floating")) {
createFloatingList(itemList);
addFloating();
//commandBarController.setFeedback(FEEDBACK_FLOATING);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("complete")) {
createCompleteList(itemList);
addComplete();
//commandBarController.setFeedback(FEEDBACK_COMPLETE);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("incomplete")) {
createIncompleteList(itemList);
addIncomplete();
//commandBarController.setFeedback(FEEDBACK_INCOMPLETE);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("all")) {
createCompleteList(itemList);
createIncompleteList(itemList);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();

addDisplayAll();
if(userInput != null) {
if(userInput.equals("today")) {
createDeadlineList(itemList);
createEventList(itemList);
createFloatingList(itemList);
addTodaySummaryView();
//commandBarController.setFeedback(FEEDBACK_TODAY_SUMMARY);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("tomorrow")) {
createDeadlineList(itemList);
createEventList(itemList);
createFloatingList(itemList);
addTomorrowSummaryView();
//commandBarController.setFeedback(FEEDBACK_TMR_SUMMARY);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("help")) {
addHelpTable(this);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(_userInput.equals("exit")) {
commandBarController.setFeedback(FEEDBACK_EXIT);
commandBarController.clear();
delay = new PauseTransition(Duration.seconds(1)); //delay closing of GUI window by 1s
delay.setOnFinished(new EventHandler<ActionEvent> () {
@Override
public void handle(ActionEvent event) {
primaryStage.hide();
}
});
delay.play();
}

/*
* Display today and tomorrow's tasks individually
* @@author A0131300-unused due to change in plans
*
else if(userInput.equals("today")) {
addToday();
commandBarController.setFeedback(FEEDBACK_TODAY);
commandBarController.clear();
}
else if(userInput.equals("tomorrow") || userInput.equals("tmr")) {
addTmr();
commandBarController.setFeedback(FEEDBACK_TOMORROW);
commandBarController.clear();
}*/

else if(userInput.equals("deadline")) {
createDeadlineList(itemList);
addDeadline();
//commandBarController.setFeedback(FEEDBACK_DEADLINE);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("event")) {
createEventList(itemList);
addEvent();
//commandBarController.setFeedback(FEEDBACK_EVENT);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("floating")) {
createFloatingList(itemList);
addFloating();
//commandBarController.setFeedback(FEEDBACK_FLOATING);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("complete")) {
createCompleteList(itemList);
addComplete();
//commandBarController.setFeedback(FEEDBACK_COMPLETE);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("incomplete")) {
createIncompleteList(itemList);
addIncomplete();
//commandBarController.setFeedback(FEEDBACK_INCOMPLETE);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();
}

else if(userInput.equals("all")) {
createCompleteList(itemList);
createIncompleteList(itemList);
commandBarController.setFeedback(feedbackMsg);
commandBarController.clear();

addDisplayAll();
}
}

if(taskToUpdate != null) {
commandBarController.setText(taskToUpdate);
commandBarController.setFeedback(feedbackMsg);
}

} catch (Exception e) {
commandBarController.setFeedback("invalid command");
}

//handleEnterPress(commandBarController, userInput);

Expand Down
40 changes: 20 additions & 20 deletions src/main/java/parser/CreateTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ public class CreateTask {
private static final String KEYWORD_TO = " to ";
private static final int LENGTH_OF_TO = KEYWORD_TO.length();

// for testing purposes
/* // for testing purposes
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter :");
String inputForAction = sc.nextLine();
/*Task task = createEvent("event", input);
Task task = createEvent("event", input);
System.out.println("startdate: " + task.getStartDate());
System.out.println("enddate: " + task.getEndDate());
System.out.println("task: " + task.getTaskDescription());
System.out.println("TT: " + task.getTaskType());
System.out.println("ST: " + task.getStartTime());
System.out.println("ET: " + task.getEndTime());*/
System.out.println("ET: " + task.getEndTime());
System.out.println(FlexiCommands.flexiDisplayCommands(inputForAction.toLowerCase()));
}//

*/
public final static Task createDeadline(String taskType, String taskContent) {
String[] dateTime;

Expand All @@ -55,26 +55,26 @@ public final static Task createDeadline(String taskType, String taskContent) {

//input comes in date;time format
if(DateAndTime.isDate(correctDateTime[0]) && (DateAndTime.isTime(correctDateTime[1])))
return new Task(taskType, taskDescription, "null", correctDateTime[0], "null", correctDateTime[1], false);
return new Task(taskType, taskDescription, "-", correctDateTime[0], "-", correctDateTime[1], false, true);
//input comes in time;date format
else if(DateAndTime.isDate(correctDateTime[2]) && (DateAndTime.isTime(correctDateTime[3])))
return new Task(taskType, taskDescription, "null", correctDateTime[2], "null", correctDateTime[3], false);
return new Task(taskType, taskDescription, "-", correctDateTime[2], "-", correctDateTime[3], false, true);
//input format is both invalid
else
return new Task(taskType, "invalid date/time", "null", "invalid", "null", "invalid", false);
return new Task(taskType, "-", "-", "-", "-", "-", false, false);
}
//taskDateTime contains only deadline date
else if(DateAndTime.isDate(taskDateTime)) {
String date = DateAndTime.reformatDate(taskDateTime);
return new Task(taskType, taskDescription, "null", date, "null", "no time specified", false);
return new Task(taskType, taskDescription, "-", date, "-", "-", false, true);
}
//taskDateTime contains only deadline time and set deadline date as today
else if(DateAndTime.isTime(taskDateTime)) {
String time = DateAndTime.reformatTime(taskDateTime);
return new Task(taskType, taskDescription, "null", dateFormat.format(today), "null", time, false);
return new Task(taskType, taskDescription, "-", dateFormat.format(today), "-", time, false, true);
}
else
return new Task(taskType, "invalid date/time", "null", "invalid", "null", "invalid", false);
return new Task(taskType, "-", "-", "-", "-", "-", false, false);
}

public final static Task createEvent(String taskType, String taskContent) {
Expand All @@ -87,7 +87,7 @@ public final static Task createEvent(String taskType, String taskContent) {
int secondIndexToSplit = taskContent.lastIndexOf(KEYWORD_TO);

String taskDescription = taskContent.substring(0, firstIndexToSplit);
String taskStart = taskContent.substring(firstIndexToSplit + (LENGTH_OF_FROM ), secondIndexToSplit);
String taskStart = taskContent.substring(firstIndexToSplit + (LENGTH_OF_FROM), secondIndexToSplit);
String taskEnd = taskContent.substring(secondIndexToSplit + (LENGTH_OF_TO), taskContent.length());

//taskStart and taskEnd contains both time and date
Expand Down Expand Up @@ -131,7 +131,7 @@ else if(DateAndTime.isDate(correctStartDateTime[2]) && DateAndTime.isTime(correc
correctStartDateTime[3], correctEndDateTime[1]);
}
else
return new Task(taskType, taskDescription, "incorrect date format", "incorrect date format", "incorrect time format" , "incorrect time format", false);
return new Task(taskType, taskDescription, "-", "-", "-" , "-", false, false);
}
//taskStart and taskEnd contains only date
else if(DateAndTime.isDate(taskStart) && DateAndTime.isDate(taskEnd)) {
Expand All @@ -140,9 +140,9 @@ else if(DateAndTime.isDate(taskStart) && DateAndTime.isDate(taskEnd)) {
taskDescription = removeSymbol(taskDescription);

if(DateAndTime.compareDates(startDate, endDate))
return new Task(taskType, taskDescription, startDate, endDate, "no time specified", "no time specified", false);
return new Task(taskType, taskDescription, startDate, endDate, "-", "-", false, true);
else
return new Task(taskType,"end date/time is earlier than start date/time", "invalid", "invalid", "no time specified", "no time specified", false);
return new Task(taskType, "-", "-", "-", "-", "-", false, false);
}
//taskStart and taskEnd contains only time
else if(DateAndTime.isTime(taskStart) && DateAndTime.isTime(taskEnd)) {
Expand All @@ -151,25 +151,25 @@ else if(DateAndTime.isTime(taskStart) && DateAndTime.isTime(taskEnd)) {
taskDescription = removeSymbol(taskDescription);
//auto assume is today's event; append today
if(DateAndTime.compareTimes(startTime, endTime))
return new Task(taskType, taskDescription, dateFormat.format(today), dateFormat.format(today), startTime, endTime, false);
return new Task(taskType, taskDescription, dateFormat.format(today), dateFormat.format(today), startTime, endTime, false, true);
else
return new Task(taskType,"end date/time is earlier than start date/time", "no date specified", "no date specified", "invalid", "invalid", false);
return new Task(taskType, "-", "-", "-", "-", "-", false, false);
}
else
return new Task(taskType, "invalid date/time", "invalid", "invalid", "invalid", "invalid", false);
return new Task(taskType, "-", "-", "-", "-", "-", false, false);
}

public final static Task createFloating(String taskType, String taskContent) {
return new Task(taskType, removeSymbol(taskContent), "null", "null", "null", "null", false);
return new Task(taskType, removeSymbol(taskContent), "-", "-", "-", "-", false, true);
}

private static Task correctDateComparison(String taskType, String taskDescription, String startDate,
String endDate, String startTime, String endTime) {
taskDescription = removeSymbol(taskDescription);
if(DateAndTime.compareDates(startDate, endDate) && DateAndTime.compareTimes(startTime, endTime))
return new Task(taskType, taskDescription, startDate, endDate, startTime, endTime, false);
return new Task(taskType, taskDescription, startDate, endDate, startTime, endTime, false, true);
else
return new Task(taskType, "end date/time is earlier than start date/time", "invalid", "invalid", "invalid", "invalid", false);
return new Task(taskType, "-", "-", "-", "-", "-", false, false);
}

private static String removeSymbol(String input) {
Expand Down
Loading

0 comments on commit 5323f9e

Please sign in to comment.