forked from nus-cs2103-AY1718S2/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nus-cs2103-AY1718S2#43 from Robert-Peng/Major1.1
Use CalendarFX to display Calendar View
- Loading branch information
Showing
18 changed files
with
213 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Region> { | ||
|
||
public static final String DEFAULT_PAGE = "CalendarPanel.fxml"; | ||
|
||
private ObservableList<Person> ownerList; | ||
private Calendar calendar; | ||
|
||
@FXML | ||
private CalendarView calendarView; | ||
|
||
/** | ||
* | ||
* @param OwnerList | ||
*/ | ||
public CalendarWindow(ObservableList<Person> 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; | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.lang.*?> | ||
<?import java.util.*?> | ||
<?import javafx.scene.*?> | ||
<?import javafx.scene.control.*?> | ||
|
||
<?import javafx.scene.layout.StackPane?> | ||
<?import javafx.scene.layout.BorderPane?> | ||
<?import javafx.scene.web.WebView?> | ||
|
||
<StackPane xmlns = "http://javafx.com/javafx/"> | ||
<children> | ||
<BorderPane prefHeight="200.0" prefWidth="200.0" /> | ||
</children> | ||
</StackPane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/test/java/guitests/guihandles/CalendarPanelHandle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package guitests.guihandles; | ||
|
||
import javafx.scene.Node; | ||
|
||
/** | ||
* | ||
*/ | ||
public class CalendarPanelHandle extends NodeHandle<Node> { | ||
|
||
public static final String CALENDARPANEL_ID = "#calendarPlaceholder"; | ||
|
||
protected CalendarPanelHandle(Node calendarPanelNode) { | ||
super(calendarPanelNode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.