org.ka2ddo.yaac.aprs
Class MessageGroupCatalog

java.lang.Object
  extended by org.ka2ddo.yaac.aprs.MessageGroupCatalog

public class MessageGroupCatalog
extends java.lang.Object

This class manages the list of callsigns (station and tactical) that are considered for local delivery here.


Method Summary
 LocalDestinationRecord addRow()
          Create a new initially-disabled LocalDestinationRecord to the catalog.
 void deleteRow(int rowIndex)
          Delete the specified record from the catalog, including from the Preferences backing store.
 void flushToPreferences(LocalDestinationRecord ldr)
          Persist the specified LocalDestinationRecord to Preferences.
 LocalDestinationRecord[] getCustomDestinations()
          Get a list of all locally-defined destinations.
static MessageGroupCatalog getInstance()
          Get the singleton MessageGroupCatalog object.
 LocalDestinationRecord getLocalDestination(java.lang.String callsign)
          Test if the specified addressee is recognized as an alias for the local station.
 int getMessageGroupCount()
          Get the number of message groups registered in the catalog.
 LocalDestinationRecord getRow(int rowIndex)
          Get the Nth record in the MessageGroupCatalog.
 void init(java.util.prefs.Preferences prefs)
          Load the MessageGroupCatalog with persisted values from the Java Preferences store.
 LocalDestinationRecord insertDefaultRow(int row, java.lang.String callsign)
          Create a new initially-enabled LocalDestinationRecord at the specified index within the catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MessageGroupCatalog getInstance()
Get the singleton MessageGroupCatalog object.

Returns:
singleton MessageGroupCatalog

init

public void init(java.util.prefs.Preferences prefs)
          throws java.util.prefs.BackingStoreException
Load the MessageGroupCatalog with persisted values from the Java Preferences store.

Parameters:
prefs - root Preferences node of YAAC configuration
Throws:
java.util.prefs.BackingStoreException - if preferences could not be read for any reason

getMessageGroupCount

public int getMessageGroupCount()
Get the number of message groups registered in the catalog.

Returns:
message group count

getRow

public LocalDestinationRecord getRow(int rowIndex)
Get the Nth record in the MessageGroupCatalog. Intended for use by GUI table models,

Parameters:
rowIndex - zero-based index of record to fetch
Returns:
LocalDestinationRecord from the catalog

addRow

public LocalDestinationRecord addRow()
Create a new initially-disabled LocalDestinationRecord to the catalog.

Returns:
an empty LocalDestinationRecord (not yet written to Preferences)

insertDefaultRow

public LocalDestinationRecord insertDefaultRow(int row,
                                               java.lang.String callsign)
Create a new initially-enabled LocalDestinationRecord at the specified index within the catalog.

Parameters:
row - zero-based index where new record should be inserted
callsign - String alias to be assigned to the new record
Returns:
created LocalDestinationRecord

flushToPreferences

public void flushToPreferences(LocalDestinationRecord ldr)
Persist the specified LocalDestinationRecord to Preferences.

Parameters:
ldr - LocalDestinationRecord to save

deleteRow

public void deleteRow(int rowIndex)
Delete the specified record from the catalog, including from the Preferences backing store.

Parameters:
rowIndex - zero-based index of record to delete

getLocalDestination

public LocalDestinationRecord getLocalDestination(java.lang.String callsign)
Test if the specified addressee is recognized as an alias for the local station.

Parameters:
callsign - String to test against known local aliases
Returns:
LocalDestinationRecord if the callsign matches an entry, else null

getCustomDestinations

public LocalDestinationRecord[] getCustomDestinations()
Get a list of all locally-defined destinations.

Returns:
array of LocalDestinationRecords for only records not pre-defined by YAAC distribution