From 62c8ae5a161516dcc3e1aba10251039da25c0ade Mon Sep 17 00:00:00 2001 From: jingchen-z Date: Mon, 25 Mar 2019 14:35:51 +0800 Subject: [PATCH 1/7] Change UI layout --- src/main/java/seedu/address/ui/DefaultPage.java | 4 ++++ src/main/java/seedu/address/ui/calendar/Calendar.java | 4 ++++ .../java/seedu/address/ui/calendar/CalendarController.java | 4 ++++ src/main/java/seedu/address/ui/calendar/PaneNode.java | 4 ++++ src/main/resources/view/DefaultPage.fxml | 0 5 files changed, 16 insertions(+) create mode 100644 src/main/java/seedu/address/ui/DefaultPage.java create mode 100644 src/main/java/seedu/address/ui/calendar/Calendar.java create mode 100644 src/main/java/seedu/address/ui/calendar/CalendarController.java create mode 100644 src/main/java/seedu/address/ui/calendar/PaneNode.java create mode 100644 src/main/resources/view/DefaultPage.fxml diff --git a/src/main/java/seedu/address/ui/DefaultPage.java b/src/main/java/seedu/address/ui/DefaultPage.java new file mode 100644 index 000000000000..7537042857aa --- /dev/null +++ b/src/main/java/seedu/address/ui/DefaultPage.java @@ -0,0 +1,4 @@ +package seedu.address.ui; + +public class DefaultPage { +} diff --git a/src/main/java/seedu/address/ui/calendar/Calendar.java b/src/main/java/seedu/address/ui/calendar/Calendar.java new file mode 100644 index 000000000000..0369dfbfe44d --- /dev/null +++ b/src/main/java/seedu/address/ui/calendar/Calendar.java @@ -0,0 +1,4 @@ +package seedu.address.ui.calendar; + +public class Calendar { +} diff --git a/src/main/java/seedu/address/ui/calendar/CalendarController.java b/src/main/java/seedu/address/ui/calendar/CalendarController.java new file mode 100644 index 000000000000..8ab7dd254a99 --- /dev/null +++ b/src/main/java/seedu/address/ui/calendar/CalendarController.java @@ -0,0 +1,4 @@ +package seedu.address.ui.calendar; + +public class CalendarController { +} diff --git a/src/main/java/seedu/address/ui/calendar/PaneNode.java b/src/main/java/seedu/address/ui/calendar/PaneNode.java new file mode 100644 index 000000000000..c6e2092c572b --- /dev/null +++ b/src/main/java/seedu/address/ui/calendar/PaneNode.java @@ -0,0 +1,4 @@ +package seedu.address.ui.calendar; + +public class PaneNode { +} diff --git a/src/main/resources/view/DefaultPage.fxml b/src/main/resources/view/DefaultPage.fxml new file mode 100644 index 000000000000..e69de29bb2d1 From 06d60e9efcf9d3e2e57a26ac52669909263de283 Mon Sep 17 00:00:00 2001 From: jingchen-z Date: Mon, 25 Mar 2019 14:36:07 +0800 Subject: [PATCH 2/7] Change UI layout 1.1 --- .../java/seedu/address/ui/BrowserPanel.java | 2 + .../java/seedu/address/ui/DefaultPage.java | 40 ++++++++++++++++++- .../java/seedu/address/ui/MainWindow.java | 30 +++++++++++++- .../seedu/address/ui/calendar/Calendar.java | 5 +++ .../ui/calendar/CalendarController.java | 8 ++++ .../seedu/address/ui/calendar/PaneNode.java | 19 ++++++++- src/main/resources/view/BrowserPanel.fxml | 4 +- src/main/resources/view/DefaultPage.fxml | 19 +++++++++ src/main/resources/view/MainWindow.fxml | 10 ++++- 9 files changed, 129 insertions(+), 8 deletions(-) diff --git a/src/main/java/seedu/address/ui/BrowserPanel.java b/src/main/java/seedu/address/ui/BrowserPanel.java index 8ced71b5863d..55c02d6e3c5d 100644 --- a/src/main/java/seedu/address/ui/BrowserPanel.java +++ b/src/main/java/seedu/address/ui/BrowserPanel.java @@ -50,10 +50,12 @@ public BrowserPanel(ObservableValue selectedTask) { } private void loadTaskPage(Task task) { + //System.out.println(task.getDescription()); loadPage(SEARCH_PAGE_URL + task.getName().fullName); } public void loadPage(String url) { + //System.out.println(url); Platform.runLater(() -> browser.getEngine().load(url)); } diff --git a/src/main/java/seedu/address/ui/DefaultPage.java b/src/main/java/seedu/address/ui/DefaultPage.java index 7537042857aa..347e23685c12 100644 --- a/src/main/java/seedu/address/ui/DefaultPage.java +++ b/src/main/java/seedu/address/ui/DefaultPage.java @@ -1,4 +1,42 @@ package seedu.address.ui; -public class DefaultPage { +import javafx.collections.ObservableList; + +import javafx.event.Event; + +import javafx.fxml.FXML; + +import javafx.scene.control.SplitPane; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.Region; +import javafx.scene.layout.VBox; +import javafx.scene.web.WebView; + +import seedu.address.MainApp; +import seedu.address.commons.core.LogsCenter; +import seedu.address.model.task.Task; + +/** + * Default page contains calendar, reminder and timeline. + */ +public class DefaultPage extends UiPart{ + + private static final String FXML = "DefaultPage.fxml"; + + @FXML + private SplitPane overallPane; + + @FXML + private AnchorPane calendarAnchorPane; + + @FXML + private AnchorPane reminderAnchorPane; + + @FXML + private AnchorPane timelineAnchorPane; + + public DefaultPage(ObservableList taskList) { + super(FXML); + timelineAnchorPane.maxWidthProperty().bind(overallPane.widthProperty().multiply(0.5)); + } } diff --git a/src/main/java/seedu/address/ui/MainWindow.java b/src/main/java/seedu/address/ui/MainWindow.java index ad22a9c388d2..8eec7e5fbb9e 100644 --- a/src/main/java/seedu/address/ui/MainWindow.java +++ b/src/main/java/seedu/address/ui/MainWindow.java @@ -25,6 +25,9 @@ public class MainWindow extends UiPart { private static final String FXML = "MainWindow.fxml"; + private static final String DEFAULT_PAGE = "defaultPage"; + private static final String PROJECT_DETAILS = "projectDetails"; + private final Logger logger = LogsCenter.getLogger(getClass()); private Stage primaryStage; @@ -32,6 +35,7 @@ public class MainWindow extends UiPart { // Independent Ui parts residing in this Ui container private BrowserPanel browserPanel; + private DefaultPage defaultPage; private TaskListPanel taskListPanel; private ResultDisplay resultDisplay; private HelpWindow helpWindow; @@ -39,6 +43,9 @@ public class MainWindow extends UiPart { @FXML private StackPane browserPlaceholder; + @FXML + private StackPane defaultBrowserPlaceholder; + @FXML private StackPane commandBoxPlaceholder; @@ -54,6 +61,9 @@ public class MainWindow extends UiPart { @FXML private StackPane statusbarPlaceholder; + //To check which scene to show + String optionPage = "defaultPage"; + public MainWindow(Stage primaryStage, Logic logic) { super(FXML, primaryStage); @@ -111,8 +121,17 @@ private void setAccelerator(MenuItem menuItem, KeyCombination keyCombination) { * Fills up all the placeholders of this window. */ void fillInnerParts() { - browserPanel = new BrowserPanel(logic.selectedTaskProperty()); - browserPlaceholder.getChildren().add(browserPanel.getRoot()); + switch (optionPage) { + case DEFAULT_PAGE: + defaultPage = new DefaultPage(logic.getFilteredTaskList()); + defaultBrowserPlaceholder.getChildren().add(defaultPage.getRoot()); + break; + case PROJECT_DETAILS: + browserPanel = new BrowserPanel(logic.selectedTaskProperty()); + browserPlaceholder.getChildren().add(browserPanel.getRoot()); + break; + } + taskListPanel = new TaskListPanel(logic.getFilteredTaskList(), logic.selectedTaskProperty(), logic::setSelectedTask); @@ -172,6 +191,13 @@ public TaskListPanel getTaskListPanel() { return taskListPanel; } + /** + * Choose which page to show. + */ + public void setScene(String value) { + optionPage = value; + } + /** * Executes the command and returns the result. * diff --git a/src/main/java/seedu/address/ui/calendar/Calendar.java b/src/main/java/seedu/address/ui/calendar/Calendar.java index 0369dfbfe44d..309a00255a80 100644 --- a/src/main/java/seedu/address/ui/calendar/Calendar.java +++ b/src/main/java/seedu/address/ui/calendar/Calendar.java @@ -1,4 +1,9 @@ package seedu.address.ui.calendar; +/** + * The real implementation will be here. + */ public class Calendar { + //TBC + //In development. } diff --git a/src/main/java/seedu/address/ui/calendar/CalendarController.java b/src/main/java/seedu/address/ui/calendar/CalendarController.java index 8ab7dd254a99..270179f73357 100644 --- a/src/main/java/seedu/address/ui/calendar/CalendarController.java +++ b/src/main/java/seedu/address/ui/calendar/CalendarController.java @@ -1,4 +1,12 @@ package seedu.address.ui.calendar; +import javafx.fxml.FXML; +import javafx.scene.layout.Pane; + +/** + * Link between calendar and PaneNodes. + */ public class CalendarController { + // Get the pane to put the calendar on + @FXML Pane calendarAnchorPane; } diff --git a/src/main/java/seedu/address/ui/calendar/PaneNode.java b/src/main/java/seedu/address/ui/calendar/PaneNode.java index c6e2092c572b..4fc32eddf1a1 100644 --- a/src/main/java/seedu/address/ui/calendar/PaneNode.java +++ b/src/main/java/seedu/address/ui/calendar/PaneNode.java @@ -1,4 +1,21 @@ package seedu.address.ui.calendar; -public class PaneNode { +import javafx.scene.Node; +import javafx.scene.layout.AnchorPane; + +import java.time.LocalDate; + +/** + * This is each single date grid. + */ +public class PaneNode extends AnchorPane { + + private LocalDate day; + + public PaneNode(Node... children) { + super(children); + } + + public LocalDate getDay() { return day; } + public void setDay(LocalDate newDay) { this.day = newDay; } } diff --git a/src/main/resources/view/BrowserPanel.fxml b/src/main/resources/view/BrowserPanel.fxml index 31670827e3da..78a989e8af37 100644 --- a/src/main/resources/view/BrowserPanel.fxml +++ b/src/main/resources/view/BrowserPanel.fxml @@ -4,5 +4,5 @@ - - + + \ No newline at end of file diff --git a/src/main/resources/view/DefaultPage.fxml b/src/main/resources/view/DefaultPage.fxml index e69de29bb2d1..e002b56073cb 100644 --- a/src/main/resources/view/DefaultPage.fxml +++ b/src/main/resources/view/DefaultPage.fxml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index f2877352a51c..c24b8b239849 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -53,8 +53,14 @@ - - + + From ee3e37e06bc330312411850d047d3883acd45325 Mon Sep 17 00:00:00 2001 From: jingchen-z Date: Mon, 25 Mar 2019 14:49:02 +0800 Subject: [PATCH 3/7] Fixed divide ratio on UI --- .../java/seedu/address/ui/DefaultPage.java | 18 ++++++++++++------ .../seedu/address/ui/calendar/PaneNode.java | 6 +++--- src/main/resources/view/BrowserPanel.fxml | 2 +- src/main/resources/view/DefaultPage.fxml | 2 +- src/main/resources/view/MainWindow.fxml | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/seedu/address/ui/DefaultPage.java b/src/main/java/seedu/address/ui/DefaultPage.java index 347e23685c12..628713435350 100644 --- a/src/main/java/seedu/address/ui/DefaultPage.java +++ b/src/main/java/seedu/address/ui/DefaultPage.java @@ -20,23 +20,29 @@ * Default page contains calendar, reminder and timeline. */ public class DefaultPage extends UiPart{ - + private static final String FXML = "DefaultPage.fxml"; - + @FXML private SplitPane overallPane; - + @FXML private AnchorPane calendarAnchorPane; - + @FXML private AnchorPane reminderAnchorPane; @FXML private AnchorPane timelineAnchorPane; - + + @FXML + private AnchorPane upperPartAnchorPane; + public DefaultPage(ObservableList taskList) { super(FXML); - timelineAnchorPane.maxWidthProperty().bind(overallPane.widthProperty().multiply(0.5)); + upperPartAnchorPane.maxHeightProperty().bind(overallPane.heightProperty().multiply(0.5)); + timelineAnchorPane.maxHeightProperty().bind(overallPane.heightProperty().multiply(0.5)); + calendarAnchorPane.maxWidthProperty().bind(upperPartAnchorPane.widthProperty().multiply(0.5)); + reminderAnchorPane.maxWidthProperty().bind(upperPartAnchorPane.widthProperty().multiply(0.5)); } } diff --git a/src/main/java/seedu/address/ui/calendar/PaneNode.java b/src/main/java/seedu/address/ui/calendar/PaneNode.java index 4fc32eddf1a1..08a903ce7fda 100644 --- a/src/main/java/seedu/address/ui/calendar/PaneNode.java +++ b/src/main/java/seedu/address/ui/calendar/PaneNode.java @@ -9,13 +9,13 @@ * This is each single date grid. */ public class PaneNode extends AnchorPane { - + private LocalDate day; - + public PaneNode(Node... children) { super(children); } - + public LocalDate getDay() { return day; } public void setDay(LocalDate newDay) { this.day = newDay; } } diff --git a/src/main/resources/view/BrowserPanel.fxml b/src/main/resources/view/BrowserPanel.fxml index 78a989e8af37..f1c9f3df9047 100644 --- a/src/main/resources/view/BrowserPanel.fxml +++ b/src/main/resources/view/BrowserPanel.fxml @@ -5,4 +5,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/view/DefaultPage.fxml b/src/main/resources/view/DefaultPage.fxml index e002b56073cb..bda01ad0e378 100644 --- a/src/main/resources/view/DefaultPage.fxml +++ b/src/main/resources/view/DefaultPage.fxml @@ -5,7 +5,7 @@ - + diff --git a/src/main/resources/view/MainWindow.fxml b/src/main/resources/view/MainWindow.fxml index c24b8b239849..42e78f3823bb 100644 --- a/src/main/resources/view/MainWindow.fxml +++ b/src/main/resources/view/MainWindow.fxml @@ -53,7 +53,7 @@ -