From: <dan...@us...> - 2011-09-30 15:24:18
|
Revision: 18735 http://jmri.svn.sourceforge.net/jmri/?rev=18735&view=rev Author: dan_boudreau Date: 2011-09-30 15:24:12 +0000 (Fri, 30 Sep 2011) Log Message: ----------- Improve error checking when manually sending cars to staging Modified Paths: -------------- trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/RollingStockSetFrame.java trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/CarSetFrame.java trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties Modified: trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/RollingStockSetFrame.java =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/RollingStockSetFrame.java 2011-09-30 13:12:19 UTC (rev 18734) +++ trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/RollingStockSetFrame.java 2011-09-30 15:24:12 UTC (rev 18735) @@ -484,6 +484,14 @@ && !trackDestinationBox.getSelectedItem().equals("")){ destTrack = (Track)trackDestinationBox.getSelectedItem(); } + if (destTrack != null && rs.getDestinationTrack() != destTrack && destTrack.getLocType().equals(Track.STAGING)){ + log.debug ("Destination track ("+destTrack.getName()+") is staging"); + JOptionPane.showMessageDialog(this, + getRb().getString("rsDoNotSelectStaging"), + getRb().getString("rsCanNotDest"), + JOptionPane.ERROR_MESSAGE); + return false; + } String status = rs.setDestination((Location) destinationBox.getSelectedItem(), destTrack); if (!status.equals(Track.OKAY)){ log.debug ("Can't set rs's destination because of "+ status); @@ -492,7 +500,7 @@ getRb().getString("rsCanNotDest"), JOptionPane.ERROR_MESSAGE); return false; - } + } } } return true; Modified: trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/CarSetFrame.java =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/CarSetFrame.java 2011-09-30 13:12:19 UTC (rev 18734) +++ trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/CarSetFrame.java 2011-09-30 15:24:12 UTC (rev 18735) @@ -159,6 +159,14 @@ if (finalDestTrackBox.getSelectedItem() != null && !finalDestTrackBox.getSelectedItem().equals("")) finalDestTrack = (Track)finalDestTrackBox.getSelectedItem(); + if (finalDestTrack != null && car.getNextDestTrack() != finalDestTrack && finalDestTrack.getLocType().equals(Track.STAGING)){ + log.debug ("Destination track ("+finalDestTrack.getName()+") is staging"); + JOptionPane.showMessageDialog(this, + getRb().getString("rsDoNotSelectStaging"), + getRb().getString("rsCanNotFinal"), + JOptionPane.ERROR_MESSAGE); + return false; + } String status = car.testDestination((Location) finalDestinationBox.getSelectedItem(), finalDestTrack); if (!status.equals(Track.OKAY)){ JOptionPane.showMessageDialog(this, @@ -179,7 +187,16 @@ car.setReturnWhenEmptyDestTrack(null); } else { if (trackReturnWhenEmptyBox.getSelectedItem() != null - && !trackReturnWhenEmptyBox.getSelectedItem().equals("")){ + && !trackReturnWhenEmptyBox.getSelectedItem().equals("")){ + Track rwe = (Track)trackReturnWhenEmptyBox.getSelectedItem(); + if (rwe != null && rwe.getLocType().equals(Track.STAGING)){ + log.debug ("Return when empty track ("+rwe.getName()+") is staging"); + JOptionPane.showMessageDialog(this, + getRb().getString("rsDoNotSelectStaging"), + getRb().getString("rsCanNotRWE"), + JOptionPane.ERROR_MESSAGE); + return false; + } String status = car.testDestination((Location) destReturnWhenEmptyBox.getSelectedItem(), (Track)trackReturnWhenEmptyBox.getSelectedItem()); if (!status.equals(Track.OKAY)){ JOptionPane.showMessageDialog(this, Modified: trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties 2011-09-30 13:12:19 UTC (rev 18734) +++ trunk/jmri/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties 2011-09-30 15:24:12 UTC (rev 18735) @@ -162,6 +162,7 @@ rsCanNotFinalMsg = Car {0} may not be able to use Final Destination because of destination''s {1} rsCanNotFinal = Final Destination Ignore = Ignore +rsDoNotSelectStaging = Do not select a staging track when sending a car to staging! rsLocNotServ = Car''s location ({0}) not serviced by train ({1}) rsDestNotServ = Car''s destination ({0}) not serviced by train ({1}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |