| java.util.TreeMap com.anthonyeden.lib.util.XTreeMap
XTreeMap | public class XTreeMap extends TreeMap implements TableModel,ListModel(Code) | | 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.
author: Anthony Eden |
Method Summary | |
public void | addListDataListener(ListDataListener l) Add a ListDataListener. | public void | addTableModelListener(TableModelListener l) Add a TableModelListener. | public void | clear() Clear the map. | protected Object | elementAt(int index, 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(TableModelEvent evt) | public Class | getColumnClass(int column) Get the given column's class. | public int | getColumnCount() Get the total number of columns. | public String | getColumnName(int column) Get the column name for the given column. | public Object | getElementAt(int index) Get the element at the given index. | public boolean | getListUsesKey() Return true if the map keys are returned in the ListModel getElementAt()
method. | public int | getRowCount() Get the total number of rows. | public int | getSize() Get the list size. | public Object | getValueAt(int row, int column) Get the value at the given row and column. | public boolean | isCellEditable(int row, int column) Return true if the cell is editable. | public Object | keyAt(int index) Get the key at the given index. | public int | keyIndex(Object key) Get the index of the given key or -1 if there is no matching key. | public Object | put(Object key, Object value) Put the given object into the map using the given key. | public void | putAll(Map map) Put all of the given map into this map. | public Object | remove(Object key) Remove the object for the given key. | public void | removeListDataListener(ListDataListener l) Remove a ListDataListener. | public void | removeTableModelListener(TableModelListener l) Remove a TableModelListener. | public synchronized void | setColumnClass(int column, Class columnClass) | public synchronized void | setColumnName(int column, String name) Set the column name for the given column index. | public void | setListUsesKey(boolean listUsesKey) Set to true if the map keys should be returned in the ListModel
getElementAt() method. | public synchronized void | setValueAt(Object value, int row, int column) Set the value at the given row and column. | public Object | valueAt(int index) Get the value at the given index. |
addListDataListener | public void addListDataListener(ListDataListener l)(Code) | | Add a ListDataListener.
Parameters: l - The ListDataListener |
addTableModelListener | public void addTableModelListener(TableModelListener l)(Code) | | Add a TableModelListener.
Parameters: l - The TableModelListener to add |
clear | public void clear()(Code) | | Clear the map.
|
elementAt | protected Object elementAt(int index, Collection c)(Code) | | Get the element at the given index in the given collection.
Parameters: index - The index Parameters: c - The collection The element at index in the collection |
fireContentsChanged | protected void fireContentsChanged(int index0, int index1)(Code) | | |
fireIntervalAdded | protected void fireIntervalAdded(int index0, int index1)(Code) | | |
fireIntervalRemoved | protected void fireIntervalRemoved(int index0, int index1)(Code) | | |
fireRowsDeleted | protected void fireRowsDeleted(int index0, int index1)(Code) | | |
fireRowsInserted | protected void fireRowsInserted(int index0, int index1)(Code) | | |
getColumnClass | public Class getColumnClass(int column)(Code) | | Get the given column's class.
Parameters: column - The column The column class |
getColumnCount | public int getColumnCount()(Code) | | Get the total number of columns.
The column count |
getColumnName | public String getColumnName(int column)(Code) | | Get the column name for the given column.
Parameters: column - The column index The column name |
getElementAt | public Object getElementAt(int index)(Code) | | Get the element at the given index.
Parameters: index - The index The element |
getListUsesKey | public boolean getListUsesKey()(Code) | | Return true if the map keys are returned in the ListModel getElementAt()
method. If this method returns false then the getElementAt() method
returns map values.
True if getElementAt() returns keys |
getRowCount | public int getRowCount()(Code) | | Get the total number of rows.
The total number of rows |
getSize | public int getSize()(Code) | | Get the list size.
The list size |
getValueAt | public Object getValueAt(int row, int column)(Code) | | Get the value at the given row and column.
Parameters: row - The row Parameters: column - The column The value |
isCellEditable | public boolean isCellEditable(int row, int column)(Code) | | Return true if the cell is editable. The default behavior allows
the UI user to change the key value.
Parameters: row - The row Parameters: column - The column True if the column is editable |
keyAt | public Object keyAt(int index)(Code) | | Get the key at the given index.
Parameters: index - The index The key at the given index |
keyIndex | public int keyIndex(Object key)(Code) | | Get the index of the given key or -1 if there is no matching key.
Parameters: key - The key The index |
put | public Object put(Object key, Object value)(Code) | | Put the given object into the map using the given key. If there
is already an object in the map with the given key then the object
being replaced will be returned. If there is not value for the
given key then the return value will be null.
Parameters: key - The key Parameters: value - The value The previous object |
putAll | public void putAll(Map map)(Code) | | Put all of the given map into this map.
Parameters: map - The map to insert |
remove | public Object remove(Object key)(Code) | | Remove the object for the given key. This method will return
the removed object or null if no object is removed.
Parameters: key - The key The removed object or null |
removeListDataListener | public void removeListDataListener(ListDataListener l)(Code) | | Remove a ListDataListener.
Parameters: l - The ListDataListener |
removeTableModelListener | public void removeTableModelListener(TableModelListener l)(Code) | | Remove a TableModelListener.
Parameters: l - The TableModelListener to remove |
setColumnClass | public synchronized void setColumnClass(int column, Class columnClass)(Code) | | |
setColumnName | public synchronized void setColumnName(int column, String name)(Code) | | Set the column name for the given column index.
Parameters: column - The column index Parameters: name - The new name |
setListUsesKey | public void setListUsesKey(boolean listUsesKey)(Code) | | Set to true if the map keys should be returned in the ListModel
getElementAt() method. Set to false if the getElementAt() method should
return map values.
Parameters: listUsesKey - True if getElementAt() should return keys |
setValueAt | public synchronized void setValueAt(Object value, int row, int column)(Code) | | Set the value at the given row and column.
Parameters: value - The new value Parameters: row - The row Parameters: column - The column |
valueAt | public Object valueAt(int index)(Code) | | Get the value at the given index.
Parameters: index - The index The value at the given index |
Methods inherited from java.util.TreeMap | public Map.Entry<K, V> ceilingEntry(K key)(Code)(Java Doc) public K ceilingKey(K key)(Code)(Java Doc) public void clear()(Code)(Java Doc) public Object clone()(Code)(Java Doc) public Comparator<? super K> comparator()(Code)(Java Doc) public boolean containsKey(Object key)(Code)(Java Doc) public boolean containsValue(Object value)(Code)(Java Doc) public NavigableSet<K> descendingKeySet()(Code)(Java Doc) public NavigableMap<K, V> descendingMap()(Code)(Java Doc) public Set<Map.Entry<K, V>> entrySet()(Code)(Java Doc) public Map.Entry<K, V> firstEntry()(Code)(Java Doc) public K firstKey()(Code)(Java Doc) public Map.Entry<K, V> floorEntry(K key)(Code)(Java Doc) public K floorKey(K key)(Code)(Java Doc) public V get(Object key)(Code)(Java Doc) public NavigableMap<K, V> headMap(K toKey, boolean inclusive)(Code)(Java Doc) public SortedMap<K, V> headMap(K toKey)(Code)(Java Doc) public Map.Entry<K, V> higherEntry(K key)(Code)(Java Doc) public K higherKey(K key)(Code)(Java Doc) public Set<K> keySet()(Code)(Java Doc) public Map.Entry<K, V> lastEntry()(Code)(Java Doc) public K lastKey()(Code)(Java Doc) public Map.Entry<K, V> lowerEntry(K key)(Code)(Java Doc) public K lowerKey(K key)(Code)(Java Doc) public NavigableSet<K> navigableKeySet()(Code)(Java Doc) public Map.Entry<K, V> pollFirstEntry()(Code)(Java Doc) public Map.Entry<K, V> pollLastEntry()(Code)(Java Doc) public V put(K key, V value)(Code)(Java Doc) public void putAll(Map<? extends K, ? extends V> map)(Code)(Java Doc) public V remove(Object key)(Code)(Java Doc) public int size()(Code)(Java Doc) public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)(Code)(Java Doc) public SortedMap<K, V> subMap(K fromKey, K toKey)(Code)(Java Doc) public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive)(Code)(Java Doc) public SortedMap<K, V> tailMap(K fromKey)(Code)(Java Doc) public Collection<V> values()(Code)(Java Doc)
|
|
|