001package jmri.jmrit.operations.trains;
002
003import org.jdom2.Attribute;
004import org.jdom2.Element;
005
006/**
007 * Loads and stores the manifest header text strings.
008 *
009 * @author Daniel Boudreau Copyright (C) 2014, 2026
010 *
011 */
012public class TrainManifestHeaderText {
013
014    private static String order = Bundle.getMessage("Order");
015    private static String road = Bundle.getMessage("Road");
016    private static String number = Bundle.getMessage("Number");
017    private static String engine_number = Bundle.getMessage("Number");
018    private static String type = Bundle.getMessage("Type");
019    private static String model = Bundle.getMessage("Model");
020    private static String hp = Bundle.getMessage("HP");
021    private static String length = Bundle.getMessage("Length");
022    private static String weight = Bundle.getMessage("Weight");
023    private static String load = Bundle.getMessage("Load");
024    private static String load_type = Bundle.getMessage("Load_Type");
025    private static String color = Bundle.getMessage("Color");
026    private static String track = Bundle.getMessage("Track");
027    private static String destination = Bundle.getMessage("Destination");
028    private static String dest_track = Bundle.getMessage("Dest&Track");
029    private static String final_dest = Bundle.getMessage("Final_Dest");
030    private static String final_dest_track = Bundle.getMessage("FD&Track");
031    private static String location = Bundle.getMessage("Location");
032    private static String consist = Bundle.getMessage("Consist");
033    private static String dcc_address = Bundle.getMessage("DCC_Address");
034    private static String kernel = Bundle.getMessage("Kernel");
035    private static String owner = Bundle.getMessage("Owner");
036    private static String division = Bundle.getMessage("Division");
037    private static String rwe = Bundle.getMessage("RWELabel"); // add "RWE:" in Switch List
038    private static String comment = Bundle.getMessage("Comment");
039    private static String drop_comment = Bundle.getMessage("SetOut_Msg");
040    private static String pickup_comment = Bundle.getMessage("PickUp_Msg");
041    private static String hazardous = Bundle.getMessage("Hazardous");
042    private static String lastTrain = Bundle.getMessage("LastTrain");
043    private static String lastMoved = Bundle.getMessage("LastMoved");
044    private static String lastLocation = Bundle.getMessage("LastLocation");
045
046    public static String getStringHeader_Order() {
047        return order;
048    }
049
050    public static void setStringHeader_Order(String s) {
051        order = s;
052    }
053    
054    public static String getStringHeader_Road() {
055        return road;
056    }
057
058    public static void setStringHeader_Road(String s) {
059        road = s;
060    }
061
062    public static String getStringHeader_Number() {
063        return number;
064    }
065
066    public static void setStringHeader_Number(String s) {
067        number = s;
068    }
069
070    public static String getStringHeader_EngineNumber() {
071        return engine_number;
072    }
073
074    public static void setStringHeader_EngineNumber(String s) {
075        engine_number = s;
076    }
077
078    public static String getStringHeader_Type() {
079        return type;
080    }
081
082    public static void setStringHeader_Type(String s) {
083        type = s;
084    }
085
086    public static String getStringHeader_Model() {
087        return model;
088    }
089
090    public static void setStringHeader_Model(String s) {
091        model = s;
092    }
093
094    public static String getStringHeader_Hp() {
095        return hp;
096    }
097
098    public static void setStringHeader_Hp(String s) {
099        hp = s;
100    }
101
102    public static String getStringHeader_Length() {
103        return length;
104    }
105
106    public static void setStringHeader_Length(String s) {
107        length = s;
108    }
109    
110    public static String getStringHeader_Weight() {
111        return weight;
112    }
113
114    public static void setStringHeader_Weight(String s) {
115        weight = s;
116    }
117
118    public static String getStringHeader_Load() {
119        return load;
120    }
121
122    public static void setStringHeader_Load(String s) {
123        load = s;
124    }
125    
126    public static String getStringHeader_Load_Type() {
127        return load_type;
128    }
129
130    public static void setStringHeader_Load_Type(String s) {
131        load_type = s;
132    }
133
134    public static String getStringHeader_Color() {
135        return color;
136    }
137
138    public static void setStringHeader_Color(String s) {
139        color = s;
140    }
141
142    public static String getStringHeader_Track() {
143        return track;
144    }
145
146    public static void setStringHeader_Track(String s) {
147        track = s;
148    }
149
150    public static String getStringHeader_Destination() {
151        return destination;
152    }
153
154    public static void setStringHeader_Destination(String s) {
155        destination = s;
156    }
157
158    public static String getStringHeader_Dest_Track() {
159        return dest_track;
160    }
161
162    public static void setStringHeader_Dest_Track(String s) {
163        dest_track = s;
164    }
165
166    public static String getStringHeader_Final_Dest() {
167        return final_dest;
168    }
169
170    public static void setStringHeader_Final_Dest(String s) {
171        final_dest = s;
172    }
173
174    public static String getStringHeader_Final_Dest_Track() {
175        return final_dest_track;
176    }
177
178    public static void setStringHeader_Final_Dest_Track(String s) {
179        final_dest_track = s;
180    }
181
182    public static String getStringHeader_Location() {
183        return location;
184    }
185
186    public static void setStringHeader_Location(String s) {
187        location = s;
188    }
189
190    public static String getStringHeader_Consist() {
191        return consist;
192    }
193
194    public static void setStringHeader_Consist(String s) {
195        consist = s;
196    }
197
198    public static String getStringHeader_Kernel() {
199        return kernel;
200    }
201
202    public static void setStringHeader_Kernel(String s) {
203        kernel = s;
204    }
205
206    public static String getStringHeader_Owner() {
207        return owner;
208    }
209
210    public static void setStringHeader_Owner(String s) {
211        owner = s;
212    }
213    
214    public static String getStringHeader_Division() {
215        return division;
216    }
217
218    public static void setStringHeader_Division(String s) {
219        division = s;
220    }
221
222    public static String getStringHeader_RWE() {
223        return rwe;
224    }
225
226    public static void setStringHeader_RWE(String s) {
227        rwe = s;
228    }
229
230    public static String getStringHeader_Comment() {
231        return comment;
232    }
233
234    public static void setStringHeader_Comment(String s) {
235        comment = s;
236    }
237
238    public static String getStringHeader_Drop_Comment() {
239        return drop_comment;
240    }
241
242    public static void setStringHeader_Drop_Comment(String s) {
243        drop_comment = s;
244    }
245
246    public static String getStringHeader_Pickup_Comment() {
247        return pickup_comment;
248    }
249
250    public static void setStringHeader_Pickup_Comment(String s) {
251        pickup_comment = s;
252    }
253
254    public static String getStringHeader_Hazardous() {
255        return hazardous;
256    }
257
258    public static void setStringHeader_Hazardous(String s) {
259        hazardous = s;
260    }
261    
262    public static String getStringHeader_DCC_Address() {
263        return dcc_address;
264    }
265    
266    public static void setStringHeader_DCC_Address(String s) {
267        dcc_address = s;
268    }
269
270    public static String getStringHeader_Last_Train() {
271        return lastTrain;
272    }
273
274    public static void setStringHeader_Last_Train(String s) {
275        lastTrain = s;
276    }
277    
278    public static String getStringHeader_Last_Moved() {
279        return lastMoved;
280    }
281
282    public static void setStringHeader_Last_Moved(String s) {
283        lastMoved = s;
284    }
285    
286    public static String getStringHeader_Last_Location() {
287        return lastLocation;
288    }
289
290    public static void setStringHeader_Last_Location(String s) {
291        lastLocation = s;
292    }
293
294    // must synchronize changes with operation-config.dtd
295    public static Element store() {
296        Element values;
297        Element e = new Element(Xml.MANIFEST_HEADER_TEXT_STRINGS);
298        // only save strings that have been modified
299        if (!getStringHeader_Order().equals(Bundle.getMessage("Order"))) {
300            e.addContent(values = new Element(Xml.ORDER));
301            values.setAttribute(Xml.TEXT, getStringHeader_Order());
302        }
303        if (!getStringHeader_Road().equals(Bundle.getMessage("Road"))) {
304            e.addContent(values = new Element(Xml.ROAD));
305            values.setAttribute(Xml.TEXT, getStringHeader_Road());
306        }
307        if (!getStringHeader_Number().equals(Bundle.getMessage("Number"))) {
308            e.addContent(values = new Element(Xml.NUMBER));
309            values.setAttribute(Xml.TEXT, getStringHeader_Number());
310        }
311        if (!getStringHeader_EngineNumber().equals(Bundle.getMessage("Number"))) {
312            e.addContent(values = new Element(Xml.ENGINE_NUMBER));
313            values.setAttribute(Xml.TEXT, getStringHeader_EngineNumber());
314        }
315        if (!getStringHeader_Type().equals(Bundle.getMessage("Type"))) {
316            e.addContent(values = new Element(Xml.TYPE));
317            values.setAttribute(Xml.TEXT, getStringHeader_Type());
318        }
319        if (!getStringHeader_Model().equals(Bundle.getMessage("Model"))) {
320            e.addContent(values = new Element(Xml.MODEL));
321            values.setAttribute(Xml.TEXT, getStringHeader_Model());
322        }
323        if (!getStringHeader_Hp().equals(Bundle.getMessage("HP"))) {
324            e.addContent(values = new Element(Xml.HP));
325            values.setAttribute(Xml.TEXT, getStringHeader_Hp());
326        }
327        if (!getStringHeader_Length().equals(Bundle.getMessage("Length"))) {
328            e.addContent(values = new Element(Xml.LENGTH));
329            values.setAttribute(Xml.TEXT, getStringHeader_Length());
330        }
331        if (!getStringHeader_Weight().equals(Bundle.getMessage("Weight"))) {
332            e.addContent(values = new Element(Xml.WEIGHT));
333            values.setAttribute(Xml.TEXT, getStringHeader_Weight());
334        }
335        if (!getStringHeader_Load().equals(Bundle.getMessage("Load"))) {
336            e.addContent(values = new Element(Xml.LOAD));
337            values.setAttribute(Xml.TEXT, getStringHeader_Load());
338        }
339        if (!getStringHeader_Load_Type().equals(Bundle.getMessage("Load_Type"))) {
340            e.addContent(values = new Element(Xml.LOAD_TYPE));
341            values.setAttribute(Xml.TEXT, getStringHeader_Load_Type());
342        }
343        if (!getStringHeader_Color().equals(Bundle.getMessage("Color"))) {
344            e.addContent(values = new Element(Xml.COLOR));
345            values.setAttribute(Xml.TEXT, getStringHeader_Color());
346        }
347        if (!getStringHeader_Track().equals(Bundle.getMessage("Track"))) {
348            e.addContent(values = new Element(Xml.TRACK));
349            values.setAttribute(Xml.TEXT, getStringHeader_Track());
350        }
351        if (!getStringHeader_Destination().equals(Bundle.getMessage("Destination"))) {
352            e.addContent(values = new Element(Xml.DESTINATION));
353            values.setAttribute(Xml.TEXT, getStringHeader_Destination());
354        }
355        if (!getStringHeader_Dest_Track().equals(Bundle.getMessage("Dest&Track"))) {
356            e.addContent(values = new Element(Xml.DEST_TRACK));
357            values.setAttribute(Xml.TEXT, getStringHeader_Dest_Track());
358        }
359        if (!getStringHeader_Final_Dest().equals(Bundle.getMessage("Final_Dest"))) {
360            e.addContent(values = new Element(Xml.FINAL_DEST));
361            values.setAttribute(Xml.TEXT, getStringHeader_Final_Dest());
362        }
363        if (!getStringHeader_Final_Dest_Track().equals(Bundle.getMessage("FD&Track"))) {
364            e.addContent(values = new Element(Xml.FINAL_DEST_TRACK));
365            values.setAttribute(Xml.TEXT, getStringHeader_Final_Dest_Track());
366        }
367        if (!getStringHeader_Location().equals(Bundle.getMessage("Location"))) {
368            e.addContent(values = new Element(Xml.LOCATION));
369            values.setAttribute(Xml.TEXT, getStringHeader_Location());
370        }
371        if (!getStringHeader_Consist().equals(Bundle.getMessage("Consist"))) {
372            e.addContent(values = new Element(Xml.CONSIST));
373            values.setAttribute(Xml.TEXT, getStringHeader_Consist());
374        }
375        if (!getStringHeader_DCC_Address().equals(Bundle.getMessage("DCC_Address"))) {
376            e.addContent(values = new Element(Xml.DCC_ADDRESS));
377            values.setAttribute(Xml.TEXT, getStringHeader_DCC_Address());
378        }
379        if (!getStringHeader_Kernel().equals(Bundle.getMessage("Kernel"))) {
380            e.addContent(values = new Element(Xml.KERNEL));
381            values.setAttribute(Xml.TEXT, getStringHeader_Kernel());
382        }
383        if (!getStringHeader_Owner().equals(Bundle.getMessage("Owner"))) {
384            e.addContent(values = new Element(Xml.OWNER));
385            values.setAttribute(Xml.TEXT, getStringHeader_Owner());
386        }
387        if (!getStringHeader_Division().equals(Bundle.getMessage("Division"))) {
388            e.addContent(values = new Element(Xml.DIVISION));
389            values.setAttribute(Xml.TEXT, getStringHeader_Division());
390        }
391        if (!getStringHeader_RWE().equals(Bundle.getMessage("RWELabel"))) {
392            e.addContent(values = new Element(Xml.RWE));
393            values.setAttribute(Xml.TEXT, getStringHeader_RWE());
394        }
395        if (!getStringHeader_Comment().equals(Bundle.getMessage("Comment"))) {
396            e.addContent(values = new Element(Xml.COMMENT));
397            values.setAttribute(Xml.TEXT, getStringHeader_Comment());
398        }
399        if (!getStringHeader_Drop_Comment().equals(Bundle.getMessage("SetOut_Msg"))) {
400            e.addContent(values = new Element(Xml.DROP_COMMENT));
401            values.setAttribute(Xml.TEXT, getStringHeader_Drop_Comment());
402        }
403        if (!getStringHeader_Pickup_Comment().equals(Bundle.getMessage("PickUp_Msg"))) {
404            e.addContent(values = new Element(Xml.PICKUP_COMMENT));
405            values.setAttribute(Xml.TEXT, getStringHeader_Pickup_Comment());
406        }
407        if (!getStringHeader_Hazardous().equals(Bundle.getMessage("Hazardous"))) {
408            e.addContent(values = new Element(Xml.HAZARDOUS));
409            values.setAttribute(Xml.TEXT, getStringHeader_Hazardous());
410        }
411        if (!getStringHeader_Last_Train().equals(Bundle.getMessage("LastTrain"))) {
412            e.addContent(values = new Element(Xml.LAST_TRAIN));
413            values.setAttribute(Xml.TEXT, getStringHeader_Last_Train());
414        }
415        if (!getStringHeader_Last_Moved().equals(Bundle.getMessage("LastMoved"))) {
416            e.addContent(values = new Element(Xml.LAST_MOVED));
417            values.setAttribute(Xml.TEXT, getStringHeader_Last_Moved());
418        }
419        if (!getStringHeader_Last_Location().equals(Bundle.getMessage("LastLocation"))) {
420            e.addContent(values = new Element(Xml.LAST_LOCATION));
421            values.setAttribute(Xml.TEXT, getStringHeader_Last_Location());
422        }
423
424        return e;
425    }
426
427    public static void load(Element e) {
428        Element emts = e.getChild(Xml.MANIFEST_HEADER_TEXT_STRINGS);
429        if (emts == null) {
430            return;
431        }
432        Attribute a;
433        if (emts.getChild(Xml.ORDER) != null) {
434            if ((a = emts.getChild(Xml.ORDER).getAttribute(Xml.TEXT)) != null) {
435                setStringHeader_Order(a.getValue());
436            }
437        }
438        if (emts.getChild(Xml.ROAD) != null) {
439            if ((a = emts.getChild(Xml.ROAD).getAttribute(Xml.TEXT)) != null) {
440                setStringHeader_Road(a.getValue());
441            }
442        }
443        if (emts.getChild(Xml.NUMBER) != null) {
444            if ((a = emts.getChild(Xml.NUMBER).getAttribute(Xml.TEXT)) != null) {
445                setStringHeader_Number(a.getValue());
446            }
447        }
448        if (emts.getChild(Xml.ENGINE_NUMBER) != null) {
449            if ((a = emts.getChild(Xml.ENGINE_NUMBER).getAttribute(Xml.TEXT)) != null) {
450                setStringHeader_EngineNumber(a.getValue());
451            }
452        }
453        if (emts.getChild(Xml.TYPE) != null) {
454            if ((a = emts.getChild(Xml.TYPE).getAttribute(Xml.TEXT)) != null) {
455                setStringHeader_Type(a.getValue());
456            }
457        }
458        if (emts.getChild(Xml.MODEL) != null) {
459            if ((a = emts.getChild(Xml.MODEL).getAttribute(Xml.TEXT)) != null) {
460                setStringHeader_Model(a.getValue());
461            }
462        }
463        if (emts.getChild(Xml.HP) != null) {
464            if ((a = emts.getChild(Xml.HP).getAttribute(Xml.TEXT)) != null) {
465                setStringHeader_Hp(a.getValue());
466            }
467        }
468        if (emts.getChild(Xml.LENGTH) != null) {
469            if ((a = emts.getChild(Xml.LENGTH).getAttribute(Xml.TEXT)) != null) {
470                setStringHeader_Length(a.getValue());
471            }
472        }
473        if (emts.getChild(Xml.WEIGHT) != null) {
474            if ((a = emts.getChild(Xml.WEIGHT).getAttribute(Xml.TEXT)) != null) {
475                setStringHeader_Weight(a.getValue());
476            }
477        }
478        if (emts.getChild(Xml.LOAD) != null) {
479            if ((a = emts.getChild(Xml.LOAD).getAttribute(Xml.TEXT)) != null) {
480                setStringHeader_Load(a.getValue());
481            }
482        }
483        if (emts.getChild(Xml.LOAD_TYPE) != null) {
484            if ((a = emts.getChild(Xml.LOAD_TYPE).getAttribute(Xml.TEXT)) != null) {
485                setStringHeader_Load_Type(a.getValue());
486            }
487        }
488        if (emts.getChild(Xml.COLOR) != null) {
489            if ((a = emts.getChild(Xml.COLOR).getAttribute(Xml.TEXT)) != null) {
490                setStringHeader_Color(a.getValue());
491            }
492        }
493        if (emts.getChild(Xml.TRACK) != null) {
494            if ((a = emts.getChild(Xml.TRACK).getAttribute(Xml.TEXT)) != null) {
495                setStringHeader_Track(a.getValue());
496            }
497        }
498        if (emts.getChild(Xml.DESTINATION) != null) {
499            if ((a = emts.getChild(Xml.DESTINATION).getAttribute(Xml.TEXT)) != null) {
500                setStringHeader_Destination(a.getValue());
501            }
502        }
503        if (emts.getChild(Xml.DEST_TRACK) != null) {
504            if ((a = emts.getChild(Xml.DEST_TRACK).getAttribute(Xml.TEXT)) != null) {
505                setStringHeader_Dest_Track(a.getValue());
506            }
507        }
508        if (emts.getChild(Xml.FINAL_DEST) != null) {
509            if ((a = emts.getChild(Xml.FINAL_DEST).getAttribute(Xml.TEXT)) != null) {
510                setStringHeader_Final_Dest(a.getValue());
511            }
512        }
513        if (emts.getChild(Xml.FINAL_DEST_TRACK) != null) {
514            if ((a = emts.getChild(Xml.FINAL_DEST_TRACK).getAttribute(Xml.TEXT)) != null) {
515                setStringHeader_Final_Dest_Track(a.getValue());
516            }
517        }
518        if (emts.getChild(Xml.LOCATION) != null) {
519            if ((a = emts.getChild(Xml.LOCATION).getAttribute(Xml.TEXT)) != null) {
520                setStringHeader_Location(a.getValue());
521            }
522        }
523        if (emts.getChild(Xml.CONSIST) != null) {
524            if ((a = emts.getChild(Xml.CONSIST).getAttribute(Xml.TEXT)) != null) {
525                setStringHeader_Consist(a.getValue());
526            }
527        }
528        if (emts.getChild(Xml.DCC_ADDRESS) != null) {
529            if ((a = emts.getChild(Xml.DCC_ADDRESS).getAttribute(Xml.TEXT)) != null) {
530                setStringHeader_DCC_Address(a.getValue());
531            }
532        }
533        if (emts.getChild(Xml.KERNEL) != null) {
534            if ((a = emts.getChild(Xml.KERNEL).getAttribute(Xml.TEXT)) != null) {
535                setStringHeader_Kernel(a.getValue());
536            }
537        }
538        if (emts.getChild(Xml.OWNER) != null) {
539            if ((a = emts.getChild(Xml.OWNER).getAttribute(Xml.TEXT)) != null) {
540                setStringHeader_Owner(a.getValue());
541            }
542        }
543        if (emts.getChild(Xml.DIVISION) != null) {
544            if ((a = emts.getChild(Xml.DIVISION).getAttribute(Xml.TEXT)) != null) {
545                setStringHeader_Division(a.getValue());
546            }
547        }
548        if (emts.getChild(Xml.RWE) != null) {
549            if ((a = emts.getChild(Xml.RWE).getAttribute(Xml.TEXT)) != null) {
550                setStringHeader_RWE(a.getValue());
551            }
552        }
553        if (emts.getChild(Xml.COMMENT) != null) {
554            if ((a = emts.getChild(Xml.COMMENT).getAttribute(Xml.TEXT)) != null) {
555                setStringHeader_Comment(a.getValue());
556            }
557        }
558        if (emts.getChild(Xml.DROP_COMMENT) != null) {
559            if ((a = emts.getChild(Xml.DROP_COMMENT).getAttribute(Xml.TEXT)) != null) {
560                setStringHeader_Drop_Comment(a.getValue());
561            }
562        }
563        if (emts.getChild(Xml.PICKUP_COMMENT) != null) {
564            if ((a = emts.getChild(Xml.PICKUP_COMMENT).getAttribute(Xml.TEXT)) != null) {
565                setStringHeader_Pickup_Comment(a.getValue());
566            }
567        }
568        if (emts.getChild(Xml.HAZARDOUS) != null) {
569            if ((a = emts.getChild(Xml.HAZARDOUS).getAttribute(Xml.TEXT)) != null) {
570                setStringHeader_Hazardous(a.getValue());
571            }
572        }
573        if (emts.getChild(Xml.LAST_TRAIN) != null) {
574            if ((a = emts.getChild(Xml.LAST_TRAIN).getAttribute(Xml.TEXT)) != null) {
575                setStringHeader_Last_Train(a.getValue());
576            }
577        }
578        if (emts.getChild(Xml.LAST_MOVED) != null) {
579            if ((a = emts.getChild(Xml.LAST_MOVED).getAttribute(Xml.TEXT)) != null) {
580                setStringHeader_Last_Moved(a.getValue());
581            }
582        }
583        if (emts.getChild(Xml.LAST_LOCATION) != null) {
584            if ((a = emts.getChild(Xml.LAST_LOCATION).getAttribute(Xml.TEXT)) != null) {
585                setStringHeader_Last_Location(a.getValue());
586            }
587        }
588    }
589}