|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.anthonyeden.lib.util.XArrayList
This class extends the ArrayList class to support direct placement of the
list in a JList or JComboBox.
This class can also listen for PropertyChangeEvents on objects in the
collection which have an
addPropertyChangeListener(PropertyChangeListener l)
method. This option is on by default, but can be turned off to invoid
introspection overhead required to find and invoke this method.
| Field Summary | |
static java.awt.datatransfer.DataFlavor |
dataFlavor
|
static XArrayList |
EMPTY_LIST
Constant for an empty XArrayList. |
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
XArrayList()
|
|
| Method Summary | |
void |
add(int index,
java.lang.Object element)
Add the given element to the list at the given index. |
boolean |
add(java.lang.Object element)
Add the given object to the list. |
boolean |
addAll(java.util.Collection collection)
Add all of the objects in the collection to this collection. |
boolean |
addAll(int index,
java.util.Collection collection)
Add all elements in the collection to this list inserting at the given index. |
void |
addListDataListener(javax.swing.event.ListDataListener l)
Add a ListDataListener. |
static XArrayList |
arrayToList(java.lang.Object[] array)
Populate an XArrayList with the data from the given object array. |
void |
clear()
Clear the list data. |
protected void |
fireContentsChanged(int index0,
int index1)
Fire a ListDataEvent for the changed interval. |
protected void |
fireIntervalAdded(int index0,
int index1)
Fire a ListDataEvent for the added interval. |
protected void |
fireIntervalRemoved(int index0,
int index1)
Fire a ListDataEvent for the removed interval. |
java.lang.Object |
getElementAt(int index)
Get the element at the given index. |
protected java.util.ArrayList |
getListDataListeners()
Get all registered ListDataListeners |
java.lang.Object |
getSelectedItem()
Get the selected item or null if no item is selected. |
int |
getSize()
Get the number of elements in the list. |
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor dataFlavor)
Get the transferable data for the given data flavor. |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
Get an array of supported DataFlavors. |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor dataFlavor)
Return true if the given DataFlavor is supported. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
|
java.lang.Object |
remove(int index)
Remove the object at the given index. |
boolean |
remove(java.lang.Object object)
Remove the given object. |
boolean |
removeAll(java.util.Collection c)
Remove the objects in the specified collection from this list. |
void |
removeListDataListener(javax.swing.event.ListDataListener l)
Remove a ListDataListener. |
protected void |
removeRange(int startIndex,
int endIndex)
Remove the given range of objects. |
boolean |
retainAll(java.util.Collection c)
See the ArrayList retainAll() method. |
void |
setPropertyChangeListenerEnabled(boolean propertyChangeListenerEnabled)
Set to false to disable property change listener support. |
void |
setSelectedItem(java.lang.Object selectedItem)
Set the selected item. |
| Methods inherited from class java.util.ArrayList |
clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, set, size, subList, toArray, toArray |
| Field Detail |
public static final XArrayList EMPTY_LIST
public static java.awt.datatransfer.DataFlavor dataFlavor
| Constructor Detail |
public XArrayList()
| Method Detail |
public static XArrayList arrayToList(java.lang.Object[] array)
array - The object array
public void add(int index,
java.lang.Object element)
add in interface java.util.Listindex - The indexelement - The elementpublic boolean add(java.lang.Object element)
add in interface java.util.Listelement - The element
public boolean addAll(java.util.Collection collection)
addAll in interface java.util.Listcollection - The collection to add
public boolean addAll(int index,
java.util.Collection collection)
addAll in interface java.util.Listindex - The offset indexcollection - The collection to addpublic void clear()
clear in interface java.util.Listpublic java.lang.Object remove(int index)
remove in interface java.util.Listindex - The index
public boolean remove(java.lang.Object object)
remove in interface java.util.Listobject - The object
public boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Listc - The Collection of objects to retain
public boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Listc - The Collection to remove
public int getSize()
getSize in interface javax.swing.ListModelpublic java.lang.Object getElementAt(int index)
getElementAt in interface javax.swing.ListModelindex - The index
public void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener in interface javax.swing.ListModell - The ListDataListenerpublic void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener in interface javax.swing.ListModell - The ListDataListenerpublic java.lang.Object getSelectedItem()
getSelectedItem in interface javax.swing.ComboBoxModelpublic void setSelectedItem(java.lang.Object selectedItem)
setSelectedItem in interface javax.swing.ComboBoxModelselectedItem - The new selected item
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor dataFlavor)
throws java.awt.datatransfer.UnsupportedFlavorException
getTransferData in interface java.awt.datatransfer.TransferabledataFlavor - The DataFlavor
java.awt.datatransfer.UnsupportedFlavorExceptionpublic java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors in interface java.awt.datatransfer.Transferablepublic boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor dataFlavor)
isDataFlavorSupported in interface java.awt.datatransfer.TransferabledataFlavor - The DataFlavor
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerpublic void setPropertyChangeListenerEnabled(boolean propertyChangeListenerEnabled)
propertyChangeListenerEnabled - Set to false to disableprotected java.util.ArrayList getListDataListeners()
protected void removeRange(int startIndex,
int endIndex)
startIndex - The start indexendIndex - The end index
protected void fireIntervalAdded(int index0,
int index1)
index0 - The start indexindex1 - The end index
protected void fireIntervalRemoved(int index0,
int index1)
index0 - The start indexindex1 - The end index
protected void fireContentsChanged(int index0,
int index1)
index0 - The start indexindex1 - The end index
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||