Class EnumRadioButtonGroupBean<E extends java.lang.Enum<E>>

  • Type Parameters:
    E - the generic enum type

    public class EnumRadioButtonGroupBean<E extends java.lang.Enum<E>>
    extends java.lang.Object
    The class EnumRadioButtonGroupBean represents a model object that can be used with JRadioButton's that are assosiated with an Enum.
    • Constructor Detail

      • EnumRadioButtonGroupBean

        public EnumRadioButtonGroupBean​(java.util.Map<E,​javax.swing.JRadioButton> radioButtonMap,
                                        de.alpharogroup.model.api.Model<E> selected)
        Instantiates a new EnumRadioButtonGroupBean.
        Parameters:
        radioButtonMap - The map with the mapped JRadioButton objects.
        selected - the model where the selected enum is kept.
      • EnumRadioButtonGroupBean

        public EnumRadioButtonGroupBean​(de.alpharogroup.model.api.Model<E> selected)
        Instantiates a new EnumRadioButtonGroupBean.
        Parameters:
        selected - the model where the selected enum is kept.
    • Method Detail

      • associate

        public void associate​(E enumValue,
                              javax.swing.JRadioButton radioButton)
        Associate the given enum value with the given JRadioButton.
        Parameters:
        enumValue - the enum value
        radioButton - the radio button
      • associateMap

        public void associateMap​(java.util.Map<E,​javax.swing.JRadioButton> map)
        Associate the given Map with the JRadioButton objects as values and the enum values as keys and associates them.
        Parameters:
        map - the map
      • getSelected

        public de.alpharogroup.model.api.Model<E> getSelected()
        Gets the selected.
        Returns:
        the selected
      • getSelectedEnum

        public E getSelectedEnum()
        Gets the selected enum.
        Returns:
        the selected enum
      • getSelectedEnumFromRadioButtons

        protected E getSelectedEnumFromRadioButtons()
        Resolves the selected enum from the radio buttons.
        Returns:
        the selected enum or null if none is selected.
      • getValue

        public E getValue()
        Gets the value.
        Returns:
        the value
      • setValue

        public void setValue​(E enumValue)
        Sets the value.
        Parameters:
        enumValue - the new enum value to set