|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractListModel net.sf.magicproject.ui.MListModel<T>
T
- the model type.public class MListModel<T extends MCardCompare>
Field Summary | |
---|---|
java.util.Vector<T> |
delegate
The content. |
java.util.List<T> |
removedDelegate
The original content. |
Constructor Summary | |
---|---|
MListModel(javax.swing.JLabel linkedAmount,
boolean deepSum)
Create a new instance of this class. |
Method Summary | |
---|---|
void |
add(T obj)
Adds the specified component to the end of this list. |
boolean |
addAll(java.util.Collection<T> c)
Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator. |
void |
clear()
Removes all of the elements from this list. |
boolean |
contains(T elem)
Tests whether the specified object is a component in this list. |
T |
elementAt(int index)
Returns the component at the specified index. |
T |
get(int index)
Returns the element at the specified position in this list. |
T |
getElementAt(int index)
Returns the component at the specified index. |
int |
getSize()
Returns the number of components in this list. |
int |
indexOf(java.lang.String elem)
Searches for the first occurrence of elem . |
int |
indexOf(T elem)
Searches for the first occurrence of elem . |
void |
insertElementAt(T obj,
int index)
Inserts the specified object as a component in this list at the specified index . |
boolean |
isEmpty()
Tests whether this list has any components. |
java.util.Iterator<T> |
iterator()
Returns an enumeration of the components of this list. |
int |
lastIndexOf(T elem)
Returns the index of the last occurrence of elem . |
T |
remove(int index)
Removes the element at the specified position in this list. |
boolean |
remove(T obj)
Removes the first (lowest-indexed) occurrence of the argument from this list. |
boolean |
removeAll(java.util.Collection<T> c)
Removes from this Vector all of its elements that are contained in the specified Collection. |
T |
set(int index,
T element)
Replaces the element at the specified position in this list with the specified element. |
void |
setElementAt(T obj,
int index)
Sets the component at the specified index of this list to be
the specified object. |
int |
size()
Returns the number of components in this list. |
T[] |
toArray()
Returns an array containing all of the elements in this list in proper sequence (from first to last element). |
java.lang.String |
toString()
Returns a string that displays and identifies this object's properties. |
Methods inherited from class javax.swing.AbstractListModel |
---|
addListDataListener, getListDataListeners, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final java.util.Vector<T extends MCardCompare> delegate
public final java.util.List<T extends MCardCompare> removedDelegate
Constructor Detail |
---|
public MListModel(javax.swing.JLabel linkedAmount, boolean deepSum)
linkedAmount
- the label reflecting the amount of this list.deepSum
- if true
the amount lable is updated with the
internal amount.Method Detail |
---|
public int getSize()
This method is identical to size
, which implements the
List
interface defined in the 1.2 Collections framework.
This method exists in conjunction with setSize
so that
size
is identifiable as a JavaBean property.
size()
public T getElementAt(int index)
Note: Although this method is not deprecated, the preferred method to use isget(int)
, which implements theList
interface defined in the 1.2 Collections framework.
index
- an index into this list
java.lang.ArrayIndexOutOfBoundsException
- if the index
is negative or greater than the
current size of this listget(int)
public int size()
List.size()
public boolean isEmpty()
true
if and only if this list has no components,
that is, its size is zero; false
otherwiseList.isEmpty()
public java.util.Iterator<T> iterator()
List.iterator()
public boolean contains(T elem)
elem
- an object
true
if the specified object is the same as a
component in this listList.contains(Object)
public int indexOf(T elem)
elem
.
elem
- an object
-1
if the object is not foundList.indexOf(Object)
public int indexOf(java.lang.String elem)
elem
.
elem
- an object
-1
if the object is not foundList.indexOf(Object)
public int lastIndexOf(T elem)
elem
.
elem
- the desired component
elem
in the
list; returns -1
if the object is not foundList.lastIndexOf(Object)
public T elementAt(int index)
ArrayIndexOutOfBoundsException
if the index is negative or
not less than the size of the list. Note: Although this method is not deprecated, the preferred method to use isget(int)
, which implements theList
interface defined in the 1.2 Collections framework.
index
- an index into this list
get(int)
,
List.get(int)
public void setElementAt(T obj, int index)
index
of this list to be
the specified object. The previous component at that position is discarded.
Throws an ArrayIndexOutOfBoundsException
if the index is
invalid.
Note: Although this method is not deprecated, the preferred method to use isset(int,Object)
, which implements theList
interface defined in the 1.2 Collections framework.
obj
- what the component is to be set toindex
- the specified indexList.set(int, Object)
public void add(T obj)
obj
- the component to be addedList.add(Object)
public boolean remove(T obj)
obj
- the component to be removed
true
if the argument was a component of this list;
false
otherwiseList.remove(Object)
public java.lang.String toString()
toString
in class java.lang.Object
public T get(int index)
Throws an ArrayIndexOutOfBoundsException
if the index is out
of range (index < 0 || index >= size()
).
index
- index of element to return
public T set(int index, T element)
Throws an ArrayIndexOutOfBoundsException
if the index is out
of range (index < 0 || index >= size()
).
index
- index of element to replaceelement
- element to be stored at the specified position
public void insertElementAt(T obj, int index)
index
.
Throws an ArrayIndexOutOfBoundsException
if the index is
invalid.
Note: Although this method is not deprecated, the preferred method to use isadd(int,Object)
, which implements theList
interface defined in the 1.2 Collections framework.
obj
- the component to insertindex
- where to insert the new component
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalidpublic T remove(int index)
Throws an ArrayIndexOutOfBoundsException
if the index is out
of range (index < 0 || index >= size()
).
index
- the index of the element to removed
public void clear()
public T[] toArray()
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
Arrays.asList(Object[])
public boolean removeAll(java.util.Collection<T> c)
c
- a collection of elements to be removed from the Vector
java.lang.ClassCastException
- if the types of one or more elements in this vector are
incompatible with the specified collection (optional)
java.lang.NullPointerException
- if this vector contains one or more null elements and the
specified collection does not support null elements (optional),
or if the specified collection is nullpublic boolean addAll(java.util.Collection<T> c)
c
- elements to be inserted into this Vector
true
if this Vector changed as a result of the call
java.lang.NullPointerException
- if the specified collection is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |