001package jmri.jmrit.ctc.configurexml;
002
003import java.io.Serializable;
004import java.util.HashMap;
005
006/**
007 *
008 * @author Gregory J. Bedlek Copyright (C) 2018, 2019
009 */
010public class ImportOtherData implements Serializable {
011    private final static int FILE_VERSION = 0;
012
013    public enum CTC_PANEL_TYPE {
014// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
015// gotten by calling "CommonSubs.getButtonSelectedInt".
016        USS(0), OTHER(1);
017        private final int _mRadioGroupValue;
018        private final static HashMap<Integer, CTC_PANEL_TYPE> map = new HashMap<>();
019        private CTC_PANEL_TYPE (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
020        static { for (CTC_PANEL_TYPE value : CTC_PANEL_TYPE.values()) { map.put(value._mRadioGroupValue, value); }}
021    }
022
023    public enum SIGNALS_ON_PANEL {
024// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
025// gotten by calling "CommonSubs.getButtonSelectedInt".
026        ALL(0), GREEN_OFF(1), NONE(2);
027        private final int _mRadioGroupValue;
028        private final static HashMap<Integer, SIGNALS_ON_PANEL> map = new HashMap<>();
029        private SIGNALS_ON_PANEL (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
030        static { for (SIGNALS_ON_PANEL value : SIGNALS_ON_PANEL.values()) { map.put(value._mRadioGroupValue, value); }}
031    }
032
033    public enum VERTICAL_SIZE {
034// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
035// gotten by calling "CommonSubs.getButtonSelectedInt".
036        SMALL(0), MEDIUM(1), LARGE(2);
037        private final int _mRadioGroupValue;
038        private final static HashMap<Integer, VERTICAL_SIZE> map = new HashMap<>();
039        private VERTICAL_SIZE (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
040        static { for (VERTICAL_SIZE value : VERTICAL_SIZE.values()) { map.put(value._mRadioGroupValue, value); }}
041    }
042
043    public enum SIGNAL_SYSTEM_TYPE {
044// The values in paren's are the RadioGroup values set by "CommonSubs.numberButtonGroup",
045// gotten by calling "CommonSubs.getButtonSelectedInt".
046        SIGNALHEAD(0), SIGNALMAST(1);
047        private final int _mRadioGroupValue;
048        private final static HashMap<Integer, SIGNAL_SYSTEM_TYPE> map = new HashMap<>();
049        private SIGNAL_SYSTEM_TYPE (int radioGroupValue) { _mRadioGroupValue = radioGroupValue; }
050        static { for (SIGNAL_SYSTEM_TYPE value : SIGNAL_SYSTEM_TYPE.values()) { map.put(value._mRadioGroupValue, value); }}
051    }
052
053/*
054Because of "getAllInternalSensorStringFields", ANY JMRI sensor object that we
055create should have "InternalSensor" (case sensitive) as ANY PART of their
056variable name and declared as type String.
057*/
058//     private static final String INTERNAL_SENSOR = "InternalSensor";             // NOI18N
059//  Version of this file for supporting upgrade paths from prior versions:
060    public int      _mFileVersion;
061//  Fleeting:
062    public String   _mFleetingToggleInternalSensor;
063    public boolean  _mDefaultFleetingEnabled;
064//  Global startup:
065    public boolean  _mTUL_EnabledAtStartup = true;
066    public SIGNAL_SYSTEM_TYPE _mSignalSystemType;
067    public int      _mTUL_SecondsToLockTurnouts = 0;
068//  Next unique # for each created Column:
069    public int      _mNextUniqueNumber = 0;
070//  CTC Debugging:
071    public String   _mCTCDebugSystemReloadInternalSensor;
072    public String   _mCTCDebug_TrafficLockingRuleTriggeredDisplayInternalSensor;
073//  GUI design:
074    public int      _mGUIDesign_NumberOfEmptyColumnsAtEnd;
075    public CTC_PANEL_TYPE   _mGUIDesign_CTCPanelType;
076    public boolean  _mGUIDesign_BuilderPlate;
077    public SIGNALS_ON_PANEL _mGUIDesign_SignalsOnPanel;
078    public boolean  _mGUIDesign_FleetingToggleSwitch;
079    public boolean  _mGUIDesign_AnalogClockEtc;
080    public boolean  _mGUIDesign_ReloadCTCSystemButton;
081    public boolean  _mGUIDesign_CTCDebugOnToggle;
082    public boolean  _mGUIDesign_CreateTrackPieces;
083    public VERTICAL_SIZE _mGUIDesign_VerticalSize;
084    public boolean  _mGUIDesign_OSSectionUnknownInconsistentRedBlink;
085    public boolean  _mGUIDesign_TurnoutsOnPanel;
086
087    public ImportOtherData() {
088        _mFleetingToggleInternalSensor = "IS:FLEETING";                                 // NOI18N
089        _mDefaultFleetingEnabled = false;
090        _mSignalSystemType = SIGNAL_SYSTEM_TYPE.SIGNALMAST;
091        _mCTCDebugSystemReloadInternalSensor = "IS:RELOADCTC";                          // NOI18N
092        _mCTCDebug_TrafficLockingRuleTriggeredDisplayInternalSensor = "IS:DEBUGCTC";    // NOI18N
093        _mGUIDesign_NumberOfEmptyColumnsAtEnd = 0;
094        _mGUIDesign_CTCPanelType = CTC_PANEL_TYPE.USS;
095        _mGUIDesign_BuilderPlate = false;
096        _mGUIDesign_SignalsOnPanel = SIGNALS_ON_PANEL.ALL;
097        _mGUIDesign_FleetingToggleSwitch = true;
098        _mGUIDesign_AnalogClockEtc = false;
099        _mGUIDesign_ReloadCTCSystemButton = true;
100        _mGUIDesign_CTCDebugOnToggle = true;
101        _mGUIDesign_CreateTrackPieces = false;
102        _mGUIDesign_VerticalSize = VERTICAL_SIZE.SMALL;
103        _mGUIDesign_OSSectionUnknownInconsistentRedBlink = false;
104        _mGUIDesign_TurnoutsOnPanel = true;
105    }
106
107//  Figure out if we need to convert from prior verion(s) (As of 2/20/19, no):
108    public void upgradeSelf() {
109        if (_mFileVersion == FILE_VERSION) { _mFileVersion = FILE_VERSION; }    // Get around complaints by Travis.
110//  I had to get rid of this stub, because SpotBugs complained:
111/*
112        for (int oldVersion = _mFileVersion; oldVersion < FILE_VERSION; oldVersion++) {
113            switch(oldVersion) {
114                case 0:
115                    break;
116            }
117        }
118*/
119    }
120}