|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap
java.util.TreeMap
com.anthonyeden.lib.util.XTreeMap
An implementation of a TreeMap which can be placed in a JTable or in a JList. When used in a JTable the table will have two columns: column 1 for the key and column 2 for the value. Whan used in a JList the keys will be used by default for display.
Note that since this class extends from the TreeMap class the keys will be sorted in natural order as described in the TreeMap documentation.
Constructor Summary | |
XTreeMap()
|
Method Summary | |
void |
addListDataListener(javax.swing.event.ListDataListener l)
Add a ListDataListener. |
void |
addTableModelListener(javax.swing.event.TableModelListener l)
Add a TableModelListener. |
void |
clear()
Clear the map. |
protected java.lang.Object |
elementAt(int index,
java.util.Collection c)
Get the element at the given index in the given collection. |
protected void |
fireContentsChanged(int index0,
int index1)
|
protected void |
fireIntervalAdded(int index0,
int index1)
|
protected void |
fireIntervalRemoved(int index0,
int index1)
|
protected void |
fireRowsDeleted(int index0,
int index1)
|
protected void |
fireRowsInserted(int index0,
int index1)
|
protected void |
fireTableChanged(javax.swing.event.TableModelEvent evt)
|
java.lang.Class |
getColumnClass(int column)
Get the given column's class. |
int |
getColumnCount()
Get the total number of columns. |
java.lang.String |
getColumnName(int column)
Get the column name for the given column. |
java.lang.Object |
getElementAt(int index)
Get the element at the given index. |
boolean |
getListUsesKey()
Return true if the map keys are returned in the ListModel getElementAt() method. |
int |
getRowCount()
Get the total number of rows. |
int |
getSize()
Get the list size. |
java.lang.Object |
getValueAt(int row,
int column)
Get the value at the given row and column. |
boolean |
isCellEditable(int row,
int column)
Return true if the cell is editable. |
java.lang.Object |
keyAt(int index)
Get the key at the given index. |
int |
keyIndex(java.lang.Object key)
Get the index of the given key or -1 if there is no matching key. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Put the given object into the map using the given key. |
void |
putAll(java.util.Map map)
Put all of the given map into this map. |
java.lang.Object |
remove(java.lang.Object key)
Remove the object for the given key. |
void |
removeListDataListener(javax.swing.event.ListDataListener l)
Remove a ListDataListener. |
void |
removeTableModelListener(javax.swing.event.TableModelListener l)
Remove a TableModelListener. |
void |
setColumnClass(int column,
java.lang.Class columnClass)
|
void |
setColumnName(int column,
java.lang.String name)
Set the column name for the given column index. |
void |
setListUsesKey(boolean listUsesKey)
Set to true if the map keys should be returned in the ListModel getElementAt() method. |
void |
setValueAt(java.lang.Object value,
int row,
int column)
Set the value at the given row and column. |
java.lang.Object |
valueAt(int index)
Get the value at the given index. |
Methods inherited from class java.util.TreeMap |
clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, size, subMap, tailMap, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, isEmpty, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
equals, hashCode, isEmpty |
Constructor Detail |
public XTreeMap()
Method Detail |
public void clear()
clear
in interface java.util.Map
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- The keyvalue
- The value
public void putAll(java.util.Map map)
putAll
in interface java.util.Map
map
- The map to insertpublic java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
key
- The key
public int keyIndex(java.lang.Object key)
key
- The key
public java.lang.Object keyAt(int index)
index
- The index
public java.lang.Object valueAt(int index)
index
- The index
protected java.lang.Object elementAt(int index, java.util.Collection c)
index
- The indexc
- The collection
public boolean getListUsesKey()
public void setListUsesKey(boolean listUsesKey)
listUsesKey
- True if getElementAt() should return keyspublic int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
column
- The column index
public void setColumnName(int column, java.lang.String name)
column
- The column indexname
- The new namepublic java.lang.Class getColumnClass(int column)
getColumnClass
in interface javax.swing.table.TableModel
column
- The column
public void setColumnClass(int column, java.lang.Class columnClass)
public boolean isCellEditable(int row, int column)
isCellEditable
in interface javax.swing.table.TableModel
row
- The rowcolumn
- The column
public java.lang.Object getValueAt(int row, int column)
getValueAt
in interface javax.swing.table.TableModel
row
- The rowcolumn
- The column
public void setValueAt(java.lang.Object value, int row, int column)
setValueAt
in interface javax.swing.table.TableModel
value
- The new valuerow
- The rowcolumn
- The columnpublic void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener
in interface javax.swing.table.TableModel
l
- The TableModelListener to addpublic void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener
in interface javax.swing.table.TableModel
l
- The TableModelListener to removepublic java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
index
- The index
public int getSize()
getSize
in interface javax.swing.ListModel
public void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener
in interface javax.swing.ListModel
l
- The ListDataListenerpublic void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener
in interface javax.swing.ListModel
l
- The ListDataListenerprotected void fireTableChanged(javax.swing.event.TableModelEvent evt)
protected void fireRowsInserted(int index0, int index1)
protected void fireRowsDeleted(int index0, int index1)
protected void fireIntervalAdded(int index0, int index1)
protected void fireIntervalRemoved(int index0, int index1)
protected void fireContentsChanged(int index0, int index1)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |