com.isti.quakewatch.message
Class EventListManager

java.lang.Object
  extended by com.isti.quakewatch.message.EventListManager
All Implemented Interfaces:
EventAdderInterface
Direct Known Subclasses:
SortedEventJListMgr

public class EventListManager
extends java.lang.Object
implements EventAdderInterface

Class EventListManager manages a list of event objects.


Field Summary
protected  boolean eventsListChangedFlag
           
protected  FifoHashtable eventsListTable
           
protected  LogFile logObj
           
 
Constructor Summary
EventListManager()
          Creates a "dummy" list manager.
EventListManager(LogFile logFileObj)
          Creates an event list manager.
 
Method Summary
 void addEventToList(QWEventMsgRecord recObj)
          Adds the given event message record object to the table of events, putting it into sorted position.
 void clearEventsListChangedFlag()
          Clears the events-list-changed flag that is set by the 'addEventToList()' and 'removeEventFromList()' methods.
 void ensureQuakeListSelectionVisible()
          Ensures that the current quake list selection is visible.
 void fireQuakeListContentsChanged()
          Fires a contents-changed event to the list model for the quake list.
 boolean getEventsListChangedFlag()
          Returns the events-list-changed flag that is set by the 'addEventToList()' and 'removeEventFromList()' methods.
 java.util.Iterator getEventsListIterator()
          Returns an iterator that operates over a read-only collection view of the values contained in the table of event message record objects.
 int getEventsListSize()
          Returns the size of the events list.
 java.lang.Object getEventsListSyncObj()
          Returns the thread-synchronized object for the events list.
 java.util.Vector getEventsListValuesVec()
          Returns a copy of the Vector of values from the table of event message record objects.
 int getIndexOfEventKey(java.lang.String keyStr)
          Returns the index value for the given event message record ID key string value.
 QWEventMsgRecord getLastEventInList()
          Returns the last event message record object on the list.
 QWEventMsgRecord getRecordObjForIndex(int indexVal)
          Returns the event message record object at the given index in the table of events.
 QWEventMsgRecord getRecordObjForKeyStr(java.lang.String keyStr)
          Returns the event message record object with the given event ID key string in the table of events.
 boolean isEventKeyInList(java.lang.String keyStr)
          Returns true if the given event ID key string is in the events list.
 java.lang.Object removeEventForIndex(int idx)
          Removes the event message record object for the given index value from the table of events.
 void removeEventFromList(java.lang.String keyStr)
          Removes the given event message record object from the table of events.
 void setQuakeListListenersEnabled(boolean flgVal)
          Sets whether or not 'ListDataListener' objects attached to the list model for the quake list are called when changes occur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventsListTable

protected final FifoHashtable eventsListTable

logObj

protected final LogFile logObj

eventsListChangedFlag

protected boolean eventsListChangedFlag
Constructor Detail

EventListManager

public EventListManager(LogFile logFileObj)
Creates an event list manager.

Parameters:
logFileObj - log file object to use, or null for none.

EventListManager

public EventListManager()
Creates a "dummy" list manager.

Method Detail

getEventsListSyncObj

public java.lang.Object getEventsListSyncObj()
Returns the thread-synchronized object for the events list.

Returns:
The thread-synchronized object for the events list.

addEventToList

public void addEventToList(QWEventMsgRecord recObj)
Adds the given event message record object to the table of events, putting it into sorted position.

Specified by:
addEventToList in interface EventAdderInterface
Parameters:
recObj - the event message record object to add.

removeEventFromList

public void removeEventFromList(java.lang.String keyStr)
Removes the given event message record object from the table of events.

Parameters:
keyStr - the event-ID string for the message record to be removed.

removeEventForIndex

public java.lang.Object removeEventForIndex(int idx)
Removes the event message record object for the given index value from the table of events.

Parameters:
idx - the index of the event message record object to be removed.
Returns:
The "key" object for the removed record, or null if a record for the given index could not be found.

getEventsListChangedFlag

public boolean getEventsListChangedFlag()
Returns the events-list-changed flag that is set by the 'addEventToList()' and 'removeEventFromList()' methods.

Returns:
true if the events list has changed since the last call to 'clearEventsListChangedFlag()', false otherwise.

clearEventsListChangedFlag

public void clearEventsListChangedFlag()
Clears the events-list-changed flag that is set by the 'addEventToList()' and 'removeEventFromList()' methods.


getIndexOfEventKey

public int getIndexOfEventKey(java.lang.String keyStr)
Returns the index value for the given event message record ID key string value.

Parameters:
keyStr - the event ID key string value to use.
Returns:
The associated index value, or -1 if none matched.

getRecordObjForKeyStr

public QWEventMsgRecord getRecordObjForKeyStr(java.lang.String keyStr)
Returns the event message record object with the given event ID key string in the table of events.

Parameters:
keyStr - the event ID string to use.
Returns:
The event message record object, or null if no match could be found.

getRecordObjForIndex

public QWEventMsgRecord getRecordObjForIndex(int indexVal)
Returns the event message record object at the given index in the table of events.

Parameters:
indexVal - the index value to use.
Returns:
The event message record object, or null if no match could be found.

isEventKeyInList

public boolean isEventKeyInList(java.lang.String keyStr)
Returns true if the given event ID key string is in the events list.

Parameters:
keyStr - the event ID key string value to use.
Returns:
true if the given event ID key string is in the events list, otherwise false.

getLastEventInList

public QWEventMsgRecord getLastEventInList()
Returns the last event message record object on the list.

Returns:
The event message record object, or null if none could be found.

getEventsListSize

public int getEventsListSize()
Returns the size of the events list.

Returns:
The number of events in the list.

getEventsListIterator

public java.util.Iterator getEventsListIterator()
Returns an iterator that operates over a read-only collection view of the values contained in the table of event message record objects. The iterator does not support the remove operation. The table should not be modified while the iterator is in use.

Returns:
An iterator that operates over a the values contained in the table of event message record objects.

getEventsListValuesVec

public java.util.Vector getEventsListValuesVec()
Returns a copy of the Vector of values from the table of event message record objects.

Returns:
A 'Vector' object of 'QWEventMsgRecord' objects.

setQuakeListListenersEnabled

public void setQuakeListListenersEnabled(boolean flgVal)
Sets whether or not 'ListDataListener' objects attached to the list model for the quake list are called when changes occur. This version of the method does nothing; subclasses will probably want to override it.

Parameters:
flgVal - true to enable calling of 'ListDataListener' objects, false to disable.

fireQuakeListContentsChanged

public void fireQuakeListContentsChanged()
Fires a contents-changed event to the list model for the quake list. This version of the method does nothing; subclasses will probably want to override it.


ensureQuakeListSelectionVisible

public void ensureQuakeListSelectionVisible()
Ensures that the current quake list selection is visible. This version of the method does nothing; subclasses will probably want to override it.