Class TemplateOption

  • Direct Known Subclasses:
    AbstractChoiceOption, BlankField, BooleanOption, ChoiceOption, StringOption

    public abstract class TemplateOption
    extends TemplateField
    The base class of all the template options. Options have unique name and a value that can be changed. The value of the option is automatically available to the template files - can be accessed by substitution (e.g. $value_name$) or as part of conditional code generation (e.g. if value_name).
    • Constructor Detail

      • TemplateOption

        public TemplateOption​(BaseOptionTemplateSection section,
                              String name,
                              String label)
        Creates a new option for the provided template section.
        section - the parent template section
        name - the unique name of this option
        label - presentable label of this option
    • Method Detail

      • getName

        public String getName()
        Returns the unique name of this option
        option name
      • setName

        public void setName​(String name)
        Changes the unique name of this option
        name - the new option name
      • getValue

        public Object getValue()
        Returns the value of this option.
        the current value
      • isEmpty

        public boolean isEmpty()
        Returns whether this option is currently empty. The actual semantics of the result depends on the implementing option.
        true if option is empty, false otherwise.
      • setRequired

        public void setRequired​(boolean required)
        Marks this option as required. Required options must be set by the user. An option that is empty and is marked required will be flagged as an error in the wizard.
        required - the new value of the property
        See Also:
      • isRequired

        public boolean isRequired()
        Returns whether this option is required (cannot be empty)
        true if this option is required, false otherwise.
      • setValue

        public void setValue​(Object value)
        Sets the new value of this option.
        value - the new value
      • isEnabled

        public boolean isEnabled()
        Returns whether this option is enabled. The actual presentation of enabled state depends on the implementing option.
        true if option is enabled and can be modified.
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets the enabled state of this option. The action presentation of the enabled state depends on the implementing option.
        enabled - the new enabled state
      • getMessageLabel

        public String getMessageLabel()
        Returns the label of this option that can be presented in the messages to the user. The default implementation trims the 'label' property from mnemonics and from the trailing column.
        the label to show to the user