Skip to content

Commit

Permalink
Face lifting changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Aug 31, 2022
1 parent 4da2a42 commit 5b2e1d2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class CalendarView extends DateControl {
private PrintView printView;

public CalendarView() {
this(DAY, WEEK, MONTH);
this(Page.values());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import static javafx.geometry.Pos.CENTER;

/**
* Displays a given month in a given year. The view can be configured in many
* Displays a given month of a given year. The view can be configured in many
* ways:
* <ul>
* <li>Show / hide the name of the month</li>
Expand Down Expand Up @@ -67,7 +67,6 @@ public class YearMonthView extends MonthViewBase {
*/
public YearMonthView() {
getStyleClass().add("year-month-view");

setCellFactory(view -> new DateCell());
}

Expand Down Expand Up @@ -140,8 +139,7 @@ public final Callback<YearMonthView, DateCell> getCellFactory() {
return cellFactoryProperty().get();
}

private final BooleanProperty showMonth = new SimpleBooleanProperty(this,
"showMonth", true);
private final BooleanProperty showMonth = new SimpleBooleanProperty(this, "showMonth", true);

/**
* Show or hide the name of the month.
Expand Down Expand Up @@ -171,8 +169,7 @@ public final boolean isShowMonth() {
return showMonthProperty().get();
}

private final BooleanProperty showYear = new SimpleBooleanProperty(this,
"showYear", true);
private final BooleanProperty showYear = new SimpleBooleanProperty(this, "showYear", true);

/**
* Show or hide the year.
Expand Down Expand Up @@ -202,8 +199,7 @@ public final boolean isShowYear() {
return showYearProperty().get();
}

private final BooleanProperty showTodayButton = new SimpleBooleanProperty(
this, "showTodayButton", true);
private final BooleanProperty showTodayButton = new SimpleBooleanProperty(this, "showTodayButton", true);

/**
* Show or hide a button to quickly go to today's date.
Expand Down Expand Up @@ -233,8 +229,7 @@ public final boolean isShowTodayButton() {
return showTodayButtonProperty().get();
}

private final BooleanProperty showMonthArrows = new SimpleBooleanProperty(
this, "showMonthArrows", true);
private final BooleanProperty showMonthArrows = new SimpleBooleanProperty(this, "showMonthArrows", true);

/**
* Shows or hides the arrows to change the month.
Expand Down Expand Up @@ -264,8 +259,7 @@ public final boolean isShowMonthArrows() {
return showMonthArrowsProperty().get();
}

private final BooleanProperty showYearArrows = new SimpleBooleanProperty(
this, "showYearArrows", true);
private final BooleanProperty showYearArrows = new SimpleBooleanProperty(this, "showYearArrows", true);

/**
* Shows or hides the arrows to change the year.
Expand Down Expand Up @@ -295,8 +289,7 @@ public final boolean isShowYearArrows() {
return showYearArrowsProperty().get();
}

private final BooleanProperty showUsageColors = new SimpleBooleanProperty(
this, "showUsageColors", false);
private final BooleanProperty showUsageColors = new SimpleBooleanProperty(this, "showUsageColors", false);

/**
* Show or hide usage colors that are based on the number of entries on a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public TrayPane() {

// year month view
yearMonthView = getSkinnable().getYearMonthView();
yearMonthView.setShowToday(false);
yearMonthView.setShowToday(true);
yearMonthView.setShowTodayButton(false);
yearMonthView.setId("date-picker");
yearMonthView.setSelectionMode(SINGLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public YearMonthViewSkin(YearMonthView view) {

final InvalidationListener updateViewListener = evt -> updateView();
view.yearMonthProperty().addListener(evt -> {
if (displayedYearMonth == null
|| !displayedYearMonth.equals(view.getYearMonth())) {
if (displayedYearMonth == null || !displayedYearMonth.equals(view.getYearMonth())) {
updateView();
}
});
Expand Down Expand Up @@ -437,16 +436,14 @@ private void updateView() {
}
}

// update the days (1 .. 31) plus padding days
// update the days (1 to 31) plus padding days

final DayOfWeek firstDayOfWeek = getSkinnable().getFirstDayOfWeek();
LocalDate date = Util.adjustToFirstDayOfWeek(getLoadStartDate(),
firstDayOfWeek);
LocalDate date = Util.adjustToFirstDayOfWeek(getLoadStartDate(), firstDayOfWeek);

if (getSkinnable().isShowWeekNumbers()) {
for (int i = 0; i < 6; i++) {
int weekOfYear = date
.get(getSkinnable().getWeekFields().weekOfYear());
int weekOfYear = date.get(getSkinnable().getWeekFields().weekOfYear());
weekNumberLabels[i].setText(Integer.toString(weekOfYear));
date = date.plusWeeks(1);
}
Expand All @@ -460,19 +457,15 @@ private void updateView() {

YearMonthView.DateCell cell = cellsMap.get(getKey(row, col));
cell.setDate(localDate);
cell.getStyleClass().removeAll(TODAY, DAY_OF_MONTH_LABEL,
DAY_NOT_OF_MONTH_LABEL, WEEKEND_DAY,
SELECTED_MONTH_DATE);
cell.getStyleClass().removeAll(TODAY, DAY_OF_MONTH_LABEL, DAY_NOT_OF_MONTH_LABEL, WEEKEND_DAY, SELECTED_MONTH_DATE);

if (getSkinnable().getSelectedDates().contains(date)) {
cell.getStyleClass().add(SELECTED_MONTH_DATE); // $NON-NLS-1$
}

if (YearMonth.from(date)
.equals(YearMonth.from(getSkinnable().getDate()))) {
if (getSkinnable().isShowToday()
&& date.equals(getSkinnable().getToday())) {
cell.getStyleClass().add(TODAY);
if (YearMonth.from(date).equals(YearMonth.from(getSkinnable().getDate()))) {
if (getSkinnable().isShowToday() && date.equals(getSkinnable().getToday())) {
cell.getStyleClass().addAll(DAY_OF_MONTH_LABEL, TODAY);
} else {
cell.getStyleClass().add(DAY_OF_MONTH_LABEL); // $NON-NLS-1$
}
Expand Down
26 changes: 19 additions & 7 deletions CalendarFXView/src/main/resources/com/calendarfx/view/calendar.css
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@
* Styles needed by the year view.
*/

.year-view .container {
.year-view .scroll-pane {
-fx-padding: 0px;
-fx-background-insets: 0px;
}

.year-view .scroll-pane .container {
-fx-background-color: white;
}

Expand All @@ -355,11 +360,11 @@
}

.year-month-view > .container > .header > .month-header > .month-label {
-fx-font-size: 18.0px;
-fx-font-size: 18px;
}

.year-month-view > .container > .header > .year-header > .year-label {
-fx-font-size: 18.0px;
-fx-font-size: 18px;
}

.year-month-view > .container {
Expand Down Expand Up @@ -409,7 +414,7 @@
.year-month-view > .container > .week-label,
.year-month-view > .container > .day-of-week-label {
-fx-text-fill: gray;
-fx-font-size: 10.0px;
-fx-font-size: 10px;
}

.year-month-view > .container > .week-label {
Expand All @@ -428,7 +433,11 @@
}

.year-month-view > .container > .month-day {
-fx-padding: .2em .3em .2em .3em;
-size: 2em;
-fx-pref-width: -size;
-fx-pref-height: -size;
-fx-min-width: -size;
-fx-min-height: -size;
}

.year-month-view > .container > .day-of-month-label {
Expand Down Expand Up @@ -472,12 +481,15 @@
-fx-background-color: lightgray;
-fx-text-fill: black;
-fx-font-weight: bold;
-fx-background-radius: 10em;
}

.year-month-view > .container > .today {
-fx-background-color: -today-fill-color;
-fx-text-fill: white;
-fx-text-fill: white !important;
-fx-font-weight: bold;
-fx-background-radius: 10em;
-fx-opacity: 1 !important;
}

/*
Expand Down Expand Up @@ -1428,7 +1440,7 @@
.popover-header > .title {
-fx-padding: 0.0;
-fx-text-fill: green;
-fx-font-size: 16.0px;
-fx-font-size: 16px;
-fx-background-color: null;
-fx-border-color: null;
}
Expand Down

0 comments on commit 5b2e1d2

Please sign in to comment.