public class IlpDefaultListModel extends AbstractListModel implements ListModel, AttributeValueListener
DefaultListModel
. It recognizes
the representation objects that are inserted and listens to their
notifications, changing the AttributeValueEvent
s into regular
ListDataEvent
s.IlpRepresentationObject
,
AttributeValueEvent
,
Serialized FormlistenerList
Constructor and Description |
---|
IlpDefaultListModel()
Default constructor
|
IlpDefaultListModel(boolean listeningToAttributeValueChange)
Creates a new model instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object o)
Inserts the specified element at the specified position in this list.
|
boolean |
add(Object o)
Appends the specified element to this list (optional
operation).
|
void |
addAll(Collection collection)
Adds the specified collection of elements at the end of this list.
|
void |
attributeValueChange(AttributeValueEvent ev)
This method is called when an attribute value is changed.
|
void |
clear()
Removes all of the elements from this list.
|
Object |
get(int index)
Returns the value at the specified index.
|
Object |
getElementAt(int index)
Returns the value at the specified index.
|
int |
getSize()
Returns the length of the list.
|
int |
indexOf(Object o)
Returns the index in this list of the first occurrence of the specified
element, or
-1 if this list does not contain this element. |
int |
lastIndexOf(Object o)
Returns the index in this list of the last occurrence of the specified
element, or
-1 if this list does not contain this element. |
Object |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
remove(Object o)
Removes the first occurrence in this list of the specified element
(optional operation).
|
void |
removeRange(int fromIndex,
int toIndex)
Deletes the components at the specified range of indexes.
|
Object |
set(int index,
Object o)
Replaces the element at the specified position in this list with the
specified element.
|
int |
size()
Returns the length of the list.
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addListDataListener, removeListDataListener
public IlpDefaultListModel()
public IlpDefaultListModel(boolean listeningToAttributeValueChange)
listeningToAttributeValueChange
- Indicates that this model will
listen to attribute value change
events on its contained objects.public int getSize()
public int size()
public Object getElementAt(int index)
getElementAt
in interface ListModel
public Object get(int index)
public void attributeValueChange(AttributeValueEvent ev)
attributeValueChange
in interface AttributeValueListener
public Object set(int index, Object o)
index
- Index of element to replace.o
- Object to be stored at the specified position.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public boolean add(Object o)
o
- Element to be appended to this list.true
(according to the general contract of the
Collection.add
method).public void add(int index, Object o)
index
- index at which the specified element is to be inserted.o
- object to be inserted.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public Object remove(int index)
Throws an IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size()).
index
- the index of the element to removed.public boolean remove(Object o)
(o==null ? get(i)==null : o.equals(get(i)))
(if
such an element exists).o
- Element to be removed from this list, if present.true
if this list contained the specified element.UnsupportedOperationException
- if the remove
method is
not supported by this list.public void clear()
public void removeRange(int fromIndex, int toIndex)
fromIndex
- The index of the lower end of the range.toIndex
- The index of the upper end of the range.IndexOutOfBoundsException
- if the index was invalid.IllegalArgumentException
- if fromIndex
> toIndex
.remove(int)
public void addAll(Collection collection)
public int indexOf(Object o)
-1
if this list does not contain this element.
More formally, returns the lowest index i
such that
(o==null ? get(i)==null : o.equals(get(i)))
,
or -1
if there is no such index.o
- Element to search for.-1
if this list does not contain this element.public int lastIndexOf(Object o)
-1
if this list does not contain this element.
More formally, returns the highest index i
such that
(o==null ? get(i)==null : o.equals(get(i)))
,
or -1
if there is no such index.o
- Element to search for.-1
if this list does not contain this element.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.