Class TimelineItem

All Implemented Interfaces:
Animatable<TimelineItem>, CanDrop<TimelineItem>, Clickable<TimelineItem>, Draggable<TimelineItem>, HandleMouseEvents<TimelineItem>, Scrollable<TimelineItem>, Touchable<TimelineItem>

Timeline item component

The component cannot be used on its own. It represents the item of a Timeline component. This is where the item's data and settings can be set, but it cannot be used on its own, it cannot be displayed on its own.

Supported events:

AnimationStart AnimationEnd, Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, Scrollable TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd

Since:
4.0
Author:
JBStrap
  • Constructor Details

    • TimelineItem

      public TimelineItem(Date date, String title)
      Creates a timeline item based on the specified date and title
      Parameters:
      date - The item date
      title - Item title. If null, no title will be used
      Throws:
      NullPointerException - If the date is null
    • TimelineItem

      public TimelineItem(String id, Date date, String title)
      Creates a timeline item based on the specified date and title
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      date - The item date
      title - Item title. If null, no title will be used
      Throws:
      NullPointerException - If the date is null
    • TimelineItem

      public TimelineItem(Date date, Icon icon, String title)
      Creates a timeline item based on the specified date and title, with the specified icon
      Parameters:
      date - The item date
      icon - The item's icon. The usable icons can be found in the Icon enum. If null, no icon will be used
      title - Item title. If null, no title will be used
      Throws:
      NullPointerException - If the date is null
    • TimelineItem

      public TimelineItem(String id, Date date, Icon icon, String title)
      Creates a timeline item based on the specified date and title, with the specified icon
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      date - The item date
      icon - The item's icon. The usable icons can be found in the Icon enum. If null, no icon will be used
      title - Item title. If null, no title will be used
      Throws:
      NullPointerException - If the date is null
  • Method Details

    • setIconBackgroundColor

      public TimelineItem setIconBackgroundColor(Color color)
      Sets the item's icon background color.
      Parameters:
      color - The icon background color
      Returns:
      A time line item
    • getIconColor

      public Color getIconColor()
      Gets the item's icon color.
      Returns:
      The icon color, in the format it was specified in, or null, if none was set
    • setIconColor

      public TimelineItem setIconColor(Color color)
      Sets the item's icon color.
      Parameters:
      color - The icon color
      Returns:
      A time line item
    • getIconBackgroundColor

      public Color getIconBackgroundColor()
      Gets the item's icon background color.
      Returns:
      The background color, in the format it was specified in, or null, if none was set
    • addComponent

      public TimelineItem addComponent(Component<?> component)
      Adds a component to the timeline item
      Overrides:
      addComponent in class Component<TimelineItem>
      Parameters:
      component - The component instance to be added to the timeline item
      Returns:
      The timeline item
    • addComponents

      public TimelineItem addComponents(Component<?>... components)
      Adds multiple components to the timeline item
      Overrides:
      addComponents in class Component<TimelineItem>
      Parameters:
      components - The component instances to be added to the timeline item
      Returns:
      The timeline item
    • removeComponent

      public TimelineItem removeComponent(Component<?> component)
      Removes the specified component from the timeline item
      Overrides:
      removeComponent in class Component<TimelineItem>
      Parameters:
      component - The component instance to be removed from the timeline item
      Returns:
      The timeline item
    • removeComponents

      public TimelineItem removeComponents(Component<?>... components)
      Removes the specified components from the timeline item
      Overrides:
      removeComponents in class Component<TimelineItem>
      Parameters:
      components - The component instances to be removed from the timeline item
      Returns:
      The timeline item
    • getComponents

      public List<Component<?>> getComponents()
      Gets a list of the components that are on the timeline item
      Overrides:
      getComponents in class Component<TimelineItem>
      Returns:
      A list containing the timeline item's components. If there are none, the list will be empty
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<TimelineItem>
      Returns:
      If the componentwas drawn, true, otherwise false