/**
* Constructs a new calendar view.
*/
public CalendarView() {
getStyleClass().add(DEFAULT_STYLE_CLASS);
this.dayPage = new DayPage();
this.weekPage = new WeekPage();
this.monthPage = new MonthPage();
this.yearPage = new YearPage();
this.searchField = (CustomTextField) TextFields.createClearableTextField();
this.sourceView = new SourceView();
this.searchResultView = new SearchResultView();
this.yearMonthView = new YearMonthView();
if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$
this.developerConsole = new DeveloperConsole();
this.developerConsole.setDateControl(this);
}
selectedPage.set(dayPage);
Bindings.bindBidirectional(searchField.visibleProperty(), showSearchFieldProperty());
/*
* We do have a user agent stylesheet, but it doesn't seem to work
* properly when run as a standalone jar file.
*/
getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm()); //$NON-NLS-1$
/*
* We are "abusing" the properties map to pass new values of read-only
* properties from the skin to the control.
*/
getProperties().addListener((Change<?, ?> change) -> {
if (change.getKey().equals(SELECTED_PAGE)) {
if (change.getValueAdded() != null) {
PageBase page = (PageBase) change.getValueAdded();
selectedPage.set(page);
getProperties().remove(SELECTED_PAGE);
}
}
});
InvalidationListener fixSelectedPageListener = it -> fixSelectedPage();
dayPage.hiddenProperty().addListener(fixSelectedPageListener);
weekPage.hiddenProperty().addListener(fixSelectedPageListener);
monthPage.hiddenProperty().addListener(fixSelectedPageListener);
yearPage.hiddenProperty().addListener(fixSelectedPageListener);
fixSelectedPage();
}
CalendarView.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:CalendarFX
作者:
评论列表
文章目录