Skip to content

Commit

Permalink
Merge pull request se-edu#83 from jingchen-z/master
Browse files Browse the repository at this point in the history
Changed UI layout
  • Loading branch information
jingchen-z authored Mar 25, 2019
2 parents ac5b147 + 4a262b5 commit eaf2f91
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/ui/BrowserPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ public BrowserPanel(ObservableValue<Task> selectedTask) {
}

private void loadTaskPage(Task task) {
//System.out.println(task.getDescription());
loadPage(SEARCH_PAGE_URL + task.getName().fullName);
}

/**
* Load selected page.
* @param url
*/
public void loadPage(String url) {
//System.out.println(url);
Platform.runLater(() -> browser.getEngine().load(url));
}

Expand Down
42 changes: 42 additions & 0 deletions src/main/java/seedu/address/ui/DefaultPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package seedu.address.ui;

import javafx.collections.ObservableList;

import javafx.fxml.FXML;

import javafx.scene.control.SplitPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region;

import seedu.address.model.task.Task;

/**
* Default page contains calendar, reminder and timeline.
*/
public class DefaultPage extends UiPart<Region> {

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<Task> taskList) {
super(FXML);
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));
}
}
45 changes: 43 additions & 2 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,30 @@ public class MainWindow extends UiPart<Stage> {

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;
private Logic logic;

// Independent Ui parts residing in this Ui container
private BrowserPanel browserPanel;
private DefaultPage defaultPage;
private TaskListPanel taskListPanel;
private ResultDisplay resultDisplay;
private HelpWindow helpWindow;

//To check which scene to show
private String optionPage = DEFAULT_PAGE;

@FXML
private StackPane browserPlaceholder;

@FXML
private StackPane defaultBrowserPlaceholder;

@FXML
private StackPane commandBoxPlaceholder;

Expand All @@ -54,6 +64,7 @@ public class MainWindow extends UiPart<Stage> {
@FXML
private StackPane statusbarPlaceholder;


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

Expand Down Expand Up @@ -111,8 +122,23 @@ 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;

default:
defaultPage = new DefaultPage(logic.getFilteredTaskList());
defaultBrowserPlaceholder.getChildren().add(defaultPage.getRoot());
break;
}


taskListPanel = new TaskListPanel(logic.getFilteredTaskList(), logic.selectedTaskProperty(),
logic::setSelectedTask);
Expand Down Expand Up @@ -172,6 +198,21 @@ public TaskListPanel getTaskListPanel() {
return taskListPanel;
}

/**
* Choose which page to show.
*/
public void setScene(String value) {
optionPage = value;
}

/**
* Get current page.
* @return
*/
public String getPage() {
return this.optionPage;
}

/**
* Executes the command and returns the result.
*
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/seedu/address/ui/calendar/Calendar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package seedu.address.ui.calendar;

/**
* The real implementation will be here.
*/
public class Calendar {
//TBC
//In development.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package seedu.address.ui.calendar;

/**
* Link between calendar and PaneNodes.
*/
public class CalendarController {
// Get the pane to put the calendar on
//@FXML Pane calendarAnchorPane;
}
34 changes: 34 additions & 0 deletions src/main/java/seedu/address/ui/calendar/PaneNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package seedu.address.ui.calendar;

import java.time.LocalDate;

import javafx.scene.Node;
import javafx.scene.layout.AnchorPane;


/**
* This is each single date grid.
*/
public class PaneNode extends AnchorPane {

private LocalDate day;

/**
* Initialize.
* @param children
*/
public PaneNode(Node... children) {
super(children);
}

/**
* Get today.
* @return
*/
public LocalDate getDay() {
return day;
}

public void setDay(LocalDate newDay) { this.day = newDay; }

}
2 changes: 1 addition & 1 deletion src/main/resources/view/BrowserPanel.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<?import javafx.scene.web.WebView?>

<StackPane xmlns:fx="http://javafx.com/fxml/1">
<WebView fx:id="browser"/>
<WebView fx:id="browser"/>
</StackPane>
19 changes: 19 additions & 0 deletions src/main/resources/view/DefaultPage.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

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

<SplitPane fx:id="overallPane" dividerPositions="0.5" orientation="VERTICAL" prefHeight="424.0" prefWidth="860.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1">
<items>
<AnchorPane fx:id="upperPartAnchorPane" minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
<children>
<SplitPane dividerPositions="0.5" prefHeight="224.0" prefWidth="682.0">
<items>
<AnchorPane fx:id="calendarAnchorPane" minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
<AnchorPane fx:id="reminderAnchorPane" minHeight="0.0" minWidth="0.0" prefHeight="189.0" prefWidth="292.0" />
</items>
</SplitPane>
</children></AnchorPane>
<AnchorPane fx:id="timelineAnchorPane" minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
</items>
</SplitPane>
10 changes: 8 additions & 2 deletions src/main/resources/view/MainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@
</padding>
<StackPane fx:id="taskListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
</VBox>

<StackPane fx:id="browserPlaceholder" prefWidth="340" >
<!--
<StackPane fx:id="browserPlaceholder" prefWidth="340" >
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
</StackPane>
-->
<StackPane fx:id="defaultBrowserPlaceholder" prefWidth="340" >
<padding>
<Insets top="10" right="10" bottom="10" left="10" />
</padding>
Expand Down

0 comments on commit eaf2f91

Please sign in to comment.