Skip to content

Commit

Permalink
Changed maximum height of various toolbar controls to ensure proper a…
Browse files Browse the repository at this point in the history
…lignment between all of them.
  • Loading branch information
dlemmermann committed Aug 31, 2022
1 parent 7a69959 commit 298b585
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.calendarfx.model.CalendarSource;
import com.calendarfx.model.Entry;
import com.calendarfx.view.CalendarView;
import com.calendarfx.view.CalendarView.Page;
import com.calendarfx.view.DateControl;

import java.time.LocalDate;
Expand All @@ -43,7 +44,7 @@ protected DateControl createControl() {
CalendarSource calendarSource = new CalendarSource("My Calendars");
calendarSource.getCalendars().add(new HelloCalendar());

calendarView = new CalendarView();
calendarView = new CalendarView(Page.values());
calendarView.getCalendarSources().add(calendarSource);

return calendarView;
Expand Down
28 changes: 21 additions & 7 deletions CalendarFXView/src/main/java/com/calendarfx/view/page/DayPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,34 @@ public Node getToolBarControls() {
return toolBarControls;
}

private Node createToolBarControls() {
ToggleButton agendaOnlyButton = new ToggleButton();
ToggleButton dayOnlyButton = new ToggleButton();
ToggleButton standardButton = new ToggleButton();

/**
* Creates the node used for the page-specific part of the calendar
* view.
*
* @return the toolbar controls specific for this page
*/
protected Node createToolBarControls() {
FontIcon listIcon = new FontIcon(FontAwesome.LIST);
listIcon.getStyleClass().addAll("button-icon");

ToggleButton agendaOnlyButton = new ToggleButton();
agendaOnlyButton.setMaxHeight(Double.MAX_VALUE);
agendaOnlyButton.setGraphic(listIcon);
agendaOnlyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

FontIcon calendarIcon = new FontIcon(FontAwesome.CALENDAR);
calendarIcon.getStyleClass().addAll("button-icon");

ToggleButton dayOnlyButton = new ToggleButton();
dayOnlyButton.setMaxHeight(Double.MAX_VALUE);
dayOnlyButton.setGraphic(calendarIcon);
dayOnlyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

FontIcon standardIcon = new FontIcon(FontAwesome.COLUMNS);
standardIcon.getStyleClass().addAll("button-icon");

ToggleButton standardButton = new ToggleButton();
standardButton.setMaxHeight(Double.MAX_VALUE);
standardButton.setGraphic(standardIcon);
standardButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);

Expand All @@ -119,6 +130,7 @@ private Node createToolBarControls() {
SegmentedButton segmentedButton = new SegmentedButton(agendaOnlyButton, standardButton, dayOnlyButton);
segmentedButton.getStyleClass().add("layout-button");
segmentedButton.visibleProperty().bind(showDayPageLayoutControlsProperty());
segmentedButton.setMaxHeight(Double.MAX_VALUE);

updateDayPageLayoutButtons(agendaOnlyButton, dayOnlyButton, standardButton);
dayPageLayout.addListener((observable, oldValue, newValue) -> updateDayPageLayoutButtons(agendaOnlyButton, dayOnlyButton, standardButton));
Expand All @@ -127,11 +139,13 @@ private Node createToolBarControls() {
dayOnlyButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_MAXIMIZE_DAY_VIEW")));
standardButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_STANDARD_LAYOUT")));

FontIcon layoutIcon = new FontIcon(FontAwesome.TABLE);
layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon");

ToggleButton layoutButton = new ToggleButton();
layoutButton.setMaxHeight(Double.MAX_VALUE);
layoutButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_LAYOUT")));
layoutButton.setId("layout-button");
FontIcon layoutIcon = new FontIcon(FontAwesome.TABLE);
layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon");
layoutButton.setGraphic(layoutIcon);
layoutButton.setSelected(getLayout().equals(Layout.SWIMLANE));
layoutButton.setOnAction(evt -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ public WeekPage() {

this.detailedWeekView = new DetailedWeekView();

FontIcon layoutIcon = new FontIcon(FontAwesome.TABLE);
layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon");

ToggleButton layoutButton = new ToggleButton();
layoutButton.setMaxHeight(Double.MAX_VALUE);
layoutButton.setTooltip(new Tooltip(Messages.getString("WeekPage.TOOLTIP_LAYOUT")));
layoutButton.setId("layout-button");
FontIcon layoutIcon = new FontIcon(FontAwesome.TABLE);
layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon");
layoutButton.setGraphic(layoutIcon);
layoutButton.setSelected(getLayout().equals(Layout.SWIMLANE));
layoutButton.setOnAction(evt -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public YearPage() {
displayModeProperty().addListener(it -> updateDisplayModeIcon());

displayModeButton = new ToggleButton();
displayModeButton.setMaxHeight(Double.MAX_VALUE);
displayModeButton.setId("display-mode-button");
displayModeButton.setTooltip(new Tooltip(Messages.getString("YearPage.TOOLTIP_DISPLAY_MODE")));
displayModeButton.setSelected(getDisplayMode().equals(DisplayMode.COLUMNS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,26 @@ public CalendarViewSkin(CalendarView view) {
TrayPane trayPane = new TrayPane();
this.trayButton = new ToggleButton(Messages.getString("CalendarViewSkin.TOGGLE_SOURCE_TRAY"));
this.trayButton.setId("show-tray-button");
this.addCalendarButton = new Button();
this.addCalendarButton.setId("add-calendar-button");
this.addCalendarButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
this.trayButton.setMaxHeight(Double.MAX_VALUE);

FontIcon addIcon = new FontIcon(FontAwesome.PLUS);
addIcon.getStyleClass().addAll("button-icon", "add-calendar-button-icon");
this.addCalendarButton.setGraphic(addIcon);

this.addCalendarButton = new Button();
this.addCalendarButton.setId("add-calendar-button");
this.addCalendarButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
this.addCalendarButton.setMaxHeight(Double.MAX_VALUE);
this.addCalendarButton.setGraphic(addIcon);
this.addCalendarButton.setOnAction(evt -> view.createCalendarSource());

FontIcon printIcon = new FontIcon(FontAwesome.PRINT);
printIcon.getStyleClass().addAll("button-icon", "print-button-icon");

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");
this.printButton.setMaxHeight(Double.MAX_VALUE);
this.printButton.setGraphic(printIcon);

this.leftMasterDetailPane = new MasterDetailPane(Side.LEFT);
Expand Down Expand Up @@ -183,6 +187,7 @@ public CalendarViewSkin(CalendarView view) {
* control 's properties change.
*/
leftToolBarBox = new HBox();
leftToolBarBox.getStyleClass().add("left-toolbar-container");
leftToolBarBox.setSpacing(5);

buildLeftToolBarBox();
Expand Down

0 comments on commit 298b585

Please sign in to comment.