Skip to content

Commit

Permalink
Fixed updates of day page layout buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Oct 1, 2019
1 parent a54999a commit b11ffa2
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions CalendarFXView/src/main/java/com/calendarfx/view/page/DayPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,8 @@ private Node createToolBarControls() {
segmentedButton.getStyleClass().add("layout-button"); //$NON-NLS-1$
segmentedButton.visibleProperty().bind(showDayPageLayoutControlsProperty());

switch (getDayPageLayout()) {
case AGENDA_ONLY:
agendaOnlyButton.setSelected(true);
break;
case DAY_ONLY:
dayOnlyButton.setSelected(true);
break;
case STANDARD:
standardButton.setSelected(true);
break;
default:
break;
}
updateDayPageLayoutButtons(agendaOnlyButton, dayOnlyButton, standardButton);
dayPageLayout.addListener((observable, oldValue, newValue) -> updateDayPageLayoutButtons(agendaOnlyButton, dayOnlyButton, standardButton));

agendaOnlyButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_MAXIMIZE_AGENDA_LIST"))); //$NON-NLS-1$
dayOnlyButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_MAXIMIZE_DAY_VIEW"))); //$NON-NLS-1$
Expand Down Expand Up @@ -163,6 +152,22 @@ private Node createToolBarControls() {
return toolbarControls;
}

private void updateDayPageLayoutButtons(ToggleButton agendaOnlyButton,ToggleButton dayOnlyButton,ToggleButton standardButton) {
switch (dayPageLayout.get()) {
case AGENDA_ONLY:
agendaOnlyButton.setSelected(true);
break;
case DAY_ONLY:
dayOnlyButton.setSelected(true);
break;
case STANDARD:
standardButton.setSelected(true);
break;
default:
break;
}
}

private void updateToolBarControls(SegmentedButton segmentedButton, ToggleButton layoutButton) {
if (isShowLayoutButton()) {
toolbarControls.getChildren().setAll(layoutButton, segmentedButton);
Expand Down

0 comments on commit b11ffa2

Please sign in to comment.