import javafx.scene.layout.BorderPane; //導入方法依賴的package包/類
private void update() {
if (!entries.isEmpty()) {
List> workingList = new ArrayList<>(entries);
/*
* Individual calendars are already sorted, but now we are
* displaying entries from several calendars, so let's resort.
*/
Collections.sort(workingList);
for (Entry> entry : workingList) {
Calendar calendar = entry.getCalendar();
BorderPane borderPane = new BorderPane();
borderPane.getStyleClass().add("entry");
Label titleLabel = new Label(entry.getTitle());
BorderPane.setAlignment(titleLabel, Pos.CENTER_LEFT);
titleLabel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
titleLabel.getStyleClass().add("title"); //$NON-NLS-1$
borderPane.setCenter(titleLabel);
Circle colorDot = new Circle();
colorDot.setRadius(2.5);
colorDot.getStyleClass().add(
calendar.getStyle() + "-icon-small"); //$NON-NLS-1$
titleLabel.setGraphic(colorDot);
Label timeLabel = new Label();
if (entry.isFullDay()) {
timeLabel.setText(Messages.getString("EntriesPane.FULL_DAY")); //$NON-NLS-1$
} else {
timeLabel.setText(DateTimeFormatter.ofLocalizedTime(
FormatStyle.SHORT).format(entry.getStartTime()));
}
borderPane.setRight(timeLabel);
timeLabel.getStyleClass().add("time"); //$NON-NLS-1$
BorderPane.setAlignment(timeLabel, Pos.CENTER_RIGHT);
getChildren().add(borderPane);
}
}
}