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