Class TimeDurationBean


  • @RequestScoped
    @Named
    public class TimeDurationBean
    extends Object
    Bean for the time duration component.
    Since:
    8.1.0
    • Constructor Detail

      • TimeDurationBean

        public TimeDurationBean()
    • Method Detail

      • getMaxDurationValue

        public String getMaxDurationValue​(Long value,
                                          String unitName,
                                          TimeDuration target)
        Gets the value for the max attribute of the component. Converts the configured maximum value to the currently selected unit.
        Parameters:
        value - Configured maximum value.
        unitName - Configured unit of the maximum value.
        target - Target time duration with the currently selected unit.
        Returns:
        The maximum value in the currently selected unit.
      • getMinDurationValue

        public String getMinDurationValue​(Long value,
                                          String unitName,
                                          TimeDuration target)
        Gets the value for the min attribute of the component. Converts the configured minimum value to the currently selected unit.
        Parameters:
        value - Configured minimum value.
        unitName - Configured unit of the minimum value.
        target - Target time duration with the currently selected unit.
        Returns:
        The minimum value in the currently selected unit.
      • getSelectItems

        public List<javax.faces.model.SelectItem> getSelectItems​(Map<String,​Object> attrs)
        Gets a list of select items for the available time units.
        Parameters:
        attrs - Attributes of the component.
        Returns:
        List of available time units.
      • showUnitSelect

        public boolean showUnitSelect​(Map<String,​Object> attrs)
        Whether to show the unit select. If only one unit is available, the unit select is not shown.
        Parameters:
        attrs - Attributes of the component.
        Returns:
        Whether to show the unit select.
      • updateDuration

        public long updateDuration​(TimeDuration duration,
                                   Map<String,​Object> attrs)
        Converts the duration to one of the available units when the current unit is not available.
        Parameters:
        duration - Duration to modify.
        attrs - Attributes of the component.
        Returns:
        Always 0.