Search in sources :

Example 1 with ResetTableModel

use of jmri.jmrit.symbolicprog.ResetTableModel in project JMRI by JMRI.

the class EcosLocoToRoster method SelectedDecoder.

private void SelectedDecoder(DecoderFile pDecoderFile) {
    //pDecoderFile=DecoderIndexFile.instance().fileFromTitle(selectedDecoderType());
    re.setDecoderModel(pDecoderFile.getModel());
    re.setDecoderFamily(pDecoderFile.getFamily());
    re.setDccAddress(Integer.toString(ecosLoco.getNumber()));
    //re.setLongAddress(true);
    re.setRoadName("");
    re.setRoadNumber("");
    re.setMfg("");
    re.setModel("");
    re.setOwner(InstanceManager.getDefault(RosterConfigManager.class).getDefaultOwner());
    re.setComment("Automatically Imported from the Ecos");
    re.setDecoderComment("");
    re.putAttribute(adaptermemo.getPreferenceManager().getRosterAttribute(), _ecosObject);
    re.ensureFilenameExists();
    if ((ecosLoco.getECOSProtocol().startsWith("DCC"))) {
        if (ecosLoco.getNumber() <= 127) {
            re.setProtocol(jmri.LocoAddress.Protocol.DCC_SHORT);
        } else {
            re.setProtocol(jmri.LocoAddress.Protocol.DCC_LONG);
        }
    } else if (ecosLoco.getECOSProtocol().equals("MMFKT") || ecosLoco.getECOSProtocol().equals("MFX")) {
        re.setProtocol(jmri.LocoAddress.Protocol.MFX);
    } else if (ecosLoco.getECOSProtocol().startsWith("MM")) {
        re.setProtocol(jmri.LocoAddress.Protocol.MOTOROLA);
    } else if (ecosLoco.getECOSProtocol().equals("SX32")) {
        re.setProtocol(jmri.LocoAddress.Protocol.SELECTRIX);
    }
    mProgrammer = null;
    cvModel = new CvTableModel(progStatus, mProgrammer);
    iCvModel = new IndexedCvTableModel(progStatus, mProgrammer);
    variableModel = new VariableTableModel(progStatus, new String[] { "CV", "Value" }, cvModel, iCvModel);
    resetModel = new ResetTableModel(progStatus, mProgrammer);
    storeloco();
    filename = "programmers" + File.separator + "Basic.xml";
    loadProgrammerFile(re);
    loadDecoderFile(pDecoderFile, re);
    variableModel.findVar("Speed Step Mode").setIntValue(0);
    if (ecosLoco.getECOSProtocol().equals("DCC128")) {
        variableModel.findVar("Speed Step Mode").setIntValue(1);
    }
    re.writeFile(cvModel, iCvModel, variableModel);
    getFunctionDetails(0);
    JOptionPane.showMessageDialog(frame, "Loco Added to the JMRI Roster");
    waitingForComplete = true;
}
Also used : CvTableModel(jmri.jmrit.symbolicprog.CvTableModel) IndexedCvTableModel(jmri.jmrit.symbolicprog.IndexedCvTableModel) VariableTableModel(jmri.jmrit.symbolicprog.VariableTableModel) ResetTableModel(jmri.jmrit.symbolicprog.ResetTableModel) IndexedCvTableModel(jmri.jmrit.symbolicprog.IndexedCvTableModel)

Aggregations

CvTableModel (jmri.jmrit.symbolicprog.CvTableModel)1 IndexedCvTableModel (jmri.jmrit.symbolicprog.IndexedCvTableModel)1 ResetTableModel (jmri.jmrit.symbolicprog.ResetTableModel)1 VariableTableModel (jmri.jmrit.symbolicprog.VariableTableModel)1