|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractListModel javax.swing.DefaultListModel org.bibalex.daf.commongui.datamodels.UIListEditableModel
public class UIListEditableModel
A data model Class used with JLists, allows The JList data to be modified (add or remove entries). It can be intialized using a DataTable. But the DataTable values are copied into the DefaultListModel. This class allows modification, in case of using it when no modifications are required it is recommended to use the UIListModel instead. As the last one consumes less memory.
Nested Class Summary | |
---|---|
class |
UIListEditableModel.ListObject
This class in used to maintain the Object in the list, an ID to identify the record and a value to be displayed are maintained. |
Field Summary | |
---|---|
protected int |
colID
The index of the Column in the DataTable considered as ID. |
protected int |
colVisisble
The index of the Column in the DataTable to be displayed in the List. |
protected DataTable |
dataTable
The DataTable that initilize the value of List. |
Fields inherited from class javax.swing.AbstractListModel |
---|
listenerList |
Constructor Summary | |
---|---|
UIListEditableModel(DataTable dataTable,
int colID,
int colVisible)
Constructor (1). |
|
UIListEditableModel(int colID,
int colVisible)
Constructor (2). |
Method Summary | |
---|---|
boolean |
addElement(int id,
java.lang.String value)
Adds a new element to the List. |
boolean |
addElementAt(int index,
int id,
java.lang.String value)
Adds a new element to the List at a specific index location. |
DataTable |
getDataTable()
Retrives dataTable that formed the model. |
int |
getIDAt(int index)
Retrives the ID of the Item at the given index. |
java.lang.Object[] |
getIDs()
Retreives all the IDs on the list and returns them as an Object[] (the IDs are of Integer type). |
void |
setDataTable(DataTable dt)
update dataTable that formed the model. |
Methods inherited from class javax.swing.DefaultListModel |
---|
add, addElement, capacity, clear, contains, copyInto, elementAt, elements, ensureCapacity, firstElement, get, getElementAt, getSize, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, removeAllElements, removeElement, removeElementAt, removeRange, set, setElementAt, setSize, size, toArray, toString, trimToSize |
Methods inherited from class javax.swing.AbstractListModel |
---|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int colID
protected int colVisisble
protected DataTable dataTable
Constructor Detail |
---|
public UIListEditableModel(DataTable dataTable, int colID, int colVisible)
dataTable
- The DataTable to extract the data from.colID
- The index of the column indicating the ID in the DataTable.colVisible
- The index of the column to be displayed on the list from the DataTable.public UIListEditableModel(int colID, int colVisible)
colID
- The index of the column indicating the ID in the DataTable.colVisible
- The index of the column to be displayed on the list from the DataTable.Method Detail |
---|
public int getIDAt(int index)
index
- The index of the item.
public DataTable getDataTable()
public void setDataTable(DataTable dt)
dt
- The DataTable
to be used in the UIListModel.public boolean addElement(int id, java.lang.String value)
id
- The ID of the added element.value
- The displayed value of the added element.
public boolean addElementAt(int index, int id, java.lang.String value)
index
- The index location to add the element to.id
- The ID of the added element.value
- The displayed value of the added element.
public java.lang.Object[] getIDs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |