Skip to content

Commit

Permalink
Implement view schedule feature (#68)
Browse files Browse the repository at this point in the history
* Pull request (#7)

* Add help and edit features into User Guide (#44)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (#54)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (#55)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue

* Edit fxml file to change UI

* Pull request from team repo (#8)

* Add help and edit features into User Guide (#44)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (#54)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (#55)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue

* Fix checkstyle issue (#62)

* Add ScheduleView.java to display timetable

* Resolve conflicts

* Resolve conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflict

* Resolve Conflicts

* Pull Request (#9)

* Add help and edit features into User Guide (#44)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml to create a table (#54)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Add skeleton classes for generate interview timetable feature (#50)

* Add skeleton classes for generate interview timetable feature

* Fix errors with continous integration

* Add Unit Tests for Row, Column, and Schedule class

* Fix checkstyle issue

* Add skeleton Email feature (#51)

* Add new unimplemented email command

* Fix line endings

* Edit UserGuide.adoc to change UI display feature (#55)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add help and edit features into User Guide (#44) (#5)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Edit the User Guide to sort the flow of guide (#43) (#4)

* Edit User Guide in display

* Edit User Guide in display (#42) (#3)

* Cleanup the User Guide format

* Add help and edit features into the User Guide

* Add TableView.fxml skeleton

* Edit TableView.fxml

* Add textfield and user input field into TableView.fxml

* Edit UserGuide to change the display feature

* Add skeleton Interviewee and Interviewer class (#46)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* [Partial] Implement import interviewer's availability from excel sheet feature (#57)

* Import from excel function

* Adds implementation for ExcelReader

* debug importExcel classes

* Check style for Import branch

* Add minimal functionality for Interviewee and Interviewer class (#60)

* Add skeleton Interviewee and Interviewer class

* Fix travis CI issues

* Add minimal fields and logic for Interviewee and Interviewer

* Fix travis CI issues

* Update Interviewee, add Emails, Rework Faculty

* [Partial] Generate interview schedule timetable from interviewers' availability (#61)

* [Partial] Implement Schedule Class

* Modify Model Manager to adapt to list of schedules

* Fix travis build issue

* Fix checkstyle issue

* Fix checkstyle issue (#62)

* [Complete] Implement Schedule class (#63)

* Update Slot class and squash bug

* Add ScheduleView.java for viewing of timetable

* Edit ScheduleView.java to make it work

* Edit code to fulfil checkstyle

* Edit code to fulfil checkstyle

* Edit code to fulfil Checkstyle requirements

* Delete getSamplePersons from SampleDataUtil.java

* Edit code to fulfil Checkstyle Requirements

* Fix Checkstyle
  • Loading branch information
mrchensheng21 authored and ChrisKheng committed Oct 17, 2019
1 parent d4cb606 commit a815800
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 24 deletions.
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/MainApp.java
Expand Up @@ -2,7 +2,7 @@

import java.io.IOException;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.logging.Logger;

Expand All @@ -21,6 +21,7 @@
import seedu.address.model.ModelManager;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.ReadOnlyUserPrefs;
import seedu.address.model.Schedule;
import seedu.address.model.UserPrefs;
import seedu.address.model.util.SampleDataUtil;
import seedu.address.storage.AddressBookStorage;
Expand Down Expand Up @@ -90,8 +91,10 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
logger.warning("Problem while reading from the file. Will be starting with an empty AddressBook");
initialData = new AddressBook();
}
// For now ModelManager is always initialised with sample schedulesList first
List<Schedule> schedules = SampleDataUtil.getSampleSchedulesList();

return new ModelManager(initialData, userPrefs, new LinkedList<>());
return new ModelManager(initialData, userPrefs, schedules);
}

private void initLogging(Config config) {
Expand Down
59 changes: 45 additions & 14 deletions src/main/java/seedu/address/model/util/SampleDataUtil.java
@@ -1,12 +1,14 @@
package seedu.address.model.util;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import seedu.address.model.AddressBook;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.Schedule;
import seedu.address.model.person.Address;
import seedu.address.model.person.Department;
import seedu.address.model.person.Name;
Expand All @@ -19,26 +21,36 @@
* Contains utility methods for populating {@code AddressBook} with sample data.
*/
public class SampleDataUtil {
private static String[][] sampleFilledTable =
new String[][]{
{"10/9/2019", "Welfare - Hazel", "Technical - Johnathan", "Publicity - Lucia"},
{"18:00 - 18:30", "John", "Steven", "0"},
{"18:30 - 19:00", "Alex", "Clark", "John"},
{"19:00 - 19:30", "Alicia", "0", "charlie"},
{"19:30 - 20:00", "Charlie", "0", "Selina"},
{"20:00 - 20:30", "Selina", "0", "0"},
{"20:30 - 21:00", "Natal", "0", "0"}};

public static Person[] getSamplePersons() {
return new Person[] {
new Person(new Name("Alex Yeoh"), new Phone("87438807"),
new Address("Blk 30 Geylang Street 29, #06-40"),
getTagSet("friends")),
new Address("Blk 30 Geylang Street 29, #06-40"),
getTagSet("friends")),
new Person(new Name("Bernice Yu"), new Phone("99272758"),
new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"),
getTagSet("colleagues", "friends")),
new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"),
getTagSet("colleagues", "friends")),
new Person(new Name("Charlotte Oliveiro"), new Phone("93210283"),
new Address("Blk 11 Ang Mo Kio Street 74, #11-04"),
getTagSet("neighbours")),
new Address("Blk 11 Ang Mo Kio Street 74, #11-04"),
getTagSet("neighbours")),
new Person(new Name("David Li"), new Phone("91031282"),
new Address("Blk 436 Serangoon Gardens Street 26, #16-43"),
getTagSet("family")),
new Address("Blk 436 Serangoon Gardens Street 26, #16-43"),
getTagSet("family")),
new Person(new Name("Irfan Ibrahim"), new Phone("92492021"),
new Address("Blk 47 Tampines Street 20, #17-35"),
getTagSet("classmates")),
new Address("Blk 47 Tampines Street 20, #17-35"),
getTagSet("classmates")),
new Person(new Name("Roy Balakrishnan"), new Phone("92624417"),
new Address("Blk 45 Aljunied Street 85, #11-31"),
getTagSet("colleagues"))
new Address("Blk 45 Aljunied Street 85, #11-31"),
getTagSet("colleagues"))
};
}

Expand All @@ -50,6 +62,26 @@ public static ReadOnlyAddressBook getSampleAddressBook() {
return sampleAb;
}

public static List<Schedule> getSampleSchedulesList() {
LinkedList<Schedule> sampleSchedulesList = new LinkedList<>();
String date = sampleFilledTable[0][0];
LinkedList<LinkedList<String>> sampleData = toTwoDimensionalLinkedList(sampleFilledTable);
sampleSchedulesList.add(new Schedule(date, sampleData));

return sampleSchedulesList;
}

/**
* Returns the given two dimensional array of strings as a two dimensional LinkedList of strings.
*/
private static LinkedList<LinkedList<String>> toTwoDimensionalLinkedList(String[][] table) {
LinkedList<LinkedList<String>> tableCopy = new LinkedList<>();
for (String[] row : table) {
LinkedList<String> rowCopy = new LinkedList<>(Arrays.asList(row));
tableCopy.add(rowCopy);
}
return tableCopy;
}
/**
* Returns a tag set containing the list of strings given.
*/
Expand All @@ -58,7 +90,6 @@ public static Set<Tag> getTagSet(String... strings) {
.map(Tag::new)
.collect(Collectors.toSet());
}

/**
* Returns a department list containing the list of strings given.
*/
Expand All @@ -76,5 +107,5 @@ public static List<Slot> getTimeslotList(String...timeslots) {
.map(Slot::new)
.collect(Collectors.toList());
}

}

8 changes: 5 additions & 3 deletions src/main/java/seedu/address/ui/MainWindow.java
Expand Up @@ -34,6 +34,7 @@ public class MainWindow extends UiPart<Stage> {
private PersonListPanel personListPanel;
private ResultDisplay resultDisplay;
private HelpWindow helpWindow;
private ScheduleView scheduleView;

@FXML
private StackPane commandBoxPlaceholder;
Expand All @@ -42,14 +43,15 @@ public class MainWindow extends UiPart<Stage> {
private MenuItem helpMenuItem;

@FXML
private StackPane personListPanelPlaceholder;
private StackPane schedulePanelPlaceholder;

@FXML
private StackPane resultDisplayPlaceholder;

@FXML
private StackPane statusbarPlaceholder;


public MainWindow(Stage primaryStage, Logic logic) {
super(FXML, primaryStage);

Expand Down Expand Up @@ -107,8 +109,8 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) {
* Fills up all the placeholders of this window.
*/
void fillInnerParts() {
personListPanel = new PersonListPanel(logic.getFilteredPersonList());
personListPanelPlaceholder.getChildren().add(personListPanel.getRoot());
scheduleView = new ScheduleView(logic.getObservableLists());
schedulePanelPlaceholder.getChildren().add(scheduleView.getRoot());

resultDisplay = new ResultDisplay();
resultDisplayPlaceholder.getChildren().add(resultDisplay.getRoot());
Expand Down
54 changes: 54 additions & 0 deletions src/main/java/seedu/address/ui/ScheduleView.java
@@ -0,0 +1,54 @@
package seedu.address.ui;

import java.util.List;

import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.layout.Region;

/**
* Table consisting of timetables of scheduling.
*/
public class ScheduleView extends UiPart<Region> {

private static final String FXML = "ScheduleView.fxml";

private List<ObservableList<ObservableList<String>>> scheduleList;

@FXML
private TableView tableView;

ScheduleView(List<ObservableList<ObservableList<String>>> scheduleList) {
super(FXML);
this.scheduleList = scheduleList;
initialise();
}

/**
* Allow the creation of table.
*/
private void initialise() {
for (int i = 0; i < this.scheduleList.get(0).get(0).size(); i++) {
final int finalIdx = i;
TableColumn<ObservableList<String>, String> column =
new TableColumn<ObservableList<String>, String>(
this.scheduleList.get(0).get(0).get(i)
);
column.setCellValueFactory(param ->
new ReadOnlyObjectWrapper<>(param.getValue().get(finalIdx))
);
this.tableView.getColumns().add(column);
this.tableView.setColumnResizePolicy(this.tableView.CONSTRAINED_RESIZE_POLICY);
}

for (int i = 1; i < this.scheduleList.get(0).size(); i++) {
this.tableView.getItems().add(
this.scheduleList.get(0).get(i)
);
}
}
}

11 changes: 6 additions & 5 deletions src/main/resources/view/MainWindow.fxml
Expand Up @@ -11,8 +11,9 @@
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>


<fx:root type="javafx.stage.Stage" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
title="Address App" minWidth="450" minHeight="600" onCloseRequest="#handleExit">
title="Address App" minWidth="760" minHeight="600" onCloseRequest="#handleExit">
<icons>
<Image url="@/images/address_book_32.png" />
</icons>
Expand Down Expand Up @@ -46,14 +47,14 @@
</padding>
</StackPane>

<VBox fx:id="personList" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<StackPane fx:id="schedulePanelPlaceholder" styleClass="pane-with-border" minWidth="340" prefWidth="340" VBox.vgrow="ALWAYS">
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
<StackPane fx:id="personListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>
</StackPane>


<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
<StackPane fx:id="statusbarPlaceholder" VBox.vgrow="SOMETIMES"/>
</VBox>
</Scene>
</scene>
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/view/ScheduleView.fxml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>

<VBox xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<TableView fx:id="tableView" VBox.vgrow="ALWAYS">
</TableView>
</VBox>
9 changes: 9 additions & 0 deletions src/test/java/seedu/address/model/ScheduleTest.java
Expand Up @@ -19,6 +19,15 @@
import seedu.address.testutil.SampleSchedules;

public class ScheduleTest {
private static String[][] sampleFilledTable =
new String[][]{
{"10/9/2019(Thur)", "Welfare-Hazel", "Technical-Johnathan", "Publicity-Lucia"},
{"6:00pm-6:30pm", "John", "Steven", "NA"},
{"6:30pm-7:00pm", "Alex", "Clark", "Alice"},
{"7:00pm-7:30pm", "Alicia", "NA", "Charlie"},
{"7:30pm-8:00pm", "Bruce", "NA", "Selina"},
{"8:00pm-8:30pm", "Barry", "NA", "NA"},
{"8:30pm-9:00pm", "Natal", "NA", "NA"}};

@Test
public void getInterviewsSlot_existingInterviewee_success() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/test.iml
Expand Up @@ -25,5 +25,7 @@
</library>
</orderEntry>
<orderEntry type="library" scope="TEST" name="Gradle: org.openjfx:javafx-base:mac:11" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.openjfx:javafx-fxml:mac:11" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.openjfx:javafx-graphics:mac:11" level="project" />
</component>
</module>

0 comments on commit a815800

Please sign in to comment.