Search in sources :

Example 1 with PaneOpsProgFrame

use of jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame in project JMRI by JMRI.

the class AddressPanel method openProgrammer.

/**
     * Open a programmer for this address
     */
protected void openProgrammer() {
    if (rosterEntry == null) {
        return;
    }
    java.util.ResourceBundle rbt = java.util.ResourceBundle.getBundle("jmri.jmrit.symbolicprog.SymbolicProgBundle");
    String title = java.text.MessageFormat.format(rbt.getString("FrameOpsProgrammerTitle"), new Object[] { rosterEntry.getId() });
    // find the ops-mode programmer
    int address = Integer.parseInt(rosterEntry.getDccAddress());
    boolean longAddr = true;
    if (address < 100) {
        longAddr = false;
    }
    Programmer programmer = InstanceManager.getDefault(jmri.ProgrammerManager.class).getAddressedProgrammer(longAddr, address);
    // and created the frame        
    JFrame p = new PaneOpsProgFrame(null, rosterEntry, title, "programmers" + File.separator + ProgDefault.getDefaultProgFile() + ".xml", programmer);
    p.pack();
    p.setVisible(true);
}
Also used : Programmer(jmri.Programmer) JFrame(javax.swing.JFrame) PaneOpsProgFrame(jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame)

Example 2 with PaneOpsProgFrame

use of jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame in project JMRI by JMRI.

the class RosterFrame method startProgrammer.

protected void startProgrammer(DecoderFile decoderFile, RosterEntry re, String filename) {
    if (inStartProgrammer) {
        log.debug("Call to start programmer has been called twice when the first call hasn't opened");
        return;
    }
    if (!checkIfEntrySelected()) {
        return;
    }
    try {
        setCursor(new Cursor(Cursor.WAIT_CURSOR));
        inStartProgrammer = true;
        String title = re.getId();
        JFrame progFrame = null;
        if (edit.isSelected()) {
            progFrame = new PaneProgFrame(decoderFile, re, title, "programmers" + File.separator + filename + ".xml", null, false) {

                @Override
                protected JPanel getModePane() {
                    return null;
                }
            };
        } else if (service.isSelected()) {
            progFrame = new PaneServiceProgFrame(decoderFile, re, title, "programmers" + File.separator + filename + ".xml", modePanel.getProgrammer()) {
            };
        } else if (ops.isSelected()) {
            int address = Integer.parseInt(re.getDccAddress());
            boolean longAddr = re.isLongAddress();
            Programmer pProg = InstanceManager.getDefault(AddressedProgrammerManager.class).getAddressedProgrammer(longAddr, address);
            progFrame = new PaneOpsProgFrame(decoderFile, re, title, "programmers" + File.separator + filename + ".xml", pProg);
        }
        if (progFrame == null) {
            return;
        }
        progFrame.pack();
        progFrame.setVisible(true);
    } finally {
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    }
    inStartProgrammer = false;
}
Also used : JPanel(javax.swing.JPanel) PaneProgFrame(jmri.jmrit.symbolicprog.tabbedframe.PaneProgFrame) JFrame(javax.swing.JFrame) Programmer(jmri.Programmer) PaneServiceProgFrame(jmri.jmrit.symbolicprog.tabbedframe.PaneServiceProgFrame) AddressedProgrammerManager(jmri.AddressedProgrammerManager) Cursor(java.awt.Cursor) PaneOpsProgFrame(jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame)

Example 3 with PaneOpsProgFrame

use of jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame in project JMRI by JMRI.

the class AutoSpeedAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (log.isInfoEnabled()) {
        log.debug("auto speed tool requested");
    }
    // create the initial frame that steers
    final JFrame f = new JFrame("Auto-speed Tool Setup");
    f.getContentPane().setLayout(new BoxLayout(f.getContentPane(), BoxLayout.Y_AXIS));
    // add the Roster menu
    JMenuBar menuBar = new JMenuBar();
    // menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));
    menuBar.add(new jmri.jmrit.roster.swing.RosterMenu("Roster", jmri.jmrit.roster.swing.RosterMenu.MAINMENU, f));
    f.setJMenuBar(menuBar);
    // known loco on main track
    JPanel pane1 = new // no ident in ops mode yet
    KnownLocoSelPane(// no ident in ops mode yet
    false) {

        @Override
        protected void startProgrammer(DecoderFile decoderFile, RosterEntry re, String filename) {
            String title = "Set speed info for " + re.getId() + " on main track";
            // find the ops-mode programmer
            int address = Integer.parseInt(re.getDccAddress());
            boolean longAddr = true;
            if (address < 100) {
                longAddr = false;
            }
            Programmer programmer = InstanceManager.getDefault(jmri.ProgrammerManager.class).getAddressedProgrammer(longAddr, address);
            // and created the frame
            JFrame p = new PaneOpsProgFrame(decoderFile, re, title, "programmers" + File.separator + filename + ".xml", programmer);
            p.pack();
            p.setVisible(true);
            f.setVisible(false);
            f.dispose();
        }
    };
    // load primary frame
    pane1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
    f.getContentPane().add(pane1);
    f.pack();
    if (log.isInfoEnabled()) {
        log.debug("setup created");
    }
    f.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) DecoderFile(jmri.jmrit.decoderdefn.DecoderFile) BoxLayout(javax.swing.BoxLayout) KnownLocoSelPane(jmri.jmrit.symbolicprog.KnownLocoSelPane) PaneOpsProgFrame(jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame) JFrame(javax.swing.JFrame) Programmer(jmri.Programmer) RosterEntry(jmri.jmrit.roster.RosterEntry) JMenuBar(javax.swing.JMenuBar)

Aggregations

JFrame (javax.swing.JFrame)3 Programmer (jmri.Programmer)3 PaneOpsProgFrame (jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame)3 JPanel (javax.swing.JPanel)2 Cursor (java.awt.Cursor)1 BoxLayout (javax.swing.BoxLayout)1 JMenuBar (javax.swing.JMenuBar)1 AddressedProgrammerManager (jmri.AddressedProgrammerManager)1 DecoderFile (jmri.jmrit.decoderdefn.DecoderFile)1 RosterEntry (jmri.jmrit.roster.RosterEntry)1 KnownLocoSelPane (jmri.jmrit.symbolicprog.KnownLocoSelPane)1 PaneProgFrame (jmri.jmrit.symbolicprog.tabbedframe.PaneProgFrame)1 PaneServiceProgFrame (jmri.jmrit.symbolicprog.tabbedframe.PaneServiceProgFrame)1