Class PromptFancySelectItem

  • All Implemented Interfaces:
    Serializable

    public final class PromptFancySelectItem
    extends Object
    implements Serializable
    Generic view model for the <p:selectOneMenu /> components, representing one selectable option. Used to display select options in a more fanciful way, with an optional description and icon.
    See Also:
    Serialized Form
    • Constructor Detail

      • PromptFancySelectItem

        public PromptFancySelectItem​(Object value,
                                     String label)
        Constructor that creates a select item with the given value and label.
        Parameters:
        value - The value of the select item.
        label - The label of the select item.
      • PromptFancySelectItem

        public PromptFancySelectItem​(Object value,
                                     String label,
                                     String description)
        Constructor that creates a select item with the given value, label and description.
        Parameters:
        value - The value of the select item.
        label - The label of the select item.
        description - The description of the select item.
      • PromptFancySelectItem

        public PromptFancySelectItem​(Object value,
                                     String label,
                                     IGuiIcon icon)
        Constructor that creates a select item with the given value, label, and icon.
        Parameters:
        value - The value of the select item.
        label - The label of the select item.
        icon - The icon of the select item, which is show next to the label.
      • PromptFancySelectItem

        public PromptFancySelectItem​(Object value,
                                     String label,
                                     String description,
                                     IGuiIcon icon)
        Constructor that creates a select item with the given value, label, description, and icon.
        Parameters:
        value - The value of the select item.
        label - The label of the select item.
        description - The description of the select item.
        icon - The icon of the select item, which is show next to the label.
    • Method Detail

      • getDescription

        public String getDescription()
        Gets the optional description of the select item.
        Returns:
        The description of the select item.
      • setDescription

        public void setDescription​(String description)
        Sets the optional description of the select item.
        Parameters:
        description - The description of the select item.
      • getIcon

        public IGuiIcon getIcon()
        Gets the optional icon of the select item, which is show next to the label.
        Returns:
        The icon of the select item, or null if none is set.
      • setIcon

        public void setIcon​(IGuiIcon icon)
        Sets the optional icon of the select item, which is show next to the label.
        Parameters:
        icon - The icon of the select item.
      • getLabel

        public String getLabel()
        Gets the label of the select item, a short name shown to the user.
        Returns:
        The label of the select item.
      • setLabel

        public void setLabel​(String label)
        Sets the label of the select item, a short name shown to the user.
        Parameters:
        label - The label of the select item.
      • getValue

        public Object getValue()
        Gets the value of the select item.
        Returns:
        The value of the select item.
      • setValue

        public void setValue​(Object value)
        Sets the value of the select item.
        Parameters:
        value - The value of the select item.
      • getValueAs

        public <T> T getValueAs​(Class<T> type)
        Gets the value of the select item, cast to the given type if possible. Returns null if the value is not of the given type.
        Type Parameters:
        T - The type to cast the value to.
        Parameters:
        type - The type to cast the value to.
        Returns:
        The value of the select item.