Class MessageList

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.messages.MessageList
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.i18n.LocaleChangeObserver, Serializable

@Tag("vaadin-message-list") @JsModule("./messageListConnector.js") @JsModule("@vaadin/message-list/src/vaadin-message-list.js") @NpmPackage(value="@vaadin/message-list", version="25.0.0-alpha16") public class MessageList extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasSize, com.vaadin.flow.i18n.LocaleChangeObserver
Message List allows you to show a list of messages, for example, a chat log. You can configure the text content, information about the sender and the time of sending for each message. The component displays a list of messages that can be configured with setItems(Collection).
Author:
Vaadin Ltd.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new message list component.
    Creates a new message list component, with the provided items rendered as messages.
    Creates a new message list component, with the provided items rendered as messages.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a single item to be rendered as a message at the end of this message list.
    Gets the items that are rendered as message components in this message list.
    boolean
    Returns whether new messages are announced to assistive technologies.
    boolean
    Returns whether the messages are parsed as markdown.
    void
    localeChange(com.vaadin.flow.i18n.LocaleChangeEvent event)
     
    void
    setAnnounceMessages(boolean announceMessages)
    When set to true, new messages are announced to assistive technologies using ARIA live regions.
    void
    Sets the items that will be rendered as messages in this message list.
    void
    Sets the items that will be rendered as messages in this message list.
    void
    setMarkdown(boolean markdown)
    Sets whether the messages should be parsed as markdown.

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Constructor Details

    • MessageList

      public MessageList()
      Creates a new message list component. To populate the content of the list, use setItems(Collection).
    • MessageList

      public MessageList(Collection<MessageListItem> items)
      Creates a new message list component, with the provided items rendered as messages.
      Parameters:
      items - the items to render as messages
      See Also:
    • MessageList

      public MessageList(MessageListItem... items)
      Creates a new message list component, with the provided items rendered as messages.
      Parameters:
      items - the items to render as messages
      See Also:
  • Method Details

    • setItems

      public void setItems(Collection<MessageListItem> items)
      Sets the items that will be rendered as messages in this message list.
      Parameters:
      items - the items to set, not null and not containing any null items
    • setItems

      public void setItems(MessageListItem... items)
      Sets the items that will be rendered as messages in this message list.
      Parameters:
      items - the items to set, none of which can be null
    • addItem

      public void addItem(MessageListItem item)
      Adds a single item to be rendered as a message at the end of this message list.
      Parameters:
      item - the item to add, not null
    • getItems

      public List<MessageListItem> getItems()
      Gets the items that are rendered as message components in this message list.
      Returns:
      an unmodifiable view of the list of items
    • localeChange

      public void localeChange(com.vaadin.flow.i18n.LocaleChangeEvent event)
      Specified by:
      localeChange in interface com.vaadin.flow.i18n.LocaleChangeObserver
    • setMarkdown

      public void setMarkdown(boolean markdown)
      Sets whether the messages should be parsed as markdown. By default, this is set to false.
      Parameters:
      markdown - true if the message text is parsed as Markdown.
    • isMarkdown

      public boolean isMarkdown()
      Returns whether the messages are parsed as markdown.
      Returns:
      true if the message text is parsed as Markdown.
    • setAnnounceMessages

      public void setAnnounceMessages(boolean announceMessages)
      When set to true, new messages are announced to assistive technologies using ARIA live regions. By default, this is set to false.
      Parameters:
      announceMessages - true if new messages should be announced to assistive technologies.
    • isAnnounceMessages

      public boolean isAnnounceMessages()
      Returns whether new messages are announced to assistive technologies.
      Returns:
      true if new messages are announced to assistive technologies.