Top Description Inners Fields Constructors Methods
com.calendarfx.view

public Class AgendaView

extends DateControl
Class Inheritance
Imports
com.calendarfx.model.Entry, impl.com.calendarfx.view.AgendaViewSkin, javafx.beans.property.BooleanProperty, .IntegerProperty, .ObjectProperty, .SimpleBooleanProperty, .SimpleIntegerProperty, .SimpleObjectProperty, javafx.beans.value.ObservableValue, javafx.collections.ObservableList, javafx.geometry.HPos, javafx.scene.Node, javafx.scene.control.ContentDisplay, .ContextMenu, .Label, .ListCell, .ListView, .Menu, .MenuItem, .Skin, javafx.scene.layout.BorderPane, .ColumnConstraints, .GridPane, .Priority, .Region, javafx.scene.shape.Circle, javafx.util.Callback, org.controlsfx.control.PropertySheet.Item, java.text.MessageFormat, java.time.LocalDate, java.time.format.DateTimeFormatter, .FormatStyle, .TextStyle, java.util.ArrayList, .List, .Locale, .Objects, .Optional

The agenda view displays calendar entries in a list. The view can be configured to look back a given number of days and also to look forward a given number of days. Agenda View

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AgendaView.AgendaEntry

Agenda entries are model objects that reference a collection of calendar entries for a specific date.

public static class
AgendaView.AgendaEntryCell

A specialized list cell that is capable of displaying all entries currently assigned to a given day.

Field Summary

Modifier and TypeField and Description
private static final String
private final ObjectProperty<Callback<AgendaView, ? extends AgendaView.AgendaEntryCell>>
private static final String
private final ObjectProperty<DateTimeFormatter>
private final ListView<AgendaView.AgendaEntry>
private final IntegerProperty
private final IntegerProperty
private final BooleanProperty
Inherited from com.calendarfx.view.DateControl:
usagePolicy

Constructor Summary

AccessConstructor and Description
public
AgendaView()

Constructs a new agenda view.

Method Summary

Modifier and TypeMethod and Description
private ContextMenu
public final ObjectProperty<Callback<AgendaView, ? extends AgendaView.AgendaEntryCell>>
protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final ObjectProperty<DateTimeFormatter>

Returns:

the date formatter.
dateTimeFormatterProperty
()

Gets the DateTimeFormatter property, which is use to provide the format on the TimeScale Labels.

public final Callback<AgendaView, ? extends AgendaView.AgendaEntryCell>
public final DateTimeFormatter

Returns:

a date time formatter
getDateTimeFormatter
()

Returns the value of dateTimeFormatterProperty()

public final ListView<AgendaView.AgendaEntry>

Returns:

the list view used by this control
getListView
()

Returns the list view that will be used to display one cell for each day that contains at least one calendar entry.

public final int

Returns:

the number of days to look ahead
getLookAheadPeriodInDays
()

Returns the value of lookAheadPeriodInDaysProperty().

public final int

Returns:

the number of days to look back
getLookBackPeriodInDays
()

Gets the value of lookBackPeriodInDaysProperty().

public ObservableList<PropertySheet.Item>
getPropertySheetItems()

Overrides com.calendarfx.view.DateControl.getPropertySheetItems.

Returns a list of property items that can be shown by the PropertySheet of ControlsFX.

public final boolean
public final IntegerProperty

Returns:

the number of days to "look ahead"
lookAheadPeriodInDaysProperty
()

Stores the number of days to "look ahead" into the future when loading its data.

public final IntegerProperty

Returns:

the number of days to look back
lookBackPeriodInDaysProperty
()

Stores the number of days to "look back" into the past when loading data.

public final void
public final void
setDateTimeFormatter(DateTimeFormatter
a date time formatter, not null
formatter
)

Sets the value of dateTimeFormatterProperty()

public final void
setLookAheadPeriodInDays(int
the number of days to look ahead
days
)

Sets the value of lookAheadPeriodInDaysProperty().

public final void
setLookBackPeriodInDays(int
the new number of days to look back
days
)

Sets the value of lookBackPeriodInDaysProperty().

public final void
setShowStatusLabel(boolean showStatusLabel)

