com.sas.swing.models
Class TransformingListModel

com.sas.swing.models.TransformingListModel
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, java.io.Serializable, java.util.EventListener, javax.swing.event.ListDataListener, javax.swing.ListModel
Direct Known Subclasses:
TransformingComboBoxModel

public class TransformingListModel
implements javax.swing.event.ListDataListener, com.sas.beans.PropertyChangeSource

TransformingListModel is a model that is used for instances of javax.swing.JList that can use transforms derived from com.sas.util.transforms.TransformInterface.

The TransformingListModel creates a new default model which is set to be a javax.swing.DefaultListModel to be used as the model for the list. No default transform is set so no transformation will take place on the items in the list unless a transform is provided.

See Also:
Serialized Form

Field Summary
protected  javax.swing.ListModel model
          Model to be used for the list
protected  java.beans.PropertyChangeSupport propertyChangeSupport
           
protected  com.sas.util.transforms.TransformInterface transform
          Transform to be used on the model
 
Constructor Summary
TransformingListModel()
          Default constructor that sets a new default model
TransformingListModel(javax.swing.ListModel model)
          Constructor that sets the model of the list
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void contentsChanged(javax.swing.event.ListDataEvent event)
          Sent when the contents of the list has changed in a way that's too complex to characterize with the previous methods.
protected  void firePropertyChange(java.beans.PropertyChangeEvent evt)
           
protected  void firePropertyChange(java.lang.String propName, java.lang.Object oldValue, java.lang.Object newValue)
           
 java.lang.Object getElementAt(int index)
          Returns the value at the specified index
 javax.swing.ListModel getModel()
          Return current model
 int getSize()
          Returns the length of the list
 com.sas.util.transforms.TransformInterface getTransform()
          Return current transform, which can be null
 void intervalAdded(javax.swing.event.ListDataEvent event)
          Sent after the indices in the index0,index1 interval have been inserted in the data model.
 void intervalRemoved(javax.swing.event.ListDataEvent event)
          Sent after the indices in the index0,index1 interval have been removed from the data model.
protected  javax.swing.ListModel newDefaultModel()
          Create a default model for the list
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void setModel(javax.swing.ListModel newModel)
          Set model of the list to given model
 void setTransform(com.sas.util.transforms.TransformInterface newTransform)
          Set transform to given transform, which can be null
 

Field Detail

propertyChangeSupport

protected java.beans.PropertyChangeSupport propertyChangeSupport

model

protected javax.swing.ListModel model
Model to be used for the list


transform

protected com.sas.util.transforms.TransformInterface transform
Transform to be used on the model

Constructor Detail

TransformingListModel

public TransformingListModel()
Default constructor that sets a new default model


TransformingListModel

public TransformingListModel(javax.swing.ListModel model)
Constructor that sets the model of the list

Parameters:
model - model to be set
Method Detail

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

firePropertyChange

protected void firePropertyChange(java.beans.PropertyChangeEvent evt)

firePropertyChange

protected void firePropertyChange(java.lang.String propName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)

newDefaultModel

protected javax.swing.ListModel newDefaultModel()
Create a default model for the list

Returns:
model to be used as default

getModel

public javax.swing.ListModel getModel()
Return current model

Returns:
current model

setModel

public void setModel(javax.swing.ListModel newModel)
Set model of the list to given model

Parameters:
newModel - model to be set

getTransform

public com.sas.util.transforms.TransformInterface getTransform()
Return current transform, which can be null

Returns:
current transform

setTransform

public void setTransform(com.sas.util.transforms.TransformInterface newTransform)
Set transform to given transform, which can be null

Parameters:
newTransform - transform to be set

getElementAt

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

Specified by:
getElementAt in interface javax.swing.ListModel

getSize

public int getSize()
Returns the length of the list

Specified by:
getSize in interface javax.swing.ListModel

intervalAdded

public void intervalAdded(javax.swing.event.ListDataEvent event)
Sent after the indices in the index0,index1 interval have been inserted in the data model. The new interval includes both index0 and index1.

Specified by:
intervalAdded in interface javax.swing.event.ListDataListener
Parameters:
event - a ListDataEvent encapuslating the event information

intervalRemoved

public void intervalRemoved(javax.swing.event.ListDataEvent event)
Sent after the indices in the index0,index1 interval have been removed from the data model. The interval includes both index0 and index1.

Specified by:
intervalRemoved in interface javax.swing.event.ListDataListener
Parameters:
event - a ListDataEvent encapuslating the event information

contentsChanged

public void contentsChanged(javax.swing.event.ListDataEvent event)
Sent when the contents of the list has changed in a way that's too complex to characterize with the previous methods. Index0 and index1 bracket the change.

Specified by:
contentsChanged in interface javax.swing.event.ListDataListener
Parameters:
event - a ListDataEvent encapuslating the event information



Copyright © 2009 SAS Institute Inc. All Rights Reserved.