Package be.gaudry.swing.component.jlist
Class SortedListModel
java.lang.Object
javax.swing.AbstractListModel
be.gaudry.swing.component.jlist.SortedListModel
- All Implemented Interfaces:
IModel
,Serializable
,ListModel
Wrapper class to add sort feature to a listModel
Provided by the broldev.core.swing project.
- Since:
- 1.0 (Oct 11, 2008), broldev.core.swing 0.0.1-SNAPSHOT dependency
- Version:
- 1.0 (Oct 11, 2008)
- Author:
- Steph GAUDRY
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class javax.swing.AbstractListModel
listenerList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds all of the elements in the specified array to the listvoid
addElement(Object element)
Adds the specified element to the listvoid
clear()
Removes all of the elements from this list The list will be empty after this call returns.boolean
Returns true if this list contains the specified element.getElementAt(int index)
int
getSize()
boolean
removeElement(Object element)
Removes the first occurrence of the specified element from this list, if it is present.Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
Constructor Details
-
SortedListModel
public SortedListModel()Builds a default instance
-
-
Method Details
-
getSize
public int getSize() -
getElementAt
- Specified by:
getElementAt
in interfaceListModel
-
addElement
Adds the specified element to the list- Specified by:
addElement
in interfaceIModel
- Parameters:
element
- element to be appended to this list
-
addAll
Adds all of the elements in the specified array to the list- Parameters:
elements
- elements to add
-
clear
public void clear()Removes all of the elements from this list The list will be empty after this call returns. -
contains
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).- Parameters:
element
- element whose presence in this list is to be tested- Returns:
- true if this list contains the specified element
-
removeElement
Removes the first occurrence of the specified element from this list, if it is present. If this list does not contain the element, it is unchanged. Returns true if this list contained the specified element (or equivalently, if this list changed as a result of the call).- Specified by:
removeElement
in interfaceIModel
- Parameters:
element
- element to be removed from this list, if present- Returns:
- true if this list contained the specified element
-