public final BooleanProperty
Inherited from com.calendarfx.view.DateControl:
availabilityCalendarPropertyavailabilityFillPropertyavailabilityGridPropertybindcalendarSourceFactoryPropertycalendarsPropertyclearSelectioncontextMenuCallbackPropertycreateCalendarSourcecreateEntryAtcreateEntryAtcreateEntryAtcreateEntryClickCountPropertydateDetailsCallbackPropertydatePropertydefaultCalendarProviderPropertydeselectdraggedEntryPropertyeditAvailabilityPropertyeditEntryeditEntryenableHyperlinksPropertyenableTimeZoneSupportPropertyendTimePropertyentryContextMenuCallbackPropertyentryDetailsCallbackPropertyentryDetailsPopOverContentCallbackPropertyentryEditPolicyPropertyentryFactoryPropertyfindEntryViewgetAvailabilityCalendargetAvailabilityFillgetAvailabilityGridgetAvailableZoneIdsgetBoundDateControlsgetCalendarAtgetCalendarsgetCalendarSourceFactorygetCalendarSourcesgetCalendarVisibilityMapgetCalendarVisibilityPropertygetContextMenuCallbackgetCreateEntryClickCountgetDategetDateDetailsCallbackgetDefaultCalendarProvidergetDraggedEntrygetEndTimegetEntryContextMenuCallbackgetEntryDetailsCallbackgetEntryDetailsPopOverContentCallbackgetEntryEditPolicygetEntryFactorygetFirstDayOfWeekgetLayoutgetRequestedTimegetSelectionModegetSelectionsgetStartTimegetTimegetTodaygetUsagePolicygetVirtualGridgetWeekendDaysgetWeekFieldsgetZonedDateTimegetZoneIdgoBackgoForwardgoTodayisCalendarVisibleisEditAvailabilityisEnableHyperlinksisEnableTimeZoneSupportisShowDetailsUponEntryCreationisShowNoonMarkerisShowTodayisSuspendUpdateslayoutPropertyrefreshDatarequestedTimePropertyselectselectionModePropertysetAvailabilityCalendarsetAvailabilityFillsetAvailabilityGridsetCalendarSourceFactorysetCalendarVisibilitysetContextMenuCallbacksetCreateEntryClickCountsetDatesetDateDetailsCallbacksetDefaultCalendarProvidersetDraggedEntrysetEditAvailabilitysetEnableHyperlinkssetEnableTimeZoneSupportsetEndTimesetEntryContextMenuCallbacksetEntryDetailsCallbacksetEntryDetailsPopOverContentCallbacksetEntryEditPolicysetEntryFactorysetLayoutsetRequestedTimesetSelectionModesetShowDetailsUponEntryCreationsetShowNoonMarkersetShowTodaysetStartTimesetSuspendUpdatessetTimesetTodaysetUsagePolicysetVirtualGridsetWeekFieldssetZoneIdshowDateDetailsshowDetailsUponEntryCreationPropertyshowEntryshowNoonMarkerPropertyshowTodayPropertystartTimePropertysuspendUpdatesPropertytimePropertytodayPropertyunbindunbindAllusagePolicyPropertyvirtualGridPropertyvisibleLayersPropertyweekFieldsPropertyzoneIdProperty

Field Detail

AGENDA_CATEGORYback to summary
private static final String AGENDA_CATEGORY
cellFactoryback to summary
private final ObjectProperty<Callback<AgendaView, ? extends AgendaView.AgendaEntryCell>> cellFactory
DEFAULT_STYLE_CLASSback to summary
private static final String DEFAULT_STYLE_CLASS
formatterback to summary
private final ObjectProperty<DateTimeFormatter> formatter
listViewback to summary
private final ListView<AgendaView.AgendaEntry> listView
lookAheadPeriodInDaysback to summary
private final IntegerProperty lookAheadPeriodInDays
lookBackPeriodInDaysback to summary
private final IntegerProperty lookBackPeriodInDays
showStatusLabelback to summary
private final BooleanProperty showStatusLabel

Constructor Detail

AgendaViewback to summary
public AgendaView()

Constructs a new agenda view.

Method Detail

buildContextMenuback to summary
private ContextMenu buildContextMenu()
cellFactoryPropertyback to summary
public final ObjectProperty<Callback<AgendaView, ? extends AgendaView.AgendaEntryCell>> cellFactoryProperty()
createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Returns:Skin<?>

new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.

Annotations
@Override
dateTimeFormatterPropertyback to summary
public final ObjectProperty<DateTimeFormatter> dateTimeFormatterProperty()

Gets the DateTimeFormatter property, which is use to provide the format on the TimeScale Labels. By default it has a value of FormatStyle#LONG

