From: <dan...@us...> - 2012-03-31 23:43:00
|
Revision: 20272 http://jmri.svn.sourceforge.net/jmri/?rev=20272&view=rev Author: dan_boudreau Date: 2012-03-31 23:42:53 +0000 (Sat, 31 Mar 2012) Log Message: ----------- New operations feature. Allow user to delete rolling stock from a train after it has been built. Modified Paths: -------------- trunk/jmri/java/src/jmri/jmrit/operations/trains/Train.java trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableModel.java trunk/jmri/xml/DTD/operations-trains.dtd Modified: trunk/jmri/java/src/jmri/jmrit/operations/trains/Train.java =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/trains/Train.java 2012-03-31 23:13:11 UTC (rev 20271) +++ trunk/jmri/java/src/jmri/jmrit/operations/trains/Train.java 2012-03-31 23:42:53 UTC (rev 20272) @@ -1829,7 +1829,9 @@ public void setModified(boolean modified) { boolean old = _modified; _modified = modified; - if (old != modified){ + if (modified) + setPrinted(false); + if (old != modified) { setDirtyAndFirePropertyChange("TrainModified", old?"true":"false", modified?"true":"false"); } } @@ -2033,6 +2035,22 @@ setDirtyAndFirePropertyChange("trainPrinted", old?"true":"false", printed?"true":"false"); } + /** + * Used to determine if train manifest was printed. + * @return true if the train manifest was printed. + * + */ + public boolean isPrinted(){ + return _printed; + } + + + /** + * Deprecated, kept for user scripts. Use isPrinted() + * @return true if the train manifest was printed. + * + */ + @Deprecated public boolean getPrinted(){ return _printed; } @@ -2570,7 +2588,7 @@ e.setAttribute("built", isBuilt()?"true":"false"); e.setAttribute("build", isBuildEnabled()?"true":"false"); e.setAttribute("buildFailed", getBuildFailed()?"true":"false"); - e.setAttribute("printed", getPrinted()?"true":"false"); + e.setAttribute("printed", isPrinted()?"true":"false"); e.setAttribute("modified", isModified()?"true":"false"); e.setAttribute("switchListStatus", getSwitchListStatus()); if(getLeadEngine()!= null) Modified: trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java 2012-03-31 23:13:11 UTC (rev 20271) +++ trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java 2012-03-31 23:42:53 UTC (rev 20272) @@ -325,10 +325,10 @@ List<String> trains = getSortByList(); for (int i=0; i<trains.size(); i++){ Train train = trainManager.getTrainById(trains.get(i)); - if (train.isBuildEnabled() && train.isBuilt() && train.getPrinted()){ + if (train.isBuildEnabled() && train.isBuilt() && train.isPrinted()){ train.terminate(); } - else if (train.isBuildEnabled() && train.isBuilt() && !train.getPrinted()){ + else if (train.isBuildEnabled() && train.isBuilt() && !train.isPrinted()){ int status = JOptionPane.showConfirmDialog(null, rb.getString("WarningTrainManifestNotPrinted"), MessageFormat.format(rb.getString("TerminateTrain"),new Object[]{train.getName(), train.getDescription()}), Modified: trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableModel.java =================================================================== --- trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableModel.java 2012-03-31 23:13:11 UTC (rev 20271) +++ trunk/jmri/java/src/jmri/jmrit/operations/trains/TrainsTableModel.java 2012-03-31 23:42:53 UTC (rev 20272) @@ -268,7 +268,7 @@ if (train.isBuilt()) if (manager.isPrintPreviewEnabled()) return rb.getString("Preview"); - else if (train.getPrinted()) + else if (train.isPrinted()) return rb.getString("Printed"); else return rb.getString("Print"); Modified: trunk/jmri/xml/DTD/operations-trains.dtd =================================================================== --- trunk/jmri/xml/DTD/operations-trains.dtd 2012-03-31 23:13:11 UTC (rev 20271) +++ trunk/jmri/xml/DTD/operations-trains.dtd 2012-03-31 23:42:53 UTC (rev 20272) @@ -73,6 +73,7 @@ <!ATTLIST train build (true | false) "false"> <!ATTLIST train buildFailed (true | false) "false"> <!ATTLIST train printed (true | false) "false"> +<!ATTLIST train modified (true | false) "false"> <!ATTLIST train switchListStatus CDATA #IMPLIED> <!ATTLIST train status CDATA #IMPLIED> <!ATTLIST train current CDATA #IMPLIED> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |