Search in sources :

Example 1 with LocoSelTreePane

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

the class PaneNewProgAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (log.isDebugEnabled()) {
        log.debug("New roster entry programmer requested");
    }
    // create the initial frame that steers
    final JmriJFrame f = new JmriJFrame(SymbolicProgBundle.getMessage("FrameNewEntrySetup"));
    f.getContentPane().setLayout(new BoxLayout(f.getContentPane(), BoxLayout.Y_AXIS));
    // add the Roster menu
    JMenuBar menuBar = new JMenuBar();
    // menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));
    JMenu j = new JMenu(SymbolicProgBundle.getMessage("MenuFile"));
    j.add(new jmri.jmrit.decoderdefn.PrintDecoderListAction(SymbolicProgBundle.getMessage("MenuPrintDecoderDefinitions"), f, false));
    j.add(new jmri.jmrit.decoderdefn.PrintDecoderListAction(SymbolicProgBundle.getMessage("MenuPrintPreviewDecoderDefinitions"), f, true));
    menuBar.add(j);
    menuBar.add(new jmri.jmrit.roster.swing.RosterMenu(SymbolicProgBundle.getMessage("MenuRoster"), jmri.jmrit.roster.swing.RosterMenu.MAINMENU, f));
    f.setJMenuBar(menuBar);
    // new Loco on programming track
    JPanel pane1 = new LocoSelTreePane(null, null) {

        @Override
        protected void startProgrammer(DecoderFile decoderFile, RosterEntry re, String filename) {
            String title = SymbolicProgBundle.getMessage("FrameNewEntryTitle");
            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) LocoSelTreePane(jmri.jmrit.symbolicprog.LocoSelTreePane) JmriJFrame(jmri.util.JmriJFrame) JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) RosterEntry(jmri.jmrit.roster.RosterEntry) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Aggregations

BoxLayout (javax.swing.BoxLayout)1 JFrame (javax.swing.JFrame)1 JMenu (javax.swing.JMenu)1 JMenuBar (javax.swing.JMenuBar)1 JPanel (javax.swing.JPanel)1 DecoderFile (jmri.jmrit.decoderdefn.DecoderFile)1 RosterEntry (jmri.jmrit.roster.RosterEntry)1 LocoSelTreePane (jmri.jmrit.symbolicprog.LocoSelTreePane)1 JmriJFrame (jmri.util.JmriJFrame)1