Search in sources :

Example 51 with RosterEntry

use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.

the class RosterTreeNode method initComponents.

/**
     * Initialize the connection to the Roster.
     * <p>
     * Should be called before connecting the node to a JTree.
     */
public void initComponents() {
    // title this node
    setUserObject("Roster");
    // add every roster entry
    List<RosterEntry> list = Roster.getDefault().matchingList(null, null, null, null, null, null, null);
    for (RosterEntry r : list) {
        add(new DefaultMutableTreeNode(r.getId()));
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) RosterEntry(jmri.jmrit.roster.RosterEntry)

Example 52 with RosterEntry

use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.

the class AttributeTableModel method getValueAt.

/**
     * Provides the empty String if attribute doesn't exist.
     */
@Override
public Object getValueAt(int row, int col) {
    // get column key
    String key = getColumnName(col);
    // get roster entry for row
    RosterEntry re = Roster.getDefault().getEntry(row);
    String retval = re.getAttribute(key);
    if (retval != null) {
        return retval;
    }
    return "";
}
Also used : RosterEntry(jmri.jmrit.roster.RosterEntry)

Example 53 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 54 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 55 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)

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