001package apps.DispatcherPro;
002
003import apps.Apps;
004
005import java.awt.event.ActionEvent;
006import java.text.MessageFormat;
007
008import javax.swing.AbstractAction;
009import javax.swing.Action;
010import javax.swing.BoxLayout;
011import javax.swing.JButton;
012import javax.swing.JLabel;
013import javax.swing.JPanel;
014
015
016/**
017 * The JMRI program for creating control panels.
018 * <p>
019 * If an argument is provided at startup, it will be used as the name of the
020 * configuration file. Note that this is just the name, not the path; the file
021 * is searched for in the usual way, first in the preferences tree and then in
022 * xml/
023 *
024 * <hr>
025 * This file is part of JMRI.
026 * <p>
027 * JMRI is free software; you can redistribute it and/or modify it under the
028 * terms of version 2 of the GNU General Public License as published by the Free
029 * Software Foundation. See the "COPYING" file for a copy of this license.
030 * <p>
031 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY
032 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
033 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
034 *
035 * @author Bob Jacobsen Copyright 2003
036 */
037public class DispatcherPro extends Apps {
038
039    DispatcherPro() {
040        super();
041    }
042
043    @Override
044    protected String logo() {
045        return "resources/logo.gif";
046    }
047
048    @Override
049    protected String mainWindowHelpID() {
050        return "package.apps.DispatcherPro.DispatcherPro";
051    }
052
053    @Override
054    protected String line1() {
055        return MessageFormat.format(Bundle.getMessage("DispatcherProVersionCredit"),
056                new Object[]{jmri.Version.name()});
057    }
058
059    @Override
060    protected String line2() {
061        return "https://jmri.org/DispatcherPro";
062    }
063
064    /**
065     * JPanel displayed as DispatcherPro main screen.
066     */
067    @Override
068    protected JPanel statusPanel() {
069        JPanel j = new JPanel();
070        j.setLayout(new BoxLayout(j, BoxLayout.Y_AXIS));
071        j.add(super.statusPanel());
072
073        // Buttons
074        Action quit = new AbstractAction(Bundle.getMessage("MenuItemQuit")) {
075            @Override
076            public void actionPerformed(ActionEvent e) {
077                Apps.handleQuit();
078            }
079        };
080
081        JPanel p3 = new JPanel();
082        p3.setLayout(new java.awt.FlowLayout());
083        h1 = new JButton(Bundle.getMessage("ButtonHelp"));
084        // as globalHelpBroker is still null, wait to attach help target after help menu is created
085        h1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
086        p3.add(h1);
087        JButton q1 = new JButton(Bundle.getMessage("ButtonQuit"));
088        q1.addActionListener(quit);
089        q1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
090        p3.add(q1);
091        j.add(p3);
092
093        return j;
094    }
095
096    /**
097     * Help button on Main Screen.
098     */
099    private JButton h1;
100
101    /**
102     * {@inheritDoc}
103     */
104    @Override
105    protected void attachHelp() {
106        if (h1 != null) {
107            jmri.util.HelpUtil.addHelpToComponent(h1, "html.apps.DispatcherPro.index");
108        }
109    }
110
111// main() method is commented out since it's probably not used anymore
112// See: https://jmri-developers.groups.io/g/jmri/message/12240
113/*
114    // Main entry point
115    public static void main(String args[]) {
116
117        // Set up system properties that needs to be loaded early
118        jmri.util.EarlyInitializationPreferences.getInstance().loadAndSetPreferences();
119
120        // show splash screen early
121        splash(true);
122
123        Apps.setStartupInfo("DispatcherPro");
124
125        setConfigFilename("DispatcherProConfig2.xml", args);
126        DispatcherPro dp = new DispatcherPro();
127        JmriJFrame f = new JmriJFrame(jmri.Application.getApplicationName());
128        createFrame(dp, f);
129
130        log.debug("main initialization done");
131        splash(false);
132    }
133*/
134//    private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(DispatcherPro.class);
135
136}