biouml.standard.type.access
Class TitleSqlIndex

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended bybiouml.standard.type.access.TitleSqlIndex
All Implemented Interfaces:
java.lang.Cloneable, javax.swing.ComboBoxModel, DataCollectionListener, java.util.EventListener, Index, javax.swing.ListModel, java.util.Map, java.io.Serializable

public class TitleSqlIndex
extends java.util.HashMap
implements Index, DataCollectionListener, javax.swing.ListModel, javax.swing.ComboBoxModel

TitleSqlIndex is map where key is Base#title and value Base#name. The index is loaded during DataCollection initialisation and updates itself using DataCollectionEvents. Additionally titles are stores in sorted list (titleList). This list is used by ListModel and ComboBoxModel, thus TitleSqlIndex can be easily used by JList and JComboBox controls.

See Also:
Serialized Form
Pendung:
it is suggested that title is unique, update index when element name is changed.

Nested Class Summary
 
Nested classes inherited from class ru.biosoft.access.Index
Index.IndexEntry, Index.StringIndexEntry
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
protected static org.apache.log4j.Category cat
           
protected  javax.swing.event.EventListenerList listenerList
           
protected  java.util.List titleList
           
 
Fields inherited from interface ru.biosoft.access.Index
DEFAULT_INDEX_NAME
 
Constructor Summary
TitleSqlIndex(DataCollection dc)
           
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener l)
           
 void close()
          Release all resources.
 void elementAdded(DataCollectionEvent e)
          Called after data element was added.
 void elementChanged(DataCollectionEvent e)
          Called after data element was changed.
 void elementRemoved(DataCollectionEvent e)
          Called after data element was removed.
 void elementWillAdd(DataCollectionEvent e)
          Called before data element will be added.
 void elementWillChange(DataCollectionEvent e)
          Called before data element will be changed.
 void elementWillRemove(DataCollectionEvent e)
          Called before data element will be removed.
protected  void fireIntervalAdded(java.lang.Object source, int index0, int index1)
           
protected  void fireIntervalRemoved(java.lang.Object source, int index0, int index1)
           
 java.lang.String getCompositeName(java.lang.Object title, java.lang.Object id)
           
 java.lang.Object getElementAt(int index)
           
 java.io.File getIndexFile()
          Returns index file.
 java.lang.Object getSelectedItem()
           
 int getSize()
           
 boolean isValid()
          Check is this index valid.
 java.util.Iterator nodeIterator(Key key)
           
 java.lang.Object put(java.lang.Object title, java.lang.Object id)
           
 void removeListDataListener(javax.swing.event.ListDataListener l)
           
 void setSelectedItem(java.lang.Object anItem)
           
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, values
 

Field Detail

cat

protected static org.apache.log4j.Category cat

titleList

protected java.util.List titleList

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

TitleSqlIndex

public TitleSqlIndex(DataCollection dc)
              throws java.lang.Exception,
                     java.sql.SQLException
Method Detail

getCompositeName

public java.lang.String getCompositeName(java.lang.Object title,
                                         java.lang.Object id)

put

public java.lang.Object put(java.lang.Object title,
                            java.lang.Object id)
Specified by:
put in interface java.util.Map

nodeIterator

public java.util.Iterator nodeIterator(Key key)
Specified by:
nodeIterator in interface Index

close

public void close()
Description copied from interface: Index
Release all resources. After call this method all operations on this object are invalid.

Specified by:
close in interface Index

isValid

public boolean isValid()
Description copied from interface: Index
Check is this index valid.

Specified by:
isValid in interface Index
Returns:
true if index valid, false otherwise.

getIndexFile

public java.io.File getIndexFile()
Description copied from interface: Index
Returns index file. This information is essential to remove index files. Can return null if file is not used.

Specified by:
getIndexFile in interface Index
Returns:
index file.

getSize

public int getSize()
Specified by:
getSize in interface javax.swing.ListModel

getElementAt

public java.lang.Object getElementAt(int index)
Specified by:
getElementAt in interface javax.swing.ListModel

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener l)
Specified by:
addListDataListener in interface javax.swing.ListModel

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener l)
Specified by:
removeListDataListener in interface javax.swing.ListModel

fireIntervalAdded

protected void fireIntervalAdded(java.lang.Object source,
                                 int index0,
                                 int index1)

fireIntervalRemoved

protected void fireIntervalRemoved(java.lang.Object source,
                                   int index0,
                                   int index1)

getSelectedItem

public java.lang.Object getSelectedItem()
Specified by:
getSelectedItem in interface javax.swing.ComboBoxModel

setSelectedItem

public void setSelectedItem(java.lang.Object anItem)
Specified by:
setSelectedItem in interface javax.swing.ComboBoxModel

elementAdded

public void elementAdded(DataCollectionEvent e)
                  throws java.lang.Exception
Description copied from interface: DataCollectionListener
Called after data element was added.

Specified by:
elementAdded in interface DataCollectionListener
Parameters:
e - DataCollectionEvent information about added data element.
Throws:
java.lang.Exception - If error occured.

elementWillRemove

public void elementWillRemove(DataCollectionEvent e)
                       throws DataCollectionVetoException,
                              java.lang.Exception
Description copied from interface: DataCollectionListener
Called before data element will be removed.

Specified by:
elementWillRemove in interface DataCollectionListener
Parameters:
e - DataCollectionEvent information about will removed data element.
Throws:
DataCollectionVetoException - If listener cancel removing of data element.
java.lang.Exception - If error occured.

elementRemoved

public void elementRemoved(DataCollectionEvent e)
                    throws java.lang.Exception
Description copied from interface: DataCollectionListener
Called after data element was removed.

Specified by:
elementRemoved in interface DataCollectionListener
Parameters:
e - DataCollectionEvent information about removed data element.
Throws:
java.lang.Exception - If error occured.

elementWillAdd

public void elementWillAdd(DataCollectionEvent e)
                    throws DataCollectionVetoException,
                           java.lang.Exception
Description copied from interface: DataCollectionListener
Called before data element will be added.

Specified by:
elementWillAdd in interface DataCollectionListener
Parameters:
e - DataCollectionEvent information about will added data element.
Throws:
DataCollectionVetoException - If listener cancel adding of data element.
java.lang.Exception - If error occured.

elementChanged

public void elementChanged(DataCollectionEvent e)
                    throws java.lang.Exception
Description copied from interface: DataCollectionListener
Called after data element was changed. e contains old data element (which already changed).

Specified by:
elementChanged in interface DataCollectionListener
Parameters:
e - DataCollectionEvent information about changed data element.
Throws:
java.lang.Exception - If error occured.

elementWillChange

public void elementWillChange(DataCollectionEvent e)
                       throws DataCollectionVetoException,
                              java.lang.Exception
Description copied from interface: DataCollectionListener
Called before data element will be changed. e contains old data element (which will be changed).

Specified by:
elementWillChange in interface DataCollectionListener
Parameters:
e - DataCollectionEvent information about will change data element.
Throws:
DataCollectionVetoException - If listener cancel changing of data element.
java.lang.Exception - If error occured.


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.