Skip to content

Commit

Permalink
Use more descriptive name
Browse files Browse the repository at this point in the history
  • Loading branch information
crosland committed May 9, 2020
1 parent a67995a commit 7bba800
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion java/src/jmri/jmrix/can/cbus/swing/SprogCbusMenu.java
Expand Up @@ -33,7 +33,7 @@ public SprogCbusMenu(CanSystemConnectionMemo memo) {

// Not a CanNamedPane
add(new javax.swing.JSeparator());
add(new jmri.jmrix.can.cbus.swing.modeswitcher.ModeSwitcherAction(Bundle.getMessage("MenuItemSPROGModeSwitcher")));
add(new jmri.jmrix.can.cbus.swing.modeswitcher.SprogCbusModeSwitcherAction(Bundle.getMessage("MenuItemSPROGModeSwitcher")));
// Added tools that can normally only be found in PanelPro tools menu so that they are available from DP3
add(new javax.swing.JSeparator());
add(new jmri.jmrit.ampmeter.AmpMeterAction(Bundle.getMessage("MenuItemAmpMeter")));
Expand Down
Expand Up @@ -6,20 +6,20 @@
/**
* Create a ModeSwitcherPane.
*/
public class ModeSwitcherAction extends AbstractAction {
public class SprogCbusModeSwitcherAction extends AbstractAction {

public ModeSwitcherAction() {
public SprogCbusModeSwitcherAction() {
this(Bundle.getMessage("MenuItemSPROGModeSwitcher"));
}

public ModeSwitcherAction(String s) {
public SprogCbusModeSwitcherAction(String s) {
super(s);
}

@Override
public void actionPerformed(ActionEvent e) {

ModeSwitcherPane f = new ModeSwitcherPane();
SprogCbusModeSwitcherPane f = new SprogCbusModeSwitcherPane();
f.initComponents();
f.setVisible(true);
}
Expand Down
Expand Up @@ -24,7 +24,7 @@
*
* @author Andrew Crosland Copyright (C) 2020
*/
public class ModeSwitcherPane extends JmriJFrame {
public class SprogCbusModeSwitcherPane extends JmriJFrame {

CbusDccProgrammerManager pm = null;

Expand All @@ -33,7 +33,7 @@ public class ModeSwitcherPane extends JmriJFrame {

private CbusPreferences preferences;

public ModeSwitcherPane() {
public SprogCbusModeSwitcherPane() {
super();
}

Expand Down Expand Up @@ -91,11 +91,11 @@ public void initComponents() {
ActionListener setProgMode = ae -> {
if (progModeButton.isSelected()) {
// Enable service mode programmer
log.debug("Firing property change on {}", InstanceManager.getListPropertyName(GlobalProgrammerManager.class));
log.debug("Setting Global Programmer Available");
pm.setGlobalProgrammerAvailable(true);
} else if (cmdModeButton.isSelected()) {
// Only disable service mode if ops mode active
log.debug("Firing property change on {}", InstanceManager.getListPropertyName(GlobalProgrammerManager.class));
log.debug("Setting Global Programmer Unavailable");
pm.setGlobalProgrammerAvailable(false);
} else {
// Service mode is the default if all are deselected - reselect it
Expand All @@ -109,15 +109,15 @@ public void initComponents() {
ActionListener setCmdMode = ae -> {
if (cmdModeButton.isSelected()) {
// Enable ops mode programmer
log.debug("Firing property change on {}", InstanceManager.getListPropertyName(AddressedProgrammerManager.class));
log.debug("Setting Addressed Programmer Available");
pm.setAddressedModePossible(true);
} else {
// Disable ops mode programmer
log.debug("Firing property change on {}", InstanceManager.getListPropertyName(AddressedProgrammerManager.class));
log.debug("Setting Addressed Programmer Unavailable");
pm.setAddressedModePossible(false);
if (!progModeButton.isSelected()) {
// Re-enable service mode if all are deselected
log.debug("Firing property change on {}", InstanceManager.getListPropertyName(GlobalProgrammerManager.class));
log.debug("Setting GLobal Programmer Available");
pm.setGlobalProgrammerAvailable(true);
progModeButton.setSelected(true);
}
Expand All @@ -135,7 +135,7 @@ public void initComponents() {
panel.add(modePane, BorderLayout.CENTER);

this.add(panel);

pack();
setVisible(true);
}

Expand All @@ -157,6 +157,6 @@ private void writeMode() {
}


private final static Logger log = LoggerFactory.getLogger(ModeSwitcherPane.class);
private final static Logger log = LoggerFactory.getLogger(SprogCbusModeSwitcherPane.class);

}
Expand Up @@ -8,13 +8,13 @@
*
* @author Andrew Crosland (C) 2020
*/
public class ModeSwitcherActionTest {
public class SprogCbusModeSwitcherActionTest {

@Test
public void testAction() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());

ModeSwitcherAction action = new ModeSwitcherAction("ModeSwitcherAction test");
SprogCbusModeSwitcherAction action = new SprogCbusModeSwitcherAction("ModeSwitcherAction test");
Assert.assertNotNull("exists", action);
}

Expand Down
Expand Up @@ -18,7 +18,7 @@
*
* @author Andrew Crosland (C) 2020
*/
public class ModeSwitcherPaneTest extends jmri.util.JmriJFrameTestBase {
public class SprogCbusModeSwitcherPaneTest extends jmri.util.JmriJFrameTestBase {

CanSystemConnectionMemo memo;
CbusDccProgrammer prog;
Expand All @@ -27,7 +27,7 @@ public class ModeSwitcherPaneTest extends jmri.util.JmriJFrameTestBase {
@Test
public void testInitComponents() throws Exception{
// for now, just make sure there isn't an exception.
((ModeSwitcherPane) frame).initComponents();
((SprogCbusModeSwitcherPane) frame).initComponents();
}

@Before
Expand All @@ -42,7 +42,7 @@ public void setUp() {

jmri.InstanceManager.setDefault(GlobalProgrammerManager.class,new CbusDccProgrammerManager(prog, memo) );
if (!GraphicsEnvironment.isHeadless()) {
frame = new ModeSwitcherPane();
frame = new SprogCbusModeSwitcherPane();
}
}

Expand Down

0 comments on commit 7bba800

Please sign in to comment.