Class UILibraryHelper.BindableGroup

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    UILibraryHelper

    public static class UILibraryHelper.BindableGroup
    extends javax.swing.ButtonGroup
    A button group that supports including the group in a Bindings script object.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.ButtonGroup

        buttons
    • Constructor Summary

      Constructors 
      Constructor Description
      BindableGroup​(javax.swing.AbstractButton[] buttons, java.lang.String[] values)
      Creates a new button group that supports binding to setting values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(javax.swing.AbstractButton b)  
      void addActionListener​(java.awt.event.ActionListener l)
      Adds a listener for changes to the selected button.
      protected void fireActionPerformed​(java.lang.String value)
      Fires an action event to all listeners that indicates that the button with the given value was selected.
      void fromSetting​(java.lang.String v)
      Selects the button in the group that is mapped to the specified setting value.
      void remove​(javax.swing.AbstractButton b)  
      void removeActionListener​(java.awt.event.ActionListener l)
      Removes a registered action listener.
      java.lang.String toSetting()
      Returns the setting value mapped to by the selected button.
      • Methods inherited from class javax.swing.ButtonGroup

        clearSelection, getButtonCount, getElements, getSelection, isSelected, setSelected
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BindableGroup

        public BindableGroup​(javax.swing.AbstractButton[] buttons,
                             java.lang.String[] values)
        Creates a new button group that supports binding to setting values.
        Parameters:
        buttons - the buttons to include in the group
        values - the setting value to bind to each group member
    • Method Detail

      • add

        public void add​(javax.swing.AbstractButton b)
        Overrides:
        add in class javax.swing.ButtonGroup
      • remove

        public void remove​(javax.swing.AbstractButton b)
        Overrides:
        remove in class javax.swing.ButtonGroup
      • fromSetting

        public void fromSetting​(java.lang.String v)
        Selects the button in the group that is mapped to the specified setting value.
        Parameters:
        v - the value of the button to select
        Throws:
        java.lang.IllegalArgumentException - if the value does not map to any button in the group
      • toSetting

        public java.lang.String toSetting()
        Returns the setting value mapped to by the selected button.
        Returns:
        the value for the selected button
        Throws:
        java.lang.IllegalStateException - if no button in the group is selected
      • addActionListener

        public void addActionListener​(java.awt.event.ActionListener l)
        Adds a listener for changes to the selected button. This is only fired if the user selects a button, not if the button is selected by calling setSelected(true). To simulate the user clicking a button, call its doClick() method. The action event that is generated will have this as its source and the command string will be equal to the setting value of the selected button.
        Parameters:
        l - the listener to add
      • removeActionListener

        public void removeActionListener​(java.awt.event.ActionListener l)
        Removes a registered action listener.
        Parameters:
        l - the listener to remove
      • fireActionPerformed

        protected void fireActionPerformed​(java.lang.String value)
        Fires an action event to all listeners that indicates that the button with the given value was selected.
        Parameters:
        value - the setting value of the selected button