|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrit.roster.RosterEntry
public class RosterEntry
RosterEntry represents a single element in a locomotive roster, including information on how to locate it from decoder information.
The RosterEntry is the central place to find information about a locomotive's configuration, including CV and "programming variable" information. RosterEntry handles persistency through the LocoFile class. Creating a RosterEntry does not necessarily read the corresponding file (which might not even exist), please see readFile(), writeFile() member functions.
All the data attributes have a content, not null. FileName, however, is special. A null value for it indicates that no physical file is (yet) associated with this entry.
When the filePath attribute is non-null, the user has decided to organize the roster into directories.
Each entry can have one or more "Attributes" associated with it. These are (key, value) pairs. The key has to be unique, and currently both objects have to be Strings.
All properties, including the "Attributes", are bound.
LocoFile| Field Summary | |
|---|---|
protected String |
_comment
|
protected String |
_dateUpdated
|
protected String |
_dccAddress
|
protected String |
_decoderComment
|
protected String |
_decoderFamily
|
protected String |
_decoderModel
|
protected String |
_fileName
|
protected String |
_iconFilePath
|
protected String |
_id
|
protected String |
_imageFilePath
|
protected boolean |
_isLongAddress
|
protected String |
_isShuntingOn
|
protected int |
_maxSpeedPCT
|
protected String |
_mfg
|
protected String |
_model
|
protected String |
_owner
|
protected String |
_roadName
|
protected String |
_roadNumber
|
protected String |
_URL
|
protected String[] |
functionImages
|
protected String[] |
functionLabels
|
protected boolean[] |
functionLockables
|
protected String[] |
functionSelectedImages
|
| Constructor Summary | |
|---|---|
RosterEntry()
Construct a blank object. |
|
RosterEntry(Element e)
Construct this Entry from XML. |
|
RosterEntry(RosterEntry pEntry,
String pID)
|
|
RosterEntry(String fileName)
|
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
|
void |
changeDateUpdated()
Mark the date updated, e.g. from storing this roster entry |
void |
deleteAttribute(String key)
|
void |
ensureFilenameExists()
Ensure the entry has a valid filename. |
protected void |
firePropertyChange(String p,
Object old,
Object n)
|
String |
getAttribute(String key)
|
String[] |
getAttributeList()
|
Set<String> |
getAttributes()
Provide access to the set of attributes. |
String |
getComment()
|
String |
getDateUpdated()
|
String |
getDccAddress()
|
DccLocoAddress |
getDccLocoAddress()
|
String |
getDecoderComment()
|
String |
getDecoderFamily()
|
String |
getDecoderModel()
|
static String |
getDefaultOwner()
|
String |
getFileName()
|
String |
getFunctionImage(int fn)
|
String |
getFunctionLabel(int fn)
If a label has been defined for a specific function, return it, otherwise return null. |
boolean |
getFunctionLockable(int fn)
Return the lockable state of a specific function. |
String |
getFunctionSelectedImage(int fn)
|
String |
getIconPath()
|
String |
getId()
|
String |
getImagePath()
|
int |
getMAXFNNUM()
|
int |
getMaxSpeedPCT()
|
String |
getMfg()
|
String |
getModel()
|
String |
getOwner()
|
String |
getPathName()
|
String |
getRoadName()
|
String |
getRoadNumber()
|
String |
getShuntingFunction()
|
String |
getURL()
|
boolean |
isLongAddress()
|
void |
loadAttributes(Element e3)
Loads attribute key/value pairs from a JDOM element. |
void |
loadCvModel(CvTableModel cvModel,
IndexedCvTableModel iCvModel)
Load a pre-existing CvTableModel object with the CV contents of this entry |
void |
loadFunctions(Element e3)
Loads function names from a JDOM element. |
void |
printEntry(HardcopyWriter w)
|
void |
printEntryDetails(Writer w)
Prints the roster information. |
void |
putAttribute(String key,
String value)
|
void |
readFile()
Read a file containing the contents of this RosterEntry. |
void |
removePropertyChangeListener(PropertyChangeListener l)
|
void |
setComment(String s)
|
void |
setDateUpdated(String s)
|
void |
setDccAddress(String s)
|
void |
setDecoderComment(String s)
|
void |
setDecoderFamily(String s)
|
void |
setDecoderModel(String s)
|
static void |
setDefaultOwner(String n)
|
void |
setFileName(String s)
|
void |
setFunctionImage(int fn,
String s)
|
void |
setFunctionLabel(int fn,
String label)
Define label for a specific function |
void |
setFunctionLockable(int fn,
boolean lockable)
Define whether a specific function is lockable. |
void |
setFunctionSelectedImage(int fn,
String s)
|
void |
setIconPath(String s)
|
void |
setId(String s)
|
void |
setImagePath(String s)
|
void |
setLongAddress(boolean b)
|
void |
setMaxSpeedPCT(int maxSpeedPCT)
|
void |
setMfg(String s)
|
void |
setModel(String s)
|
void |
setOwner(String s)
|
void |
setRoadName(String s)
|
void |
setRoadNumber(String s)
|
void |
setShuntingFunction(String fn)
|
void |
setURL(String s)
|
String |
titleString()
|
String |
toString()
|
void |
updateFile()
Write the contents of this RosterEntry back to a file, preserving all existing decoder content. |
protected void |
warnShortLong(String id)
Warn user that the roster entry needs to be resaved. |
Vector<String> |
wrapComment(String comment,
int textSpace)
Take a String comment field and perform line wrapping on it. |
void |
writeFile(CvTableModel cvModel,
IndexedCvTableModel iCvModel,
VariableTableModel variableModel)
Write the contents of this RosterEntry to a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String _fileName
protected String _id
protected String _roadName
protected String _roadNumber
protected String _mfg
protected String _owner
protected String _model
protected String _dccAddress
protected boolean _isLongAddress
protected String _comment
protected String _decoderModel
protected String _decoderFamily
protected String _decoderComment
protected String _dateUpdated
protected int _maxSpeedPCT
protected String[] functionLabels
protected String[] functionSelectedImages
protected String[] functionImages
protected boolean[] functionLockables
protected String _isShuntingOn
protected String _imageFilePath
protected String _iconFilePath
protected String _URL
| Constructor Detail |
|---|
public RosterEntry()
public RosterEntry(String fileName)
public RosterEntry(RosterEntry pEntry,
String pID)
public RosterEntry(Element e)
e - Locomotive XML element| Method Detail |
|---|
public static String getDefaultOwner()
public static void setDefaultOwner(String n)
public int getMAXFNNUM()
public void setId(String s)
public String getId()
public void setFileName(String s)
public String getFileName()
public String getPathName()
public void ensureFilenameExists()
public void setRoadName(String s)
public String getRoadName()
public void setRoadNumber(String s)
public String getRoadNumber()
public void setMfg(String s)
public String getMfg()
public void setModel(String s)
public String getModel()
public void setOwner(String s)
public String getOwner()
public void setDccAddress(String s)
public String getDccAddress()
public void setLongAddress(boolean b)
public boolean isLongAddress()
public void setComment(String s)
public String getComment()
public void setDecoderModel(String s)
public String getDecoderModel()
public void setDecoderFamily(String s)
public String getDecoderFamily()
public void setDecoderComment(String s)
public String getDecoderComment()
public DccLocoAddress getDccLocoAddress()
public void setImagePath(String s)
public String getImagePath()
public void setIconPath(String s)
public String getIconPath()
public void setShuntingFunction(String fn)
public String getShuntingFunction()
public void setURL(String s)
public String getURL()
public void setDateUpdated(String s)
public String getDateUpdated()
public void loadFunctions(Element e3)
public void loadAttributes(Element e3)
public void setFunctionLabel(int fn,
String label)
fn - function number, starting with 0public String getFunctionLabel(int fn)
fn - function number, starting with 0
public void setFunctionImage(int fn,
String s)
public String getFunctionImage(int fn)
public void setFunctionSelectedImage(int fn,
String s)
public String getFunctionSelectedImage(int fn)
public void setFunctionLockable(int fn,
boolean lockable)
fn - function number, starting with 0public boolean getFunctionLockable(int fn)
fn - function number, starting with 0
public void putAttribute(String key,
String value)
public String getAttribute(String key)
public void deleteAttribute(String key)
public Set<String> getAttributes()
public String[] getAttributeList()
public int getMaxSpeedPCT()
public void setMaxSpeedPCT(int maxSpeedPCT)
protected void warnShortLong(String id)
public String titleString()
public String toString()
toString in class Objectpublic void updateFile()
This writes the file back in place, with the same decoder-specific content.
public void writeFile(CvTableModel cvModel,
IndexedCvTableModel iCvModel,
VariableTableModel variableModel)
cvModel - CV contents to include in filevariableModel - Variable contents to include in filepublic void changeDateUpdated()
public void loadCvModel(CvTableModel cvModel,
IndexedCvTableModel iCvModel)
cvModel - Model to load, must existpublic void printEntry(HardcopyWriter w)
public void printEntryDetails(Writer w)
public Vector<String> wrapComment(String comment,
int textSpace)
public void readFile()
public void addPropertyChangeListener(PropertyChangeListener l)
protected void firePropertyChange(String p,
Object old,
Object n)
public void removePropertyChangeListener(PropertyChangeListener l)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||