Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KIV] add calendar view #90

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: java
matrix:
include:
- jdk: oraclejdk9
- jdk: openjdk10

script: >-
./config/travis/run-checks.sh &&
Expand All @@ -17,7 +17,7 @@ deploy:
addons:
apt:
packages:
- oracle-java9-installer
- openjdk10

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ if (JavaVersion.current() == JavaVersion.VERSION_1_10
// Specifies the entry point of the application
mainClassName = 'seedu.address.MainApp'

sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
sourceCompatibility = JavaVersion.VERSION_1_10
targetCompatibility = JavaVersion.VERSION_1_10

repositories {
mavenCentral()
Expand Down Expand Up @@ -69,6 +69,9 @@ dependencies {

compile group: 'com.opencsv', name: 'opencsv', version: '4.1'

//compile group: 'com.calendarfx', name: 'view', version: '11.5.0'
compile group: 'com.calendarfx', name: 'view', version: '10.5.0'

testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.testfx', name: 'testfx-core', version: testFxVersion, {
exclude group: 'org.testfx', module: 'testfx-internal-java8'
Expand Down
54 changes: 54 additions & 0 deletions src/main/java/seedu/address/ui/CalendarPanel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package seedu.address.ui;

import com.calendarfx.model.Calendar;
import com.calendarfx.model.CalendarSource;
import com.calendarfx.view.CalendarView;

import javafx.fxml.FXML;
import javafx.scene.layout.Region;

/**
* @@ author: linnnruoo
* Calendar view of the App
*/

public class CalendarPanel extends UiPart<Region> {
private static final String FXML = "CalendarPanel.fxml";

@FXML
private CalendarView calendarView;

private Calendar calendar;

public CalendarPanel() {
super(FXML);
registerAsAnEventHandler(this);

calendarView.setShowAddCalendarButton(false);
calendarView.setShowPrintButton(false);
//calendarView.showMonthPage();
calendarView.showWeekPage();
calendarView.setShowDeveloperConsole(true);
calendarView.setShowSearchResultsTray(false);
calendarView.setShowToolBar(false);

// Set css
String fullpath = getClass().getResource("/view/CalendarTheme.css").toExternalForm();
calendarView.getStylesheets().removeAll();
calendarView.getStylesheets().add(fullpath);

calendar = new Calendar("Your Weekly Schedule");
calendar.setReadOnly(true);

CalendarSource myCalendarSource = new CalendarSource("My Personal Weekly Schedule");
myCalendarSource.getCalendars().addAll(calendar);
calendarView.getCalendarSources().addAll(myCalendarSource);
}

/**
* Frees resources allocated to the browser.
*/
public void freeResources() {
calendarView = null;
}
}
8 changes: 8 additions & 0 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class MainWindow extends UiPart<Stage> {

// Independent Ui parts residing in this Ui container
private BrowserPanel browserPanel;
private CalendarPanel calendarPanel;
private PersonListPanel personListPanel;
private Config config;
private UserPrefs prefs;
Expand All @@ -43,6 +44,9 @@ public class MainWindow extends UiPart<Stage> {
@FXML
private StackPane browserPlaceholder;

@FXML
private StackPane calendarPlaceholder;

@FXML
private StackPane commandBoxPlaceholder;

Expand Down Expand Up @@ -122,6 +126,9 @@ void fillInnerParts() {
browserPanel = new BrowserPanel();
browserPlaceholder.getChildren().add(browserPanel.getRoot());

calendarPanel = new CalendarPanel();
calendarPlaceholder.getChildren().add(calendarPanel.getRoot());

personListPanel = new PersonListPanel(logic.getFilteredPersonList());
personListPanelPlaceholder.getChildren().add(personListPanel.getRoot());

Expand Down Expand Up @@ -193,6 +200,7 @@ public PersonListPanel getPersonListPanel() {

void releaseResources() {
browserPanel.freeResources();
calendarPanel.freeResources();
}

@Subscribe
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/view/CalendarPanel.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.layout.StackPane?>
<?import com.calendarfx.view.CalendarView?>

<StackPane xmlns:fx="http://javafx.com/fxml/1">
<CalendarView fx:id="calendarView"/>
</StackPane>