Class OptionUI<T extends Option<?>>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean editable
      Whether the Option should be editable.
      private BooleanOptionUI enabler  
      private javax.swing.JLabel label
      The label to use for the Option.
      private T option
      The Option value itself.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected OptionUI​(T option, boolean editable)
      Constructor.
    • Field Detail

      • editable

        private boolean editable
        Whether the Option should be editable.
      • label

        private javax.swing.JLabel label
        The label to use for the Option.
      • option

        private T extends Option<?> option
        The Option value itself.
    • Constructor Detail

      • OptionUI

        protected OptionUI​(T option,
                           boolean editable)
        Constructor.
        Parameters:
        option - The Option to display.
        editable - True if the option should be editable.
    • Method Detail

      • initialize

        protected void initialize()
        Set up component.
      • getOption

        public final T getOption()
      • setOption

        public final void setOption​(T newOption)
      • isEditable

        public final boolean isEditable()
      • isEnabled

        private boolean isEnabled()
      • setEditable

        public final void setEditable​(boolean newEditable)
      • getJLabel

        public javax.swing.JLabel getJLabel()
      • setLabel

        protected void setLabel​(javax.swing.JLabel label)
      • getListCellRenderer

        public javax.swing.ListCellRenderer getListCellRenderer()
        Get a ListCellRenderer suitable for the wrapped Option.
        Returns:
        A suitable ListCellRenderer.
      • getComponent

        public abstract javax.swing.JComponent getComponent()
        Get the Component used to set the value of the Option.
        Returns:
        a JComponent value
      • updateOption

        public abstract void updateOption()
        Update the value of the Option from the UI's component.
        Specified by:
        updateOption in interface OptionUpdater
      • reset

        public abstract void reset()
        Reset the value of the UI's component from the Option.
        Specified by:
        reset in interface OptionUpdater
      • getOptionUI

        public static OptionUI getOptionUI​(GUI gui,
                                           Option option,
                                           boolean editable)
        Get an option UI for a given option.
        Parameters:
        gui - The GUI to use.
        option - The Option to check.
        editable - Should the result be editable.
        Returns:
        A suitable OptionUI, or null if none found.