@NpmPackage(value="vis-timeline",version="7.4.9") @NpmPackage(value="moment",version="2.29.1")
@JsModule(value="./src/arrow.js") @JsModule(value="./src/vcf-timeline.js")
@CssImport(value="vis-timeline/styles/vis-timeline-graph2d.min.css") @CssImport(value="./styles/timeline.css")
public class Timeline
extends com.vaadin.flow.component.html.Div
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(Item item)
Add a new item to the timeline.
|
void |
addItemRemoveListener(com.vaadin.flow.component.ComponentEventListener<ItemRemoveEvent> listener)
Adds a listener for
ItemRemoveEvent to the component. |
void |
addItemResizeListener(com.vaadin.flow.component.ComponentEventListener<ItemResizeEvent> listener)
Adds a listener for
ItemResizeEvent to the component. |
void |
addItemsDragAndDropListener(com.vaadin.flow.component.ComponentEventListener<ItemsDragAndDropEvent> listener)
Adds a listener for
ItemsDragAndDropEvent to the component. |
void |
fireItemRemoveEvent(String itemId,
boolean fromClient)
Fires a
ItemRemoveEvent. |
protected void |
fireItemResizeEvent(String itemId,
LocalDateTime newStart,
LocalDateTime newEnd,
boolean fromClient)
Fires a
ItemResizeEvent. |
List<Item> |
getItems()
Return the list of items that are currently part of the timeline.
|
protected TimelineOptions |
getTimelineOptions() |
protected void |
handleDragAndDrop(String itemId,
LocalDateTime newStart,
LocalDateTime newEnd,
boolean fromClient)
Handle item moved by drag and drop.
|
protected void |
onAttach(com.vaadin.flow.component.AttachEvent attachEvent) |
void |
onMove(String itemId,
String itemNewStart,
String itemNewEnd,
boolean resizedItem)
Call from client when an item is moved (dragged and dropped or resized).
|
void |
onRemove(String itemId)
Call from client when an item is removed.
|
void |
onSelect(String selectedItemsIds)
Call from client when items are selected.
|
void |
removeItem(Item item)
Removes an item.
|
void |
setAutoZoom(boolean autoZoom)
Sets whether all range should be visible at once.
|
void |
setAxisOrientation(AxisOrientation axisOrientation)
Sets orientation of the timeline axis.
|
void |
setEnd(LocalDateTime end)
The initial end date for the axis of the timeline.
|
void |
setHeight(String height)
Sets the height of the timeline.
|
void |
setItems(List<Item> items) |
void |
setMaxHeight(String maxHeight)
Sets the maximum height for the timeline.
|
void |
setMoveable(boolean moveable)
Sets wheter the timeline can be moved by dragging the window.
|
void |
setMultiselect(boolean multiselect)
Sets whether multiple items can be selected.
|
void |
setSelectable(boolean selectable)
Sets wheter the items in the timeline can be selected.
|
void |
setShowCurentTime(boolean showCurrentTime)
Sets whether a vertical bar at current time is displayed.
|
void |
setShowTooltips(boolean showTooltips)
Sets whether tooltips will be displaying for items with defined titles.
|
void |
setSnapStep(SnapStep snapStep)
Sets snap value.
|
void |
setStack(boolean stack)
Sets whether items will be stack on top of each other if they overlap.
|
void |
setStart(LocalDateTime start)
Sets the initial start date for the axis of the timeline.
|
void |
setTimelineRange(LocalDateTime min,
LocalDateTime max)
Sets visible range for timeline.
|
void |
setTooltipOnItemUpdateTime(boolean tooltip)
Sets whether tooltip should be displayed while updating an item.
|
void |
setTooltipOnItemUpdateTimeDateFormat(String dateFormat)
Sets the date format for the dates displayed in the
on update item tooltip.
|
void |
setTooltipOnItemUpdateTimeTemplate(String template)
Sets the template for the tooltip displayed on item update.
|
void |
setZoomable(boolean zoomable)
Sets whether the timeline can be zoomed by pinching or scrolling in the window.
|
void |
setZoomOption(Integer zoomOption)
Sets zoom option for timeline.
|
void |
setZoomRange(Long zoomMin,
Long zoomMax)
Sets zoom range for timeline.
|
void |
updateItemContent(String itemId,
String newContent)
Updates content of an existing item.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddClickListener, addClickShortcutgetChildren, getComponentAt, getComponentCount, indexOf, replaceadd, add, addComponentAsFirst, addComponentAtIndex, remove, removeAllgetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullprotected TimelineOptions getTimelineOptions()
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
onAttach in class com.vaadin.flow.component.Componentpublic void addItem(Item item)
item - the new item to add to the timelinepublic List<Item> getItems()
public void setTimelineRange(LocalDateTime min, LocalDateTime max)
min - minimum datemax - maximum datepublic void setAxisOrientation(AxisOrientation axisOrientation)
axisOrientation - orientation of the timeline axispublic void setZoomable(boolean zoomable)
zoomable - true if timeline is zoomablepublic void setMoveable(boolean moveable)
moveable - true if timeline is moveablepublic void setZoomRange(Long zoomMin, Long zoomMax)
zoomMin - minimum zoom intervalzoomMax - maximum zoom intervalpublic void setSelectable(boolean selectable)
selectable - true if times can be selectedpublic void setShowCurentTime(boolean showCurrentTime)
showCurrentTime - true if current time is shownpublic void setHeight(String height)
public void setMaxHeight(String maxHeight)
public void setStart(LocalDateTime start)
start - initial start datepublic void setAutoZoom(boolean autoZoom)
setTimelineRange(java.time.LocalDateTime, java.time.LocalDateTime).
It will set start and end for timeline axis.autoZoom - true if autozoom is allowedpublic void setEnd(LocalDateTime end)
end - initial end datepublic void setStack(boolean stack)
stack - true if items should stackpublic void setMultiselect(boolean multiselect)
multiselect - true if multiselect is allowedpublic void setShowTooltips(boolean showTooltips)
showTooltips - true if tooltips should be shownpublic void updateItemContent(String itemId, String newContent)
itemId - id of item to be updatednewContent - new item contentpublic void setSnapStep(SnapStep snapStep)
snapStep - snap valuepublic void setZoomOption(Integer zoomOption)
zoomOption - integer representing days for zooming@ClientCallable public void onMove(String itemId, String itemNewStart, String itemNewEnd, boolean resizedItem)
itemId - id of the moved itemitemNewStart - new start date of the moved itemitemNewEnd - new end date of the moved itemresizedItem - true if item was resizedprotected void fireItemResizeEvent(String itemId, LocalDateTime newStart, LocalDateTime newEnd, boolean fromClient)
ItemResizeEvent.itemId - id of the item that was movednewStart - new start date for the itemnewEnd - new end date for the itemfromClient - if event comes from clientprotected void handleDragAndDrop(String itemId, LocalDateTime newStart, LocalDateTime newEnd, boolean fromClient)
itemId - id of the item that was movednewStart - new start date for the itemnewEnd - new end date for the itemfromClient - if event comes from clientpublic void addItemResizeListener(com.vaadin.flow.component.ComponentEventListener<ItemResizeEvent> listener)
ItemResizeEvent to the component.listener - the listener to be addedpublic void removeItem(Item item)
item - item to be removed.@ClientCallable public void onRemove(String itemId)
itemId - id of the removed itempublic void fireItemRemoveEvent(String itemId, boolean fromClient)
ItemRemoveEvent.itemId - id of the removed itemfromClient - if event comes from clientpublic void addItemRemoveListener(com.vaadin.flow.component.ComponentEventListener<ItemRemoveEvent> listener)
ItemRemoveEvent to the component.listener - the listener to be added.@ClientCallable public void onSelect(String selectedItemsIds)
selectedItemsIds - list of selected itemspublic void addItemsDragAndDropListener(com.vaadin.flow.component.ComponentEventListener<ItemsDragAndDropEvent> listener)
ItemsDragAndDropEvent to the component.listener - the listener to be addedpublic void setTooltipOnItemUpdateTime(boolean tooltip)
tooltip - true if tooltip is allowedpublic void setTooltipOnItemUpdateTimeDateFormat(String dateFormat)
dateFormat - format for tooltip datespublic void setTooltipOnItemUpdateTimeTemplate(String template)
To reference item start and end dates, please use item.start and item.end to be able to parse the template in the client-side.
E.g.: Starting at item.start, ending at item.end.
template - the template shown in the tooltipCopyright © 2021–2026 Vaadin Ltd. All rights reserved.