|
||||||||||
| 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 String |
_isShuntingOn
|
protected int |
_maxSpeedPCT
|
protected String |
_mfg
|
protected String |
_model
|
protected String |
_owner
|
protected LocoAddress.Protocol |
_protocol
|
protected String |
_roadName
|
protected String |
_roadNumber
|
protected RosterSpeedProfile |
_sp
|
protected String |
_URL
|
(package private) TreeMap<String,String> |
attributePairs
|
protected String[] |
functionImages
|
protected String[] |
functionLabels
|
protected boolean[] |
functionLockables
|
protected String[] |
functionSelectedImages
|
(package private) String |
indent
|
(package private) int |
indentWidth
|
(package private) boolean |
loadedOnce
|
(package private) static org.slf4j.Logger |
log
|
(package private) static int |
MAXFNNUM
|
(package private) String |
newLine
|
(package private) int |
openCounter
|
(package private) PropertyChangeSupport |
pcs
|
| Constructor Summary | |
|---|---|
RosterEntry()
Construct a blank object. |
|
RosterEntry(org.jdom.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()
|
LocoAddress.Protocol |
getProtocol()
|
String |
getProtocolAsString()
|
String |
getRoadName()
|
String |
getRoadNumber()
|
String |
getShuntingFunction()
|
RosterSpeedProfile |
getSpeedProfile()
|
String |
getURL()
|
boolean |
isLongAddress()
|
boolean |
isOpen()
|
void |
loadAttributes(org.jdom.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(org.jdom.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 |
setOpen(boolean boo)
|
void |
setOwner(String s)
|
void |
setProtocol(LocoAddress.Protocol protocol)
|
void |
setRoadName(String s)
|
void |
setRoadNumber(String s)
|
void |
setShuntingFunction(String fn)
|
void |
setSpeedProfile(RosterSpeedProfile sp)
|
void |
setURL(String s)
|
org.jdom.Element |
store()
Create an XML element to represent this Entry. |
String |
titleString()
|
String |
toString()
|
void |
updateFile()
Write the contents of this RosterEntry back to a file, preserving all existing decoder CV 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 LocoAddress.Protocol _protocol
protected String _comment
protected String _decoderModel
protected String _decoderFamily
protected String _decoderComment
protected String _dateUpdated
protected int _maxSpeedPCT
static final int MAXFNNUM
protected String[] functionLabels
protected String[] functionSelectedImages
protected String[] functionImages
protected boolean[] functionLockables
protected String _isShuntingOn
TreeMap<String,String> attributePairs
protected String _imageFilePath
protected String _iconFilePath
protected String _URL
protected RosterSpeedProfile _sp
int openCounter
boolean loadedOnce
String indent
int indentWidth
String newLine
PropertyChangeSupport pcs
static org.slf4j.Logger log
| Constructor Detail |
|---|
public RosterEntry()
public RosterEntry(String fileName)
public RosterEntry(RosterEntry pEntry,
String pID)
public RosterEntry(org.jdom.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()
getId in interface BasicRosterEntrypublic 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()
getDccAddress in interface BasicRosterEntrypublic void setLongAddress(boolean b)
public RosterSpeedProfile getSpeedProfile()
public void setSpeedProfile(RosterSpeedProfile sp)
public boolean isLongAddress()
isLongAddress in interface BasicRosterEntrypublic void setProtocol(LocoAddress.Protocol protocol)
public LocoAddress.Protocol getProtocol()
public String getProtocolAsString()
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()
getDccLocoAddress in interface BasicRosterEntrypublic void setImagePath(String s)
public String getImagePath()
public void setIconPath(String s)
public String getIconPath()
public void setShuntingFunction(String fn)
public String getShuntingFunction()
getShuntingFunction in interface BasicRosterEntrypublic void setURL(String s)
public String getURL()
public void setDateUpdated(String s)
public String getDateUpdated()
public void setOpen(boolean boo)
setOpen in interface BasicRosterEntrypublic boolean isOpen()
isOpen in interface BasicRosterEntrypublic void loadFunctions(org.jdom.Element e3)
public void loadAttributes(org.jdom.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)
putAttribute in interface BasicRosterEntrypublic String getAttribute(String key)
getAttribute in interface BasicRosterEntrypublic void deleteAttribute(String key)
deleteAttribute in interface BasicRosterEntrypublic Set<String> getAttributes()
public String[] getAttributeList()
getAttributeList in interface BasicRosterEntrypublic int getMaxSpeedPCT()
getMaxSpeedPCT in interface BasicRosterEntrypublic void setMaxSpeedPCT(int maxSpeedPCT)
protected void warnShortLong(String id)
public org.jdom.Element store()
store in interface BasicRosterEntrypublic String titleString()
titleString in interface BasicRosterEntrypublic String toString()
toString in interface BasicRosterEntrytoString 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)
addPropertyChangeListener in interface BasicRosterEntry
protected void firePropertyChange(String p,
Object old,
Object n)
public void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener in interface BasicRosterEntry
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||