private void layoutNodes()
{
getChildren().clear();
// the result
GridPane gridPane = new GridPane();
gridPane = new GridPane();
gridPane.setVgap(2.0);
gridPane.setHgap(2.0);
//gridPane.setPadding(new javafx.geometry.Insets(0,0,0,0));
//gridPane.gridLinesVisibleProperty().set(true);
getChildren().add(gridPane);
// show weeknumbers
boolean lShowWeeknumbers = ShowWeeknumbers.YES.equals( getShowWeeknumbers() );
int lWeeknumbersCols = (lShowWeeknumbers ? 1 : 0);
// setup the grid so all weekday togglebuttons will grow, but the weeknumbers do not
ColumnConstraints lColumnConstraintsAlwaysGrow = new ColumnConstraints();
lColumnConstraintsAlwaysGrow.setHgrow(Priority.ALWAYS);
ColumnConstraints lColumnConstraintsNeverGrow = new ColumnConstraints();
lColumnConstraintsNeverGrow.setHgrow(Priority.NEVER);
if (lShowWeeknumbers)
{
gridPane.getColumnConstraints().addAll(lColumnConstraintsNeverGrow);
}
gridPane.getColumnConstraints().addAll(lColumnConstraintsAlwaysGrow, lColumnConstraintsAlwaysGrow, lColumnConstraintsAlwaysGrow, lColumnConstraintsAlwaysGrow, lColumnConstraintsAlwaysGrow, lColumnConstraintsAlwaysGrow, lColumnConstraintsAlwaysGrow);
// month spinner
gridPane.add(monthListSpinner, new GridPane.C().col(lWeeknumbersCols).row(0).colSpan(4).rowSpan(1));
// year spinner
gridPane.add(yearListSpinner, new GridPane.C().col(lWeeknumbersCols + 4).row(0).colSpan(3).rowSpan(1));
// double click here to show today
if (lShowWeeknumbers) {
gridPane.add(todayLabel, new GridPane.C().col(0).row(1));
}
// weekday labels
for (int i = 0; i < 7; i++)
{
gridPane.add(weekdayLabels.get(i), new GridPane.C().col(lWeeknumbersCols + i).row(1));
}
// weeknumber labels
if (lShowWeeknumbers)
{
for (int i = 0; i < 6; i++)
{
gridPane.add(weeknumberLabels.get(i), new GridPane.C().col(0).row(i + 2).margin(new javafx.geometry.Insets(0,0,0,0)));
}
}
// setup: 6 rows of 7 days per week (which is the maximum number of buttons required in the worst case layout)
for (int i = 0; i < 6 * 7; i++)
{
gridPane.add(dayButtons.get(i), new GridPane.C().col(lWeeknumbersCols + (i % 7)).row((i / 7) + 2));
}
// add timepicker
// TODO: this is done upon construction, we need to make this dynamic based on Mode and showTime
if (getSkinnable().getMode().equals(CalendarPicker.Mode.SINGLE) && getSkinnable().showTimeProperty().get() == true)
{
gridPane.add(timePicker, new GridPane.C().col(lWeeknumbersCols).row(8).colSpan(7).rowSpan(1));
}
}