Joda System API

org.joda.swing.binder
Class PropertyListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--org.joda.swing.binder.PropertyListModel
All Implemented Interfaces:
java.util.EventListener, JComponentBinder, javax.swing.ListModel, java.beans.PropertyChangeListener, java.io.Serializable

public class PropertyListModel
extends javax.swing.AbstractListModel
implements java.beans.PropertyChangeListener, JComponentBinder

JList model that binds to a data list property. JList models cannot be updated programmatically or by the GUI, so this implementation is fairly simple. 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.AbstractListModel
listenerList
 
Constructor Summary
PropertyListModel()
          Constructor
PropertyListModel(javax.swing.JList comp, DataListProperty 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
 java.lang.Object getElementAt(int index)
           
 int getSize()
           
 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
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyListModel

public PropertyListModel()
Constructor


PropertyListModel

public PropertyListModel(javax.swing.JList comp,
                         DataListProperty property)
Constructor that binds to a particular property.

Method Detail

getElementAt

public java.lang.Object getElementAt(int index)
Specified by:
getElementAt in interface javax.swing.ListModel
See Also:
ListModel.getElementAt(int)

getSize

public int getSize()
Specified by:
getSize in interface javax.swing.ListModel
See Also:
ListModel.getSize()

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.