com.sas.swing.models
Class CollectionToListModelAdapter

com.sas.swing.models.CollectionToListModelAdapter
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, java.io.Serializable, javax.swing.ListModel
Direct Known Subclasses:
CollectionToComboBoxModelAdapter

public class CollectionToListModelAdapter
implements com.sas.beans.PropertyChangeSource

The CollectionToListModelAdapter allows collections that extend from java.util.Collection, such as instances of java.util.List and java.util.Set, to be used as the model for a javax.swing.JList. The collection must be set as the model for the adapter, which can then used as the model for the viewer.

See Also:
Serialized Form

Field Summary
protected  java.util.List delegate
          Internal storage of data from collection
protected  java.util.Collection model
          Model for the adapter
protected  javax.swing.event.SwingPropertyChangeSupport spcs
          Used to support property changes in the webAF customizer
 
Constructor Summary
CollectionToListModelAdapter()
          Default constructor
CollectionToListModelAdapter(java.util.Collection c)
          Overloaded constructor that intializes the adapter with the data given by the collection
CollectionToListModelAdapter(int size)
          Overloaded constructor that initializes the delegate to be of given size
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
protected  void createDelegate()
          Create the delegate object
 java.lang.Object getElementAt(int i)
          Returns the value at the specified index.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
 java.util.Collection getModel()
          Returns the model of the adapter
 int getSize()
          Returns the length of the list.
 void refresh()
          Force a refresh on the adapter
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setModel(java.util.Collection model)
          Sets the model of the adapter to the given collection
 

Field Detail

delegate

protected java.util.List delegate
Internal storage of data from collection


model

protected java.util.Collection model
Model for the adapter


spcs

protected javax.swing.event.SwingPropertyChangeSupport spcs
Used to support property changes in the webAF customizer

Constructor Detail

CollectionToListModelAdapter

public CollectionToListModelAdapter()
Default constructor


CollectionToListModelAdapter

public CollectionToListModelAdapter(int size)
Overloaded constructor that initializes the delegate to be of given size

Parameters:
size - Initial size of the delegate representing the collection

CollectionToListModelAdapter

public CollectionToListModelAdapter(java.util.Collection c)
Overloaded constructor that intializes the adapter with the data given by the collection

Parameters:
c - Collection whose data will be used within the adapter
Method Detail

getSize

public int getSize()
Returns the length of the list.

Specified by:
getSize in interface javax.swing.ListModel

getElementAt

public java.lang.Object getElementAt(int i)
Returns the value at the specified index.

Specified by:
getElementAt in interface javax.swing.ListModel

setModel

public void setModel(java.util.Collection model)
Sets the model of the adapter to the given collection

Parameters:
model - Collection whose data will be used within the adapter

getModel

public java.util.Collection getModel()
Returns the model of the adapter


createDelegate

protected void createDelegate()
Create the delegate object


refresh

public void refresh()
Force a refresh on the adapter


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
addPropertyChangeListener in interface com.sas.beans.PropertyChangeSource

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Specified by:
removePropertyChangeListener in interface com.sas.beans.PropertyChangeSource

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.