use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class CombinedLocoSelPane method openKnownLoco.
/**
* Start with a locomotive selected, so we're opening an existing
* RosterEntry.
*/
protected void openKnownLoco() {
if (locoBox.getSelectedRosterEntries().length != 0) {
RosterEntry re = locoBox.getSelectedRosterEntries()[0];
if (log.isDebugEnabled()) {
log.debug("loco file: " + re.getFileName());
}
startProgrammer(null, re, (String) programmerBox.getSelectedItem());
} else {
log.error("No roster entry was selected to open.");
}
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class NewLocoSelPane method openButton.
/**
* Handle pushing the open programmer button by finding names, then calling
* a template method
*/
protected void openButton() {
// find the decoderFile object
DecoderFile decoderFile = DecoderIndexFile.instance().fileFromTitle((String) decoderBox.getSelectedItem());
if (log.isDebugEnabled()) {
log.debug("decoder file: " + decoderFile.getFilename());
}
// create a dummy RosterEntry with the decoder info
RosterEntry re = new RosterEntry();
re.setDecoderFamily(decoderFile.getFamily());
re.setDecoderModel(decoderFile.getModel());
re.setId(Bundle.getMessage("LabelNewDecoder"));
// note we're leaving the filename information as null
// add the new roster entry to the in-memory roster
Roster.getDefault().addEntry(re);
startProgrammer(decoderFile, re);
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class KnownLocoSelPane method openButton.
/**
* handle pushing the open programmer button by finding names, then calling
* a template method
*/
protected void openButton() {
if (locoBox.getSelectedRosterEntries().length != 0) {
RosterEntry re = locoBox.getSelectedRosterEntries()[0];
startProgrammer(null, re, (String) programmerBox.getSelectedItem());
} else {
JOptionPane.showMessageDialog(this, Bundle.getMessage("LocoMustSelected"), Bundle.getMessage("NoSelection"), JOptionPane.ERROR_MESSAGE);
}
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class DeviceServer method sendRoster.
/**
* Format a package to be sent to the device for roster list selections.
*
* @return String containing a formatted list of some of each RosterEntry's
* info. Include a header with the length of the string to be
* received.
*/
public String sendRoster() {
List<RosterEntry> rosterList;
rosterList = Roster.getDefault().getEntriesInGroup(manager.getSelectedRosterGroup());
StringBuilder rosterString = new StringBuilder(rosterList.size() * 25);
for (RosterEntry entry : rosterList) {
// Start with name
StringBuilder entryInfo = new StringBuilder(entry.getId());
entryInfo.append("}|{");
entryInfo.append(entry.getDccAddress());
if (entry.isLongAddress()) {
// Append length value
entryInfo.append("}|{L");
} else {
entryInfo.append("}|{S");
}
// Put this info in as an item
rosterString.append("]\\[");
rosterString.append(entryInfo);
}
rosterString.trimToSize();
return ("RL" + rosterList.size() + rosterString);
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class ThrottleController method setRosterLocoForConsistFunctions.
public void setRosterLocoForConsistFunctions(String id) {
RosterEntry re = null;
List<RosterEntry> l = Roster.getDefault().matchingList(null, null, null, null, null, null, id);
if (l.size() > 0) {
if (log.isDebugEnabled()) {
log.debug("Consist Lead Roster Loco found: " + l.get(0).getDccAddress() + " for ID: " + id);
}
re = l.get(0);
clearLeadLoco();
leadLocoF = new ConsistFunctionController(this, re);
useLeadLocoF = leadLocoF.requestThrottle(re.getDccLocoAddress());
if (!useLeadLocoF) {
log.warn("Lead loco address not available.");
leadLocoF = null;
}
} else {
log.debug("No Roster Loco found for: " + id);
return;
}
}
Aggregations