diff --git a/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/IntroPaneApp.java b/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/IntroPaneApp.java index e5a37952..e1680f94 100644 --- a/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/IntroPaneApp.java +++ b/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/IntroPaneApp.java @@ -32,7 +32,7 @@ public class IntroPaneApp extends Application { @Override - public void start(Stage primaryStage) throws Exception { + public void start(Stage primaryStage) { CalendarView calendarView = new CalendarView(); Calendar katja = new Calendar("Katja"); diff --git a/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/sampler/package-info.java b/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/sampler/package-info.java deleted file mode 100644 index 32c7cd91..00000000 --- a/CalendarFXExperimental/src/main/java/com/calendarfx/experimental/sampler/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 Dirk Lemmermann Software & Consulting (dlsc.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * - */ -/** - * @author gdiaz - * - */ -package com.calendarfx.experimental.sampler; \ No newline at end of file diff --git a/CalendarFXExperimental/src/main/java/impl/com/calendarfx/experimental/package-info.java b/CalendarFXExperimental/src/main/java/impl/com/calendarfx/experimental/package-info.java deleted file mode 100644 index 8bd92829..00000000 --- a/CalendarFXExperimental/src/main/java/impl/com/calendarfx/experimental/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 Dirk Lemmermann Software & Consulting (dlsc.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * - */ -/** - * @author gdiaz - * - */ -package impl.com.calendarfx.experimental; \ No newline at end of file diff --git a/CalendarFXExperimental/src/main/java/module-info.java b/CalendarFXExperimental/src/main/java/module-info.java new file mode 100644 index 00000000..1a0e2fbf --- /dev/null +++ b/CalendarFXExperimental/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.calendarfx.experimental { + requires javafx.controls; + requires com.calendarfx.view; + + exports com.calendarfx.experimental; +} \ No newline at end of file diff --git a/CalendarFXGoogle/pom.xml b/CalendarFXGoogle/pom.xml index 21f372f4..a5adf7f0 100644 --- a/CalendarFXGoogle/pom.xml +++ b/CalendarFXGoogle/pom.xml @@ -35,13 +35,13 @@ org.openjfx javafx-controls - 12.0.1 + 13 org.openjfx javafx-web - 12.0.1 + 13 @@ -66,25 +66,25 @@ com.google.api-client google-api-client - 1.22.0 + 1.30.4 com.google.api-client google-api-client-java6 - 1.30.2 + 1.30.4 com.google.api-client google-api-client-jackson2 - 1.30.2 + 1.30.4 com.google.apis google-api-services-calendar - v3-rev20190609-1.30.1 + v3-rev20190910-1.30.1 diff --git a/CalendarFXGoogle/pom.xml.versionsBackup b/CalendarFXGoogle/pom.xml.versionsBackup new file mode 100644 index 00000000..21f372f4 --- /dev/null +++ b/CalendarFXGoogle/pom.xml.versionsBackup @@ -0,0 +1,134 @@ + + + + + 4.0.0 + CalendarFXGoogle + google + + + com.calendarfx + calendar + 11.6.4 + + + + true + + + + + org.openjfx + javafx-controls + 12.0.1 + + + + org.openjfx + javafx-web + 12.0.1 + + + + com.lynden + GMapsFX + 2.12.0 + + + + + org.slf4j + slf4j-simple + 2.0.0-alpha0 + + + + com.calendarfx + view + 11.6.4 + + + + com.google.api-client + google-api-client + 1.22.0 + + + + com.google.api-client + google-api-client-java6 + 1.30.2 + + + + com.google.api-client + google-api-client-jackson2 + 1.30.2 + + + + com.google.apis + google-api-services-calendar + v3-rev20190609-1.30.1 + + + + com.google.apis + google-api-services-oauth2 + v2-rev20190313-1.30.1 + + + + com.google.code.geocoder-java + geocoder-java + 0.16 + + + + + + + + + maven-assembly-plugin + 2.4 + + google-demo + + jar-with-dependencies + + false + + + com.calendarfx.google.GoogleCalendarApp + + + + + + make-samples + package + + single + + + + + + + \ No newline at end of file diff --git a/CalendarFXGoogle/src/main/java/com/calendarfx/google/view/log/StatusType.java b/CalendarFXGoogle/src/main/java/com/calendarfx/google/view/log/StatusType.java index 925d89d6..03cede07 100644 --- a/CalendarFXGoogle/src/main/java/com/calendarfx/google/view/log/StatusType.java +++ b/CalendarFXGoogle/src/main/java/com/calendarfx/google/view/log/StatusType.java @@ -16,9 +16,10 @@ package com.calendarfx.google.view.log; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView; import javafx.scene.paint.Color; +import org.kordamp.ikonli.Ikon; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; /** * Status of the google task. @@ -34,8 +35,8 @@ public String getDisplayName() { } @Override - public FontAwesomeIcon getIcon() { - return FontAwesomeIcon.CHECK; + public Ikon getIcon() { + return FontAwesome.CHECK; } @Override @@ -51,8 +52,8 @@ public String getDisplayName() { } @Override - public FontAwesomeIcon getIcon() { - return FontAwesomeIcon.EXCLAMATION_TRIANGLE; + public Ikon getIcon() { + return FontAwesome.EXCLAMATION_TRIANGLE; } @Override @@ -68,8 +69,8 @@ public String getDisplayName() { } @Override - public FontAwesomeIcon getIcon() { - return FontAwesomeIcon.CLOSE; + public Ikon getIcon() { + return FontAwesome.CLOSE; } @Override @@ -85,8 +86,8 @@ public String getDisplayName() { } @Override - public FontAwesomeIcon getIcon() { - return FontAwesomeIcon.EXCLAMATION_CIRCLE; + public Ikon getIcon() { + return FontAwesome.EXCLAMATION_CIRCLE; } @Override @@ -97,12 +98,12 @@ public Color getColor() { public abstract String getDisplayName(); - public abstract FontAwesomeIcon getIcon(); + public abstract Ikon getIcon(); public abstract Color getColor(); - public FontAwesomeIconView createView() { - FontAwesomeIconView view = new FontAwesomeIconView(getIcon()); + public FontIcon createView() { + FontIcon view = new FontIcon(getIcon()); view.setFill(getColor()); return view; } diff --git a/CalendarFXGoogle/src/main/java/impl/com/calendarfx/google/view/log/LogPaneSkin.java b/CalendarFXGoogle/src/main/java/impl/com/calendarfx/google/view/log/LogPaneSkin.java index e367eb0f..d28b7f0d 100644 --- a/CalendarFXGoogle/src/main/java/impl/com/calendarfx/google/view/log/LogPaneSkin.java +++ b/CalendarFXGoogle/src/main/java/impl/com/calendarfx/google/view/log/LogPaneSkin.java @@ -21,8 +21,6 @@ import com.calendarfx.google.view.log.LogPane; import com.calendarfx.google.view.log.StatusType; import com.google.api.client.util.Lists; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView; import javafx.beans.InvalidationListener; import javafx.beans.Observable; import javafx.event.Event; @@ -43,6 +41,8 @@ import javafx.scene.input.KeyEvent; import javafx.scene.layout.BorderPane; import org.controlsfx.control.MasterDetailPane; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; import java.io.PrintWriter; import java.io.StringWriter; @@ -97,12 +97,12 @@ public LogPaneSkin(LogPane control, TableView table) { private ToolBar createToolBar() { Button clearAllBtn = new Button(); clearAllBtn.setText("Clear All"); - clearAllBtn.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.TRASH)); + clearAllBtn.setGraphic(new FontIcon(FontAwesome.TRASH)); clearAllBtn.setOnAction(evt -> getSkinnable().clearItems()); Button clearSelectionBtn = new Button(); clearSelectionBtn.setText("Clear Selected"); - clearSelectionBtn.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.TRASH_ALT)); + clearSelectionBtn.setGraphic(new FontIcon(FontAwesome.TRASH_O)); clearSelectionBtn.setOnAction(evt -> getSkinnable().removeItems(Lists.newArrayList(getSkinnable().getSelectedItems()))); List statusTypeButtons = new ArrayList<>(); @@ -138,7 +138,7 @@ private ToolBar createToolBar() { } }); Button searchBtn = new Button(); - searchBtn.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.SEARCH)); + searchBtn.setGraphic(new FontIcon(FontAwesome.SEARCH)); searchBtn.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); searchBtn.setOnAction(evt -> getSkinnable().filter(textField.getText())); diff --git a/CalendarFXGoogle/src/main/java/module-info.java b/CalendarFXGoogle/src/main/java/module-info.java index 5588553b..0b100988 100644 --- a/CalendarFXGoogle/src/main/java/module-info.java +++ b/CalendarFXGoogle/src/main/java/module-info.java @@ -1,21 +1,24 @@ module com.calendarfx.google { + requires org.kordamp.ikonli.javafx; + requires org.kordamp.ikonli.fontawesome; + requires org.kordamp.iconli.core; + requires com.calendarfx.view; requires javafx.base; requires com.google.api.services.calendar; requires javafx.graphics; - requires de.jensd.fx.glyphs.fontawesome; - requires guava.jdk5; requires org.controlsfx.controls; - requires google.http.client; requires javafx.controls; requires javafx.web; - requires com.google.api.services.oauth2; - requires google.oauth.client; - requires google.api.client; - requires google.http.client.jackson2; requires geocoder.java; requires GMapsFX; + requires com.google.common; + requires com.google.api.client; + requires com.google.api.client.auth; + requires com.google.api.services.oauth2; + requires com.google.api.client.json.jackson2; + requires google.api.client; exports com.calendarfx.google; } \ No newline at end of file diff --git a/CalendarFXSampler/pom.xml b/CalendarFXSampler/pom.xml index 40195159..4ac837fe 100644 --- a/CalendarFXSampler/pom.xml +++ b/CalendarFXSampler/pom.xml @@ -49,7 +49,7 @@ org.openjfx javafx-web - 12.0.1 + 13 diff --git a/CalendarFXSampler/pom.xml.versionsBackup b/CalendarFXSampler/pom.xml.versionsBackup new file mode 100644 index 00000000..40195159 --- /dev/null +++ b/CalendarFXSampler/pom.xml.versionsBackup @@ -0,0 +1,106 @@ + + + + 4.0.0 + sampler + jar + + CalendarFXSampler + + + + oss-sonatype + oss-sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + true + + + + + + true + + + + com.calendarfx + calendar + 11.6.4 + + + + + + org.openjfx + javafx-web + 12.0.1 + + + + com.calendarfx + view + 11.6.4 + + + + com.calendarfx + application + 11.6.4 + + + + + org.controlsfx + fxsampler + 1.0.10 + + + + + + + + maven-assembly-plugin + 2.4 + + sampler-demo + false + + jar-with-dependencies + + + + com.calendarfx.demo.CalendarFXSampler + + + + + + make-samples + package + + single + + + + + + + + diff --git a/CalendarFXSampler/src/main/resources/calendar.css b/CalendarFXSampler/src/main/resources/calendar.css index d6240c6f..92cec5af 100644 --- a/CalendarFXSampler/src/main/resources/calendar.css +++ b/CalendarFXSampler/src/main/resources/calendar.css @@ -102,8 +102,8 @@ } .calendar-view .button-icon { - -fx-fill: rgb(100, 100, 100); - -glyph-size: 14.0px; + -fx-icon-color: rgb(100, 100, 100); + -fx-icon-size: 14.0px; } /* diff --git a/CalendarFXView/pom.xml b/CalendarFXView/pom.xml index 48aaa01a..ba1296f4 100644 --- a/CalendarFXView/pom.xml +++ b/CalendarFXView/pom.xml @@ -36,16 +36,28 @@ + + org.kordamp.ikonli + ikonli-javafx + 11.3.4 + + + + org.kordamp.ikonli + ikonli-fontawesome-pack + 11.3.4 + + org.openjfx javafx-controls - 12.0.1 + 13 org.openjfx javafx-fxml - 12.0.1 + 13 @@ -60,18 +72,6 @@ 11.0.0 - - de.jensd - fontawesomefx-commons - 9.1.2 - - - - de.jensd - fontawesomefx-fontawesome - 4.7.0-9.1.2 - - diff --git a/CalendarFXView/pom.xml.versionsBackup b/CalendarFXView/pom.xml.versionsBackup new file mode 100644 index 00000000..c027f5a1 --- /dev/null +++ b/CalendarFXView/pom.xml.versionsBackup @@ -0,0 +1,190 @@ + + + + 4.0.0 + view + CalendarFXView + + + com.calendarfx + calendar + 11.6.4 + + + + + bintray + bintray + https://dl.bintray.com/jerady/maven + + + + + + + org.kordamp.ikonli + ikonli-javafx + 11.3.4 + + + + org.kordamp.ikonli + ikonli-fontawesome-pack + 11.3.4 + + + + org.openjfx + javafx-controls + 12.0.1 + + + + org.openjfx + javafx-fxml + 12.0.1 + + + + com.calendarfx + recurrence + 11.6.4 + + + + org.controlsfx + controlsfx + 11.0.0 + + + + + + + + src/main/resources + true + + + + + + org.asciidoctor + asciidoctor-maven-plugin + 1.5.3 + + + + output-html + install + + process-asciidoc + + + + + + coderay + html + manual-images + + + + + org.apache.maven.plugins + maven-source-plugin + 3.0.1 + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + false + true + CalendarFX API + + -J-Djavafx.javadoc=true + -html5 + + true + + + defaultValue + a + Default Value: + + + apiNote + a + API Note: + + + implSpec + a + Implementation Requirements: + + + implNote + a + Implementation Note: + + + + **\/\module-info.java + + + + + org.ow2.asm + asm + 7.0 + + + + + make-docs + + + package + + + aggregate + + + + attach-javadocs + + jar + + + + + + + + diff --git a/CalendarFXView/src/main/java/com/calendarfx/view/page/DayPage.java b/CalendarFXView/src/main/java/com/calendarfx/view/page/DayPage.java index 8d3d949d..96895b76 100644 --- a/CalendarFXView/src/main/java/com/calendarfx/view/page/DayPage.java +++ b/CalendarFXView/src/main/java/com/calendarfx/view/page/DayPage.java @@ -25,8 +25,6 @@ import com.calendarfx.view.TimeScaleView; import com.calendarfx.view.YearMonthView; import com.calendarfx.view.print.ViewType; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory; import impl.com.calendarfx.view.page.DayPageSkin; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; @@ -40,10 +38,11 @@ import javafx.scene.control.ToggleButton; import javafx.scene.control.Tooltip; import javafx.scene.layout.HBox; -import javafx.scene.text.Text; import org.controlsfx.control.PropertySheet; import org.controlsfx.control.PropertySheet.Item; import org.controlsfx.control.SegmentedButton; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; import java.time.format.DateTimeFormatter; import java.util.Optional; @@ -98,17 +97,17 @@ private Node createToolBarControls() { ToggleButton dayOnlyButton = new ToggleButton(); ToggleButton standardButton = new ToggleButton(); - Text listIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.LIST); + FontIcon listIcon = new FontIcon(FontAwesome.LIST); listIcon.getStyleClass().addAll("button-icon"); agendaOnlyButton.setGraphic(listIcon); agendaOnlyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); - Text calendarIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.CALENDAR); + FontIcon calendarIcon = new FontIcon(FontAwesome.CALENDAR); calendarIcon.getStyleClass().addAll("button-icon"); dayOnlyButton.setGraphic(calendarIcon); dayOnlyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); - Text standardIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.COLUMNS); + FontIcon standardIcon = new FontIcon(FontAwesome.COLUMNS); standardIcon.getStyleClass().addAll("button-icon"); standardButton.setGraphic(standardIcon); standardButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); @@ -142,7 +141,7 @@ private Node createToolBarControls() { ToggleButton layoutButton = new ToggleButton(); layoutButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_LAYOUT"))); //$NON-NLS-1$ layoutButton.setId("layout-button"); - Text layoutIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TABLE); + FontIcon layoutIcon = new FontIcon(FontAwesome.TABLE); layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon"); //$NON-NLS-1$ //$NON-NLS-2$ layoutButton.setGraphic(layoutIcon); layoutButton.setSelected(getLayout().equals(Layout.SWIMLANE)); diff --git a/CalendarFXView/src/main/java/com/calendarfx/view/page/WeekPage.java b/CalendarFXView/src/main/java/com/calendarfx/view/page/WeekPage.java index d0d69be5..6451d8a4 100644 --- a/CalendarFXView/src/main/java/com/calendarfx/view/page/WeekPage.java +++ b/CalendarFXView/src/main/java/com/calendarfx/view/page/WeekPage.java @@ -16,10 +16,12 @@ package com.calendarfx.view.page; -import com.calendarfx.view.*; +import com.calendarfx.view.AllDayView; +import com.calendarfx.view.DetailedWeekView; +import com.calendarfx.view.Messages; +import com.calendarfx.view.WeekDayView; +import com.calendarfx.view.WeekTimeScaleView; import com.calendarfx.view.print.ViewType; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory; import impl.com.calendarfx.view.page.WeekPageSkin; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; @@ -30,8 +32,9 @@ import javafx.scene.control.ToggleButton; import javafx.scene.control.Tooltip; import javafx.scene.layout.HBox; -import javafx.scene.text.Text; import org.controlsfx.control.PropertySheet; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; import java.time.format.DateTimeFormatter; import java.util.Optional; @@ -62,7 +65,7 @@ public WeekPage() { ToggleButton layoutButton = new ToggleButton(); layoutButton.setTooltip(new Tooltip(Messages.getString("WeekPage.TOOLTIP_LAYOUT"))); //$NON-NLS-1$ layoutButton.setId("layout-button"); - Text layoutIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TABLE); + FontIcon layoutIcon = new FontIcon(FontAwesome.TABLE); layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon"); //$NON-NLS-1$ //$NON-NLS-2$ layoutButton.setGraphic(layoutIcon); layoutButton.setSelected(getLayout().equals(Layout.SWIMLANE)); diff --git a/CalendarFXView/src/main/java/com/calendarfx/view/page/YearPage.java b/CalendarFXView/src/main/java/com/calendarfx/view/page/YearPage.java index 2d981d4f..b2229550 100644 --- a/CalendarFXView/src/main/java/com/calendarfx/view/page/YearPage.java +++ b/CalendarFXView/src/main/java/com/calendarfx/view/page/YearPage.java @@ -21,8 +21,6 @@ import com.calendarfx.view.MonthSheetView.ClickBehaviour; import com.calendarfx.view.YearView; import com.calendarfx.view.print.ViewType; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory; import impl.com.calendarfx.view.page.YearPageSkin; import javafx.beans.binding.Bindings; import javafx.beans.property.ObjectProperty; @@ -33,8 +31,9 @@ import javafx.scene.control.Skin; import javafx.scene.control.ToggleButton; import javafx.scene.control.Tooltip; -import javafx.scene.text.Text; import org.controlsfx.control.PropertySheet; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; import java.time.format.DateTimeFormatter; import java.util.Optional; @@ -110,12 +109,12 @@ public Node getToolBarControls() { * mode (column or grid). */ private void updateDisplayModeIcon() { - FontAwesomeIcon icon = FontAwesomeIcon.CALENDAR; + FontAwesome icon = FontAwesome.CALENDAR; if (getDisplayMode().equals(DisplayMode.GRID)) { - icon = FontAwesomeIcon.CALENDAR_ALT; + icon = FontAwesome.TABLE; } - final Text graphic = FontAwesomeIconFactory.get().createIcon(icon); + final FontIcon graphic = new FontIcon(icon); graphic.getStyleClass().addAll("button-icon", "display-mode-icon"); displayModeButton.setGraphic(graphic); } diff --git a/CalendarFXView/src/main/java/impl/com/calendarfx/view/CalendarViewSkin.java b/CalendarFXView/src/main/java/impl/com/calendarfx/view/CalendarViewSkin.java index d2baaf45..674e863f 100644 --- a/CalendarFXView/src/main/java/impl/com/calendarfx/view/CalendarViewSkin.java +++ b/CalendarFXView/src/main/java/impl/com/calendarfx/view/CalendarViewSkin.java @@ -16,23 +16,6 @@ package impl.com.calendarfx.view; -import static com.calendarfx.view.RequestEvent.REQUEST_DATE; -import static com.calendarfx.view.RequestEvent.REQUEST_DATE_TIME; -import static com.calendarfx.view.RequestEvent.REQUEST_ENTRY; -import static com.calendarfx.view.RequestEvent.REQUEST_WEEK; -import static com.calendarfx.view.RequestEvent.REQUEST_YEAR; -import static com.calendarfx.view.RequestEvent.REQUEST_YEAR_MONTH; -import static com.calendarfx.view.YearMonthView.ClickBehaviour.PERFORM_SELECTION; -import static javafx.geometry.Side.RIGHT; -import static javafx.scene.control.SelectionMode.SINGLE; - -import java.util.ArrayList; -import java.util.List; - -import org.controlsfx.control.MasterDetailPane; -import org.controlsfx.control.SegmentedButton; -import org.controlsfx.control.textfield.CustomTextField; - import com.calendarfx.model.Calendar; import com.calendarfx.model.Entry; import com.calendarfx.view.CalendarFXControl; @@ -50,9 +33,6 @@ import com.calendarfx.view.print.PrintView; import com.calendarfx.view.print.PrintablePage; import com.calendarfx.view.print.ViewType; - -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.utils.FontAwesomeIconFactory; import javafx.animation.Animation.Status; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; @@ -84,665 +64,679 @@ import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; -import javafx.scene.text.Text; import javafx.util.Duration; +import org.controlsfx.control.MasterDetailPane; +import org.controlsfx.control.SegmentedButton; +import org.controlsfx.control.textfield.CustomTextField; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; + +import java.util.ArrayList; +import java.util.List; + +import static com.calendarfx.view.RequestEvent.REQUEST_DATE; +import static com.calendarfx.view.RequestEvent.REQUEST_DATE_TIME; +import static com.calendarfx.view.RequestEvent.REQUEST_ENTRY; +import static com.calendarfx.view.RequestEvent.REQUEST_WEEK; +import static com.calendarfx.view.RequestEvent.REQUEST_YEAR; +import static com.calendarfx.view.RequestEvent.REQUEST_YEAR_MONTH; +import static com.calendarfx.view.YearMonthView.ClickBehaviour.PERFORM_SELECTION; +import static javafx.geometry.Side.RIGHT; +import static javafx.scene.control.SelectionMode.SINGLE; public class CalendarViewSkin extends SkinBase { - private MasterDetailPane leftMasterDetailPane; - private ToggleButton trayButton; - private Button addCalendarButton; - private Button printButton; - private SearchResultView searchResultView; - private StackPane stackPane; - - private DayPage dayPage; - private WeekPage weekPage; - private MonthPage monthPage; - private YearPage yearPage; - - private List pageList = new ArrayList<>(); - private ToggleButton showYear; - private ToggleButton showMonth; - private ToggleButton showWeek; - private ToggleButton showDay; - private HBox leftToolBarBox; - private SegmentedButton switcher; - - private SourceView sourceView; - private final InvalidationListener entriesVisibilityListener = obs -> updateCalendarVisibility(); - private final InvalidationListener printEntriesVisibilityListener = obs -> updatePrintVisibility(); - - public CalendarViewSkin(CalendarView view) { - super(view); - - if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$ - view.addEventFilter(KeyEvent.KEY_PRESSED, evt -> { - if (evt.isMetaDown() && evt.getCode().equals(KeyCode.D)) { - view.setShowDeveloperConsole( - !view.isShowDeveloperConsole()); - } - }); - } - - view.addEventHandler(REQUEST_DATE, evt -> view.showDate(evt.getDate())); - view.addEventHandler(REQUEST_DATE_TIME, - evt -> view.showDateTime(evt.getDateTime())); - view.addEventHandler(REQUEST_WEEK, - evt -> view.showWeek(evt.getYear(), evt.getWeekOfYear())); - view.addEventHandler(REQUEST_YEAR_MONTH, - evt -> view.showYearMonth(evt.getYearMonth())); - view.addEventHandler(REQUEST_YEAR, evt -> view.showYear(evt.getYear())); - view.addEventHandler(REQUEST_ENTRY, - evt -> view.getSelectedPage().editEntry(evt.getEntry())); - - this.dayPage = view.getDayPage(); - this.weekPage = view.getWeekPage(); - this.monthPage = view.getMonthPage(); - this.yearPage = view.getYearPage(); - - this.pageList.add(dayPage); - this.pageList.add(weekPage); - this.pageList.add(monthPage); - this.pageList.add(yearPage); - - view.bind(dayPage, true); - view.bind(weekPage, true); - view.bind(monthPage, true); - view.bind(yearPage, true); - - InvalidationListener updateSwitcherListener = it -> buildSwitcher(); - dayPage.hiddenProperty().addListener(updateSwitcherListener); - weekPage.hiddenProperty().addListener(updateSwitcherListener); - monthPage.hiddenProperty().addListener(updateSwitcherListener); - yearPage.hiddenProperty().addListener(updateSwitcherListener); - - this.leftMasterDetailPane = new MasterDetailPane(Side.LEFT); - TrayPane trayPane = new TrayPane(); - this.trayButton = new ToggleButton( - Messages.getString("CalendarViewSkin.TOGGLE_SOURCE_TRAY")); //$NON-NLS-1$ - this.trayButton.setId("show-tray-button"); - this.addCalendarButton = new Button(); - this.addCalendarButton.setId("add-calendar-button"); - this.addCalendarButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); - - Text addIcon = FontAwesomeIconFactory.get() - .createIcon(FontAwesomeIcon.PLUS); - addIcon.getStyleClass().addAll("button-icon", //$NON-NLS-1$ - "add-calendar-button-icon"); //$NON-NLS-1$ - this.addCalendarButton.setGraphic(addIcon); - - this.addCalendarButton.setOnAction(evt -> view.createCalendarSource()); - this.printButton = new Button(); - this.printButton.setId("print-button"); - this.printButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); - this.printButton.setOnAction(evt -> print()); - - Text printIcon = FontAwesomeIconFactory.get() - .createIcon(FontAwesomeIcon.PRINT); - printIcon.getStyleClass().addAll("button-icon", "print-button-icon"); //$NON-NLS-1$ //$NON-NLS-2$ - this.printButton.setGraphic(printIcon); - - if (view.isShowSourceTray()) { - openTray(); - } else { - closeTray(); - } - - Bindings.bindBidirectional(trayButton.selectedProperty(), - view.showSourceTrayProperty()); - - view.showSourceTrayProperty().addListener(it -> { - if (view.isShowSourceTray()) { - openTray(); - } else { - closeTray(); - } - }); - - Platform.runLater(() -> { - sourceView.getCalendarVisibilityMap().keySet() - .forEach(calendar -> sourceView - .getCalendarVisibilityProperty(calendar) - .addListener(entriesVisibilityListener)); - }); - - view.selectedPageProperty().addListener(entriesVisibilityListener); - - ColumnConstraints leftColumn = new ColumnConstraints(); - ColumnConstraints centerColumn = new ColumnConstraints(); - ColumnConstraints rightColumn = new ColumnConstraints(); - - leftColumn.setPercentWidth(35); - centerColumn.setPercentWidth(30); - rightColumn.setPercentWidth(35); - - GridPane toolBarGridPane = new GridPane(); - toolBarGridPane.setMinWidth(0); - toolBarGridPane.getColumnConstraints().addAll(leftColumn, centerColumn, - rightColumn); - - toolBarGridPane.setId("toolbar"); //$NON-NLS-1$ - - /* - * Toolbar box on the left - hand side.Gets rebuild when some of the - * control 's properties change. - */ - leftToolBarBox = new HBox(); - leftToolBarBox.setSpacing(5); - - buildLeftToolBarBox(); - - InvalidationListener buildLeftToolBarBoxListener = it -> buildLeftToolBarBox(); - view.showSourceTrayButtonProperty() - .addListener(buildLeftToolBarBoxListener); - view.showAddCalendarButtonProperty() - .addListener(buildLeftToolBarBoxListener); - view.showPrintButtonProperty().addListener(buildLeftToolBarBoxListener); - view.showPageToolBarControlsProperty() - .addListener(buildLeftToolBarBoxListener); - view.selectedPageProperty().addListener(buildLeftToolBarBoxListener); - - toolBarGridPane.add(leftToolBarBox, 0, 0); - - // toolbar center - showDay = new ToggleButton( - Messages.getString("CalendarViewSkin.TOGGLE_SHOW_DAY")); //$NON-NLS-1$ - showWeek = new ToggleButton( - Messages.getString("CalendarViewSkin.TOGGLE_SHOW_WEEK")); //$NON-NLS-1$ - showMonth = new ToggleButton( - Messages.getString("CalendarViewSkin.TOGGLE_SHOW_MONTH")); //$NON-NLS-1$ - showYear = new ToggleButton( - Messages.getString("CalendarViewSkin.TOGGLE_SHOW_YEAR")); //$NON-NLS-1$ - - showDay.setOnAction(evt -> { - view.showDayPage(); - updateToggleButtons(); - }); - showWeek.setOnAction(evt -> { - view.showWeekPage(); - updateToggleButtons(); - }); - showMonth.setOnAction(evt -> { - view.showMonthPage(); - updateToggleButtons(); - }); - showYear.setOnAction(evt -> { - view.showYearPage(); - updateToggleButtons(); - }); - - switcher = new SegmentedButton(); - switcher.setId("switcher"); //$NON-NLS-1$ - switcher.visibleProperty().bind(view.showPageSwitcherProperty()); - buildSwitcher(); - - GridPane centerToolBarBox = new GridPane(); - GridPane.setHalignment(switcher, HPos.CENTER); - GridPane.setValignment(switcher, VPos.CENTER); - centerToolBarBox.add(switcher, 0, 0); - centerToolBarBox.setAlignment(Pos.CENTER); - toolBarGridPane.add(centerToolBarBox, 1, 0); - - // tooltips - trayButton.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_SOURCE_TRAY"))); //$NON-NLS-1$ - addCalendarButton.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_ADD_CALENDAR"))); //$NON-NLS-1$ - printButton.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_PRINT"))); //$NON-NLS-1$ - showDay.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_DAY"))); //$NON-NLS-1$ - showWeek.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_WEEK"))); //$NON-NLS-1$ - showMonth.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_MONTH"))); //$NON-NLS-1$ - showYear.setTooltip(new Tooltip( - Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_YEAR"))); //$NON-NLS-1$ - - // toolbar right - Text searchIcon = FontAwesomeIconFactory.get() - .createIcon(FontAwesomeIcon.SEARCH); - searchIcon.setId("search-icon"); //$NON-NLS-1$ - - CustomTextField searchField = view.getSearchField(); - searchField.setPrefColumnCount(20); - searchField.setLeft(searchIcon); - searchField.setId("search-field"); //$NON-NLS-1$ - searchField.setPromptText( - Messages.getString("CalendarViewSkin.PROMPT_SEARCH_FIELD")); //$NON-NLS-1$ - searchField.getStylesheets().add(CalendarFXControl.class - .getResource("calendar.css").toExternalForm()); //$NON-NLS-1$ - GridPane.setFillWidth(searchField, false); - GridPane.setHalignment(searchField, HPos.RIGHT); - toolBarGridPane.add(searchField, 2, 0); - - BorderPane borderPane1 = new BorderPane(); - - borderPane1.topProperty().bind(view.headerProperty()); - borderPane1.setCenter(stackPane = new StackPane()); - borderPane1.bottomProperty().bind(view.footerProperty()); - - view.selectedPageProperty().addListener(it -> changePage()); - - leftMasterDetailPane.setMasterNode(borderPane1); - leftMasterDetailPane.setDetailNode(trayPane); - leftMasterDetailPane.setId("tray-pane"); //$NON-NLS-1$ - leftMasterDetailPane.animatedProperty() - .bindBidirectional(view.traysAnimatedProperty()); - leftMasterDetailPane.getStylesheets().add(CalendarFXControl.class - .getResource("calendar.css").toExternalForm()); //$NON-NLS-1$ - - MasterDetailPane rightMasterDetailPane = new MasterDetailPane(RIGHT); - searchResultView = view.getSearchResultView(); - - Bindings.bindContentBidirectional(searchResultView.getCalendarSources(), - view.getCalendarSources()); - - searchResultView.zoneIdProperty().bind(view.zoneIdProperty()); - searchResultView.searchTextProperty().bind(searchField.textProperty()); - searchResultView.selectedEntryProperty() - .addListener(evt -> showSelectedSearchResult()); - - view.showSearchResultsTrayProperty().bind(Bindings - .not(Bindings.isEmpty(searchResultView.getSearchResults()))); - - rightMasterDetailPane.setDetailNode(searchResultView); - rightMasterDetailPane.setMasterNode(leftMasterDetailPane); - rightMasterDetailPane.showDetailNodeProperty() - .bind(view.showSearchResultsTrayProperty()); - - BorderPane borderPane = new BorderPane(); - - if (view.isShowToolBar()) { - borderPane.setTop(toolBarGridPane); - } - - view.showToolBarProperty().addListener(it -> { - if (view.isShowToolBar()) { - borderPane.setTop(toolBarGridPane); - } else { - borderPane.setTop(null); - } - }); - - borderPane.setCenter(rightMasterDetailPane); - - if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$ - DeveloperConsole developerConsole = view.getDeveloperConsole(); - MasterDetailPane developerConsoleMasterDetailPane = new MasterDetailPane( - Side.BOTTOM); - developerConsoleMasterDetailPane.setDividerPosition(.6); - developerConsoleMasterDetailPane.animatedProperty() - .bind(view.traysAnimatedProperty()); - developerConsoleMasterDetailPane.getStyleClass() - .add("developer-master-detail-pane"); //$NON-NLS-1$ - developerConsoleMasterDetailPane.setDetailSide(Side.BOTTOM); - developerConsoleMasterDetailPane.setMasterNode(borderPane); - developerConsoleMasterDetailPane.setDetailNode(developerConsole); - developerConsoleMasterDetailPane.setShowDetailNode(true); - developerConsoleMasterDetailPane.showDetailNodeProperty() - .bind(view.showDeveloperConsoleProperty()); - developerConsoleMasterDetailPane.getStylesheets() - .add(CalendarFXControl.class.getResource("calendar.css") - .toExternalForm()); - getChildren().add(developerConsoleMasterDetailPane); - } else { - getChildren().add(borderPane); - } - - stackPane.getChildren().setAll(dayPage, weekPage, monthPage, yearPage); - - final PageBase selectedPage = view.getSelectedPage(); - selectedPage.toFront(); - - hideNonSelectedPages(); - updateToggleButtons(); - } - - private void openTray() { - leftMasterDetailPane.resetDividerPosition(); - leftMasterDetailPane.setShowDetailNode(true); - } - - private void closeTray() { - leftMasterDetailPane.setShowDetailNode(false); - } - - /** - * Refresh entries from specific page (Selected Page). It is called - * after change selected Page (ButtonSwitcher) or check/uncheck any - * CalendarSource. - */ - private void updateCalendarVisibility() { - CalendarView view = getSkinnable(); - - if (view.getSelectedPage() == view.getDayPage()) { - view.getDayPage().refreshData(); - } else if (view.getSelectedPage() == view.getWeekPage()) { - view.getWeekPage().refreshData(); - } - } - - /** - * Refresh entries in PrintablePage. It is called after change type - * of view or check/uncheck any CalendarSource in Print dialog. - */ - private void updatePrintVisibility() { - PrintablePage printablePage = printView.getPreviewPane() - .getPrintablePage(); - - if (printablePage.getViewType() == ViewType.DAY_VIEW) { - printablePage.getDayView().refreshData(); - } else if (printablePage.getViewType() == ViewType.WEEK_VIEW) { - printablePage.getWeekView().refreshData(); - } - } - - private void buildSwitcher() { - switcher.getButtons().clear(); - if (!dayPage.isHidden()) { - switcher.getButtons().add(showDay); - } - if (!weekPage.isHidden()) { - switcher.getButtons().add(showWeek); - } - if (!monthPage.isHidden()) { - switcher.getButtons().add(showMonth); - } - if (!yearPage.isHidden()) { - switcher.getButtons().add(showYear); - } - - // no need to show anything if there is only one page left - if (switcher.getButtons().size() == 1) { - switcher.getButtons().clear(); - } - } - - private void buildLeftToolBarBox() { - leftToolBarBox.getChildren().clear(); - - if (getSkinnable().isShowSourceTrayButton()) { - leftToolBarBox.getChildren().add(trayButton); - } - - if (getSkinnable().isShowAddCalendarButton()) { - leftToolBarBox.getChildren().add(addCalendarButton); - } - - if (!leftToolBarBox.getChildren().isEmpty() - && getSkinnable().isShowPrintButton()) { - leftToolBarBox.getChildren() - .add(new Separator(Orientation.VERTICAL)); - } - - if (getSkinnable().isShowPrintButton()) { - leftToolBarBox.getChildren().add(printButton); - } - - if (getSkinnable().isShowPageToolBarControls()) { - PageBase page = getSkinnable().getSelectedPage(); - Node toolBarControls = page.getToolBarControls(); - - if (toolBarControls != null && !((toolBarControls instanceof Pane) - && ((Pane) toolBarControls).getChildrenUnmodifiable() - .isEmpty())) { - if (!leftToolBarBox.getChildren().isEmpty()) { - leftToolBarBox.getChildren() - .add(new Separator(Orientation.VERTICAL)); - } - leftToolBarBox.getChildren().add(toolBarControls); - } - } - } - - private Timeline timeline; - - private void changePage() { - CalendarView view = getSkinnable(); - - if (view.isTransitionsEnabled()) { - animateChangePage(); - } else { - updateToggleButtons(); - - PageBase selectedPage = view.getSelectedPage(); - - selectedPage.setManaged(true); - selectedPage.setVisible(true); - - /* - * These values might have been changed if transitions were used - * before. - */ - selectedPage.setScaleX(1); - selectedPage.setScaleY(1); - selectedPage.setOpacity(1); - selectedPage.toFront(); - - hideNonSelectedPages(); - } - } - - private void hideNonSelectedPages() { - PageBase selectedPage = getSkinnable().getSelectedPage(); - - pageList.forEach(page -> { - if (page != selectedPage) { - page.setVisible(false); - page.setManaged(false); - } - }); - } - - private void updateToggleButtons() { - CalendarView view = getSkinnable(); - PageBase page = view.getSelectedPage(); - if (page == view.getDayPage()) { - showDay.setSelected(true); - } else if (page == view.getWeekPage()) { - showWeek.setSelected(true); - } else if (page == view.getMonthPage()) { - showMonth.setSelected(true); - } else if (page == view.getYearPage()) { - showYear.setSelected(true); - } - } - - private void animateChangePage() { - if (timeline != null && timeline.getStatus().equals(Status.RUNNING)) { - return; - } - - PageBase oldPage = null; - - final ObservableList children = stackPane.getChildren(); - if (!children.isEmpty()) { - oldPage = (PageBase) children.get(children.size() - 1); - } - - final Node fOldPage = oldPage; - - boolean zoomIn = false; - - PageBase newPage = getSkinnable().getSelectedPage(); - - timeline = new Timeline(); - - double small = .6; - double large = 1.4; - Duration duration = Duration.seconds(.2); - - if (oldPage != null) { - oldPage.setCache(true); - oldPage.setCacheHint(CacheHint.SCALE); - - zoomIn = pageList.indexOf(newPage) < pageList.indexOf(oldPage); - - KeyValue oldOpacity = new KeyValue(oldPage.opacityProperty(), 0); - KeyValue oldScaleX = new KeyValue(oldPage.scaleXProperty(), - zoomIn ? large : small); - KeyValue oldScaleY = new KeyValue(oldPage.scaleYProperty(), - zoomIn ? large : small); - KeyFrame frame1 = new KeyFrame(duration, oldOpacity, oldScaleX, - oldScaleY); - timeline.getKeyFrames().add(frame1); - - oldPage.setCache(true); - oldPage.setCacheHint(CacheHint.SCALE); - - timeline.setOnFinished(evt -> { - fOldPage.setVisible(false); - fOldPage.setManaged(false); - fOldPage.setCache(false); - newPage.setCache(false); - updateToggleButtons(); - }); - } else { - timeline.setOnFinished(evt -> updateToggleButtons()); - } - - newPage.setOpacity(0); - newPage.setScaleX(zoomIn ? small : large); - newPage.setScaleY(zoomIn ? small : large); - newPage.setCache(true); - newPage.setCacheHint(CacheHint.SCALE); - newPage.toFront(); - - pageList.forEach(page -> { - if (!(page == newPage || page == fOldPage)) { - page.setVisible(false); - page.setManaged(false); - } else { - page.setVisible(true); - page.setManaged(true); - } - }); - - KeyValue newOpacity = new KeyValue(newPage.opacityProperty(), 1); - KeyValue newScaleX = new KeyValue(newPage.scaleXProperty(), 1); - KeyValue newScaleY = new KeyValue(newPage.scaleYProperty(), 1); - - if (!children.contains(newPage)) { - children.add(newPage); - } - - KeyFrame frame2 = new KeyFrame(duration, newOpacity, newScaleX, - newScaleY); - timeline.getKeyFrames().add(frame2); - - timeline.play(); - } - - private void showSelectedSearchResult() { - Entry result = searchResultView.getSelectedEntry(); - if (result != null) { - getSkinnable().showEntry(result); - } - } - - class TrayPane extends BorderPane { - - private YearMonthView yearMonthView; - - public TrayPane() { - // source view - sourceView = getSkinnable().getSourceView(); - sourceView.bind(getSkinnable()); - - // year month view - yearMonthView = getSkinnable().getYearMonthView(); - yearMonthView.setShowToday(false); - yearMonthView.setShowTodayButton(false); - yearMonthView.setId("date-picker"); //$NON-NLS-1$ - yearMonthView.setSelectionMode(SINGLE); - yearMonthView.setClickBehaviour(PERFORM_SELECTION); - yearMonthView.getSelectedDates().add(getSkinnable().getDate()); - yearMonthView.getSelectedDates().addListener((Observable evt) -> { - if (!yearMonthView.getSelectedDates().isEmpty()) { - yearMonthView.setDate( - yearMonthView.getSelectedDates().iterator().next()); - } - }); - - getSkinnable().dateProperty().addListener(it -> { - yearMonthView.getSelectedDates().clear(); - yearMonthView.getSelectedDates().add(getSkinnable().getDate()); - }); - - Bindings.bindBidirectional(yearMonthView.todayProperty(), - getSkinnable().todayProperty()); - Bindings.bindBidirectional(yearMonthView.dateProperty(), - getSkinnable().dateProperty()); - yearMonthView.weekFieldsProperty() - .bind(getSkinnable().weekFieldsProperty()); - - ScrollPane scrollPane = new ScrollPane(sourceView); - - scrollPane.getStyleClass().add("source-view-scroll-pane"); //$NON-NLS-1$ - setCenter(scrollPane); - setBottom(yearMonthView); - } - } - - private PrintView printView; - - private void print() { - if (printView == null) { - printView = getSkinnable().getPrintView(); - printView.dateProperty().bind(getSkinnable().dateProperty()); - } - - printView.setToday(getSkinnable().getToday()); - printView.getPreviewPane().getPrintablePage() - .setPageStartDate(getSkinnable().getDate()); - - printView.setWeekFields(getSkinnable().getWeekFields()); - printView.getCalendarSources() - .setAll(getSkinnable().getCalendarSources()); - printView.setLayout(getSkinnable().getSelectedPage().getLayout()); - printView.setViewType( - getSkinnable().getSelectedPage().getPrintViewType()); - printView.loadDropDownValues(getSkinnable().getDate()); - - printView.show(getSkinnable().getScene().getWindow()); - - Platform.runLater(() -> { - - SourceView printSource = printView.getSettingsView() - .getSourceView(); - - for (Calendar calendar : printSource.getCalendarVisibilityMap() - .keySet()) { - printSource.getCalendarVisibilityProperty(calendar) - .removeListener(printEntriesVisibilityListener); - printSource.getCalendarVisibilityProperty(calendar) - .addListener(printEntriesVisibilityListener); - } - - }); - } - - @Override - protected double computePrefHeight(double width, double topInset, - double rightInset, double bottomInset, double leftInset) { - double dayHeight = dayPage.prefHeight(-1); - double weekHeight = weekPage.prefHeight(-1); - double monthHeight = monthPage.prefHeight(-1); - double yearHeight = yearPage.prefHeight(-1); - return Math.max(dayHeight, - Math.max(weekHeight, Math.max(monthHeight, yearHeight))); - } - - @Override - protected double computePrefWidth(double width, double topInset, - double rightInset, double bottomInset, double leftInset) { - double dayWidth = dayPage.prefWidth(-1); - double weekWidth = weekPage.prefWidth(-1); - double monthWidth = monthPage.prefWidth(-1); - double yearWidth = yearPage.prefWidth(-1); - return Math.max(dayWidth, - Math.max(weekWidth, Math.max(monthWidth, yearWidth))); - } + private MasterDetailPane leftMasterDetailPane; + private ToggleButton trayButton; + private Button addCalendarButton; + private Button printButton; + private SearchResultView searchResultView; + private StackPane stackPane; + + private DayPage dayPage; + private WeekPage weekPage; + private MonthPage monthPage; + private YearPage yearPage; + + private List pageList = new ArrayList<>(); + private ToggleButton showYear; + private ToggleButton showMonth; + private ToggleButton showWeek; + private ToggleButton showDay; + private HBox leftToolBarBox; + private SegmentedButton switcher; + + private SourceView sourceView; + private final InvalidationListener entriesVisibilityListener = obs -> updateCalendarVisibility(); + private final InvalidationListener printEntriesVisibilityListener = obs -> updatePrintVisibility(); + + public CalendarViewSkin(CalendarView view) { + super(view); + + if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$ + view.addEventFilter(KeyEvent.KEY_PRESSED, evt -> { + if (evt.isMetaDown() && evt.getCode().equals(KeyCode.D)) { + view.setShowDeveloperConsole( + !view.isShowDeveloperConsole()); + } + }); + } + + view.addEventHandler(REQUEST_DATE, evt -> view.showDate(evt.getDate())); + view.addEventHandler(REQUEST_DATE_TIME, + evt -> view.showDateTime(evt.getDateTime())); + view.addEventHandler(REQUEST_WEEK, + evt -> view.showWeek(evt.getYear(), evt.getWeekOfYear())); + view.addEventHandler(REQUEST_YEAR_MONTH, + evt -> view.showYearMonth(evt.getYearMonth())); + view.addEventHandler(REQUEST_YEAR, evt -> view.showYear(evt.getYear())); + view.addEventHandler(REQUEST_ENTRY, + evt -> view.getSelectedPage().editEntry(evt.getEntry())); + + this.dayPage = view.getDayPage(); + this.weekPage = view.getWeekPage(); + this.monthPage = view.getMonthPage(); + this.yearPage = view.getYearPage(); + + this.pageList.add(dayPage); + this.pageList.add(weekPage); + this.pageList.add(monthPage); + this.pageList.add(yearPage); + + view.bind(dayPage, true); + view.bind(weekPage, true); + view.bind(monthPage, true); + view.bind(yearPage, true); + + InvalidationListener updateSwitcherListener = it -> buildSwitcher(); + dayPage.hiddenProperty().addListener(updateSwitcherListener); + weekPage.hiddenProperty().addListener(updateSwitcherListener); + monthPage.hiddenProperty().addListener(updateSwitcherListener); + yearPage.hiddenProperty().addListener(updateSwitcherListener); + + this.leftMasterDetailPane = new MasterDetailPane(Side.LEFT); + TrayPane trayPane = new TrayPane(); + this.trayButton = new ToggleButton( + Messages.getString("CalendarViewSkin.TOGGLE_SOURCE_TRAY")); //$NON-NLS-1$ + this.trayButton.setId("show-tray-button"); + this.addCalendarButton = new Button(); + this.addCalendarButton.setId("add-calendar-button"); + this.addCalendarButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); + + FontIcon addIcon = new FontIcon(FontAwesome.PLUS); + addIcon.getStyleClass().addAll("button-icon", //$NON-NLS-1$ + "add-calendar-button-icon"); //$NON-NLS-1$ + this.addCalendarButton.setGraphic(addIcon); + + this.addCalendarButton.setOnAction(evt -> view.createCalendarSource()); + this.printButton = new Button(); + this.printButton.setId("print-button"); + this.printButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); + this.printButton.setOnAction(evt -> print()); + + FontIcon printIcon = new FontIcon(FontAwesome.PRINT); + printIcon.getStyleClass().addAll("button-icon", "print-button-icon"); //$NON-NLS-1$ //$NON-NLS-2$ + this.printButton.setGraphic(printIcon); + + if (view.isShowSourceTray()) { + openTray(); + } else { + closeTray(); + } + + Bindings.bindBidirectional(trayButton.selectedProperty(), + view.showSourceTrayProperty()); + + view.showSourceTrayProperty().addListener(it -> { + if (view.isShowSourceTray()) { + openTray(); + } else { + closeTray(); + } + }); + + Platform.runLater(() -> { + sourceView.getCalendarVisibilityMap().keySet() + .forEach(calendar -> sourceView + .getCalendarVisibilityProperty(calendar) + .addListener(entriesVisibilityListener)); + }); + + view.selectedPageProperty().addListener(entriesVisibilityListener); + + ColumnConstraints leftColumn = new ColumnConstraints(); + ColumnConstraints centerColumn = new ColumnConstraints(); + ColumnConstraints rightColumn = new ColumnConstraints(); + + leftColumn.setPercentWidth(35); + centerColumn.setPercentWidth(30); + rightColumn.setPercentWidth(35); + + GridPane toolBarGridPane = new GridPane(); + toolBarGridPane.setMinWidth(0); + toolBarGridPane.getColumnConstraints().addAll(leftColumn, centerColumn, + rightColumn); + + toolBarGridPane.setId("toolbar"); //$NON-NLS-1$ + + /* + * Toolbar box on the left - hand side.Gets rebuild when some of the + * control 's properties change. + */ + leftToolBarBox = new HBox(); + leftToolBarBox.setSpacing(5); + + buildLeftToolBarBox(); + + InvalidationListener buildLeftToolBarBoxListener = it -> buildLeftToolBarBox(); + view.showSourceTrayButtonProperty() + .addListener(buildLeftToolBarBoxListener); + view.showAddCalendarButtonProperty() + .addListener(buildLeftToolBarBoxListener); + view.showPrintButtonProperty().addListener(buildLeftToolBarBoxListener); + view.showPageToolBarControlsProperty() + .addListener(buildLeftToolBarBoxListener); + view.selectedPageProperty().addListener(buildLeftToolBarBoxListener); + + toolBarGridPane.add(leftToolBarBox, 0, 0); + + // toolbar center + showDay = new ToggleButton( + Messages.getString("CalendarViewSkin.TOGGLE_SHOW_DAY")); //$NON-NLS-1$ + showWeek = new ToggleButton( + Messages.getString("CalendarViewSkin.TOGGLE_SHOW_WEEK")); //$NON-NLS-1$ + showMonth = new ToggleButton( + Messages.getString("CalendarViewSkin.TOGGLE_SHOW_MONTH")); //$NON-NLS-1$ + showYear = new ToggleButton( + Messages.getString("CalendarViewSkin.TOGGLE_SHOW_YEAR")); //$NON-NLS-1$ + + showDay.setOnAction(evt -> { + view.showDayPage(); + updateToggleButtons(); + }); + showWeek.setOnAction(evt -> { + view.showWeekPage(); + updateToggleButtons(); + }); + showMonth.setOnAction(evt -> { + view.showMonthPage(); + updateToggleButtons(); + }); + showYear.setOnAction(evt -> { + view.showYearPage(); + updateToggleButtons(); + }); + + switcher = new SegmentedButton(); + switcher.setId("switcher"); //$NON-NLS-1$ + switcher.visibleProperty().bind(view.showPageSwitcherProperty()); + buildSwitcher(); + + GridPane centerToolBarBox = new GridPane(); + GridPane.setHalignment(switcher, HPos.CENTER); + GridPane.setValignment(switcher, VPos.CENTER); + centerToolBarBox.add(switcher, 0, 0); + centerToolBarBox.setAlignment(Pos.CENTER); + toolBarGridPane.add(centerToolBarBox, 1, 0); + + // tooltips + trayButton.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_SOURCE_TRAY"))); //$NON-NLS-1$ + addCalendarButton.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_ADD_CALENDAR"))); //$NON-NLS-1$ + printButton.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_PRINT"))); //$NON-NLS-1$ + showDay.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_DAY"))); //$NON-NLS-1$ + showWeek.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_WEEK"))); //$NON-NLS-1$ + showMonth.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_MONTH"))); //$NON-NLS-1$ + showYear.setTooltip(new Tooltip( + Messages.getString("CalendarViewSkin.TOOLTIP_SHOW_YEAR"))); //$NON-NLS-1$ + + // toolbar right + FontIcon searchIcon = new FontIcon(FontAwesome.SEARCH); + searchIcon.setId("search-icon"); //$NON-NLS-1$ + + CustomTextField searchField = view.getSearchField(); + searchField.setPrefColumnCount(20); + searchField.setLeft(searchIcon); + searchField.setId("search-field"); //$NON-NLS-1$ + searchField.setPromptText( + Messages.getString("CalendarViewSkin.PROMPT_SEARCH_FIELD")); //$NON-NLS-1$ + searchField.getStylesheets().add(CalendarFXControl.class + .getResource("calendar.css").toExternalForm()); //$NON-NLS-1$ + GridPane.setFillWidth(searchField, false); + GridPane.setHalignment(searchField, HPos.RIGHT); + toolBarGridPane.add(searchField, 2, 0); + + BorderPane borderPane1 = new BorderPane(); + + borderPane1.topProperty().bind(view.headerProperty()); + borderPane1.setCenter(stackPane = new StackPane()); + borderPane1.bottomProperty().bind(view.footerProperty()); + + view.selectedPageProperty().addListener(it -> changePage()); + + leftMasterDetailPane.setMasterNode(borderPane1); + leftMasterDetailPane.setDetailNode(trayPane); + leftMasterDetailPane.setId("tray-pane"); //$NON-NLS-1$ + leftMasterDetailPane.animatedProperty() + .bindBidirectional(view.traysAnimatedProperty()); + leftMasterDetailPane.getStylesheets().add(CalendarFXControl.class + .getResource("calendar.css").toExternalForm()); //$NON-NLS-1$ + + MasterDetailPane rightMasterDetailPane = new MasterDetailPane(RIGHT); + searchResultView = view.getSearchResultView(); + + Bindings.bindContentBidirectional(searchResultView.getCalendarSources(), + view.getCalendarSources()); + + searchResultView.zoneIdProperty().bind(view.zoneIdProperty()); + searchResultView.searchTextProperty().bind(searchField.textProperty()); + searchResultView.selectedEntryProperty() + .addListener(evt -> showSelectedSearchResult()); + + view.showSearchResultsTrayProperty().bind(Bindings + .not(Bindings.isEmpty(searchResultView.getSearchResults()))); + + rightMasterDetailPane.setDetailNode(searchResultView); + rightMasterDetailPane.setMasterNode(leftMasterDetailPane); + rightMasterDetailPane.showDetailNodeProperty() + .bind(view.showSearchResultsTrayProperty()); + + BorderPane borderPane = new BorderPane(); + + if (view.isShowToolBar()) { + borderPane.setTop(toolBarGridPane); + } + + view.showToolBarProperty().addListener(it -> { + if (view.isShowToolBar()) { + borderPane.setTop(toolBarGridPane); + } else { + borderPane.setTop(null); + } + }); + + borderPane.setCenter(rightMasterDetailPane); + + if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$ + DeveloperConsole developerConsole = view.getDeveloperConsole(); + MasterDetailPane developerConsoleMasterDetailPane = new MasterDetailPane( + Side.BOTTOM); + developerConsoleMasterDetailPane.setDividerPosition(.6); + developerConsoleMasterDetailPane.animatedProperty() + .bind(view.traysAnimatedProperty()); + developerConsoleMasterDetailPane.getStyleClass() + .add("developer-master-detail-pane"); //$NON-NLS-1$ + developerConsoleMasterDetailPane.setDetailSide(Side.BOTTOM); + developerConsoleMasterDetailPane.setMasterNode(borderPane); + developerConsoleMasterDetailPane.setDetailNode(developerConsole); + developerConsoleMasterDetailPane.setShowDetailNode(true); + developerConsoleMasterDetailPane.showDetailNodeProperty() + .bind(view.showDeveloperConsoleProperty()); + developerConsoleMasterDetailPane.getStylesheets() + .add(CalendarFXControl.class.getResource("calendar.css") + .toExternalForm()); + getChildren().add(developerConsoleMasterDetailPane); + } else { + getChildren().add(borderPane); + } + + stackPane.getChildren().setAll(dayPage, weekPage, monthPage, yearPage); + + final PageBase selectedPage = view.getSelectedPage(); + selectedPage.toFront(); + + hideNonSelectedPages(); + updateToggleButtons(); + } + + private void openTray() { + leftMasterDetailPane.resetDividerPosition(); + leftMasterDetailPane.setShowDetailNode(true); + } + + private void closeTray() { + leftMasterDetailPane.setShowDetailNode(false); + } + + /** + * Refresh entries from specific page (Selected Page). It is called + * after change selected Page (ButtonSwitcher) or check/uncheck any + * CalendarSource. + */ + private void updateCalendarVisibility() { + CalendarView view = getSkinnable(); + + if (view.getSelectedPage() == view.getDayPage()) { + view.getDayPage().refreshData(); + } else if (view.getSelectedPage() == view.getWeekPage()) { + view.getWeekPage().refreshData(); + } + } + + /** + * Refresh entries in PrintablePage. It is called after change type + * of view or check/uncheck any CalendarSource in Print dialog. + */ + private void updatePrintVisibility() { + PrintablePage printablePage = printView.getPreviewPane() + .getPrintablePage(); + + if (printablePage.getViewType() == ViewType.DAY_VIEW) { + printablePage.getDayView().refreshData(); + } else if (printablePage.getViewType() == ViewType.WEEK_VIEW) { + printablePage.getWeekView().refreshData(); + } + } + + private void buildSwitcher() { + switcher.getButtons().clear(); + if (!dayPage.isHidden()) { + switcher.getButtons().add(showDay); + } + if (!weekPage.isHidden()) { + switcher.getButtons().add(showWeek); + } + if (!monthPage.isHidden()) { + switcher.getButtons().add(showMonth); + } + if (!yearPage.isHidden()) { + switcher.getButtons().add(showYear); + } + + // no need to show anything if there is only one page left + if (switcher.getButtons().size() == 1) { + switcher.getButtons().clear(); + } + } + + private void buildLeftToolBarBox() { + leftToolBarBox.getChildren().clear(); + + if (getSkinnable().isShowSourceTrayButton()) { + leftToolBarBox.getChildren().add(trayButton); + } + + if (getSkinnable().isShowAddCalendarButton()) { + leftToolBarBox.getChildren().add(addCalendarButton); + } + + if (!leftToolBarBox.getChildren().isEmpty() + && getSkinnable().isShowPrintButton()) { + leftToolBarBox.getChildren() + .add(new Separator(Orientation.VERTICAL)); + } + + if (getSkinnable().isShowPrintButton()) { + leftToolBarBox.getChildren().add(printButton); + } + + if (getSkinnable().isShowPageToolBarControls()) { + PageBase page = getSkinnable().getSelectedPage(); + Node toolBarControls = page.getToolBarControls(); + + if (toolBarControls != null && !((toolBarControls instanceof Pane) + && ((Pane) toolBarControls).getChildrenUnmodifiable() + .isEmpty())) { + if (!leftToolBarBox.getChildren().isEmpty()) { + leftToolBarBox.getChildren() + .add(new Separator(Orientation.VERTICAL)); + } + leftToolBarBox.getChildren().add(toolBarControls); + } + } + } + + private Timeline timeline; + + private void changePage() { + CalendarView view = getSkinnable(); + + if (view.isTransitionsEnabled()) { + animateChangePage(); + } else { + updateToggleButtons(); + + PageBase selectedPage = view.getSelectedPage(); + + selectedPage.setManaged(true); + selectedPage.setVisible(true); + + /* + * These values might have been changed if transitions were used + * before. + */ + selectedPage.setScaleX(1); + selectedPage.setScaleY(1); + selectedPage.setOpacity(1); + selectedPage.toFront(); + + hideNonSelectedPages(); + } + } + + private void hideNonSelectedPages() { + PageBase selectedPage = getSkinnable().getSelectedPage(); + + pageList.forEach(page -> { + if (page != selectedPage) { + page.setVisible(false); + page.setManaged(false); + } + }); + } + + private void updateToggleButtons() { + CalendarView view = getSkinnable(); + PageBase page = view.getSelectedPage(); + if (page == view.getDayPage()) { + showDay.setSelected(true); + } else if (page == view.getWeekPage()) { + showWeek.setSelected(true); + } else if (page == view.getMonthPage()) { + showMonth.setSelected(true); + } else if (page == view.getYearPage()) { + showYear.setSelected(true); + } + } + + private void animateChangePage() { + if (timeline != null && timeline.getStatus().equals(Status.RUNNING)) { + return; + } + + PageBase oldPage = null; + + final ObservableList children = stackPane.getChildren(); + if (!children.isEmpty()) { + oldPage = (PageBase) children.get(children.size() - 1); + } + + final Node fOldPage = oldPage; + + boolean zoomIn = false; + + PageBase newPage = getSkinnable().getSelectedPage(); + + timeline = new Timeline(); + + double small = .6; + double large = 1.4; + Duration duration = Duration.seconds(.2); + + if (oldPage != null) { + oldPage.setCache(true); + oldPage.setCacheHint(CacheHint.SCALE); + + zoomIn = pageList.indexOf(newPage) < pageList.indexOf(oldPage); + + KeyValue oldOpacity = new KeyValue(oldPage.opacityProperty(), 0); + KeyValue oldScaleX = new KeyValue(oldPage.scaleXProperty(), + zoomIn ? large : small); + KeyValue oldScaleY = new KeyValue(oldPage.scaleYProperty(), + zoomIn ? large : small); + KeyFrame frame1 = new KeyFrame(duration, oldOpacity, oldScaleX, + oldScaleY); + timeline.getKeyFrames().add(frame1); + + oldPage.setCache(true); + oldPage.setCacheHint(CacheHint.SCALE); + + timeline.setOnFinished(evt -> { + fOldPage.setVisible(false); + fOldPage.setManaged(false); + fOldPage.setCache(false); + newPage.setCache(false); + updateToggleButtons(); + }); + } else { + timeline.setOnFinished(evt -> updateToggleButtons()); + } + + newPage.setOpacity(0); + newPage.setScaleX(zoomIn ? small : large); + newPage.setScaleY(zoomIn ? small : large); + newPage.setCache(true); + newPage.setCacheHint(CacheHint.SCALE); + newPage.toFront(); + + pageList.forEach(page -> { + if (!(page == newPage || page == fOldPage)) { + page.setVisible(false); + page.setManaged(false); + } else { + page.setVisible(true); + page.setManaged(true); + } + }); + + KeyValue newOpacity = new KeyValue(newPage.opacityProperty(), 1); + KeyValue newScaleX = new KeyValue(newPage.scaleXProperty(), 1); + KeyValue newScaleY = new KeyValue(newPage.scaleYProperty(), 1); + + if (!children.contains(newPage)) { + children.add(newPage); + } + + KeyFrame frame2 = new KeyFrame(duration, newOpacity, newScaleX, + newScaleY); + timeline.getKeyFrames().add(frame2); + + timeline.play(); + } + + private void showSelectedSearchResult() { + Entry result = searchResultView.getSelectedEntry(); + if (result != null) { + getSkinnable().showEntry(result); + } + } + + class TrayPane extends BorderPane { + + private YearMonthView yearMonthView; + + public TrayPane() { + // source view + sourceView = getSkinnable().getSourceView(); + sourceView.bind(getSkinnable()); + + // year month view + yearMonthView = getSkinnable().getYearMonthView(); + yearMonthView.setShowToday(false); + yearMonthView.setShowTodayButton(false); + yearMonthView.setId("date-picker"); //$NON-NLS-1$ + yearMonthView.setSelectionMode(SINGLE); + yearMonthView.setClickBehaviour(PERFORM_SELECTION); + yearMonthView.getSelectedDates().add(getSkinnable().getDate()); + yearMonthView.getSelectedDates().addListener((Observable evt) -> { + if (!yearMonthView.getSelectedDates().isEmpty()) { + yearMonthView.setDate( + yearMonthView.getSelectedDates().iterator().next()); + } + }); + + getSkinnable().dateProperty().addListener(it -> { + yearMonthView.getSelectedDates().clear(); + yearMonthView.getSelectedDates().add(getSkinnable().getDate()); + }); + + Bindings.bindBidirectional(yearMonthView.todayProperty(), + getSkinnable().todayProperty()); + Bindings.bindBidirectional(yearMonthView.dateProperty(), + getSkinnable().dateProperty()); + yearMonthView.weekFieldsProperty() + .bind(getSkinnable().weekFieldsProperty()); + + ScrollPane scrollPane = new ScrollPane(sourceView); + + scrollPane.getStyleClass().add("source-view-scroll-pane"); //$NON-NLS-1$ + setCenter(scrollPane); + setBottom(yearMonthView); + } + } + + private PrintView printView; + + private void print() { + if (printView == null) { + printView = getSkinnable().getPrintView(); + printView.dateProperty().bind(getSkinnable().dateProperty()); + } + + printView.setToday(getSkinnable().getToday()); + printView.getPreviewPane().getPrintablePage() + .setPageStartDate(getSkinnable().getDate()); + + printView.setWeekFields(getSkinnable().getWeekFields()); + printView.getCalendarSources() + .setAll(getSkinnable().getCalendarSources()); + printView.setLayout(getSkinnable().getSelectedPage().getLayout()); + printView.setViewType( + getSkinnable().getSelectedPage().getPrintViewType()); + printView.loadDropDownValues(getSkinnable().getDate()); + + printView.show(getSkinnable().getScene().getWindow()); + + Platform.runLater(() -> { + + SourceView printSource = printView.getSettingsView() + .getSourceView(); + + for (Calendar calendar : printSource.getCalendarVisibilityMap() + .keySet()) { + printSource.getCalendarVisibilityProperty(calendar) + .removeListener(printEntriesVisibilityListener); + printSource.getCalendarVisibilityProperty(calendar) + .addListener(printEntriesVisibilityListener); + } + + }); + } + + @Override + protected double computePrefHeight(double width, double topInset, + double rightInset, double bottomInset, double leftInset) { + double dayHeight = dayPage.prefHeight(-1); + double weekHeight = weekPage.prefHeight(-1); + double monthHeight = monthPage.prefHeight(-1); + double yearHeight = yearPage.prefHeight(-1); + return Math.max(dayHeight, + Math.max(weekHeight, Math.max(monthHeight, yearHeight))); + } + + @Override + protected double computePrefWidth(double width, double topInset, + double rightInset, double bottomInset, double leftInset) { + double dayWidth = dayPage.prefWidth(-1); + double weekWidth = weekPage.prefWidth(-1); + double monthWidth = monthPage.prefWidth(-1); + double yearWidth = yearPage.prefWidth(-1); + return Math.max(dayWidth, + Math.max(weekWidth, Math.max(monthWidth, yearWidth))); + } } diff --git a/CalendarFXView/src/main/java/impl/com/calendarfx/view/print/PreviewPaneSkin.java b/CalendarFXView/src/main/java/impl/com/calendarfx/view/print/PreviewPaneSkin.java index b92c073b..81e92493 100644 --- a/CalendarFXView/src/main/java/impl/com/calendarfx/view/print/PreviewPaneSkin.java +++ b/CalendarFXView/src/main/java/impl/com/calendarfx/view/print/PreviewPaneSkin.java @@ -20,8 +20,6 @@ import com.calendarfx.view.print.PreviewPane; import com.calendarfx.view.print.PrintablePage; import com.calendarfx.view.print.ZoomPane; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView; import javafx.beans.binding.Bindings; import javafx.geometry.Pos; import javafx.scene.control.Button; @@ -30,6 +28,8 @@ import javafx.scene.control.Slider; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; +import org.kordamp.ikonli.fontawesome.FontAwesome; +import org.kordamp.ikonli.javafx.FontIcon; public class PreviewPaneSkin extends SkinBase { @@ -47,8 +47,8 @@ public PreviewPaneSkin(PreviewPane control) { PrintablePage page = control.getPrintablePage(); - FontAwesomeIconView backIcon = new FontAwesomeIconView(FontAwesomeIcon.CHEVRON_LEFT); - FontAwesomeIconView forwardIcon = new FontAwesomeIconView(FontAwesomeIcon.CHEVRON_RIGHT); + FontIcon backIcon = new FontIcon(FontAwesome.CHEVRON_LEFT); + FontIcon forwardIcon = new FontIcon(FontAwesome.CHEVRON_RIGHT); Button backBtn = new Button(); backBtn.setGraphic(backIcon); diff --git a/CalendarFXView/src/main/java/module-info.java b/CalendarFXView/src/main/java/module-info.java index bfb2089e..37232e80 100644 --- a/CalendarFXView/src/main/java/module-info.java +++ b/CalendarFXView/src/main/java/module-info.java @@ -1,10 +1,14 @@ module com.calendarfx.view { - requires org.controlsfx.controls; - requires javafx.controls; - requires javafx.fxml; requires java.logging; - requires de.jensd.fx.glyphs.fontawesome; + + requires transitive org.controlsfx.controls; + requires transitive javafx.controls; + requires transitive javafx.fxml; + + requires transitive org.kordamp.ikonli.javafx; + requires transitive org.kordamp.ikonli.fontawesome; + requires transitive com.calendarfx.recurrence; exports com.calendarfx.model; diff --git a/CalendarFXView/src/main/resources/com/calendarfx/view/calendar.css b/CalendarFXView/src/main/resources/com/calendarfx/view/calendar.css index 1b2b5314..6492dbaf 100644 --- a/CalendarFXView/src/main/resources/com/calendarfx/view/calendar.css +++ b/CalendarFXView/src/main/resources/com/calendarfx/view/calendar.css @@ -101,8 +101,8 @@ } .calendar-view .button-icon { - -fx-fill: rgb(100, 100, 100); - -glyph-size: 14.0px; + -fx-icon-color: rgb(100, 100, 100); + -fx-icon-size: 14.0px; } /* diff --git a/CalendarFXWeather/pom.xml b/CalendarFXWeather/pom.xml index 8e9bba9a..d9aec104 100644 --- a/CalendarFXWeather/pom.xml +++ b/CalendarFXWeather/pom.xml @@ -48,10 +48,11 @@ - de.jensd - fontawesomefx-weathericons - 2.0.10-9.1.2 + org.kordamp.ikonli + ikonli-weathericons-pack + 11.3.4 + diff --git a/CalendarFXWeather/src/main/java/com/calendarfx/app/WeatherApp.java b/CalendarFXWeather/src/main/java/com/calendarfx/app/WeatherApp.java index d54819d6..3e5cca9d 100644 --- a/CalendarFXWeather/src/main/java/com/calendarfx/app/WeatherApp.java +++ b/CalendarFXWeather/src/main/java/com/calendarfx/app/WeatherApp.java @@ -19,14 +19,14 @@ import com.calendarfx.model.Calendar; import com.calendarfx.model.CalendarSource; import com.calendarfx.view.MonthSheetView; -import de.jensd.fx.glyphs.weathericons.WeatherIcon; -import de.jensd.fx.glyphs.weathericons.WeatherIconView; import javafx.application.Application; import javafx.beans.Observable; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; +import org.kordamp.ikonli.javafx.FontIcon; +import org.kordamp.ikonli.weathericons.WeatherIcons; import java.time.LocalDate; @@ -59,7 +59,7 @@ public static void main(String[] args) { private static class WeatherCell extends MonthSheetView.SimpleDateCell { - private WeatherIconView icon = new WeatherIconView(WeatherIcon.DAY_SUNNY); + private FontIcon icon = new FontIcon(WeatherIcons.DAY_SUNNY); public WeatherCell(MonthSheetView view, LocalDate date) { super(view, date); @@ -70,48 +70,48 @@ public WeatherCell(MonthSheetView view, LocalDate date) { switch ((int) (Math.random() * 9)) { case 0: - icon = new WeatherIconView(WeatherIcon.DAY_SUNNY); + icon = new FontIcon(WeatherIcons.DAY_SUNNY); break; case 1: - icon = new WeatherIconView(WeatherIcon.DAY_RAIN); + icon = new FontIcon(WeatherIcons.DAY_RAIN); break; case 2: - icon = new WeatherIconView(WeatherIcon.DAY_CLOUDY); + icon = new FontIcon(WeatherIcons.DAY_CLOUDY); break; case 3: - icon = new WeatherIconView(WeatherIcon.DAY_FOG); + icon = new FontIcon(WeatherIcons.DAY_FOG); break; case 4: - icon = new WeatherIconView(WeatherIcon.DAY_LIGHTNING); + icon = new FontIcon(WeatherIcons.DAY_LIGHTNING); break; case 5: - icon = new WeatherIconView(WeatherIcon.DAY_HAIL); + icon = new FontIcon(WeatherIcons.DAY_HAIL); break; case 6: - icon = new WeatherIconView(WeatherIcon.DAY_CLOUDY_HIGH); + icon = new FontIcon(WeatherIcons.DAY_CLOUDY_HIGH); break; case 7: - icon = new WeatherIconView(WeatherIcon.DAY_HAZE); + icon = new FontIcon(WeatherIcons.DAY_HAZE); break; default: - icon = new WeatherIconView(WeatherIcon.DAY_SHOWERS); + icon = new FontIcon(WeatherIcons.DAY_SHOWERS); break; } } getChildren().add(icon); - icon.setGlyphSize(14); + icon.setIconSize(14); updateFillColor(icon); - WeatherIconView fIcon = icon; + FontIcon fIcon = icon; getView().getDateSelectionModel().getSelectedDates().addListener((Observable it) -> updateFillColor(fIcon)); } - private void updateFillColor(WeatherIconView icon) { + private void updateFillColor(FontIcon icon) { if (getDate() != null && getDate().equals(getView().getToday()) || getView().getDateSelectionModel().isSelected(getDate())) { - icon.setFill(Color.WHITE); + icon.setIconColor(Color.WHITE); } else { - icon.setFill(Color.CADETBLUE); + icon.setIconColor(Color.CADETBLUE); } } diff --git a/CalendarFXWeather/src/main/java/module-info.java b/CalendarFXWeather/src/main/java/module-info.java new file mode 100644 index 00000000..7e3739ea --- /dev/null +++ b/CalendarFXWeather/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.calendarfx.weather { + requires javafx.controls; + requires com.calendarfx.view; + requires org.kordamp.ikonli.javafx; + requires org.kordamp.ikonli.weathericons; +} \ No newline at end of file diff --git a/CalendarFXiCal/pom.xml b/CalendarFXiCal/pom.xml index ab9274d5..77cc4e91 100644 --- a/CalendarFXiCal/pom.xml +++ b/CalendarFXiCal/pom.xml @@ -55,7 +55,7 @@ org.mnode.ical4j ical4j - 3.0.7 + 3.0.10 diff --git a/CalendarFXiCal/pom.xml.versionsBackup b/CalendarFXiCal/pom.xml.versionsBackup new file mode 100644 index 00000000..ab9274d5 --- /dev/null +++ b/CalendarFXiCal/pom.xml.versionsBackup @@ -0,0 +1,99 @@ + + + + + 4.0.0 + CalendarFXiCal + ical + + + com.calendarfx + calendar + 11.6.4 + + + + true + + + + + sonatype + https://oss.sonatype.org/content/repositories/snapshots/ + + + + + + + com.calendarfx + view + 11.6.4 + + + + org.controlsfx + openjfx-dialogs + 1.0.3 + + + + org.mnode.ical4j + ical4j + 3.0.7 + + + + backport-util-concurrent + backport-util-concurrent + 3.1 + + + + + + + + maven-assembly-plugin + 2.4 + + ical-demo + + jar-with-dependencies + + false + + + com.calendarfx.ical.ICalCalendarAppLauncher + + + + + + make-samples + package + + single + + + + + + + + \ No newline at end of file diff --git a/CalendarFXiCal/src/main/java/com/calendarfx/ical/ICalCalendarApp.java b/CalendarFXiCal/src/main/java/com/calendarfx/ical/ICalCalendarApp.java index c0d38307..564a24dc 100644 --- a/CalendarFXiCal/src/main/java/com/calendarfx/ical/ICalCalendarApp.java +++ b/CalendarFXiCal/src/main/java/com/calendarfx/ical/ICalCalendarApp.java @@ -49,7 +49,7 @@ public class ICalCalendarApp extends Application { }); @Override - public void start(Stage primaryStage) throws Exception { + public void start(Stage primaryStage) { LoggingDomain.CONFIG.info("Java version: " + System.getProperty("java.version")); System.setProperty("ical4j.unfolding.relaxed", "true"); diff --git a/CalendarFXiCal/src/main/java/module-info.java b/CalendarFXiCal/src/main/java/module-info.java new file mode 100644 index 00000000..c8a9a85f --- /dev/null +++ b/CalendarFXiCal/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module com.calendarfx.ical { + requires java.logging; + requires com.calendarfx.view; + requires org.mnode.ical4j.core; +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index c1cfc822..628d7729 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.8.1 11 11 @@ -80,7 +80,7 @@ junit junit - 4.11 + 4.12 test @@ -94,7 +94,7 @@ org.mockito mockito-all - 1.9.5 + 2.0.2-beta test diff --git a/pom.xml.versionsBackup b/pom.xml.versionsBackup new file mode 100644 index 00000000..cf3979fe --- /dev/null +++ b/pom.xml.versionsBackup @@ -0,0 +1,118 @@ + + 4.0.0 + com.calendarfx + calendar + 11.6.4 + pom + CalendarFX + The parent project for the various CalendarFX modules. + + + Dirk Lemmermann Software & Consulting + + + https://github.com/dlemmermann/CalendarFX + + + + Apache 2.0 + + + + + https://github.com/dlemmermann/CalendarFX + + + + + Dirk Lemmermann + http://www.dlsc.com + DLSC Software & Consulting + + + + + + UTF-8 + + + + CalendarFXRecurrence + CalendarFXSampler + CalendarFXView + CalendarFXExperimental + CalendarFXGoogle + CalendarFXApp + CalendarFXiCal + CalendarFXWeather + CalendarFXAssembly + + + + + bintray-dlsc-oss-repository + dlsc-oss-repository + + https://api.bintray.com/maven/dlsc-oss/repository/CalendarFX/;publish=1 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 11 + 11 + + + + + + + + + + junit + junit + 4.11 + test + + + + org.hamcrest + hamcrest-all + 1.3 + test + + + + org.mockito + mockito-all + 1.9.5 + test + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.1 + + CalendarFX API + protected + false + + + + + + \ No newline at end of file