Returns:ObjectProperty<DateTimeFormatter>

the date formatter.

getCellFactoryback to summary
public final Callback<AgendaView, ? extends AgendaView.AgendaEntryCell> getCellFactory()
getDateTimeFormatterback to summary
public final DateTimeFormatter getDateTimeFormatter()

Returns the value of dateTimeFormatterProperty()

Returns:DateTimeFormatter

a date time formatter

getListViewback to summary
public final ListView<AgendaView.AgendaEntry> getListView()

Returns the list view that will be used to display one cell for each day that contains at least one calendar entry.

Returns:ListView<AgendaView.AgendaEntry>

the list view used by this control

getLookAheadPeriodInDaysback to summary
public final int getLookAheadPeriodInDays()

Returns the value of lookAheadPeriodInDaysProperty().

Returns:int

the number of days to look ahead

getLookBackPeriodInDaysback to summary
public final int getLookBackPeriodInDays()

Gets the value of lookBackPeriodInDaysProperty().

Returns:int

the number of days to look back

getPropertySheetItemsback to summary
public ObservableList<PropertySheet.Item> getPropertySheetItems()

Overrides com.calendarfx.view.DateControl.getPropertySheetItems.

Doc from com.calendarfx.view.CalendarFXControl.getPropertySheetItems.

Returns a list of property items that can be shown by the PropertySheet of ControlsFX.

Returns:ObservableList<PropertySheet.Item>

the property sheet items

Annotations
@Override
isShowStatusLabelback to summary
public final boolean isShowStatusLabel()
lookAheadPeriodInDaysPropertyback to summary
public final IntegerProperty lookAheadPeriodInDaysProperty()

Stores the number of days to "look ahead" into the future when loading its data.

Returns:IntegerProperty

the number of days to "look ahead"

lookBackPeriodInDaysPropertyback to summary
public final IntegerProperty lookBackPeriodInDaysProperty()

Stores the number of days to "look back" into the past when loading data.

Returns:IntegerProperty

the number of days to look back

setCellFactoryback to summary
public final void setCellFactory(Callback<AgendaView, ? extends AgendaView.AgendaEntryCell> cellFactory)
setDateTimeFormatterback to summary
public final void setDateTimeFormatter(DateTimeFormatter formatter)

Sets the value of dateTimeFormatterProperty()

Parameters
formatter:DateTimeFormatter

a date time formatter, not null

setLookAheadPeriodInDaysback to summary
public final void setLookAheadPeriodInDays(int days)

Sets the value of lookAheadPeriodInDaysProperty().

Parameters
days:int

the number of days to look ahead

setLookBackPeriodInDaysback to summary
public final void setLookBackPeriodInDays(int days)

Sets the value of lookBackPeriodInDaysProperty().

Parameters
days:int

the new number of days to look back

setShowStatusLabelback to summary
public final void setShowStatusLabel(boolean showStatusLabel)
showStatusLabelPropertyback to summary
public final BooleanProperty showStatusLabelProperty()
com.calendarfx.view back to summary

public Class AgendaView.AgendaEntry

extends Object
implements Comparable<AgendaView.AgendaEntry>
Class Inheritance
All Implemented Interfaces
java.lang.Comparable

Agenda entries are model objects that reference a collection of calendar entries for a specific date.

Field Summary

