001package apps.DecoderPro; 002 003import apps.Apps; 004 005import java.awt.Component; 006import java.awt.event.ActionEvent; 007 008import javax.swing.AbstractAction; 009import javax.swing.Action; 010import javax.swing.BoxLayout; 011import javax.swing.JButton; 012import javax.swing.JPanel; 013 014/** 015 * The JMRI main pane for configuring DCC decoders. 016 * 017 * <hr> 018 * This file is part of JMRI. 019 * <p> 020 * JMRI is free software; you can redistribute it and/or modify it under the 021 * terms of version 2 of the GNU General Public License as published by the Free 022 * Software Foundation. See the "COPYING" file for a copy of this license. 023 * <p> 024 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY 025 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 026 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 027 * 028 * @author Bob Jacobsen Copyright 2003, 2014 029 */ 030public class DecoderProPane extends apps.AppsLaunchPane { 031 032 DecoderProPane() { 033 super(); 034 } 035 036 @Override 037 protected String windowHelpID() { 038 return "package.apps.DecoderPro.DecoderPro"; 039 } 040 041 @Override 042 protected String logo() { 043 return "resources/decoderpro.gif"; 044 } 045 046 @Override 047 protected String line1() { 048 return Bundle.getMessage("DecoderProVersionCredit", jmri.Version.name()); 049 } 050 051 @Override 052 protected String line2() { 053 return "https://jmri.org/DecoderPro"; 054 } 055 056 @Override 057 protected JPanel statusPanel() { 058 JPanel j = new JPanel(); 059 j.setLayout(new BoxLayout(j, BoxLayout.Y_AXIS)); 060 j.add(super.statusPanel()); 061 062 // Buttons 063 Action serviceprog = new jmri.jmrit.symbolicprog.tabbedframe.PaneProgAction( 064 Bundle.getMessage("DpButtonUseProgrammingTrack")); 065 Action opsprog = new jmri.jmrit.symbolicprog.tabbedframe.PaneOpsProgAction( 066 Bundle.getMessage("DpButtonProgramOnMainTrack")); 067 Action quit = new AbstractAction(Bundle.getMessage("MenuItemQuit")) { 068 @Override 069 public void actionPerformed(ActionEvent e) { 070 Apps.handleQuit(); 071 } 072 }; 073 074 JButton b1 = new JButton(Bundle.getMessage("DpButtonUseProgrammingTrack")); 075 b1.addActionListener(serviceprog); 076 b1.setAlignmentX(Component.CENTER_ALIGNMENT); 077 j.add(b1); 078 if (jmri.InstanceManager.getNullableDefault(jmri.GlobalProgrammerManager.class) == null 079 || !jmri.InstanceManager.getDefault(jmri.GlobalProgrammerManager.class).isGlobalProgrammerAvailable()) { 080 b1.setEnabled(false); 081 b1.setToolTipText(Bundle.getMessage("MsgServiceButtonDisabled")); 082 } 083 JButton m1 = new JButton(Bundle.getMessage("DpButtonProgramOnMainTrack")); 084 m1.addActionListener(opsprog); 085 m1.setAlignmentX(Component.CENTER_ALIGNMENT); 086 j.add(m1); 087 if (jmri.InstanceManager.getNullableDefault(jmri.AddressedProgrammerManager.class) == null 088 || !jmri.InstanceManager.getDefault(jmri.AddressedProgrammerManager.class).isAddressedModePossible()) { 089 m1.setEnabled(false); 090 m1.setToolTipText(Bundle.getMessage("MsgOpsButtonDisabled")); 091 } 092 093 JPanel p3 = new JPanel(); 094 p3.setLayout(new java.awt.FlowLayout()); 095 JButton h1 = new JButton(Bundle.getMessage("ButtonHelp")); 096 jmri.util.HelpUtil.addHelpToComponent(h1, "html.apps.DecoderPro.index"); 097 h1.setAlignmentX(Component.CENTER_ALIGNMENT); 098 p3.add(h1); 099 JButton q1 = new JButton(Bundle.getMessage("ButtonQuit")); 100 q1.addActionListener(quit); 101 q1.setAlignmentX(Component.CENTER_ALIGNMENT); 102 p3.add(q1); 103 j.add(p3); 104 105 return j; 106 } 107 108}