ix.iface.util
Class KeyValueTable

java.lang.Object
  extended by ix.iface.util.KeyValueTable
Direct Known Subclasses:
AnnotationViewTable.ViewTable, ISpaceTool.CapabilityTable, SortingKVTable

public abstract class KeyValueTable
extends java.lang.Object

Packages a JTable together with a table model suitable for viewing a mapping from keys to values.


Nested Class Summary
static class KeyValueTable.LexicographicComparator
           
 class KeyValueTable.MostRecentFirstComparator
           
 class KeyValueTable.MostRecentLastComparator
           
static class KeyValueTable.PatternObjectComparator
           
protected  class KeyValueTable.RowPopupMenu
           
protected  class KeyValueTable.ViewJTable
           
protected  class KeyValueTable.ViewTableModel
          Mediates between the data and the JTable.
protected  class KeyValueTable.ViewTableMouseListener
           
 
Field Summary
protected  java.util.List keyList
           
protected  java.util.Comparator keySortComparator
          Determines the order in which keys are listed.
protected  java.util.Map keyTimestamps
           
protected  KeyValueTable.ViewTableModel model
           
protected  KeyValueTable.ViewTableMouseListener mouseListener
           
protected  KeyValueTable.ViewJTable table
           
protected  int timestamp
           
protected  java.util.Map viewedMap
           
 
Constructor Summary
KeyValueTable(java.util.Map initialMap, java.lang.String keyColName, java.lang.String valColName)
           
KeyValueTable(java.lang.String keyColName, java.lang.String valColName)
           
 
Method Summary
 void deleteEntry(java.lang.Object key)
           
 void deleteEntry(java.lang.Object key, java.lang.Object value)
           
protected abstract  void doPopupAction(java.awt.event.ActionEvent event, int row, java.lang.Object key)
          Called by the row popup menu to intepret any action command selected from the menu.
 javax.swing.JTable getJTable()
           
 java.util.Comparator getKeySortComparator()
           
 java.lang.Object getValue(java.lang.Object key)
           
 java.util.Map getViewedMap()
           
protected  int insertKey(java.lang.Object key)
           
protected  int keyTimestamp(java.lang.Object key)
           
protected  java.lang.String keyToString(java.lang.Object key)
           
protected abstract  KeyValueTable.RowPopupMenu makePopupMenu()
          Factory method.
 void recordNewValue(java.lang.Object key, java.lang.Object value)
           
 void recordNewValues(java.util.Map map)
           
 void reset()
          Empties the table.
 void setKeySortComparator(java.util.Comparator c)
          Sets the Comparator used to sort keys.
protected  void timestampKey(java.lang.Object key)
           
protected  java.lang.String valueToString(java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viewedMap

protected java.util.Map viewedMap

keyList

protected java.util.List keyList

keyTimestamps

protected java.util.Map keyTimestamps

timestamp

protected int timestamp

keySortComparator

protected java.util.Comparator keySortComparator
Determines the order in which keys are listed. The initial value is a Comparator that puts the newest key last by comparing timestamps; but it can be replaced by a Comparator that imposes a different order.

See Also:
keyTimestamp(Object), setKeySortComparator(Comparator)

table

protected KeyValueTable.ViewJTable table

model

protected KeyValueTable.ViewTableModel model

mouseListener

protected KeyValueTable.ViewTableMouseListener mouseListener
Constructor Detail

KeyValueTable

public KeyValueTable(java.lang.String keyColName,
                     java.lang.String valColName)

KeyValueTable

public KeyValueTable(java.util.Map initialMap,
                     java.lang.String keyColName,
                     java.lang.String valColName)
Method Detail

getJTable

public javax.swing.JTable getJTable()

getValue

public java.lang.Object getValue(java.lang.Object key)

getViewedMap

public java.util.Map getViewedMap()

keyToString

protected java.lang.String keyToString(java.lang.Object key)

valueToString

protected java.lang.String valueToString(java.lang.Object value)

getKeySortComparator

public java.util.Comparator getKeySortComparator()

setKeySortComparator

public void setKeySortComparator(java.util.Comparator c)
Sets the Comparator used to sort keys.

See Also:
keySortComparator, KeyValueTable.MostRecentLastComparator, KeyValueTable.MostRecentFirstComparator, KeyValueTable.LexicographicComparator, KeyValueTable.PatternObjectComparator

reset

public void reset()
Empties the table.


recordNewValues

public void recordNewValues(java.util.Map map)

recordNewValue

public void recordNewValue(java.lang.Object key,
                           java.lang.Object value)

insertKey

protected int insertKey(java.lang.Object key)

timestampKey

protected void timestampKey(java.lang.Object key)

keyTimestamp

protected int keyTimestamp(java.lang.Object key)

deleteEntry

public void deleteEntry(java.lang.Object key,
                        java.lang.Object value)

deleteEntry

public void deleteEntry(java.lang.Object key)

makePopupMenu

protected abstract KeyValueTable.RowPopupMenu makePopupMenu()
Factory method.


doPopupAction

protected abstract void doPopupAction(java.awt.event.ActionEvent event,
                                      int row,
                                      java.lang.Object key)
Called by the row popup menu to intepret any action command selected from the menu.