Modifier and TypeField and Description
private final LocalDate
private final List<Entry<?>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(AgendaView.AgendaEntry
the object to be compared.
o
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public LocalDate
public final List<Entry<?>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dateback to summary
private final LocalDate date
entriesback to summary
private final List<Entry<?>> entries

Constructor Detail

AgendaEntryback to summary
public AgendaEntry(LocalDate date)

Method Detail

compareToback to summary
public int compareTo(AgendaView.AgendaEntry o)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
o:AgendaView.AgendaEntry

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
getDateback to summary
public LocalDate getDate()
getEntriesback to summary
public final List<Entry<?>> getEntries()
com.calendarfx.view back to summary

public Class AgendaView.AgendaEntryCell

extends ListCell<AgendaView.AgendaEntry>
Class Inheritance

A specialized list cell that is capable of displaying all entries currently assigned to a given day. Each cell features a header that shows the date information and a body that lists all entries. Each entry is visualized with an icon, a title text, and a time text.
See Also
AgendaView#getListView(), ListView#setCellFactory(javafx.util.Callback)

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private final AgendaView
private Label
private GridPane
private BorderPane
private final boolean
private DateTimeFormatter
private DateTimeFormatter
private DateTimeFormatter
private DateTimeFormatter
private Label

Constructor Summary

AccessConstructor and Description
public
AgendaEntryCell(AgendaView
the parent list view
view
)

Constructs a new cell that will work with the given agenda view.

public
AgendaEntryCell(AgendaView
the parent list view
view
,
boolean
flag to control the visibility of the cell's header.
headerPaneVisible
)

Constructs a new cell that will work with the given agenda view.

Method Summary

Modifier and TypeMethod and Description
protected Node

Returns:

the body node
createBody
()

Creates the node used for the body part of each cell.

protected Node

Returns:

a node for displaying a graphic for the entry
createEntryGraphic
(Entry<?>
the entry for which the icon will be displayed
entry
)

Creates a node used to display an icon for the entry.

protected Label

Returns:

a label for displaying the time information on the entry
createEntryTimeLabel
(Entry<?>
the entry for which the time will be displayed
entry
)

Creates the label used to display the time of the entry.

protected Label

Returns:

a label for displaying the title of the entry
createEntryTitleLabel
(Entry<?>
the entry for which the title will be displayed
entry
)

Creates the label used to display the title of the entry.

protected Node

Returns:

the header node
createHeader
()

Creates the header part for each cell.

protected String

Returns:

a text showing the start and end times of the entry
getTimeText
(Entry<?>
the entry for which the text will be created
entry
)

Creates a nicely formatted text that contains the start and end time of the given entry.

public void
setMediumDateFormatter(DateTimeFormatter
sets medium date time format.
mediumDateFormatter
)

Sets the Medium Date Formatter, the value by default is FormatStyle#MEDIUM.

public void
setShortDateFormatter(DateTimeFormatter
sets the short date time format.
shortDateFormatter
)

Sets the Short Date Formatter, the value by default is FormatStyle#SHORT.

public void
setTimeFormatter(DateTimeFormatter
sets the time format.
timeFormatter
)

Sets the Time Formatter, the value by default is FormatStyle#SHORT.

public void
setWeekdayFormatter(DateTimeFormatter
sets the week date time format.
weekdayFormatter
)

Sets the Week Formatter, the value by default is 'EEEE' Format.

protected void
updateItem(AgendaView.AgendaEntry
The new item for the cell.
item
,
boolean
whether or not this cell represents data from the list. If it is empty, then it does not represent any domain data, but is a cell being used to render an "empty" row.
empty
)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

Inherited from javafx.scene.control.ListCell:
cancelEditcommitEditcreateDefaultSkinexecuteAccessibleActiongetListViewlayoutChildrenlistViewPropertyqueryAccessibleAttributestartEditupdateListView

Field Detail

AGENDA_VIEW_BODYback to summary
private static final String AGENDA_VIEW_BODY
AGENDA_VIEW_BODY_SEPARATORback to summary
private static final String AGENDA_VIEW_BODY_SEPARATOR
AGENDA_VIEW_DATE_LABELback to summary
private static final String AGENDA_VIEW_DATE_LABEL
AGENDA_VIEW_DATE_LABEL_TODAYback to summary
private static final String AGENDA_VIEW_DATE_LABEL_TODAY
AGENDA_VIEW_HEADERback to summary
private static final String AGENDA_VIEW_HEADER
AGENDA_VIEW_HEADER_TODAYback to summary
private static final String AGENDA_VIEW_HEADER_TODAY
AGENDA_VIEW_LIST_CELLback to summary
private static final String AGENDA_VIEW_LIST_CELL
AGENDA_VIEW_TIME_LABELback to summary
private static final String AGENDA_VIEW_TIME_LABEL
AGENDA_VIEW_TITLE_LABELback to summary
private static final String AGENDA_VIEW_TITLE_LABEL
AGENDA_VIEW_WEEKDAY_LABELback to summary
private static final String AGENDA_VIEW_WEEKDAY_LABEL
AGENDA_VIEW_WEEKDAY_LABEL_TODAYback to summary
private static final String AGENDA_VIEW_WEEKDAY_LABEL_TODAY
agendaViewback to summary
private final AgendaView agendaView
dateLabelback to summary
private Label dateLabel
gridPaneback to summary
private GridPane gridPane
headerPaneback to summary
private BorderPane headerPane
headerPaneVisibleback to summary
private final boolean headerPaneVisible
mediumDateFormatterback to summary
private DateTimeFormatter mediumDateFormatter
shortDateFormatterback to summary
private DateTimeFormatter shortDateFormatter
timeFormatterback to summary
private DateTimeFormatter timeFormatter
weekdayFormatterback to summary
private DateTimeFormatter weekdayFormatter
weekdayLabelback to summary
private Label weekdayLabel

Constructor Detail

AgendaEntryCellback to summary
public AgendaEntryCell(AgendaView view)

Constructs a new cell that will work with the given agenda view.

Parameters
view:AgendaView

the parent list view

AgendaEntryCellback to summary
public AgendaEntryCell(AgendaView view, boolean headerPaneVisible)

Constructs a new cell that will work with the given agenda view.

Parameters
view:AgendaView

the parent list view

headerPaneVisible:boolean

flag to control the visibility of the cell's header.

Method Detail

createBodyback to summary
protected Node createBody()

Creates the node used for the body part of each cell.

In this default implementation the body consists of a grid pane with three columns. The middle column is used for showing the title of calendar entries. This column will get whatever space is left after the icon and the time column have used what they need. This means that a very long title will automatically be truncated.

Returns:Node

the body node

createEntryGraphicback to summary
protected Node createEntryGraphic(Entry<?> entry)

Creates a node used to display an icon for the entry. The default implementation of this method creates a node of type Circle. The color of the circle will match the color of the calendar to which the entry belongs.

	  Circle circle = new Circle(4);
	  circle.getStyleClass().add(entry.getCalendar().getStyle() + "-icon");
Parameters
entry:Entry<?>

the entry for which the icon will be displayed

Returns:Node

a node for displaying a graphic for the entry

createEntryTimeLabelback to summary
protected Label createEntryTimeLabel(Entry<?> entry)

Creates the label used to display the time of the entry. The default implementation of this method creates a label and sets the text returned by getTimeText(Entry).

Parameters
entry:Entry<?>

the entry for which the time will be displayed

Returns:Label

a label for displaying the time information on the entry

createEntryTitleLabelback to summary
protected Label createEntryTitleLabel(Entry<?> entry)

Creates the label used to display the title of the entry. The default implementation of this method creates a label and sets the text found in Entry#getTitle().

Parameters
entry:Entry<?>

the entry for which the title will be displayed

Returns:Label

a label for displaying the title of the entry

createHeaderback to summary
protected Node createHeader()

Creates the header part for each cell. The header consists of a border pane with the weekday label in the "left" position and the date label in the "right" position.

Returns:Node

the header node

getTimeTextback to summary
protected String getTimeText(Entry<?> entry)

Creates a nicely formatted text that contains the start and end time of the given entry. The text can also be something like "full day" if the entry is a full-day entry.

Parameters
entry:Entry<?>

the entry for which the text will be created

Returns:String

a text showing the start and end times of the entry

setMediumDateFormatterback to summary
public void setMediumDateFormatter(DateTimeFormatter mediumDateFormatter)

Sets the Medium Date Formatter, the value by default is FormatStyle#MEDIUM.
Is used to set a format text on the Date Label.

Parameters
mediumDateFormatter:DateTimeFormatter

sets medium date time format.

setShortDateFormatterback to summary
public void setShortDateFormatter(DateTimeFormatter shortDateFormatter)

Sets the Short Date Formatter, the value by default is FormatStyle#SHORT.
Is be used to set a Date format text in getTimeText(Entry)

Parameters
shortDateFormatter:DateTimeFormatter

sets the short date time format.

setTimeFormatterback to summary
public void setTimeFormatter(DateTimeFormatter timeFormatter)

Sets the Time Formatter, the value by default is FormatStyle#SHORT.
Is used to set a Time format text in getTimeText(Entry)

Parameters
timeFormatter:DateTimeFormatter

sets the time format.

setWeekdayFormatterback to summary
public void setWeekdayFormatter(DateTimeFormatter weekdayFormatter)

Sets the Week Formatter, the value by default is 'EEEE' Format.

Parameters
weekdayFormatter:DateTimeFormatter

sets the week date time format.

updateItemback to summary
protected void updateItem(AgendaView.AgendaEntry item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Parameters
item:AgendaView.AgendaEntry

The new item for the cell.

empty:boolean

whether or not this cell represents data from the list. If it is empty, then it does not represent any domain data, but is a cell being used to render an "empty" row.

Annotations
@Override