From: <dan...@us...> - 2015-05-28 00:14:21
|
Revision: 29361 http://sourceforge.net/p/jmri/code/29361 Author: dan_boudreau Date: 2015-05-28 00:14:18 +0000 (Thu, 28 May 2015) Log Message: ----------- Only show RFID tag reader for a location if enabled Modified Paths: -------------- trunk/jmri/java/src/jmri/jmrit/operations/locations/JmritOperationsLocationsBundle.properties trunk/jmri/java/src/jmri/jmrit/operations/locations/LocationEditFrame.java Modified: trunk/jmri/java/src/jmri/jmrit/operations/locations/JmritOperationsLocationsBundle.properties =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/locations/JmritOperationsLocationsBundle.properties 2015-05-27 23:37:34 UTC (rev 29360) +++ trunk/jmri/java/src/jmri/jmrit/operations/locations/JmritOperationsLocationsBundle.properties 2015-05-28 00:14:18 UTC (rev 29361) @@ -109,7 +109,7 @@ ShipLoadOption = Ship Load Option Next = Next -idReader = IdTag Reader at Location: +idReader = IdTag Reader at Location Yards = Yards Spurs = Spurs Modified: trunk/jmri/java/src/jmri/jmrit/operations/locations/LocationEditFrame.java =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/locations/LocationEditFrame.java 2015-05-27 23:37:34 UTC (rev 29360) +++ trunk/jmri/java/src/jmri/jmrit/operations/locations/LocationEditFrame.java 2015-05-28 00:14:18 UTC (rev 29361) @@ -1,7 +1,6 @@ // LocationEditFrame.java package jmri.jmrit.operations.locations; - import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -14,7 +13,6 @@ import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; -import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JOptionPane; @@ -25,13 +23,13 @@ import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; +import jmri.Reporter; import jmri.jmrit.operations.OperationsFrame; import jmri.jmrit.operations.OperationsXml; import jmri.jmrit.operations.rollingstock.cars.CarTypes; import jmri.jmrit.operations.rollingstock.engines.EngineTypes; import jmri.jmrit.operations.setup.Control; import jmri.jmrit.operations.setup.Setup; -import jmri.Reporter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,7 +101,6 @@ // Reader selection dropdown. JComboBox<String> readerSelector = new JComboBox<String>(); - JLabel readerLabel = new JLabel(); public static final String NAME = Bundle.getMessage("Name"); public static final int MAX_NAME_LENGTH = Control.max_len_string_location_name; @@ -177,16 +174,16 @@ stageRadioButton.setSelected(true); } setTrainDirectionBoxes(); - if( Setup.isRfidEnabled() ) { + if (Setup.isRfidEnabled()) { // setup the Reader dropdown. readerSelector.addItem(""); // add an empty entry. - for(jmri.NamedBean r:jmri.InstanceManager.reporterManagerInstance().getNamedBeanList()){ - readerSelector.addItem(((Reporter)r).getDisplayName()); + for (jmri.NamedBean r : jmri.InstanceManager.reporterManagerInstance().getNamedBeanList()) { + readerSelector.addItem(((Reporter) r).getDisplayName()); } try { - readerSelector.setSelectedItem(_location.getReporter().getDisplayName()); - } catch(java.lang.NullPointerException e){ + readerSelector.setSelectedItem(_location.getReporter().getDisplayName()); + } catch (java.lang.NullPointerException e) { // if there is no reader set, getReporter // will return null, so set a blank. } @@ -240,7 +237,6 @@ pOp.add(interchangeRadioButton); pOp.add(stageRadioButton); - // row 11 JPanel pC = new JPanel(); pC.setLayout(new GridBagLayout()); @@ -249,14 +245,15 @@ // adjust text area width based on window size adjustTextAreaColumnWidth(commentScroller, commentTextArea); - + // reader row JPanel readerPanel = new JPanel(); readerPanel.setLayout(new GridBagLayout()); - readerLabel.setText(Bundle.getMessage("idReader")); - addItem(readerPanel,readerLabel,0,0); - addItem(readerPanel,readerSelector,1,0); + readerPanel.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("idReader"))); + addItem(readerPanel, readerSelector, 0, 0); + readerPanel.setVisible(Setup.isRfidEnabled()); + // row 12 JPanel pB = new JPanel(); pB.setLayout(new GridBagLayout()); @@ -276,7 +273,7 @@ getContentPane().add(stagingPane); getContentPane().add(addStagingButton); getContentPane().add(pC); - getContentPane().add(readerPanel); + getContentPane().add(readerPanel); getContentPane().add(pB); // setup buttons @@ -473,15 +470,15 @@ } _location.setName(locationNameTextField.getText()); _location.setComment(commentTextArea.getText()); - if(Setup.isRfidEnabled() && - readerSelector.getSelectedItem()!=null && - !((String)readerSelector.getSelectedItem()).equals("")) { + if (Setup.isRfidEnabled() && + readerSelector.getSelectedItem() != null && + !((String) readerSelector.getSelectedItem()).equals("")) { _location.setReporter( - jmri.InstanceManager.reporterManagerInstance() - .getReporter((String)readerSelector.getSelectedItem())); - } else if( Setup.isRfidEnabled() && - readerSelector.getSelectedItem()!=null && - ((String)readerSelector.getSelectedItem()).equals("")) { + jmri.InstanceManager.reporterManagerInstance() + .getReporter((String) readerSelector.getSelectedItem())); + } else if (Setup.isRfidEnabled() && + readerSelector.getSelectedItem() != null && + ((String) readerSelector.getSelectedItem()).equals("")) { _location.setReporter(null); } setLocationOps(); @@ -503,7 +500,7 @@ // log.error("Location name must be less than "+ Integer.toString(MAX_NAME_LENGTH+1) +" characters"); JOptionPane.showMessageDialog(this, MessageFormat.format(Bundle.getMessage("LocationNameLengthMax"), new Object[]{Integer.toString(MAX_NAME_LENGTH + 1)}), MessageFormat.format(Bundle - .getMessage("CanNotLocation"), new Object[]{s}), JOptionPane.ERROR_MESSAGE); + .getMessage("CanNotLocation"), new Object[]{s}), JOptionPane.ERROR_MESSAGE); return false; } return true; @@ -547,7 +544,7 @@ // yardTable.setEnabled(enabled); // enable readerSelect. - readerSelector.setEnabled(enabled && Setup.isRfidEnabled() ); + readerSelector.setEnabled(enabled && Setup.isRfidEnabled()); } public void radioButtonActionPerformed(java.awt.event.ActionEvent ae) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |