From 753d3fed420a9edfd703cb2cd02d7f11e3a4c5b3 Mon Sep 17 00:00:00 2001 From: Dirk Lemmermann Date: Tue, 20 Sep 2022 11:46:29 +0200 Subject: [PATCH] Added support for replacing corner nodes in ResourcesView. --- .../view/resources/ResourcesView.java | 38 +++++++++++++++++++ .../view/resources/ResourcesViewSkin.java | 4 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/CalendarFXView/src/main/java/com/calendarfx/view/resources/ResourcesView.java b/CalendarFXView/src/main/java/com/calendarfx/view/resources/ResourcesView.java index 2cbaeed3..d6c430f5 100644 --- a/CalendarFXView/src/main/java/com/calendarfx/view/resources/ResourcesView.java +++ b/CalendarFXView/src/main/java/com/calendarfx/view/resources/ResourcesView.java @@ -344,6 +344,44 @@ public void setWeekViewFactory(Callback weekViewFactory) { this.weekViewFactory.set(weekViewFactory); } + private final ObjectProperty upperLeftCorner = new SimpleObjectProperty<>(this, "upperLeftCorner", new Region()); + + public final Node getUpperLeftCorner() { + return upperLeftCorner.get(); + } + + /** + * Specifies a node that will be placed in the upper left corner of the view. + * + * @return the upper left corner node + */ + public final ObjectProperty upperLeftCornerProperty() { + return upperLeftCorner; + } + + public final void setUpperLeftCorner(Node upperLeftCorner) { + this.upperLeftCorner.set(upperLeftCorner); + } + + private final ObjectProperty upperRightCorner = new SimpleObjectProperty<>(this, "upperRightCorner", new Region()); + + public final Node getUpperRightCorner() { + return upperRightCorner.get(); + } + + /** + * Specifies a node that will be placed in the upper right corner of the view. + * + * @return the upper right corner node + */ + public final ObjectProperty upperRightCornerProperty() { + return upperRightCorner; + } + + public final void setUpperRightCorner(Node upperRightCorner) { + this.upperRightCorner.set(upperRightCorner); + } + private final ObjectProperty> separatorFactory = new SimpleObjectProperty<>(this, "separatorFactory", it-> { Region region = new Region(); region.getStyleClass().add("resource-separator"); diff --git a/CalendarFXView/src/main/java/impl/com/calendarfx/view/resources/ResourcesViewSkin.java b/CalendarFXView/src/main/java/impl/com/calendarfx/view/resources/ResourcesViewSkin.java index 6c8d24f9..e012b36d 100644 --- a/CalendarFXView/src/main/java/impl/com/calendarfx/view/resources/ResourcesViewSkin.java +++ b/CalendarFXView/src/main/java/impl/com/calendarfx/view/resources/ResourcesViewSkin.java @@ -120,12 +120,12 @@ private void updateView() { gridPane.add(timeScaleScrollPane, 0, 1); } - Region upperLeftCorner = new Region(); + Node upperLeftCorner = view.getUpperLeftCorner(); upperLeftCorner.getStyleClass().add("upper-left-corner"); gridPane.add(upperLeftCorner, 0, 0); if (view.isShowScrollBar()) { - Region upperRightCorner = new Region(); + Node upperRightCorner = view.getUpperRightCorner(); upperRightCorner.getStyleClass().add("upper-right-corner"); gridPane.add(upperRightCorner, 2, 0); }