net.sourceforge.xwing
Class AggregatingListModel

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended bynet.sourceforge.xwing.AggregatingListModel
All Implemented Interfaces:
ListModel, Serializable

public class AggregatingListModel
extends AbstractListModel

A ListModel that acts as an aggregation of other ListModel instances. Access requests are translated into the corresponding access requests for the appripriate backingListModel, and change events from a backing ListModel are similarly translated and propagated to this model's listeners.

Version:
$Revision: 1.2 $
Author:
Scott Howlett
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
AggregatingListModel()
          Make a new AggregatingListModel.
 
Method Summary
 void addElement(Object element)
          Adds a single element to the end of our list of models.
 void addListModel(int index, ListModel src)
          Inserts the given ListModel into our list of models.
 void addListModel(ListModel src)
          Appends the given ListModel onto the end of our list of models.
 void clear()
          Remove all our contents.
 Object getElementAt(int index)
           
 int getSize()
           
 
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

AggregatingListModel

public AggregatingListModel()
Make a new AggregatingListModel.

Method Detail

getSize

public int getSize()

getElementAt

public Object getElementAt(int index)

addListModel

public void addListModel(ListModel src)
Appends the given ListModel onto the end of our list of models. If the added ListModel contains any elements, a ListDataEvent of type INTERVAL_ADDED will be broadcast to any active listeners.

Parameters:
src - the model to add

addListModel

public void addListModel(int index,
                         ListModel src)
Inserts the given ListModel into our list of models. If the added ListModel contains any elements, a ListDataEvent of type INTERVAL_ADDED will be broadcast to any active listeners.

Parameters:
index - Where in our list of models to insert the model.
src - the model to add

addElement

public void addElement(Object element)
Adds a single element to the end of our list of models. All elements added via addElement() are actually added to an internally maintained ListModel. If multiple elements are added in a series, they will all be added to the same internal ListModel. But if another ListModel is added via addListModel(), the next time an element is added a new ListModel will be created and appended to our list of models.


clear

public void clear()
Remove all our contents.



Copyright © 2003 The Xwing Project. All Rights Reserved.