public class ZListModel<E>
extends javax.swing.DefaultListModel<E>
ListModel
s. It extends the Java DefaultListModel
by a ModifyFlag
which
is set when any of the data in the model has been changed. It is cleared when the list is
freshly reloaded.Constructor and Description |
---|
ZListModel() |
Modifier and Type | Method and Description |
---|---|
int |
addItem(E item) |
int |
addItem(int index,
E item) |
void |
addItems(java.util.Collection<E> items) |
void |
addItems(E[] items) |
void |
clear() |
void |
fireContentsChanged()
Tell the GUI that the model has changed.
|
protected void |
fireContentsChanged(java.lang.Object source,
int index0,
int index1)
Overridden not to fire in numb state
|
protected void |
fireIntervalAdded(java.lang.Object source,
int index0,
int index1)
Overridden not to fire in numb state
|
protected void |
fireIntervalRemoved(java.lang.Object source,
int index0,
int index1)
Overridden not to fire in numb state
|
java.util.List<E> |
getAllItems() |
java.util.Comparator |
getComparator() |
E |
getElementAt(int index) |
E |
getFirstItem()
Returns the first item in the model - or null if the model is empty.
|
E |
getItem(int index) |
java.lang.Object |
getItem(java.lang.Object item) |
int |
getItemCount() |
E |
getLastItem()
Returns the last item in the model - or null if the model is empty.
|
ModifyFlag |
getModifyFlag()
Returns the internal ModifyFlag.
|
boolean |
isModified()
Tells whether the data have changed.
|
boolean |
isNumb()
Tells whether the ListModel is in numb state
|
boolean |
isSortAscending() |
void |
load()
This method does nothing - it is supposed to be overridden by subclasses
|
void |
loadFrom(java.util.Collection list)
Clears and reloads the model.
|
void |
loadFrom(E[] array)
Clears and reloads the model.
|
void |
removeItem(int index) |
int |
removeItem(java.lang.Object item) |
int |
replaceItem(E item)
Replaces the item in the list.
|
int |
replaceOrAddItem(E item) |
void |
setComparator(java.util.Comparator<E> cmp) |
void |
setItem(int index,
E item) |
void |
setModified(boolean isModified)
Marks the list data as being changed.
|
void |
setModifyFlag(ModifyFlag flag)
Allows for setting the ModifyFlag from outside.
|
void |
setNumb(boolean isNumb)
Sets the ListModel in a numb state where it does not fire any events.
|
void |
setSortAscending(boolean isAscending) |
add, addElement, capacity, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getSize, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAllElements, removeElement, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize
public void setComparator(java.util.Comparator<E> cmp)
public java.util.Comparator getComparator()
public boolean isSortAscending()
public void setSortAscending(boolean isAscending)
public int removeItem(java.lang.Object item)
public int replaceItem(E item)
public int replaceOrAddItem(E item)
public void removeItem(int index)
public E getItem(int index)
public E getFirstItem()
public E getLastItem()
public E getElementAt(int index)
public java.lang.Object getItem(java.lang.Object item)
public void setItem(int index, E item)
public int getItemCount()
public java.util.List<E> getAllItems()
public void loadFrom(java.util.Collection list)
public void loadFrom(E[] array)
public void addItems(E[] items)
public void addItems(java.util.Collection<E> items)
public int addItem(int index, E item)
public int addItem(E item)
public void clear()
clear
in class javax.swing.DefaultListModel<E>
public void setModified(boolean isModified)
public void setModifyFlag(ModifyFlag flag)
public ModifyFlag getModifyFlag()
public boolean isModified()
public void load() throws java.lang.Exception
java.lang.Exception
public void setNumb(boolean isNumb)
public boolean isNumb()
protected void fireContentsChanged(java.lang.Object source, int index0, int index1)
fireContentsChanged
in class javax.swing.AbstractListModel<E>
protected void fireIntervalAdded(java.lang.Object source, int index0, int index1)
fireIntervalAdded
in class javax.swing.AbstractListModel<E>
protected void fireIntervalRemoved(java.lang.Object source, int index0, int index1)
fireIntervalRemoved
in class javax.swing.AbstractListModel<E>
public void fireContentsChanged()
Copyright © 2014 EsprIT-Systems. All Rights Reserved.