diff --git a/build.gradle b/build.gradle index 50cd2ae52efc..d8994b041ef2 100644 --- a/build.gradle +++ b/build.gradle @@ -40,13 +40,14 @@ jacocoTestReport { dependencies { String testFxVersion = '4.0.7-alpha' - + compile fileTree(dir: 'lib', include: '*.jar') compile group: 'org.fxmisc.easybind', name: 'easybind', version: '1.0.3' compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.11' compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.0' compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.7.4' compile group: 'com.google.guava', name: 'guava', version: '19.0' - + //compile 'com.calendarfx:calendar:8.4.2' + //compile "org.jfxtras:jfxtras-all:8.0-r6-SNAPSHOT" testCompile group: 'junit', name: 'junit', version: '4.12' testCompile group: 'org.testfx', name: 'testfx-core', version: testFxVersion testCompile group: 'org.testfx', name: 'testfx-junit', version: testFxVersion diff --git a/lib/README-EXT.txt b/lib/README-EXT.txt new file mode 100644 index 000000000000..133adcde75b6 --- /dev/null +++ b/lib/README-EXT.txt @@ -0,0 +1,20 @@ +This directory contains third-party jar files that are required +by CalendarFX. The framework can not work without these. + +- controlsfx-xxx.jar + + Custom controls developed as part of the open source project ControlsFX. + +- fontawesomefx-commons-xxx.jar + + Common support code for web fonts in JavaFX. + +- fontawesomefx-fontawesome-xxx.jar + + The fontawesome font for JavaFX. + +- license4j-1.4.0.jar + + Support for licensing keys. + +Updated by Robert diff --git a/lib/calendarfx-recurrence-8.4.0.jar b/lib/calendarfx-recurrence-8.4.0.jar new file mode 100644 index 000000000000..db3b42027fe7 Binary files /dev/null and b/lib/calendarfx-recurrence-8.4.0.jar differ diff --git a/lib/calendarfx-view-8.4.0.jar b/lib/calendarfx-view-8.4.0.jar new file mode 100644 index 000000000000..af91d43dc93c Binary files /dev/null and b/lib/calendarfx-view-8.4.0.jar differ diff --git a/lib/controlsfx-8.40.11.jar b/lib/controlsfx-8.40.11.jar new file mode 100644 index 000000000000..3e409877f818 Binary files /dev/null and b/lib/controlsfx-8.40.11.jar differ diff --git a/lib/fontawesomefx-commons-8.13.jar b/lib/fontawesomefx-commons-8.13.jar new file mode 100644 index 000000000000..5acff3236bf2 Binary files /dev/null and b/lib/fontawesomefx-commons-8.13.jar differ diff --git a/lib/fontawesomefx-fontawesome-4.7.0-1.jar b/lib/fontawesomefx-fontawesome-4.7.0-1.jar new file mode 100644 index 000000000000..8360e5db9fe5 Binary files /dev/null and b/lib/fontawesomefx-fontawesome-4.7.0-1.jar differ diff --git a/lib/license4j-1.4.0.jar b/lib/license4j-1.4.0.jar new file mode 100644 index 000000000000..ee72d35c53c3 Binary files /dev/null and b/lib/license4j-1.4.0.jar differ diff --git a/src/main/java/seedu/address/MainApp.java b/src/main/java/seedu/address/MainApp.java index fa0800d55cb9..c3a0aacadca4 100644 --- a/src/main/java/seedu/address/MainApp.java +++ b/src/main/java/seedu/address/MainApp.java @@ -6,6 +6,7 @@ import java.util.logging.Logger; import com.google.common.eventbus.Subscribe; +//import com.calendarfx.view.CalendarView; import javafx.application.Application; import javafx.application.Platform; diff --git a/src/main/java/seedu/address/ui/CalendarWindow.java b/src/main/java/seedu/address/ui/CalendarWindow.java new file mode 100644 index 000000000000..86fde8f1ca63 --- /dev/null +++ b/src/main/java/seedu/address/ui/CalendarWindow.java @@ -0,0 +1,106 @@ +package seedu.address.ui; + +import java.time.LocalDate; +import java.time.LocalTime; + +import com.calendarfx.model.Calendar; +//import com.calendarfx.model.CalendarEvent; +import com.calendarfx.model.CalendarSource; +//import com.calendarfx.model.Entry; +//import com.calendarfx.model.Interval; +import com.calendarfx.view.CalendarView; + +import javafx.application.Platform; +import javafx.collections.ObservableList; +//import javafx.event.EventHandler; +import javafx.fxml.FXML; +import javafx.scene.layout.Region; +import seedu.address.model.person.Person; +//import javafx.application.Application; +//import javafx.application.Platform; +//import javafx.scene.Scene; +//import javafx.stage.Stage; + +//import java.time.Duration; + +//import java.time.LocalDateTime; + +//import java.time.ZoneId; +//import java.util.List; + +//import seedu.address.MainApp; +//import seedu.address.commons.core.LogsCenter; +//import seedu.address.commons.events.ui.PersonPanelSelectionChangedEvent; + + + + +/** + * + */ +public class CalendarWindow extends UiPart { + + public static final String DEFAULT_PAGE = "CalendarPanel.fxml"; + + private ObservableList ownerList; + private Calendar calendar; + + @FXML + private CalendarView calendarView; + + /** + * + * @param OwnerList + */ + public CalendarWindow(ObservableList ownerList) { + super(DEFAULT_PAGE); + this.ownerList = ownerList; + calendarView = new CalendarView(); + + CalendarSource newCalendarSource = new CalendarSource("My Calendars"); + + calendarView.getCalendarSources().add(newCalendarSource); + + calendarView.setRequestedTime(LocalTime.now()); + + calendar = new Calendar("Appointments"); + + + CalendarSource mycalendarSource = new CalendarSource("My Appointments"); + mycalendarSource.getCalendars().addAll(calendar); + + calendarView.getCalendarSources().add(mycalendarSource); + + Thread updateTimeThread = new Thread("Calendar: Update Time Thread") { + @Override + public void run() { + while (true) { + Platform.runLater(() -> { + calendarView.setToday(LocalDate.now()); + calendarView.setTime(LocalTime.now()); + }); + + try { + // update every 10 seconds + sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + }; + }; + + updateTimeThread.setPriority(Thread.MIN_PRIORITY); + updateTimeThread.setDaemon(true); + updateTimeThread.start(); + + } + + public CalendarView getRoot() { + return this.calendarView; + } + +} + + diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index 22d8d3d20dc2..60cddf9ef523 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -3,6 +3,7 @@ import java.util.logging.Logger; import com.google.common.eventbus.Subscribe; +//import com.calendarfx.view.CalendarView; import javafx.event.ActionEvent; import javafx.fxml.FXML; @@ -35,13 +36,14 @@ public class MainWindow extends UiPart { private Logic logic; // Independent Ui parts residing in this Ui container - private BrowserPanel browserPanel; + private CalendarWindow calendarWindow; + //private BrowserPanel browserPanel; private PersonListPanel personListPanel; private Config config; private UserPrefs prefs; @FXML - private StackPane browserPlaceholder; + private StackPane calendarPlaceholder; @FXML private StackPane commandBoxPlaceholder; @@ -117,8 +119,9 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { - browserPanel = new BrowserPanel(); - browserPlaceholder.getChildren().add(browserPanel.getRoot()); + //browserPanel = new BrowserPanel(); + calendarWindow = new CalendarWindow(logic.getFilteredPersonList()); + this.calendarPlaceholder.getChildren().add(calendarWindow.getRoot()); personListPanel = new PersonListPanel(logic.getFilteredPersonList()); personListPanelPlaceholder.getChildren().add(personListPanel.getRoot()); @@ -186,9 +189,10 @@ public PersonListPanel getPersonListPanel() { return this.personListPanel; } - void releaseResources() { + + /*void releaseResources() { browserPanel.freeResources(); - } + }*/ @Subscribe private void handleShowHelpEvent(ShowHelpRequestEvent event) { diff --git a/src/main/java/seedu/address/ui/UiManager.java b/src/main/java/seedu/address/ui/UiManager.java index 3fd3c17be156..76fe198edefb 100644 --- a/src/main/java/seedu/address/ui/UiManager.java +++ b/src/main/java/seedu/address/ui/UiManager.java @@ -66,7 +66,7 @@ public void start(Stage primaryStage) { public void stop() { prefs.updateLastUsedGuiSetting(mainWindow.getCurrentGuiSetting()); mainWindow.hide(); - mainWindow.releaseResources(); + //mainWindow.releaseResources(); } private void showFileOperationAlertAndWait(String description, String details, Throwable cause) { diff --git a/src/main/resources/view/CalendarPanel.fxml b/src/main/resources/view/CalendarPanel.fxml new file mode 100644 index 000000000000..b11b1137d026 --- /dev/null +++ b/src/main/resources/view/CalendarPanel.fxml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index 1dadb95b6ffe..3b038d0e314a 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -54,7 +54,7 @@ - + diff --git a/src/test/java/guitests/guihandles/CalendarPanelHandle.java b/src/test/java/guitests/guihandles/CalendarPanelHandle.java new file mode 100644 index 000000000000..766a01198aa9 --- /dev/null +++ b/src/test/java/guitests/guihandles/CalendarPanelHandle.java @@ -0,0 +1,15 @@ +package guitests.guihandles; + +import javafx.scene.Node; + +/** + * + */ +public class CalendarPanelHandle extends NodeHandle { + + public static final String CALENDARPANEL_ID = "#calendarPlaceholder"; + + protected CalendarPanelHandle(Node calendarPanelNode) { + super(calendarPanelNode); + } +} diff --git a/src/test/java/guitests/guihandles/MainWindowHandle.java b/src/test/java/guitests/guihandles/MainWindowHandle.java index 34e36054f4fd..54e880bb1898 100644 --- a/src/test/java/guitests/guihandles/MainWindowHandle.java +++ b/src/test/java/guitests/guihandles/MainWindowHandle.java @@ -12,7 +12,9 @@ public class MainWindowHandle extends StageHandle { private final CommandBoxHandle commandBox; private final StatusBarFooterHandle statusBarFooter; private final MainMenuHandle mainMenu; - private final BrowserPanelHandle browserPanel; + private final CalendarPanelHandle calendarPanel; + //private final BrowserPanelHandle browserPanel; + public MainWindowHandle(Stage stage) { super(stage); @@ -22,7 +24,8 @@ public MainWindowHandle(Stage stage) { commandBox = new CommandBoxHandle(getChildNode(CommandBoxHandle.COMMAND_INPUT_FIELD_ID)); statusBarFooter = new StatusBarFooterHandle(getChildNode(StatusBarFooterHandle.STATUS_BAR_PLACEHOLDER)); mainMenu = new MainMenuHandle(getChildNode(MainMenuHandle.MENU_BAR_ID)); - browserPanel = new BrowserPanelHandle(getChildNode(BrowserPanelHandle.BROWSER_ID)); + calendarPanel = new CalendarPanelHandle(getChildNode(CalendarPanelHandle.CALENDARPANEL_ID)); + //browserPanel = new BrowserPanelHandle(getChildNode(BrowserPanelHandle.BROWSER_ID)); } public PersonListPanelHandle getPersonListPanel() { @@ -45,7 +48,12 @@ public MainMenuHandle getMainMenu() { return mainMenu; } - public BrowserPanelHandle getBrowserPanel() { - return browserPanel; + public CalendarPanelHandle getCalendarPanel() { + return calendarPanel; } + + //public BrowserPanelHandle getBrowserPanel() { + // return browserPanel; + //} + } diff --git a/src/test/java/systemtests/AddressBookSystemTest.java b/src/test/java/systemtests/AddressBookSystemTest.java index 97cdf96d65b8..89e86acb9765 100644 --- a/src/test/java/systemtests/AddressBookSystemTest.java +++ b/src/test/java/systemtests/AddressBookSystemTest.java @@ -1,13 +1,13 @@ package systemtests; -import static guitests.guihandles.WebViewUtil.waitUntilBrowserLoaded; +//import static guitests.guihandles.WebViewUtil.waitUntilBrowserLoaded; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static seedu.address.ui.BrowserPanel.DEFAULT_PAGE; +//import static seedu.address.ui.BrowserPanel.DEFAULT_PAGE; import static seedu.address.ui.StatusBarFooter.SYNC_STATUS_INITIAL; import static seedu.address.ui.StatusBarFooter.SYNC_STATUS_UPDATED; -import static seedu.address.ui.UiPart.FXML_FILE_FOLDER; +//import static seedu.address.ui.UiPart.FXML_FILE_FOLDER; import static seedu.address.ui.testutil.GuiTestAssert.assertListMatching; import java.net.MalformedURLException; @@ -22,13 +22,15 @@ import org.junit.ClassRule; import guitests.guihandles.BrowserPanelHandle; +import guitests.guihandles.CalendarPanelHandle; import guitests.guihandles.CommandBoxHandle; import guitests.guihandles.MainMenuHandle; import guitests.guihandles.MainWindowHandle; import guitests.guihandles.PersonListPanelHandle; import guitests.guihandles.ResultDisplayHandle; import guitests.guihandles.StatusBarFooterHandle; -import seedu.address.MainApp; + +//import seedu.address.MainApp; import seedu.address.TestApp; import seedu.address.commons.core.EventsCenter; import seedu.address.commons.core.index.Index; @@ -69,7 +71,7 @@ public void setUp() { testApp = setupHelper.setupApplication(this::getInitialData, getDataFileLocation()); mainWindowHandle = setupHelper.setupMainWindowHandle(); - waitUntilBrowserLoaded(getBrowserPanel()); + //waitUntilBrowserLoaded(getBrowserPanel()); assertApplicationStartingStateIsCorrect(); } @@ -109,8 +111,12 @@ public MainMenuHandle getMainMenu() { return mainWindowHandle.getMainMenu(); } - public BrowserPanelHandle getBrowserPanel() { - return mainWindowHandle.getBrowserPanel(); + // public BrowserPanelHandle getBrowserPanel() { + // return mainWindowHandle.getBrowserPanel(); + // } + + public CalendarPanelHandle getCalendarPanel() { + return mainWindowHandle.getCalendarPanel(); } public StatusBarFooterHandle getStatusBarFooter() { @@ -133,7 +139,7 @@ protected void executeCommand(String command) { mainWindowHandle.getCommandBox().run(command); - waitUntilBrowserLoaded(getBrowserPanel()); + //waitUntilBrowserLoaded(getBrowserPanel()); } /** @@ -188,7 +194,7 @@ protected void assertApplicationDisplaysExpected(String expectedCommandInput, St */ private void rememberStates() { StatusBarFooterHandle statusBarFooterHandle = getStatusBarFooter(); - getBrowserPanel().rememberUrl(); + //getBrowserPanel().rememberUrl(); statusBarFooterHandle.rememberSaveLocation(); statusBarFooterHandle.rememberSyncStatus(); getPersonListPanel().rememberSelectedPersonCard(); @@ -200,14 +206,14 @@ private void rememberStates() { * @see BrowserPanelHandle#isUrlChanged() */ protected void assertSelectedCardDeselected() { - assertFalse(getBrowserPanel().isUrlChanged()); + //assertFalse(getBrowserPanel().isUrlChanged()); assertFalse(getPersonListPanel().isAnyCardSelected()); } /** * Asserts that the browser's url is changed to display the details of the person in the person list panel at * {@code expectedSelectedCardIndex}, and only the card at {@code expectedSelectedCardIndex} is selected. - * @see BrowserPanelHandle#isUrlChanged() + * * @see PersonListPanelHandle#isSelectedPersonCardChanged() */ protected void assertSelectedCardChanged(Index expectedSelectedCardIndex) { @@ -218,18 +224,18 @@ protected void assertSelectedCardChanged(Index expectedSelectedCardIndex) { } catch (MalformedURLException mue) { throw new AssertionError("URL expected to be valid."); } - assertEquals(expectedUrl, getBrowserPanel().getLoadedUrl()); + //assertEquals(expectedUrl, getBrowserPanel().getLoadedUrl()); assertEquals(expectedSelectedCardIndex.getZeroBased(), getPersonListPanel().getSelectedCardIndex()); } /** * Asserts that the browser's url and the selected card in the person list panel remain unchanged. - * @see BrowserPanelHandle#isUrlChanged() + * * @see PersonListPanelHandle#isSelectedPersonCardChanged() */ protected void assertSelectedCardUnchanged() { - assertFalse(getBrowserPanel().isUrlChanged()); + //assertFalse(getBrowserPanel().isUrlChanged()); assertFalse(getPersonListPanel().isSelectedPersonCardChanged()); } @@ -275,8 +281,10 @@ private void assertApplicationStartingStateIsCorrect() { try { assertEquals("", getCommandBox().getInput()); assertEquals("", getResultDisplay().getText()); - assertListMatching(getPersonListPanel(), getModel().getFilteredPersonList()); - assertEquals(MainApp.class.getResource(FXML_FILE_FOLDER + DEFAULT_PAGE), getBrowserPanel().getLoadedUrl()); + assertListMatching(getPersonListPanel(), + getModel().getFilteredPersonList()); + //assertEquals(MainApp.class.getResource(FXML_FILE_FOLDER + DEFAULT_PAGE), + // getBrowserPanel().getLoadedUrl()); assertEquals("./" + testApp.getStorageSaveLocation(), getStatusBarFooter().getSaveLocation()); assertEquals(SYNC_STATUS_INITIAL, getStatusBarFooter().getSyncStatus()); } catch (Exception e) { diff --git a/src/test/java/systemtests/HelpCommandSystemTest.java b/src/test/java/systemtests/HelpCommandSystemTest.java index 1aa4a5f294f4..ebfce476ffac 100644 --- a/src/test/java/systemtests/HelpCommandSystemTest.java +++ b/src/test/java/systemtests/HelpCommandSystemTest.java @@ -14,7 +14,7 @@ import seedu.address.logic.commands.DeleteCommand; import seedu.address.logic.commands.HelpCommand; import seedu.address.logic.commands.SelectCommand; -import seedu.address.ui.BrowserPanel; +//import seedu.address.ui.BrowserPanel; import seedu.address.ui.StatusBarFooter; /** @@ -43,9 +43,9 @@ public void openHelpWindow() { getMainMenu().openHelpWindowUsingAccelerator(); assertHelpWindowOpen(); - getBrowserPanel().click(); + getCalendarPanel().click(); getMainMenu().openHelpWindowUsingAccelerator(); - assertHelpWindowNotOpen(); + assertHelpWindowOpen(); //use menu button getMainMenu().openHelpWindowUsingMenu(); @@ -64,7 +64,7 @@ public void openHelpWindow() { assertEquals("", getCommandBox().getInput()); assertCommandBoxShowsDefaultStyle(); assertNotEquals(HelpCommand.SHOWING_HELP_MESSAGE, getResultDisplay().getText()); - assertNotEquals(BrowserPanel.DEFAULT_PAGE, getBrowserPanel().getLoadedUrl()); + //assertNotEquals(BrowserPanel.DEFAULT_PAGE, getBrowserPanel().getLoadedUrl()); assertListMatching(getPersonListPanel(), getModel().getFilteredPersonList()); // assert that the status bar too is updated correctly while the help window is open