Joda System API

org.joda.swing
Class SwingBinder

java.lang.Object
  |
  +--org.joda.swing.SwingBinder
All Implemented Interfaces:
java.io.Serializable

public class SwingBinder
extends java.lang.Object
implements java.io.Serializable

SwingBinder controls and manages the connection between the Swing GUI and the Joda property model.

It is used as follows: Person person = new PersonBean(); JTextField textField = new JTextField(); SwingBinder binder = new SwingBinder(); binder.bind(textField, person.surname());

SwingBinder features an active flag controlled by setActive(). This allows large changes to the model to be made without immediate effect on the GUI. When complete, the binder is reactivated and the GUI updates.

Author:
Stephen Colebourne
See Also:
Serialized Form

Constructor Summary
SwingBinder()
          Constructor
SwingBinder(boolean active)
          Constructor
 
Method Summary
 void bind(javax.swing.JComponent component, Property property)
          Bind a JComponent to a property.
 boolean getActive()
          Gets the active flag.
 void setActive(boolean active)
          Sets the active flag.
 java.lang.String toString()
          Debugging toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwingBinder

public SwingBinder()
Constructor


SwingBinder

public SwingBinder(boolean active)
Constructor

Method Detail

getActive

public boolean getActive()
Gets the active flag.

Returns:
whether the binder is active or not

setActive

public void setActive(boolean active)
Sets the active flag. This should be set to false before large updates of the model. The GUI can then be updated in one go at the end by setting the flag back to active again.

Parameters:
active - whether the binder is active or not

bind

public void bind(javax.swing.JComponent component,
                 Property property)
Bind a JComponent to a property. This is the main method used to connect the GUI and the model.


toString

public java.lang.String toString()
Debugging toString

Overrides:
toString in class java.lang.Object

Joda System API

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