Class NullableToggleButtonModel

  • All Implemented Interfaces:
    ItemSelectable, Serializable, ButtonModel

    public final class NullableToggleButtonModel
    extends DefaultButtonModel
    A ToggleButtonModel implementation, which allows the null state. The states are null -> false -> true. Heavily influenced by TristateCheckBox by Heinz M. Kabutz
    See Also:
    Serialized Form
    • Constructor Detail

      • NullableToggleButtonModel

        public NullableToggleButtonModel()
        Instantiates a new NullableToggleButtonModel with a null initial state.
      • NullableToggleButtonModel

        public NullableToggleButtonModel​(Boolean initialState)
        Instantiates a new NullableToggleButtonModel with the given initial state.
        initialState - the initial state
    • Method Detail

      • setState

        public void setState​(Boolean state)
        Sets the underlying state
        state - the state
      • getState

        public Boolean getState()
        Returns the underlying value
        the state
      • nextState

        public void nextState()
        Iterates between the states: null -> false -> true
      • addStateListener

        public void addStateListener​(EventDataListener<Boolean> listener)
        Adds a listener notified each time the state changes.
        listener - the listener
      • removeStateListener

        public void removeStateListener​(EventDataListener<Boolean> listener)
        Removes the given listener.
        listener - the listener to remove