DESY ACOP Beans Home

de.desy.acop.displayers.selector
Class AcopComboBoxModel<T>

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by de.desy.acop.displayers.selector.AcopComboBoxModel<T>
All Implemented Interfaces:
java.io.Serializable, javax.swing.ComboBoxModel, javax.swing.ListModel

public class AcopComboBoxModel<T>
extends javax.swing.AbstractListModel
implements javax.swing.ComboBoxModel

AcopComboBoxModel is an implementation of the ListModel which allows adding multiple items at once. This model can only work with String objects.

Version:
$Id: Templates.xml,v 1.10 2004/01/13 16:17:13 jbobnar Exp $
Author:
Jaka Bobnar
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
AcopComboBoxModel(java.lang.Class<T> type)
          Constructs an empty DefaultComboBoxModel object.
 
Method Summary
 boolean contains(java.lang.Object o)
          Checks if this model containes the given object.
 java.lang.Object getElementAt(int index)
           
 T[] getElements()
          Returns all elements in the model.
 T getSelectedItem()
           
 int getSize()
           
protected  void removeAllElements()
          Empties the list.
 void replaceElement(int index, T newItem)
          Replaces an element at the specified index.
 void setElements(T[] obj)
          Sets new elements to this model.
 void setSelectedItem(java.lang.Object anObject)
          Set the value of the selected item.
 
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

AcopComboBoxModel

public AcopComboBoxModel(java.lang.Class<T> type)
Constructs an empty DefaultComboBoxModel object.

Method Detail

setSelectedItem

public void setSelectedItem(java.lang.Object anObject)
Set the value of the selected item. The selected item may be null.

Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel
Parameters:
anObject - The combo box value or null for no selection.

getSelectedItem

public T getSelectedItem()
Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel

getSize

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

getElementAt

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

setElements

public void setElements(T[] obj)
Sets new elements to this model.

Parameters:
obj - new elements

getElements

public T[] getElements()
Returns all elements in the model.

Returns:
the elements

removeAllElements

protected void removeAllElements()
Empties the list.


replaceElement

public void replaceElement(int index,
                           T newItem)
Replaces an element at the specified index.

Parameters:
index - the index the element should be replaced at
newItem - the replacement element

contains

public boolean contains(java.lang.Object o)
Checks if this model containes the given object.

Parameters:
o - the object that existance should be checked for
Returns:
true if object is in the model.


Copyright © 2010. All Rights Reserved.