Search in sources :

Example 1 with KnownLocoSelPane

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

the class PaneEditAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (log.isDebugEnabled()) {
        log.debug("Pane programmer requested");
    }
    // create the initial frame that steers
    final JmriJFrame f = new JmriJFrame(SymbolicProgBundle.getMessage("FrameEditEntrySetup"));
    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(SymbolicProgBundle.getMessage("MenuRoster"), jmri.jmrit.roster.swing.RosterMenu.MAINMENU, f));
    f.setJMenuBar(menuBar);
    // known entry, no programmer
    JPanel pane1 = new // not programming
    KnownLocoSelPane(// not programming
    false) {

        @Override
        protected void startProgrammer(DecoderFile decoderFile, RosterEntry re, String filename) {
            String title = SymbolicProgBundle.getMessage("FrameEditEntryTitle");
            JFrame p = new PaneProgFrame(decoderFile, re, title, "programmers" + File.separator + filename + ".xml", null, false) {

                @Override
                protected JPanel getModePane() {
                    return null;
                }
            };
            p.pack();
            p.setVisible(true);
        }
    };
    // load primary frame
    pane1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
    f.getContentPane().add(pane1);
    f.pack();
    if (log.isDebugEnabled()) {
        log.debug("Tab-Programmer 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) JmriJFrame(jmri.util.JmriJFrame) JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) RosterEntry(jmri.jmrit.roster.RosterEntry) JMenuBar(javax.swing.JMenuBar)

Example 2 with KnownLocoSelPane

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

the class PaneOpsProgAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (log.isDebugEnabled()) {
        log.debug("Pane programmer requested");
    }
    // create the initial frame that steers
    final JmriJFrame f = new JmriJFrame(SymbolicProgBundle.getMessage("FrameOpsProgrammerSetup"));
    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(SymbolicProgBundle.getMessage("MenuRoster"), 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 = java.text.MessageFormat.format(SymbolicProgBundle.getMessage("FrameOpsProgrammerTitle"), new Object[] { re.getId() });
            // find the ops-mode programmer
            int address = Integer.parseInt(re.getDccAddress());
            boolean longAddr = re.isLongAddress();
            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.isDebugEnabled()) {
        log.debug("Tab-Programmer 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) JmriJFrame(jmri.util.JmriJFrame) Programmer(jmri.Programmer) JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) RosterEntry(jmri.jmrit.roster.RosterEntry) JMenuBar(javax.swing.JMenuBar)

Example 3 with KnownLocoSelPane

use of jmri.jmrit.symbolicprog.KnownLocoSelPane 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

BoxLayout (javax.swing.BoxLayout)3 JFrame (javax.swing.JFrame)3 JMenuBar (javax.swing.JMenuBar)3 JPanel (javax.swing.JPanel)3 DecoderFile (jmri.jmrit.decoderdefn.DecoderFile)3 RosterEntry (jmri.jmrit.roster.RosterEntry)3 KnownLocoSelPane (jmri.jmrit.symbolicprog.KnownLocoSelPane)3 Programmer (jmri.Programmer)2 JmriJFrame (jmri.util.JmriJFrame)2 PaneOpsProgFrame (jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgFrame)1