Search in sources :

Example 71 with RosterEntry

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.");
    }
}
Also used : RosterEntry(jmri.jmrit.roster.RosterEntry)

Example 72 with RosterEntry

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);
}
Also used : DecoderFile(jmri.jmrit.decoderdefn.DecoderFile) RosterEntry(jmri.jmrit.roster.RosterEntry)

Example 73 with RosterEntry

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);
    }
}
Also used : RosterEntry(jmri.jmrit.roster.RosterEntry)

Example 74 with RosterEntry

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);
}
Also used : RosterEntry(jmri.jmrit.roster.RosterEntry)

Example 75 with RosterEntry

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;
    }
}
Also used : RosterEntry(jmri.jmrit.roster.RosterEntry)

Aggregations

RosterEntry (jmri.jmrit.roster.RosterEntry)77 DecoderFile (jmri.jmrit.decoderdefn.DecoderFile)12 JPanel (javax.swing.JPanel)11 Element (org.jdom2.Element)11 JFrame (javax.swing.JFrame)9 BoxLayout (javax.swing.BoxLayout)8 JLabel (javax.swing.JLabel)8 Test (org.junit.Test)7 ActionEvent (java.awt.event.ActionEvent)6 ActionListener (java.awt.event.ActionListener)6 JMenuBar (javax.swing.JMenuBar)6 CvTableModel (jmri.jmrit.symbolicprog.CvTableModel)6 IndexedCvTableModel (jmri.jmrit.symbolicprog.IndexedCvTableModel)6 VariableTableModel (jmri.jmrit.symbolicprog.VariableTableModel)6 ArrayList (java.util.ArrayList)5 JmriJFrame (jmri.util.JmriJFrame)5 File (java.io.File)4 JButton (javax.swing.JButton)3 JMenu (javax.swing.JMenu)3 NamedIcon (jmri.jmrit.catalog.NamedIcon)3