net.sf.jguiraffe.gui.platform.swing.builder.components
Class SwingListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by javax.swing.DefaultComboBoxModel
          extended by net.sf.jguiraffe.gui.platform.swing.builder.components.SwingListModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.ComboBoxModel, javax.swing.ListModel, javax.swing.MutableComboBoxModel

 class SwingListModel
extends javax.swing.DefaultComboBoxModel
implements ListModel

A specialized list model used internally by list-like components.

This class is a hybrid: It is both a Swing list model and a form builder list model.

Version:
$Id: SwingListModel.java 71 2007-06-16 20:47:48Z oheger $
Author:
Oliver Heger

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
SwingListModel(ListModel model)
           
 
Method Summary
protected  net.sf.jguiraffe.gui.platform.swing.builder.components.SwingListModel.Item createModelObject(java.lang.Object display, java.lang.Object value)
          Creates an item object from the passed in arguments.
 java.lang.Object getDisplayObject(int index)
          Returns the display object with the given index.
 java.lang.Class getType()
          Returns the data object of this list model.
 java.lang.Object getValueObject(int index)
          Returns the value object with the given index.
protected  void initFromModel(ListModel model)
          Fills this model with the data from the passed in original object.
 void insertItem(int index, java.lang.Object display, java.lang.Object value)
          Inserts the given data at the specified index.
protected  net.sf.jguiraffe.gui.platform.swing.builder.components.SwingListModel.Item itemAt(int index)
          Returns the item object at the specified index.
 int size()
          Returns the number of entries in this model.
 
Methods inherited from class javax.swing.DefaultComboBoxModel
addElement, getElementAt, getIndexOf, getSelectedItem, getSize, insertElementAt, removeAllElements, removeElement, removeElementAt, setSelectedItem
 
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
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Constructor Detail

SwingListModel

public SwingListModel(ListModel model)
Method Detail

getDisplayObject

public java.lang.Object getDisplayObject(int index)
Returns the display object with the given index.

Parameters:
index - the index (0 based)
Returns:
the display object at this index

getType

public java.lang.Class getType()
Returns the data object of this list model.

Returns:
the data type of this model

getValueObject

public java.lang.Object getValueObject(int index)
Returns the value object with the given index.

Parameters:
index - the index (0 based)
Returns:
the value object for this index

size

public int size()
Returns the number of entries in this model.

Returns:
the number of entries

insertItem

public void insertItem(int index,
                       java.lang.Object display,
                       java.lang.Object value)
Inserts the given data at the specified index.

Parameters:
index - the index
display - the display object
value - the value object

initFromModel

protected void initFromModel(ListModel model)
Fills this model with the data from the passed in original object.

Parameters:
model - the original model

createModelObject

protected net.sf.jguiraffe.gui.platform.swing.builder.components.SwingListModel.Item createModelObject(java.lang.Object display,
                                                                                                       java.lang.Object value)
Creates an item object from the passed in arguments.

Parameters:
display - the display object
value - the value object
Returns:
the new item object

itemAt

protected net.sf.jguiraffe.gui.platform.swing.builder.components.SwingListModel.Item itemAt(int index)
Returns the item object at the specified index.

Parameters:
index - the index
Returns:
the item object at this index


Copyright 2007 null. All Rights Reserved.