Joda System API

org.joda.swing.binder
Class PropertyCheckBoxModel

java.lang.Object
  |
  +--javax.swing.DefaultButtonModel
        |
        +--javax.swing.JToggleButton.ToggleButtonModel
              |
              +--org.joda.swing.binder.PropertyCheckBoxModel
All Implemented Interfaces:
javax.swing.ButtonModel, java.util.EventListener, java.awt.ItemSelectable, JComponentBinder, java.beans.PropertyChangeListener, java.io.Serializable

public class PropertyCheckBoxModel
extends javax.swing.JToggleButton.ToggleButtonModel
implements java.beans.PropertyChangeListener, JComponentBinder

JCheckBox model that binds to an property. Use of this model is best achieved by using SwingBinder.

This class can be used for both mutable and immutable properties. Immutable properties cannot be updated by the swing GUI, however they will update correctly if their value changes.

Author:
Stephen Colebourne
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.DefaultButtonModel
actionCommand, ARMED, changeEvent, ENABLED, group, listenerList, mnemonic, PRESSED, ROLLOVER, SELECTED, stateMask
 
Constructor Summary
PropertyCheckBoxModel()
          Constructor
PropertyCheckBoxModel(javax.swing.JCheckBox comp, DataProperty property)
          Constructor that binds to a particular property.
 
Method Summary
protected  void activate()
          Activate the connection between the GUI and the model
 void bind(javax.swing.JComponent component, Property property)
          Bind a Property object to the component.
protected  void deactivate()
          Deactivate the connection between the GUI and the model
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handle programmatic changes made to the property by updating the swing model.
 void setActive(boolean active)
          Set the model to GUI binding as active or inactive
 void setArmed(boolean b)
           
 void setPressed(boolean b)
           
 void setRollover(boolean b)
           
 void setSelected(boolean selected)
          Called when the checkbox is selected.
 
Methods inherited from class javax.swing.JToggleButton.ToggleButtonModel
isSelected
 
Methods inherited from class javax.swing.DefaultButtonModel
addActionListener, addChangeListener, addItemListener, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getActionListeners, getChangeListeners, getGroup, getItemListeners, getListeners, getMnemonic, getSelectedObjects, isArmed, isEnabled, isPressed, isRollover, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setEnabled, setGroup, setMnemonic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyCheckBoxModel

public PropertyCheckBoxModel()
Constructor


PropertyCheckBoxModel

public PropertyCheckBoxModel(javax.swing.JCheckBox comp,
                             DataProperty property)
Constructor that binds to a particular property.

Method Detail

setSelected

public void setSelected(boolean selected)
Called when the checkbox is selected.

Specified by:
setSelected in interface javax.swing.ButtonModel
Overrides:
setSelected in class javax.swing.JToggleButton.ToggleButtonModel

setPressed

public void setPressed(boolean b)
Specified by:
setPressed in interface javax.swing.ButtonModel
Overrides:
setPressed in class javax.swing.JToggleButton.ToggleButtonModel
See Also:
ButtonModel.setPressed(boolean)

setArmed

public void setArmed(boolean b)
Specified by:
setArmed in interface javax.swing.ButtonModel
Overrides:
setArmed in class javax.swing.DefaultButtonModel
See Also:
ButtonModel.setArmed(boolean)

setRollover

public void setRollover(boolean b)
Specified by:
setRollover in interface javax.swing.ButtonModel
Overrides:
setRollover in class javax.swing.DefaultButtonModel
See Also:
ButtonModel.setRollover(boolean)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Handle programmatic changes made to the property by updating the swing model.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - the property change event

setActive

public void setActive(boolean active)
Set the model to GUI binding as active or inactive

Specified by:
setActive in interface JComponentBinder

activate

protected void activate()
Activate the connection between the GUI and the model


deactivate

protected void deactivate()
Deactivate the connection between the GUI and the model


bind

public void bind(javax.swing.JComponent component,
                 Property property)
Description copied from interface: JComponentBinder
Bind a Property object to the component.

Specified by:
bind in interface JComponentBinder
Parameters:
component - the component to bind
property - the property to bind to
See Also:
JComponentBinder.bind(JComponent,Property)

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.