From: Dan B. <dan...@us...> - 2008-12-01 22:02:23
|
Update of /cvsroot/jmri/jmri/jmrit/operations/rollingstock/cars In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9039/src/jmri/jmrit/operations/rollingstock/cars Modified Files: CarAttributeEditFrame.java Log Message: update road name changes in train and location edit frames Index: CarAttributeEditFrame.java =================================================================== RCS file: /cvsroot/jmri/jmri/jmrit/operations/rollingstock/cars/CarAttributeEditFrame.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CarAttributeEditFrame.java 1 Dec 2008 18:52:04 -0000 1.5 --- CarAttributeEditFrame.java 1 Dec 2008 22:02:17 -0000 1.6 *************** *** 22,27 **** import jmri.jmrit.operations.setup.Setup; import jmri.jmrit.operations.locations.LocationManager; ! import jmri.jmrit.operations.locations.Location; ! import jmri.jmrit.operations.locations.Track; import jmri.jmrit.operations.OperationsFrame; --- 22,26 ---- import jmri.jmrit.operations.setup.Setup; import jmri.jmrit.operations.locations.LocationManager; ! import jmri.jmrit.operations.trains.TrainManager; import jmri.jmrit.operations.OperationsFrame; *************** *** 152,156 **** if(_comboboxName == CarsEditFrame.ROAD){ CarRoads.instance().deleteName(deleteItem); ! roadReplace(deleteItem, null); } if(_comboboxName == CarsEditFrame.TYPE){ --- 151,155 ---- if(_comboboxName == CarsEditFrame.ROAD){ CarRoads.instance().deleteName(deleteItem); ! LocationManager.instance().replaceRoad(deleteItem, null); } if(_comboboxName == CarsEditFrame.TYPE){ *************** *** 248,296 **** } } ! // now adjust locations if(_comboboxName == CarsEditFrame.TYPE){ ! LocationManager manager = LocationManager.instance(); ! List locs = manager.getLocationsByIdList(); ! for (int i=0; i<locs.size(); i++){ ! String id = (String)locs.get(i); ! Location loc = manager.getLocationById(id); ! if (loc.acceptsTypeName(oldItem)){ ! loc.deleteTypeName(oldItem); ! loc.addTypeName(newItem); ! // now adjust any track locations ! List sls = loc.getTracksByNameList(null); ! for (int j=0; j<sls.size(); j++){ ! String slId = (String)sls.get(j); ! Track sl = loc.getTrackById(slId); ! if (sl.acceptsTypeName(oldItem)){ ! sl.deleteTypeName(oldItem); ! sl.addTypeName(newItem); ! } ! } ! } ! } } if(_comboboxName == CarsEditFrame.ROAD){ ! roadReplace(oldItem, newItem); ! } ! } ! ! private void roadReplace(String oldItem, String newItem){ ! LocationManager manager = LocationManager.instance(); ! List locs = manager.getLocationsByIdList(); ! for (int i=0; i<locs.size(); i++){ ! String id = (String)locs.get(i); ! Location loc = manager.getLocationById(id); ! // now adjust any track locations ! List sls = loc.getTracksByNameList(null); ! for (int j=0; j<sls.size(); j++){ ! String slId = (String)sls.get(j); ! Track sl = loc.getTrackById(slId); ! if(sl.containsRoadName(oldItem)){ ! sl.deleteRoadName(oldItem); ! if(newItem != null) ! sl.addRoadName(newItem); ! } ! } } } --- 247,258 ---- } } ! // now adjust locations and trains if(_comboboxName == CarsEditFrame.TYPE){ ! LocationManager.instance().replaceType(oldItem, newItem); ! TrainManager.instance().replaceType(oldItem, newItem); } if(_comboboxName == CarsEditFrame.ROAD){ ! LocationManager.instance().replaceRoad(oldItem, newItem); ! TrainManager.instance().replaceRoad(oldItem, newItem); } } |