|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.XmlFile
jmri.jmrix.nce.consist.NceConsistRoster
public class NceConsistRoster
NCE Consist Roster manages and manipulates a roster of consists.
It works with the "consist-roster-config" XML DTD to load and store its information.
This is an in-memory representation of the roster xml file (see below for constants defining name and location). As such, this class is also responsible for the "dirty bit" handling to ensure it gets written. As a temporary reliability enhancement, all changes to this structure are now being written to a backup file, and a copy is made when the file is opened.
Multiple Roster objects don't make sense, so we use an "instance" member to navigate to a single one.
This predates the "XmlFile" base class, so doesn't use it. Not sure whether it should...
The only bound property is the list of s; a PropertyChangedEvent is fired every time that changes.
The entries are stored in an ArrayList, sorted alphabetically. That sort is done manually each time an entry is added.
NceConsistRosterEntry| Field Summary | |
|---|---|
protected List<NceConsistRosterEntry> |
_list
List of contained RosterEntry elements. |
| Fields inherited from class jmri.jmrit.XmlFile |
|---|
dtdLocation, xsltLocation |
| Constructor Summary | |
|---|---|
NceConsistRoster()
|
|
| Method Summary | |
|---|---|
void |
addEntry(NceConsistRosterEntry e)
Add a RosterEntry object to the in-memory Roster. |
void |
addPropertyChangeListener(PropertyChangeListener l)
|
boolean |
checkEntry(int i,
String roadName,
String roadNumber,
String consistNumber,
String loco1Address,
String loco2Address,
String loco3Address,
String loco4Address,
String loco5Address,
String loco6Address,
String id)
Check if an entry consistent with specific properties. |
static String |
defaultNceConsistRosterFilename()
Return the filename String for the default ConsistRoster file, including location. |
void |
dispose()
|
NceConsistRosterEntry |
entryFromTitle(String title)
Return RosterEntry from a "title" string, ala selection in matchingComboBox |
void |
entryIdChanged(NceConsistRosterEntry r)
Notify that the ID of an entry has changed. |
protected void |
firePropertyChange(String p,
Object old,
Object n)
|
JComboBox |
fullRosterComboBox()
Return a combo box containing the entire ConsistRoster. |
static NceConsistRoster |
instance()
Locate the single instance of Roster, loading it if need be |
JComboBox |
matchingComboBox(String roadName,
String roadNumber,
String consistNumber,
String eng1Address,
String eng2Address,
String eng3Address,
String eng4Address,
String eng5Address,
String eng6Address,
String id)
Get a JComboBox representing the choices that match. |
List<NceConsistRosterEntry> |
matchingList(String roadName,
String roadNumber,
String consistNumber,
String eng1Address,
String eng2Address,
String eng3Address,
String eng4Address,
String eng5Address,
String eng6Address,
String id)
Get a List of entries matching some information. |
int |
numEntries()
|
void |
reloadRosterFile()
update the in-memory Roster to be consistent with the current roster file. |
void |
removeEntry(NceConsistRosterEntry e)
Remove a RosterEntry object from the in-memory Roster. |
void |
removePropertyChangeListener(PropertyChangeListener l)
|
static void |
resetInstance()
|
static void |
setNceConsistRosterFileName(String name)
|
void |
updateComboBox(JComboBox box)
|
static void |
writeRosterFile()
Store the roster in the default place, including making a backup if needed |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected List<NceConsistRosterEntry> _list
| Constructor Detail |
|---|
public NceConsistRoster()
| Method Detail |
|---|
public static void resetInstance()
public static NceConsistRoster instance()
public void addEntry(NceConsistRosterEntry e)
e - Entry to addpublic void removeEntry(NceConsistRosterEntry e)
e - Entry to removepublic int numEntries()
public JComboBox fullRosterComboBox()
This is based on a single model, so it can be updated when the ConsistRoster changes.
public JComboBox matchingComboBox(String roadName,
String roadNumber,
String consistNumber,
String eng1Address,
String eng2Address,
String eng3Address,
String eng4Address,
String eng5Address,
String eng6Address,
String id)
public void updateComboBox(JComboBox box)
public NceConsistRosterEntry entryFromTitle(String title)
public List<NceConsistRosterEntry> matchingList(String roadName,
String roadNumber,
String consistNumber,
String eng1Address,
String eng2Address,
String eng3Address,
String eng4Address,
String eng5Address,
String eng6Address,
String id)
public boolean checkEntry(int i,
String roadName,
String roadNumber,
String consistNumber,
String loco1Address,
String loco2Address,
String loco3Address,
String loco4Address,
String loco5Address,
String loco6Address,
String id)
public void dispose()
public static void writeRosterFile()
public void reloadRosterFile()
public static String defaultNceConsistRosterFilename()
public static void setNceConsistRosterFileName(String name)
public void addPropertyChangeListener(PropertyChangeListener l)
protected void firePropertyChange(String p,
Object old,
Object n)
public void removePropertyChangeListener(PropertyChangeListener l)
public void entryIdChanged(NceConsistRosterEntry r)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||