Class RootUIComponent

java.lang.Object
org.openhab.core.ui.components.UIComponent
org.openhab.core.ui.components.RootUIComponent
All Implemented Interfaces:
Identifiable<String>

@NonNullByDefault public class RootUIComponent extends UIComponent implements Identifiable<String>
A root component is a special type of UIComponent at the root of the hierarchy. It has a number of specific parameters, a set of tags, a timestamp, some configurable parameters ("props") and is identifiable by its UID (generally a GUID).
Author:
Yannick Schaus - Initial contribution
  • Constructor Details

    • RootUIComponent

      public RootUIComponent()
      Empty constructor for deserialization.
    • RootUIComponent

      public RootUIComponent(String name)
      Constructs a root component.
      Parameters:
      name - the name of the UI component to render on client frontends, ie. "oh-block"
    • RootUIComponent

      public RootUIComponent(String uid, String name)
      Constructs a root component with a specific UID.
      Parameters:
      uid - the UID of the new card
      name - the name of the UI component to render on client frontends, ie. "oh-block"
  • Method Details

    • getUID

      public String getUID()
      Description copied from interface: Identifiable
      Get the unique identifier.
      Specified by:
      getUID in interface Identifiable<String>
      Returns:
      the unique identifier
    • getTags

      public Set<String> getTags()
      Gets the set of tags attached to the component
      Returns:
      the card tags
    • getTimestamp

      public @Nullable Date getTimestamp()
      Gets the timestamp of the component
      Returns:
      the timestamp
    • setTimestamp

      public void setTimestamp(Date date)
      Sets the specified timestamp of the component
      Parameters:
      date - the timestamp
    • updateTimestamp

      public void updateTimestamp()
      Updates the timestamp of the component to the current date and time.
    • hasTag

      public boolean hasTag(String tag)
      Returns whether the component has a certain tag
      Parameters:
      tag - the tag to check
      Returns:
      true if the component is tagged with the specified tag
    • addTag

      public void addTag(String tag)
      Adds a tag to the component
      Parameters:
      tag - the tag to add
    • addTags

      public void addTags(Collection<String> tags)
      Adds several tags to the component
      Parameters:
      tags - the tags to add
    • addTags

      public void addTags(String... tags)
      Adds several tags to the component
      Parameters:
      tags - the tags to add
    • removeTag

      public void removeTag(String tag)
      Removes a tag on a component
      Parameters:
      tag - the tag to remove
    • removeAllTags

      public void removeAllTags()
      Removes all tags on the component
    • getProps

      public ConfigDescriptionDTO getProps()
      Gets the configurable parameters ("props") of the component
      Returns:
      the configurable parameters
    • setProps

      public void setProps(ConfigDescriptionDTO props)
      Sets the configurable parameters ("props") of the component
      Parameters:
      props - the configurable parameters