Skip to content

Commit

Permalink
Various fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Sep 29, 2022
1 parent 5690599 commit 4b4f44c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,6 @@ protected double computeMinHeight(double width, double topInset, double rightIns
return computePrefHeight(width, topInset, rightInset, bottomInset, leftInset);
}

@Override
protected double computeMaxHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
return computePrefHeight(width, topInset, rightInset, bottomInset, leftInset);
}

@Override
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
super.layoutChildren(contentX, contentY, contentWidth, contentHeight);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ public DayViewEditController(DayViewBase dayView) {
}

// also register with the scene property. Mostly to remove our event filter if the component gets destroyed.
dayView.sceneProperty().addListener(((observable, oldValue, newValue) -> {
if (oldValue != null) {
oldValue.removeEventFilter(MouseEvent.MOUSE_RELEASED, mouseReleasedHandler);
dayView.sceneProperty().addListener(((observable, oldScene, newScene) -> {
if (oldScene != null) {
oldScene.removeEventFilter(MouseEvent.MOUSE_RELEASED, mouseReleasedHandler);
}
if (newValue != null) {
newValue.addEventFilter(MouseEvent.MOUSE_RELEASED, mouseReleasedHandler);
if (newScene != null) {
newScene.addEventFilter(MouseEvent.MOUSE_RELEASED, mouseReleasedHandler);
}
}));
dayView.addEventFilter(MouseEvent.MOUSE_MOVED, this::mouseMoved);
Expand Down Expand Up @@ -175,12 +175,18 @@ private enum Operation {
}

private void mouseClicked(MouseEvent evt) {
// standard checks
if (evt.isConsumed() || !evt.isStillSincePress() || !evt.getButton().equals(MouseButton.PRIMARY)) {
return;
}

// do not create new entries while the user is editing the availability calendar
if (view.isEditAvailability()) {
return;
}

// mouse clicks only work on day views, not on entry views
if (!evt.getTarget().equals(view)) {
if (!(evt.getTarget() instanceof DayViewBase)) {
return;
}

Expand Down Expand Up @@ -212,10 +218,9 @@ private void mousePressed(MouseEvent evt) {
LOGGER.finer("mouse event y-coordinate:" + evt.getY());
LOGGER.finer("time: " + view.getZonedDateTimeAt(evt.getX(), evt.getY(), view.getZoneId()));

if (DayViewBase.class.isAssignableFrom(evt.getTarget().getClass())) {
if (evt.getTarget() instanceof DayViewBase) {
mousePressedOnDayView(evt);
} else if (EntryViewBase.class.isAssignableFrom(evt.getTarget().getClass())) {

} else if (evt.getTarget() instanceof EntryViewBase) {
if (view.isEditAvailability()) {
if (!view.isScrollingEnabled()) {
mousePressedEditAvailability(evt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ private void updateViewDatesOverResources() {
dayBox.getChildren().add(weekDayHeaderView);

HBox allResourcesBox = new HBox();
VBox.setVgrow(allResourcesBox, Priority.ALWAYS);

dayBox.getChildren().add(allResourcesBox);

headerBox.getChildren().add(dayBox);
Expand Down Expand Up @@ -227,7 +229,9 @@ private void updateViewDatesOverResources() {
}

if (view.isShowAllDayView()) {
AllDayView allDayView = new AllDayView();

Callback<T, AllDayView> allDayViewFactory = view.getAllDayViewFactory();
AllDayView allDayView = allDayViewFactory.call(resource);

allDayView.getStyleClass().removeAll("only", "first", "middle", "last");

Expand Down Expand Up @@ -262,6 +266,7 @@ private void updateViewDatesOverResources() {
allDayView.getCalendarSources().setAll(calendarSource);
allDayView.setDefaultCalendarProvider(control -> calendarSource.getCalendars().get(0));

VBox.setVgrow(allDayView, Priority.ALWAYS);
singleResourceBox.getChildren().add(allDayView);
}

Expand Down Expand Up @@ -324,7 +329,6 @@ private void updateViewResourcesOverDates() {
HBox headerBox = new HBox();
headerBox.getStyleClass().add("header-box");

headerBox.setFillHeight(true);
gridPane.add(headerBox, 1, 0);

Callback<T, Node> resourceHeaderFactory = view.getResourceHeaderFactory();
Expand Down
22 changes: 12 additions & 10 deletions CalendarFXView/src/main/resources/com/calendarfx/view/calendar.css
Original file line number Diff line number Diff line change
Expand Up @@ -969,14 +969,14 @@
/* Small entries */
.default-style-entry-small {
-fx-padding: 0.15em 0.5em 0.15em 0.5em;
-fx-font-size: 0.9em;
}

.default-style-entry-small-only, .default-style-entry-small-last {
-fx-background-insets: 0.0 2.0 0.0 0.0;
}

.default-style-entry-small:selected > .default-style-entry-small-title-label {
-fx-font-size: 0.9em;
-fx-text-fill: white;
-fx-font-weight: bold;
}
Expand Down Expand Up @@ -2052,6 +2052,8 @@
* Styles for the ResourcesView.
*/
.resources-view {
-fx-border-width: 1px;
-fx-border-color: lightgrey;
}

.resources-view .week-number-label {
Expand All @@ -2064,12 +2066,12 @@
}

.resources-view .header-box .day-box .weekday-header-view {
-fx-border-width: 1px 0px 0px 0px;
-fx-border-width: 0px 0px 0px 0px;
}

.resources-view .header-box .day-box .resource-header {
-fx-border-color: lightgrey;
-fx-padding: 5px;
-fx-border-color: lightgrey;
-fx-font-weight: bold;
-fx-alignment: center;
}
Expand Down Expand Up @@ -2101,7 +2103,7 @@
}

.resources-view .header-box .resource-header-view.first .resource-header {
-fx-border-width: 1px 0px 1px 0px;
-fx-border-width: 0px 0px 1px 0px;
}

.resources-view .header-box .resource-header-view.first .weekday-header-view {
Expand All @@ -2113,7 +2115,7 @@
}

.resources-view .header-box .resource-header-view.last .resource-header {
-fx-border-width: 1px 0px 1px 0px;
-fx-border-width: 0px 0px 1px 0px;
}

.resources-view .header-box .resource-header-view.last .all-day-view {
Expand All @@ -2126,7 +2128,7 @@

.resources-view .header-box .resource-header-view.only .resource-header,
.resources-view .header-box .resource-header-view.middle .resource-header {
-fx-border-width: 1px 0px 1px 0px;
-fx-border-width: 0px 0px 1px 0px;
}

.resources-view .header-box .resource-header-view.only .weekday-header-view,
Expand All @@ -2144,7 +2146,7 @@
}

.resources-view .resources-view-container .week-view.first {
-fx-border-width: 0px 0px 1px 1px;
-fx-border-width: 0px 0px 1px 0px;
}

.resources-view .resources-view-container .week-view.only {
Expand All @@ -2161,17 +2163,17 @@

.resources-view .upper-left-corner {
-fx-border-color: lightgrey;
-fx-border-width: 1px 1px 1px 1px;
-fx-border-width: 0px 1px 1px 0px;
}

.resources-view .upper-right-corner {
-fx-border-color: lightgrey;
-fx-border-width: 1px 1px 1px 1px;
-fx-border-width: 0px 0px 1px 1px;
}

.resources-view .time-scale {
-fx-border-color: lightgrey;
-fx-border-width: 0px 0px 1px 1px;
-fx-border-width: 0px 1px 1px 0px;
}

.resources-view .weekday-separator {
Expand Down

0 comments on commit 4b4f44c

Please sign in to comment.