Skip to content
Permalink
Browse files

Use NamedBeanComboBoxes instead of text fields for Layout Editor Mult…

…isensor selection
  • Loading branch information...
dsand47 committed Jul 31, 2019
1 parent 6f11527 commit 86f4fde7303021528e88ae2e3d4e936ef3c39087
Showing with 5 additions and 4 deletions.
  1. +5 −4 java/src/jmri/jmrit/display/layoutEditor/MultiSensorIconFrame.java
@@ -139,14 +139,14 @@ void make() {

for (int i = 0; i < content.getComponentCount(); i++) {
Entry e = (Entry) content.getComponent(i);
if (e.sensor.getText().trim().isEmpty()) {
if (e.sensor.getSelectedItem() == null) {
JOptionPane.showMessageDialog(this,
Bundle.getMessage("Error19", i+1),
Bundle.getMessage("WarningTitle"), JOptionPane.WARNING_MESSAGE);
isEmpty = 1;
return; // Keep Panel open to edit entry
}
m.addEntry(e.sensor.getText(), e.ed.getIcon(0));
m.addEntry(e.sensor.getSelectedItemDisplayName(), e.ed.getIcon(0));
}
m.setUpDown(updown.isSelected());
m.setDisplayLevel(jmri.jmrit.display.Editor.SENSORS);
@@ -164,8 +164,8 @@ void removeWindows() {
}

class Entry extends JPanel {

JTextField sensor = new JTextField(5);
jmri.swing.NamedBeanComboBox<jmri.Sensor> sensor = new jmri.swing.NamedBeanComboBox<>(
jmri.InstanceManager.getDefault(jmri.SensorManager.class), null, jmri.NamedBean.DisplayOptions.DISPLAYNAME);
JPanel self;
MultiIconEditor ed = new MultiIconEditor(1);
JmriJFrame edf = new JmriJFrame("", false, true);
@@ -181,6 +181,7 @@ public String toString() {
this.add(new JLabel(Bundle.getMessage("MakeLabel", (Bundle.getMessage("BeanNameSensor") + " " + Bundle.getMessage("MultiSensorPosition", position)))));

this.add(sensor);
jmri.util.swing.JComboBoxUtil.setupComboBoxMaxRows(sensor);

ed.setIcon(0, Bundle.getMessage("MakeLabel", (Bundle.getMessage("SensorStateActive") + " " + Bundle.getMessage("MultiSensorPosition", position))), name);
ed.complete();

0 comments on commit 86f4fde

Please sign in to comment.
You can’t perform that action at this time.