diff --git a/build.xml b/build.xml index 75079131fb3..8c7a535f8eb 100644 --- a/build.xml +++ b/build.xml @@ -458,7 +458,7 @@ - + diff --git a/help/en/Acknowledgements.shtml b/help/en/Acknowledgements.shtml index 193074ac8ca..08a768852fa 100644 --- a/help/en/Acknowledgements.shtml +++ b/help/en/Acknowledgements.shtml @@ -104,6 +104,9 @@ general has made more contributions than can be counted. +
  • Daniel Bergqvist, who added the "ask before shutdown" code, + improved the Bundle code and added to the Swedish translation +
  • Andrew Berridge, who debugged and fixed problems with the SPROG serial interface
  • @@ -472,7 +475,8 @@
  • Ian Havercroft, who provided the correct identification codes for ESU decoders
  • -
  • David Heap, who provided a QSI decoder fix
  • +
  • David Heap, who provided a QSI decoder fix + and improved how signal head aspects are supported.
  • Rob Heikens, who created ESU decoder definitions and programmer pages
  • @@ -975,7 +979,9 @@ comboboxes (with drop-down menus); added a 2nd turnout circle for slips and added left, right & bottom options for the toolbar (and re-laid out same) in the Layout Editor. - Also wrote all the slip code for the web server. + Added support for DMX512 lighting. + Also wrote all the slip code for the web server. +
  • Mark Waters, who provided numerous Zimo decoder definitions and new Zimo MX620 definitions.
  • diff --git a/help/en/JavaHelpSearch/DOCS b/help/en/JavaHelpSearch/DOCS index 8e839c85a86..a1f4132187c 100644 Binary files a/help/en/JavaHelpSearch/DOCS and b/help/en/JavaHelpSearch/DOCS differ diff --git a/help/en/JavaHelpSearch/DOCS.TAB b/help/en/JavaHelpSearch/DOCS.TAB index 3c73d163107..27502e3cd4d 100644 Binary files a/help/en/JavaHelpSearch/DOCS.TAB and b/help/en/JavaHelpSearch/DOCS.TAB differ diff --git a/help/en/JavaHelpSearch/OFFSETS b/help/en/JavaHelpSearch/OFFSETS index 8edf0094fb6..8c9be103c52 100644 Binary files a/help/en/JavaHelpSearch/OFFSETS and b/help/en/JavaHelpSearch/OFFSETS differ diff --git a/help/en/JavaHelpSearch/POSITIONS b/help/en/JavaHelpSearch/POSITIONS index 3e06f247b46..05ff756ff93 100644 Binary files a/help/en/JavaHelpSearch/POSITIONS and b/help/en/JavaHelpSearch/POSITIONS differ diff --git a/help/en/JavaHelpSearch/SCHEMA b/help/en/JavaHelpSearch/SCHEMA index 0ba21e75abf..4bd102cae2c 100644 --- a/help/en/JavaHelpSearch/SCHEMA +++ b/help/en/JavaHelpSearch/SCHEMA @@ -1,2 +1,2 @@ JavaSearch 1.0 -TMAP bs=2048 rt=69 fl=-1 id1=15426 id2=1 +TMAP bs=2048 rt=72 fl=-1 id1=15445 id2=1 diff --git a/help/en/JavaHelpSearch/TMAP b/help/en/JavaHelpSearch/TMAP index 27ec9395ebf..9159cea8bfe 100644 Binary files a/help/en/JavaHelpSearch/TMAP and b/help/en/JavaHelpSearch/TMAP differ diff --git a/help/en/Map.jhm b/help/en/Map.jhm index 91b6d9800bf..2b713084486 100644 --- a/help/en/Map.jhm +++ b/help/en/Map.jhm @@ -54,10 +54,10 @@ - - + + @@ -174,10 +174,10 @@ - - + + @@ -200,10 +200,10 @@ - - + + @@ -220,10 +220,10 @@ - - + + @@ -270,10 +270,10 @@ - - + + @@ -314,10 +314,10 @@ - - + + @@ -348,10 +348,10 @@ - - + + @@ -366,10 +366,10 @@ - - + + @@ -464,10 +464,10 @@ - - + + @@ -490,10 +490,10 @@ - - + + @@ -534,10 +534,10 @@ - - + + @@ -558,10 +558,10 @@ - - + + @@ -646,10 +646,10 @@ - - + + @@ -664,11 +664,11 @@ - + - + @@ -698,10 +698,10 @@ - - + + @@ -726,6 +726,8 @@ + + @@ -754,10 +756,10 @@ - - + + @@ -784,10 +786,10 @@ - - + + @@ -868,19 +870,17 @@ - - - + - + @@ -898,10 +898,10 @@ - - + + @@ -920,10 +920,10 @@ - - + + @@ -932,10 +932,10 @@ - - + + @@ -1042,10 +1042,10 @@ - - + + @@ -1096,10 +1096,10 @@ - - + + @@ -1108,10 +1108,10 @@ - - + + @@ -1176,16 +1176,16 @@ - - - + - + + + @@ -1286,10 +1286,10 @@ - - + + @@ -1310,24 +1310,24 @@ - - + + - - - + + + @@ -1338,12 +1338,14 @@ - - + + + + @@ -1366,6 +1368,8 @@ + + @@ -1380,10 +1384,10 @@ - - + + @@ -1514,10 +1518,10 @@ - - + + @@ -1546,10 +1550,10 @@ - - + + @@ -1564,10 +1568,10 @@ - - + + @@ -1592,10 +1596,10 @@ - - + + @@ -1688,13 +1692,11 @@ - - - + - + @@ -1702,30 +1704,30 @@ - - + + - - + + - - + + @@ -1768,10 +1770,10 @@ - - + + @@ -1788,10 +1790,10 @@ - - + + @@ -1838,10 +1840,10 @@ - - + + @@ -1892,14 +1894,14 @@ - - - + + + @@ -1912,13 +1914,11 @@ - - - + - + @@ -1944,10 +1944,10 @@ - - + + @@ -2110,10 +2110,10 @@ - - + + @@ -2166,10 +2166,10 @@ - - + + @@ -2210,10 +2210,10 @@ - - + + @@ -2260,10 +2260,10 @@ - - + + @@ -2294,10 +2294,10 @@ - - + + @@ -2328,10 +2328,10 @@ - - + + @@ -2372,11 +2372,11 @@ - + - + @@ -2452,16 +2452,16 @@ - - - + - + + + @@ -2530,10 +2530,10 @@ - - + + @@ -2596,10 +2596,10 @@ - - + + @@ -2650,10 +2650,10 @@ - - + + @@ -2722,10 +2722,10 @@ - - + + @@ -2766,10 +2766,10 @@ - - + + @@ -2806,10 +2806,10 @@ - - + + @@ -2818,10 +2818,10 @@ - - + + @@ -2848,22 +2848,22 @@ - + - - - + - + - + + + @@ -2926,10 +2926,10 @@ - - + + @@ -3006,16 +3006,16 @@ - - - + - + + + @@ -3056,16 +3056,16 @@ - - - + - + + + @@ -3078,10 +3078,10 @@ - - + + @@ -3182,16 +3182,16 @@ + + - + - - @@ -3218,18 +3218,18 @@ - - + + - - + + @@ -3250,11 +3250,11 @@ - + - + @@ -3296,10 +3296,10 @@ - - + + @@ -3392,6 +3392,8 @@ + + @@ -3420,10 +3422,10 @@ - - + + @@ -3432,8 +3434,6 @@ - - @@ -3452,8 +3452,6 @@ - - @@ -3490,11 +3488,11 @@ - + - + @@ -3506,10 +3504,10 @@ - - + + @@ -3540,10 +3538,10 @@ - - + + @@ -3650,11 +3648,11 @@ - + - + @@ -3662,10 +3660,10 @@ - - + + @@ -3702,18 +3700,18 @@ - - - + - + + + @@ -3736,10 +3734,10 @@ - - + + @@ -3764,10 +3762,10 @@ - - + + @@ -3834,10 +3832,10 @@ - - + + @@ -3864,10 +3862,10 @@ - - + + @@ -3892,11 +3890,11 @@ - + - + @@ -3904,10 +3902,10 @@ - - + + diff --git a/help/en/html/apps/DecoderPro/CreateDecoderAdvanced.shtml b/help/en/html/apps/DecoderPro/CreateDecoderAdvanced.shtml index 5378cfb97db..864e1e110c8 100644 --- a/help/en/html/apps/DecoderPro/CreateDecoderAdvanced.shtml +++ b/help/en/html/apps/DecoderPro/CreateDecoderAdvanced.shtml @@ -461,7 +461,8 @@ and uses a special syntax: CV programming in the command station. "Capability" elements are used to tell DecoderPro about these. -

    Access to High CV addresses

    Certain command stations +

    Access to High CV addresses

    + Certain command stations can only access up to CV 256 or CV512. Some decoder manufacturers have built in mechanisms to bypass this. For example, some ESU decoders can use writes to various CVs to @@ -624,22 +625,39 @@ selects the different algorithm needed here. -

    Accessory Decoder Ops Mode

    Special programming - packets are used by certain accessory decoders to configure - their CVs from the DCC track signal. The capability to do - that is written: +

    Accessory Decoder Ops Mode

    + Certain accessory decoders require special + programming packets to configure their CVs from the DCC track signal. + The capability to do that is written:
             <capability>
                 <name>Ops Mode Accessory Programming</name>
    -            <parameter name="Address Type">decoder</name>
    +            <parameter name="Address Type">decoder</parameter>
    +            <parameter name="Delay">200</parameter>
             </capability>
     
    The "Address Type" parameter is optional:
    • If it is "decoder" or omitted, the current address is interpreted as a 9-bit accessory decoder address.
    • If it is "accessory" or "output", the current address is interpreted as an 11-bit accessory output address.
    • If it is "signal", the current address is interpreted as an 11-bit signal decoder address.
    • +
    • + If it is "altsignal", the current address is interpreted as an 11-bit signal decoder address, + using an alternative interpretation of + NMRA standard 9.2.1). +
    • +
    • + If it is "legacy", the current address is interpreted as a 9-bit address (as for "decoder") + but a "legacy" programming packet (as per Appendix A of + NMRA standard 9.2.1) + is sent. +
    -

    + The "Delay" parameter is optional and specifies a minimum delay (in milliseconds) + between successive writes. Some decoders will miss commands if the delay is too short. + If this is parameter is omitted, the default delay is 500 milliseconds. +

    Note that this only works for ops-mode writes; these particular NMRA DCC packets do not perform read operations, nor do they work in the service mode (programming @@ -670,6 +688,36 @@ selects the different algorithm needed here. NMRA standard 9.2.2.

    + +

    Ops Mode Delayed Programming

    +

    + Most locomotive decoders accept special programming packets + to configure their CVs from the DCC track signal (Programming on Main). +

    + However these packets take time to process and if subsequent packets are sent + too soon they can be missed. + The capability to do add a delay after programming each CV is written: +
    +        <capability>
    +            <name>Ops Mode Delayed Programming</name>
    +            <parameter name="Delay">500</parameter>
    +        </capability>
    +
    The "Delay" parameter specifies + a minimum delay (in milliseconds) between successive writes. + Some decoders miss commands if the delay is too short. + If this is parameter is omitted, the default delay is 500 milliseconds. +

    + Note that this only works for + ops-mode writes; these particular NMRA DCC packets do not perform + read operations, nor do they work in the service mode (programming track). +

    +

    + Note also that this particular capability only works for multi-function + decoders. Accessory decoders need to use the + Accessory Decoder Ops Mode + capability, which has its own "Delay" parameter. +

    +

    Indexed CV Access

    To access indexed CVs, include this diff --git a/help/en/html/apps/PanelPro/ShowPanel.shtml b/help/en/html/apps/PanelPro/ShowPanel.shtml index ac01785f8b6..52e765823be 100644 --- a/help/en/html/apps/PanelPro/ShowPanel.shtml +++ b/help/en/html/apps/PanelPro/ShowPanel.shtml @@ -7,7 +7,8 @@ "HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.17), see www.w3.org"> - JMRI: Displaying JMRI Panel Files + JMRI: Displaying JMRI Panel Files + - + + @@ -37,6 +39,9 @@ You open your panel file with a web browser, and can then read it, print it, copy and paste into a file of another form, etc.

    + screen shot of xml preview

    A large example of this is available as a PDF @@ -90,8 +95,8 @@

    Don't change the first line!

    For technical information on this, see the JMRI XML page. -

    + "../../doc/Technical/XmlUsage.shtml">JMRI XML page.

    + diff --git a/help/en/html/apps/PanelPro/images/PanelFileView.png b/help/en/html/apps/PanelPro/images/PanelFileView.png new file mode 100644 index 00000000000..7f7dc49585e Binary files /dev/null and b/help/en/html/apps/PanelPro/images/PanelFileView.png differ diff --git a/help/en/html/doc/Technical/GitFAQ.shtml b/help/en/html/doc/Technical/GitFAQ.shtml index 4481fa4cdcc..623d4edddbb 100644 --- a/help/en/html/doc/Technical/GitFAQ.shtml +++ b/help/en/html/doc/Technical/GitFAQ.shtml @@ -614,11 +614,15 @@ repository.
    -                git pull https://github.com/arnie/JMRI.git arnie-great-tool
    +                git remote add https://github.com/arnie/JMRI.git arnie
    +
    +                git fetch arnie arnie-great-tool
                     git checkout arnie-great-tool
     
    - where the 1st part of the "pull" is the - URL for Arnie's repository. + where the 1st part of the "remote add" is the + URL for Arnie's repository, and you just have to + do that command once to define "arnie" as an alias + you can use in "git fetch".
  • Now Bill can work with that code, and even change @@ -629,6 +633,9 @@ git commit -m"Fixed a bug in sternerstat handling" git push + which commits the changes and pushes them up + into Bill's repository on Github. +

    Then Arnie can merge those changes into his own copy with: diff --git a/help/en/html/doc/Technical/I8N.shtml b/help/en/html/doc/Technical/I8N.shtml index 42e8f40093f..78f83bad37f 100644 --- a/help/en/html/doc/Technical/I8N.shtml +++ b/help/en/html/doc/Technical/I8N.shtml @@ -427,6 +427,88 @@ using the new .properties files.

    If all is well, all the message text will have been translated to UPPER CASE. Anything you wrote that remains in lower case has not been completely internationalized. + +

    Bundle Keys Report

    +

    BundleKeysReport.py, located in the scripts (not jython) directory, +is used to analyse the bundle keys within a property file. The primary function is +to identify unused keys. The script is run using PanelPro Panels >> +Run Script... The output from the script is written to the Script +Output window. The run time will vary based on the number of keys to be checked +along with the position in the source hierarchy. It will range from several to many +seconds.

    + +

    Once a property file, normally the default/English file, is selected, all of the +classes within the package are scanned for each key in the file. if there are +more packages below the initial one, their classes are also scanned. This +covers the bundle hierarchy. Note: It is possible to get false +positive matches when a class is using a matching key but the class is using a +private property file.

    + +

    After the unused key list is built, the entire source tree is scanned for external +references to the selected property file. If the class containing the reference uses +any of the unused keys, those keys are removed from the unused key list. The jython +directory is also scanned for external references.

    + +

    After the scanning is done, a dialog box prompts to save the unused key list. If +desired, the list will be written with the selected location and name. +The default location will be the User Files Location.

    + +

    The final dialog box asks if the property files should be updated. If Yes is +selected, all of the property files in the bundle set are backed up. Each file is +then scanned for the unused keys. When one is found, the line is updated with +#NotUsed as a comment. If testing reveals that the key is +actually required, the comment can be removed. Note: If +the source tree is managed by Git, the backups will be included in the current +branch. Either move the backups or don't select them when doing a commit. + + +

    Class Keys Report

    +

    ClassKeysReport.py, located in the scripts (not jython) directory, +is used to identify the bundle keys used by a class. The script is run using +PanelPro Panels >> Run Script... The output from the +script is written to the Script Output window.

    + +

    When the script is started, a file selection dialog is displayed. Select either +a Java class file or a Java package directory. If a directory is selected, all +of the *.java files within the directory will be processed. The Bundle.java file +is excluded.

    + +

    For each file, the script scans for Bundle.getMessage( and +getString(. The first word after the +parenthesis is returned as the bundle key. A word is defined as the characters +a-z, A-Z, 0-9 and underscore. If the first word is a Locale reference, the +second word is returned.

    + +

    Here is a typical output line:

    +
    +   783, Search Type = Local, Key Type = Variable, Key = 'titleId', 	Text = addLogixFrame = new JmriJFrame(rbx.getString(titleId));
    +
    +Field List +
      +
    • The source code line number
    • +
    • Search Type +
        +
      • Local: getString, such as rbx.getString()
      • +
      • Bundle: getMessage()
      • +
      +
    • +
    • Key Type +
        +
      • String: A word wrapped in double quotes
      • +
      • Variable: A plain word
      • +
      +
    • +
    • The key
    • +
    • The source code line
    • +
    +

    Only the variable key types are displayed in the script output window.
    +Note: A key that contains non-word characters will be truncated +and assigned the Variable key type. +

    + +

    When the script is done scanning, it provides an option to export the entire +key list to a CSV file.

    + diff --git a/help/en/html/doc/Technical/gitdeveloper.shtml b/help/en/html/doc/Technical/gitdeveloper.shtml index df5fe08de67..2fe96b2ef4a 100644 --- a/help/en/html/doc/Technical/gitdeveloper.shtml +++ b/help/en/html/doc/Technical/gitdeveloper.shtml @@ -257,7 +257,10 @@ To push the current branch and set the remote as upstream, use -

    Submit a Pull Request

    The last step is to make your +

    Submit a Pull Request

    + + Once your changes are complete and ready to go, + the last step is to make your changes, already visible in your GitHub repository, known to the JMRI maintainers so that one of them can pull it into the main JMRI repository. To do that, you create and submit a @@ -322,7 +325,7 @@ To push the current branch and set the remote as upstream, use If you have any questions about the use of those on your PR, you can add a comment to the PR and somebody will get back to you. -
  • If there are any problems, you can make additional edits, +
  • If there are any problems found in the CI process, you can make additional edits, commit those files to the same branch, and push them to your repository. That'll get them included in an updated version of your PR automatically, rerun the tests, etc. diff --git a/help/en/html/hardware/loconet/Addressing.shtml b/help/en/html/hardware/loconet/Addressing.shtml index 6704d2efb54..7ecaf81e649 100644 --- a/help/en/html/hardware/loconet/Addressing.shtml +++ b/help/en/html/hardware/loconet/Addressing.shtml @@ -608,6 +608,31 @@ use both, you should skip version 1 by providing just the LOCONETSV2MODE option.

    + +

    Addressing Op Switches in Digitrax boards

    +

    (The following was first fully available in JMRI + 4.9.7. Versions before that may not be complete).

    + +

    Digitrax boards like the PM4, BDL168, SE8c and + DS64 use a special protocol to program their Op Switches. + If you specify a programming mode of LOCONETBDOPSWMODE, + DecoderPro will use that protocol.

    + +

    CVs are specified with the format "113.3", + where the part after the period is the specific + Op Switch number, and the part before is + board-specific:

    +

      +
    • 0x70 - 112 - PM4 +
    • 0x71 - 113 - BDL16 +
    • 0x72 - 114 - SE8 +
    • 0x73 - 115 - DS64 +
    + + +
    +

    LocoNet® is a registered trademark of Digitrax, Inc.

    diff --git a/help/en/html/hardware/loconet/Uhlenbrock.shtml b/help/en/html/hardware/loconet/Uhlenbrock.shtml index adee93cc3e3..fccba8d12fc 100644 --- a/help/en/html/hardware/loconet/Uhlenbrock.shtml +++ b/help/en/html/hardware/loconet/Uhlenbrock.shtml @@ -30,40 +30,44 @@

    Hardware Support: Uhlenbrock Intellibox

    JMRI can communicate with an Uhlenbrock Intellibox via the - Intellibox built-in serial port, the Intellibox-II USB port - and the LocoNet® protocol. This page provides details on - the possibilities.

    + Intellibox built-in serial port, the Intellibox II/Basic USB port + and the LocoNet™ protocol.
    + This page provides details on the possibilities.

    +

    Supported Hardware

    Command Station

      -
    • Intellibox-I
    • - -
    • Intellibox-II
    • +
    • Intellibox
    • +
    • Intellibox IR
    • +
    • Intellibox Basic
    • +
    • Intellibox II
    • IB-Com
    • Fleischmann Twin Center (software version 1.1 or later)
    • -
    + +

    Limitations

    • Full support of Intellibox-II has been added to JMRI in version 3.11.1 and up. It is not available in previous versions 3.10 and below.
    • -
    + +

    Connecting

    Direct serial connection

    This section is applicable to the - "Intellibox-I", which includes + "Intellibox-I" group, which includes
    • Intellibox ref. 65000
    • @@ -149,9 +153,9 @@ LocoNet, using any of available LocoNet connection methods.

      -

      Intellibox command stations are divided into two types, - called "Intellibox-I":

      +

      Intellibox command stations are divided into two groups:

      +

      "Intellibox-I (Serial)":

      • Intellibox ref. 65000
      • @@ -159,7 +163,9 @@
      • Fleischmann Twin Center (software version 1.1 or later)
      • -
      and "Intellibox-II": +
    + +

    "Intellibox-II (USB)":

    • Intellibox II ref. 65100
    • @@ -172,17 +178,30 @@

      Start the JMRI program and configure it to:

        -
      • Select "Digitrax" as the System Manufacturer for your - connection
      • +
      • Select "Uhlenbrock" as the System Manufacturer for your + connection.
      • Select the appropriate System Connection for your - hardware.
      • + hardware, either Intellibox-I or -II. + +
      • Select the serial port used for this connection.
      • + +
      • The single corresponding Command Station (group) choice will be selected + automatically.
      • + +
      • If diseried, adjust the system prefix and connection user name.
        + Note that an existing panel contains a certain prefix and changing this + option here will lead to an error upon loading such a panel.
      • + +
      +

      Save and restart.

      + + +

      JMRI Uhlenbrock Tools

      -
    • Select either the "Intellibox-I" or "Intellibox-II" as - the Command Station Type.
    • -
    Save and restart. +

    The Intellibox Command Stations can't be configured over their + LocoNet connection. Please use the keyboard and consult the manual.

    -

    JMRI Uhlenbrock Tools

    N/A
    diff --git a/help/en/html/tools/signaling/SimpleSignalExample.shtml b/help/en/html/tools/signaling/SimpleSignalExample.shtml index e59f8eee09c..d754df805f8 100644 --- a/help/en/html/tools/signaling/SimpleSignalExample.shtml +++ b/help/en/html/tools/signaling/SimpleSignalExample.shtml @@ -9,7 +9,8 @@ JMRI: Simple Signal Logic Example - + + - + + @@ -39,7 +41,7 @@

    This page provides an example of using the JMRI Simple Signal Logic (in short: SSL) to control Signals Heads - connected to a Digitrax SE8c board. This also works for other + connected to a Digitrax SE8C board. This also works for other types of single head hardware signals, including LEDs connected to stationary decoders, C/MRI systems, etc.
    Please try our ready-to-use example @@ -173,9 +175,9 @@ Red, Red and Yellow respectively.

  • To learn how signals are configured in SSL, open the "Simple Signal Logic" item in the Tools menu.+Simple Signal Logic Window In the pane that opens, enter a Signal (Head) Name, e.g. "Section 5A", in the top text field and hit the Return key. You should get @@ -267,7 +269,7 @@ Red, Red and Yellow respectively.
  • You can also use the "Add..." button on the Turnout Table to open a pane to enter new Turnouts.
  • -
  • The "Turnout Control..." pane in the Tools menu +
  • The "Turnout Control..." pane, found in the Tools menu, also creates a new Turnout entry for every turnout address you operate.
  • @@ -275,20 +277,19 @@ Red, Red and Yellow respectively.
  • If you have Signal Heads connected to "turnout-type" outputs, tell the program about those Turnout addresses too - (SE8c users skip this step).
  • + (SE8C users skip this step). +
  • Tell PanelPro - how your Signal Heads are addressed: Signal Head Table Figure
      -
    • From the Tools menu, open the "Tables" > - "Signals" > "Signal Heads" tool.
    • +
    • From the PanelPro Tools menu, open the Tables + > Signals > Signal Heads tool.
    • Click the "Add..." @@ -353,9 +354,9 @@ Red, Red and Yellow respectively. Logic (SSL) Tool.
      Open the "Simple Signal Logic" tool from the "Tools" menu. You should get a pane with a number of fields: - +Simple Signal Logic Window
        diff --git a/help/en/images/SslExample.png b/help/en/images/SslExample.png new file mode 100644 index 00000000000..5b1a2c21522 Binary files /dev/null and b/help/en/images/SslExample.png differ diff --git a/help/en/package/jmri/jmrit/blockboss/BlockBossFrame.shtml b/help/en/package/jmri/jmrit/blockboss/BlockBossFrame.shtml index 3615effefdb..27bca70ed26 100644 --- a/help/en/package/jmri/jmrit/blockboss/BlockBossFrame.shtml +++ b/help/en/package/jmri/jmrit/blockboss/BlockBossFrame.shtml @@ -8,7 +8,7 @@ JMRI: Simple Signal Logic - +
        -

        JMRI: Simple Signal Logic

        +

        JMRI: Simple Signal Logic

        +

        Contents

        The documentation below describes Signaling with JMRI @@ -41,8 +41,9 @@

      • Getting Started
      • More information
      • -
      +
    +

    Introduction

    Simple Signal Logic (SSL) provided the first method to @@ -56,7 +57,7 @@ Don't use the SSL Tool when you have already built Signal Masts and the more advanced Signal Mast Logic in the same Panel/Configuration file.
    - SSL has no tool to delete an SSL entry or provide an overview + SSL has no option to delete an SSL entry or provide an overview of all SSL rules other than looking at the XML file of your Panel, so make notes as you add SSL items and back up your configuration XML file.

    @@ -73,9 +74,9 @@ means for setting up basic signals in an intuitive manner, without the user having to be familiar with all of the logic necessary to account for the different Signal Aspects. - +Simple Signal Logic panel figure

    The Simple Signal Logic Tool allows you to configure JMRI @@ -84,21 +85,21 @@ each Signal Head on:

    + diff --git a/help/en/package/jmri/jmrit/blockboss/SimpleSignalExample.shtml b/help/en/package/jmri/jmrit/blockboss/SimpleSignalExample.shtml index 96a8b6ed0aa..0ed7598c3d8 100644 --- a/help/en/package/jmri/jmrit/blockboss/SimpleSignalExample.shtml +++ b/help/en/package/jmri/jmrit/blockboss/SimpleSignalExample.shtml @@ -6,7 +6,8 @@ - JMRI: Simple Signal Logic Example + JMRI: Simple Signal Logic Example + Go to the Simple - Signal Logic example. + Signal Logic example.

    -

    + diff --git a/help/en/package/jmri/jmrit/catalog/ImageIndex.png b/help/en/package/jmri/jmrit/catalog/ImageIndex.png index 68f4e014b79..e420ef1a36c 100644 Binary files a/help/en/package/jmri/jmrit/catalog/ImageIndex.png and b/help/en/package/jmri/jmrit/catalog/ImageIndex.png differ diff --git a/help/en/package/jmri/jmrit/catalog/ImageIndex.shtml b/help/en/package/jmri/jmrit/catalog/ImageIndex.shtml index 9a0a69105b8..33c94b34bc7 100644 --- a/help/en/package/jmri/jmrit/catalog/ImageIndex.shtml +++ b/help/en/package/jmri/jmrit/catalog/ImageIndex.shtml @@ -1,6 +1,5 @@ - @@ -20,7 +19,8 @@ - + + @@ -53,8 +53,8 @@ have installed after using the Open File System Directory menu item in one of the Icon Editor windows and pressed the Add to Catalog button there. (The "Add to - Catalog" button does not appear in this window.) Below the - trees is a "Preview" pane that displays the images found in + Catalog" button does not appear in this window.) Next to each + tree is a "Preview" pane that displays the images found in any node that you have selected from one of the above trees. "Nodes" are the folder icons that appear when you click on the handle to the left of a folder icon. Clicking on a node @@ -64,14 +64,14 @@

    The "Preview" pane has a label that states how many image files are referenced in the node. Beneath each image (icon) is a label that states the "scale" at which the image is - displayed. Below the icons are radio buttons that provide - three background for the icons. This may help you determine - what parts of the icon are opaque and what parts are - transparent.

    + displayed. Below the icons are "View on:" combo boxes + that allow you to choose a background for the icons. + This may help you determine what parts of the icon are + opaque and what parts are transparent.

    The right side is the Image Index you may edit. It - is similar to the left pane in that the top panel is the tree - of the Index you are creating. Likewise, the bottom panel + is similar to the left pane in that the left half shows the tree + of the Index you are creating. Likewise, the right half displays the images found in any node of the tree that you select. Initially, there will be just one node labeled "Image Index". You are able to add additional nodes to this node by @@ -79,28 +79,36 @@

    The Menus

    -

    The Find Icons menu has two items:

    +

    The File menu shown with the Create/Edit Image Index + pane contains three items:

      -
    • Store ImageIndex. This stores a permanent record +
    • Store Image Index. This stores a permanent record of the Image Index that will be restored the next time the Panel Editor is opened. The Image Index will be included in - the Catalog trees used by the Icon Editors.
    • + the Catalog trees used by the Icon Editors. +
    • Open a File System Directory. This opens a file - chooser dialog where you may open any directory that that + chooser dialog where you may open any directory that has image files. To open the directory, select any image - file contained in it and a window will attempt to display - all the image files found in the directory. - -

      See Icon - Editors for more details on this menu item.

      + file contained in it and a pane will attempt to display + all the image files found in that directory. + See Icon + Editors for more details on this menu item. -

      The icons displayed in the "preview" panel of any +
      The icons displayed in the "preview" panel of any directory window opened from this menu item can be added to the Image Index. How to do this is described - below.

      + below. +
    • + +
    • + Search File System for Icons. Opens a file chooser + dialog to start a search for image files. A panel filled with + all found image files is shown as the search finishes.
      + Drag one of the found icons to your Catalog.
    @@ -154,11 +162,12 @@ Index node.
  • -

    Note: the "preview" panel will only show these +

    Note: the "preview" pane will only show these changes after leaving the node and then returning to the node.

  • - + + diff --git a/help/en/package/jmri/jmrit/display/AddPanel2.png b/help/en/package/jmri/jmrit/display/AddPanel2.png deleted file mode 100644 index 8b602ac58f7..00000000000 Binary files a/help/en/package/jmri/jmrit/display/AddPanel2.png and /dev/null differ diff --git a/help/en/package/jmri/jmrit/display/ControlPanelEditor.shtml b/help/en/package/jmri/jmrit/display/ControlPanelEditor.shtml index 40e7d3d0528..e0c709d18f6 100644 --- a/help/en/package/jmri/jmrit/display/ControlPanelEditor.shtml +++ b/help/en/package/jmri/jmrit/display/ControlPanelEditor.shtml @@ -66,7 +66,7 @@

    Changing the View between Editors

    In either editor, when in edit mode, the last item in the File menu is - Change view to "..." ("..." being the other editor). + Change view to "xx" ("xx" being the other editor). Selecting this item switches the view from one editor mode to the other editor mode. @@ -75,13 +75,14 @@ Panel Editor does not. In Panel Editor the Edit menu opens an edit window. In Control Panel Editor the Edit menu adds three additional menus to the panel: File, - Options, Zoom, AddItems, Circuit + Options, Zoom, Add Items, Circuit Builder and Draw Shapes.

    Control Panel Editor Menus

    When in Edit mode, the following menus are displayed. -

    File Menu

    The File menu changes it items +

    File Menu

    + The File menu changes its items between edit mode and operating mode. In edit mode the items are the same as the items in the File menu of the Panel Editor's edit window with a few additional items. They are: @@ -99,7 +100,7 @@
  • Change View to Panel Editor
  • -
  • Delete This Panel...
  • +
  • Delete this Panel...
  • Close Editor
  • @@ -164,7 +165,8 @@

    The menu also has items for setting Panel Scrollbars and to Show Tooltips.

    -

    Zoom Menu

    The Zoom(percentage)... item will +

    Zoom Menu

    + The Zoom(percentage)... item will enlarge or reduce the panel size.

    The Zoom to Fit item will enlarge or reduce the @@ -178,15 +180,19 @@ panel window, then you should repeat "Zoom to Fit" to resize the display to fit the new panel window dimensions.

    -

    AddItems Menu

    The Item Palette menu item opens +

    Add Items Menu

    + The Item Palette menu item opens a tabbed window which allows you to add item icons to the panel. Each item type has a tab in the window. Adding items is done by drag and drop. Iconic items may have multiple sets of icons to choose from. Icon sets may be customized and added or deleted to suit the user. Details may be found at - The Item Palette. Note that - the Item Palette can also be opened with the accelerator key, - Control P. + The Item Palette help.
    + Note that the Item Palette can also be opened with the + accelerator key, Control P. The icons are displayed on the + background of the last editor to call the Item Palette. + Once visible, use the bottom of the pane use the "Show on:" + combo box to slect a different background.

    The Palette in Control Panel Editor does not support the Slip/3-Way/Scissor turnout icons that are available @@ -211,28 +217,29 @@ These menu items are described in Warrants. . -

    Circuit Builder

    When two or more Occupancy Blocks are - defined this menu appears. The items under this menu provide +

    Circuit Builder

    +

    This menu appears when two or more Occupancy Blocks are + defined. The items under this menu provide a graphic user interface (GUI) for defining Occupancy Blocks, Portals and Paths, that is, a track circuit. Descriptions of - the menu items are found in Circuit Builder. + the menu items are found in + Circuit Builder.

    -

    Draw Shapes

    This menu allows drawing of various - geometric shapes. +

    Draw Shapes

    + This menu allows drawing of various geometric shapes.
      -
    • Draw Rectangle .
    • +
    • Draw Rectangle
    • -
    • Draw Round Rectangle .
    • +
    • Draw Round Rectangle
    • -
    • Draw Polygon .
    • +
    • Draw Polygon
    • -
    • Draw Circle .
    • +
    • Draw Circle
    • -
    • Draw Ellipse .
    • +
    • Draw Ellipse
    • -
    • Disable Selecting Shapes .
    • +
    • Disable Selecting Shapes
    With the exception of Draw Polygon, each of the draw items is make with a mouse click and drag. Polygon shapes are made with a sequence of mouse clicks and the polygon @@ -251,11 +258,12 @@ mode. This feature can be used to mask and unmask help information to your panel or to highlight items.

    -

    Mouse operation in Control Panel Editor

    Control Panel - Editor does not implement the rollover highlighting found in - Panel Editor. +

    Mouse operation in Control Panel Editor

    + Control Panel Editor does not implement the rollover + highlighting found in Panel Editor. -

    Selection

    In Control Panel Editor selection is done +

    Selection

    + In Control Panel Editor selection is done with a simple click. Items are deselected with Control click

    When items are stacked, Shift-click will select the @@ -265,7 +273,8 @@ item above the background. Control-click over only the background will select the background icon.

    -

    Multiple Selection

    As with Panel Editor, a selection +

    Multiple Selection

    + As with Panel Editor, a selection group can be made using the "selection fence" - a dotted red rectangle that will select all the items completely within the fence. If the Shift key is @@ -284,7 +293,8 @@ by dragging it with the control key held down.

    Duplicating Selections Within Control Panel - Editor

    Copying an item or selection group is done by + Editor + Copying an item or selection group is done by bringing up the popup for one of the selected items. When the Duplicate popup menu item is clicked, a Copy of the selection group is made on top of the original selections. @@ -293,18 +303,19 @@ original postion. The copy procedure can be repeated on the newly positioned copy to continue to make more copies. -

    Item Popups in Control Panel Editor

    Right click - (meta-click on Mac or Linux) brings up the popup menu for the - item. +

    Item Popups in Control Panel Editor

    + Right click (meta-click on Mac or Linux) brings up the + popup menu for the item.

    Hold the Control key down to open the popup menu for a background item.

    -

    Edit Text Attributes

    The Edit Text Attributes - popup item opens a dialog to set any of the item's text - attributes. +

    Edit Text Attributes

    + The Edit Text Attributes popup item opens a dialog + to set any of the item's text attributes. -

    Multiple Selection Editing

    When a popup menu item is +

    Multiple Selection Editing

    +

    When a popup menu item is invoked from an item that is a member of a selection group, all of the edited values that were made in the popup are applied to all members of the selection group if that value @@ -312,7 +323,8 @@ changed on one of the items in the selection group then the font size is changed in all items in the group. If say, a fast clock were included in this group, then no change would - be made to the clock. + be made to the clock.

    + diff --git a/help/en/package/jmri/jmrit/display/IconAdder.shtml b/help/en/package/jmri/jmrit/display/IconAdder.shtml index 49b47572863..2684a28dce4 100644 --- a/help/en/package/jmri/jmrit/display/IconAdder.shtml +++ b/help/en/package/jmri/jmrit/display/IconAdder.shtml @@ -7,7 +7,7 @@ "HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.17), see www.w3.org"> jmri: Icon Editor Help - +

    The Icon Editors

    -

    Contents of the Icon Editors

    Contents of the Icon Editors

    Five of the Icon Editors: (Right Hand Turnout, Left Hand @@ -75,7 +75,7 @@ Panel.

    Pressing the Change Icon Button

    + "images/AddPanel2.png" align="right">

    Pressing this button will add a pane labeled Catalog to the window. It will show one or more @@ -94,10 +94,11 @@ indicates the icon is displayed at full size. If a large image file had been found, the scale might be 0.25:1 to indicate that the display is 1/4 the actual size of the image - that could be transferred to the Panel. Below the icons are - radio buttons that allow you to adjust the background to the - icons. This may help in determining what parts of the icon - are opaque and what parts are transparent.

    + that could be transferred to the Panel. Below the icons is a + "View On:" combo box that allows you to choose the background to + the icons. This may help in determining what parts of the icon + are opaque and what parts are transparent. Initially, the current + Panel background color is used.

    The Catalog pane will always display at least one tree titled "Program Directory". This is the resource directory @@ -263,7 +264,8 @@ later. - + + diff --git a/help/en/package/jmri/jmrit/display/ItemPalette.shtml b/help/en/package/jmri/jmrit/display/ItemPalette.shtml index 32ee8dcb1b2..1c70ddaf754 100644 --- a/help/en/package/jmri/jmrit/display/ItemPalette.shtml +++ b/help/en/package/jmri/jmrit/display/ItemPalette.shtml @@ -25,7 +25,8 @@

    -

    The Item Palette

    The Item Palette is used to +

    The Item Palette

    + The Item Palette is used to place icons and text onto Control Panel Editor panels. The palette is a tabbed window with tabs for each item type. The common method all items use to add an item to a panel is @@ -36,14 +37,17 @@ row from a table to associate that particular device with the icon - and then drag the icon to the panel. -

    Iconic Items

    For those items using icons, multiple +

    Iconic Items

    + For those items using icons, multiple sets of icons are offered by the Item Palette. In each of these cases several different icon sets are provided by default. Radio buttons are used to select an icon set.For example, under the sensor tab you may have sets of large jewels, small jewels, each size with several sets with different colors for active and inactive - e.g. red-green, - yellow-dark, etc. + yellow-dark, etc.
    + The individual icons are displayed in the preview on the + background of the last editor to open the Item Palette.

    The Show Icons button displays all the icons in the selected set.

    diff --git a/help/en/package/jmri/jmrit/display/LayoutEditor.shtml b/help/en/package/jmri/jmrit/display/LayoutEditor.shtml index bb776a3047f..eaec3f6210d 100644 --- a/help/en/package/jmri/jmrit/display/LayoutEditor.shtml +++ b/help/en/package/jmri/jmrit/display/LayoutEditor.shtml @@ -17,7 +17,8 @@ - + + @@ -293,9 +294,9 @@ horizontally on your panel.
    To make maximum use of these tools, design your panel with turnouts oriented vertically or horizontally (the orientation does not have to be exact, just - mostly vertical or mostly horizontal).

    + mostly vertical or mostly horizontal).

    +

    Using the Layout Editor Tool Bar

    The tool bar is used to add items to a panel, and to @@ -433,10 +434,9 @@ below, along with which created items they apply to and whether they are optional or required.

    -

    - Since 4.7.3: - Most of the toolbar's text fields have now been replaced with - combo boxes. A combo box combines a text field +

    Since 4.7.3 + Most of the toolbar's options are set using combo boxes. + A combo box combines a text field with a drop down list. You may ether type text into the text field or select an item from the drop down list. Selecting an item from the drop down list will copy it @@ -548,9 +548,9 @@

    When pressed, the Change Icons... button on the tool bar brings up an icon editor for either sensor icons, signal mast icons, signal head icons, or general purpose icons, - depending uponmwhether Sensor Icon, Signal Mast Icon, - Signal Head Icon, or Icon Label is checked. - If none of these items is checked, the button press is ignored. + depending upon whether Sensor Icon, Signal Mast Icon, + Signal Head Icon, or Icon Label is checked in the toolbar. + If none of these items is checked, the menu choice is ignored. For Signal Mast Icons and Signal Head Icons, the Layout Editor defaults to the left-facing short icons found at "resources/icons/smallschematics/searchlights/". If you are @@ -559,11 +559,11 @@ icons have black borders.

    -

    Using the Layout Editor Floating Toolbox

    since 4.7.2 -

    The classic toolbar resides to the top or side of the panel. The - toolbox floats on the screen and can be moved around. It provides + +

    The classic toolbar resides to the top or side of the panel. The + toolbox floats on the screen and can be moved around. It provides all of the same functions as the toolbar.

    The radio buttons, checkboxes, combo boxes and labels are grouped @@ -573,9 +573,9 @@ of the related panel.

    Since the Toolbox is a standard window, it contains the Close - and Minimize buttons. The Close button hides the toolbox, - it does not delete it. To show it again, select the toolbox name - from the Window menu. The minimize button behaves in the + and Minimize buttons. The Close button hides the toolbox, + it does not delete it. To show it again, select the toolbox name + from the Window menu. The minimize button behaves in the traditional manner with the toolbox becoming an icon on the operating system task bar. Use the Window menu or click on the task bar icon to make it visible. @@ -648,7 +648,6 @@ determines the sort order -

  • Allow Repositioning - When this item is checked, @@ -1122,7 +1121,7 @@ Zoom selected. Since zooming is temporary, the zoom factor is not preserved when a panel is saved.

    -

    As of 4.7.3 the Layout Editor Zoom +

    Since 4.7.3The Layout Editor Zoom is saved and restored per-system. Also the mouse wheel (with alt-(option-)key) may be used to zoom in and out.

    @@ -1271,8 +1270,9 @@ These tools are briefly described above under Using Layout Editor's Tools Menu, and are discussed in detail on the help page of the tool's dialog - pane.

    + pane.

    +

    Turnouts

    Layout Editor supports six different types of turnouts @@ -1401,8 +1401,9 @@ 3, or Block 4 entries are blank, the default block is used. Block connection points are numbered 1, 2, 3 and 4, proceeding from the upper left connection point in a - clockwise direction.

    + clockwise direction.

    +

    Track Segments and Connection Points

    A Track Segment is a two ended piece of track between @@ -1771,8 +1772,9 @@ have wheels and track clean, and to have enough cars in each train with current drawing wheels to ensure a block doesn't loose detection before the train enters the next - block.

    + block.

    +

    Tips

    Because of the way a Layout Editor panel is refreshed, the @@ -1925,7 +1927,7 @@ actually installing them on your layout.

    Back to the - PanelPro help page. + PanelPro help page.

  • diff --git a/help/en/package/jmri/jmrit/display/MultiSensorIconAdder.shtml b/help/en/package/jmri/jmrit/display/MultiSensorIconAdder.shtml index 08839ae305b..729bb382b54 100644 --- a/help/en/package/jmri/jmrit/display/MultiSensorIconAdder.shtml +++ b/help/en/package/jmri/jmrit/display/MultiSensorIconAdder.shtml @@ -17,7 +17,8 @@ - + + @@ -37,8 +38,8 @@ and the Image Index Editor page for details on their use.

    -

    Contents of the MultiSensor Icon Editor

    +

    Contents of the MultiSensor Icon Editor

    +

    The icons in the MultiSensor Icon Editor differ only in that there are several "active" icons. Each corresponds to a @@ -56,8 +57,8 @@

    When all the active icons are assigned sensors, the Add to Panel button will become active and it can be pressed - to install the Multisensor into the Panel. -

    + to install the Multisensor into the Panel.

    + diff --git a/help/en/package/jmri/jmrit/display/PanelEditor.shtml b/help/en/package/jmri/jmrit/display/PanelEditor.shtml index 08d849a9676..14a6c7522b9 100644 --- a/help/en/package/jmri/jmrit/display/PanelEditor.shtml +++ b/help/en/package/jmri/jmrit/display/PanelEditor.shtml @@ -17,7 +17,8 @@ - + + @@ -27,7 +28,7 @@

    The Panel Editor

    -


    +


    A Panel is a set of Icons representing various components of a layout. Some of the Icons available in JMRI include Turnouts, Signals Masts and Sensors. You can include a @@ -68,7 +69,7 @@ around after inserting it, but you currently can't edit the text later. -

  • A dropdown menu where you may choose the type of icon @@ -99,7 +100,8 @@
  • Add Fast Clock
  • Add Icon (unassociated to any JMRI device)
  • - In most cases, selecting one of these items will + +

    In most cases, selecting one of these items will open a window from which icons or values can be chosen. For the items referring to a JMRI device (e.g. turnout, sensor, etc.) a pick list of the available devices is @@ -109,7 +111,7 @@ value of item into the panel. The Background item provides images for the background of the panel. Further details on using these windows are described on the - Icon Editors page. + Icon Editors page.

    The two choices for icons that do not open windows are RPS Reporter and Fast Clock. These items install their @@ -347,7 +349,7 @@ LocoNet system, you'd refer to a LocoNet Turnout as LT13; a LocoNet Sensor as LS21, etc.

    Back to the - PanelPro help page. + PanelPro help page.

    diff --git a/help/en/package/jmri/jmrit/display/SetSignalsAt3WayTurnout.shtml b/help/en/package/jmri/jmrit/display/SetSignalsAt3WayTurnout.shtml index 2c9301b19b2..dfa1ce50dba 100644 --- a/help/en/package/jmri/jmrit/display/SetSignalsAt3WayTurnout.shtml +++ b/help/en/package/jmri/jmrit/display/SetSignalsAt3WayTurnout.shtml @@ -44,7 +44,7 @@

    Six signal heads may be placed around the 3-way turnout as shown below:

    The turnout at the throat, is referred to as Turnout diff --git a/help/en/package/jmri/jmrit/display/3_WayTurnout.jpg b/help/en/package/jmri/jmrit/display/images/3_WayTurnout.jpg similarity index 100% rename from help/en/package/jmri/jmrit/display/3_WayTurnout.jpg rename to help/en/package/jmri/jmrit/display/images/3_WayTurnout.jpg diff --git a/help/en/package/jmri/jmrit/display/AddPanel.png b/help/en/package/jmri/jmrit/display/images/AddPanel.png similarity index 100% rename from help/en/package/jmri/jmrit/display/AddPanel.png rename to help/en/package/jmri/jmrit/display/images/AddPanel.png diff --git a/help/en/package/jmri/jmrit/display/images/AddPanel2.png b/help/en/package/jmri/jmrit/display/images/AddPanel2.png new file mode 100644 index 00000000000..038c73b9346 Binary files /dev/null and b/help/en/package/jmri/jmrit/display/images/AddPanel2.png differ diff --git a/help/en/package/jmri/jmrit/display/PanelEditor.png b/help/en/package/jmri/jmrit/display/images/PanelEditor.png similarity index 100% rename from help/en/package/jmri/jmrit/display/PanelEditor.png rename to help/en/package/jmri/jmrit/display/images/PanelEditor.png diff --git a/help/en/package/jmri/jmrit/display/PanelEditor2.png b/help/en/package/jmri/jmrit/display/images/PanelEditor2.png similarity index 100% rename from help/en/package/jmri/jmrit/display/PanelEditor2.png rename to help/en/package/jmri/jmrit/display/images/PanelEditor2.png diff --git a/help/en/package/jmri/jmrit/signalling/EntryExitFrame.shtml b/help/en/package/jmri/jmrit/entryexit/EntryExitFrame.shtml similarity index 99% rename from help/en/package/jmri/jmrit/signalling/EntryExitFrame.shtml rename to help/en/package/jmri/jmrit/entryexit/EntryExitFrame.shtml index a008d429da9..bf678d8d89e 100644 --- a/help/en/package/jmri/jmrit/signalling/EntryExitFrame.shtml +++ b/help/en/package/jmri/jmrit/entryexit/EntryExitFrame.shtml @@ -27,6 +27,7 @@

    +

    JMRI: Entry/Exit (NX)

    Overview

    The Entry/Exit system uses Sensors assigned to @@ -225,8 +226,9 @@ that the blocks are made Occupied, then Unoccupied in the correct order, leaving the last block Occupied, thus simulating a train passing through the interlock. To do this, reselect the - route and select "Clear Down". + route and select "Clear Down".

    +
    diff --git a/help/en/package/jmri/jmrix/nce/boosterprog/BoosterProgPanel.shtml b/help/en/package/jmri/jmrix/nce/boosterprog/BoosterProgPanel.shtml index aff4072e7ec..cb00bf6ae50 100644 --- a/help/en/package/jmri/jmrix/nce/boosterprog/BoosterProgPanel.shtml +++ b/help/en/package/jmri/jmrix/nce/boosterprog/BoosterProgPanel.shtml @@ -1,6 +1,5 @@ - diff --git a/help/en/webindex.shtml b/help/en/webindex.shtml index f86a2a00dd6..348a5ef6974 100644 --- a/help/en/webindex.shtml +++ b/help/en/webindex.shtml @@ -618,7 +618,7 @@
  • -Switchboard Editor +Switchboard Editor
    • diff --git a/help/en/webtoc.shtml b/help/en/webtoc.shtml index 54c3ba69be4..6159899cf6f 100644 --- a/help/en/webtoc.shtml +++ b/help/en/webtoc.shtml @@ -359,24 +359,6 @@ -
    • -Reading Data -
        -
      • - - -
      • -Writing to Decoder -
          -
        • - - -
        • -Saving to a File -
            -
          • - -
          • What Next?
              diff --git a/help/fr/html/tools/Sensors.shtml b/help/fr/html/tools/Sensors.shtml index a75f2301f99..88ff66497da 100644 --- a/help/fr/html/tools/Sensors.shtml +++ b/help/fr/html/tools/Sensors.shtml @@ -16,11 +16,10 @@ + - > > - >
              diff --git a/help/fr/html/tools/Signals.shtml b/help/fr/html/tools/Signals.shtml index 2907b327066..cb563294747 100644 --- a/help/fr/html/tools/Signals.shtml +++ b/help/fr/html/tools/Signals.shtml @@ -22,7 +22,7 @@ JMRI: Signal Head Documentation -
              +
              @@ -42,6 +42,5 @@ Toute la documentation au sujet de la Signalisation JMRI est disponible sur la
              -
              diff --git a/help/fr/html/tools/signaling/Sidebar b/help/fr/html/tools/signaling/Sidebar index ca48bc7a2d0..100be46d683 100644 --- a/help/fr/html/tools/signaling/Sidebar +++ b/help/fr/html/tools/signaling/Sidebar @@ -1,4 +1,3 @@ - @@ -12,15 +11,15 @@

              Signalisation

              -
              Ajout de signaux à votre réseau avec JMRI. +
              Ajout de signaux à votre réseau avec JMRI.
              @@ -38,7 +37,7 @@
            • Variables Mémoire
            • Itinéraires
            • LItinéraires -
            • Sections +
            • Sections
            • Logix
            • Horloges Rapides
            • Compteur diff --git a/help/fr/html/tools/signaling/SimpleSignalExample.shtml b/help/fr/html/tools/signaling/SimpleSignalExample.shtml index 5f63e8dda2f..d74a60aaff7 100644 --- a/help/fr/html/tools/signaling/SimpleSignalExample.shtml +++ b/help/fr/html/tools/signaling/SimpleSignalExample.shtml @@ -1,12 +1,13 @@ - + - JMRI: Simple Signal Logic Example + JMRI: Simple Signal Logic Example +
              -

              @@ -122,7 +122,9 @@ canton sur le côté droit (Canton 1), les messages sont les suivants: Les trois messages de commutation fixent les signaux 5B, D et 4C au Rouge, Rouge et Jaune, respectivement.
            • Pour apprendre comment les signaux sont configurés en SSL, ouvrez l'élément -"Logique Signal Simple" dans le menu Outils..Simple Signal Logic Window +"Logique Signal Simple" dans le menu Outils..Simple Signal Logic Window Dans le volet qui s'ouvre, entrez un Nom de Signal ( Feu ), par exemple "Section 5A" en haut du champ de texte et frappé Retour. Vous devriez obtenir quelque chose comme l'image vers la droite (cliquez pour l'agrandir en taille réelle). @@ -193,7 +195,9 @@ signalez aussi au programme l'existence de ces adresses aiguillage. (Utilisateur
            • Renseignez PanelPro à propos de l'adressage de vos signaux. -<Signal Head Table Figure +<Signal Head Table Figure
              • Dans le menu Outils, ouvrez l'outil "Tableau Feu de Signalisation".
              • Cliquez sur le bouton @@ -238,7 +242,9 @@ signalez aussi au programme l'existence de ces adresses aiguillage. (Utilisateur
              • Configurer votre logique de signalisation en utilisant l'Outil "Logique Signal Simple".
                Ouvrez l'outil "Logique Signal Simple" depuis le menu "Outils". Vous obtiendrez un volet avec un nombre de champs: - Simple Signal Logic Window + Simple Signal Logic Window
                • Dans la case du haut, entrez le nom du Feu de Signalisation que vous souhaitez configurer.
                • Les boutons radio ci-dessous qui sélectionnent une des quatre utilisations possibles diff --git a/help/fr/images/SE8cExampleLogic.png b/help/fr/images/SE8cExampleLogic.png deleted file mode 100644 index 881a9fe40cb..00000000000 Binary files a/help/fr/images/SE8cExampleLogic.png and /dev/null differ diff --git a/help/fr/images/SSLLogic.gif b/help/fr/images/SSLLogic.gif deleted file mode 100644 index 3112418e173..00000000000 Binary files a/help/fr/images/SSLLogic.gif and /dev/null differ diff --git a/help/fr/images/SigTable.gif b/help/fr/images/SigTable.gif deleted file mode 100644 index 8840af53db5..00000000000 Binary files a/help/fr/images/SigTable.gif and /dev/null differ diff --git a/help/fr/images/SslExample.png b/help/fr/images/SslExample.png new file mode 100644 index 00000000000..5e653303752 Binary files /dev/null and b/help/fr/images/SslExample.png differ diff --git a/help/fr/package/jmri/jmrit/beantable/SignalHeadTable.shtml b/help/fr/package/jmri/jmrit/beantable/SignalHeadTable.shtml index e027e1616ea..7033a9929fa 100644 --- a/help/fr/package/jmri/jmrit/beantable/SignalHeadTable.shtml +++ b/help/fr/package/jmri/jmrit/beantable/SignalHeadTable.shtml @@ -1,7 +1,6 @@ - - + @@ -9,8 +8,6 @@ "HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.17), see www.w3.org"> JMRI: Signal Head Table Help - @@ -30,9 +27,9 @@

                  Le Tableau Tête de Signal

                  + "images/SigHeadTable.png">

                  Toutes les têtes de signal que JMRI connaît peuvent être référencées en diff --git a/help/fr/package/jmri/jmrit/beantable/images/SigHeadTable.png b/help/fr/package/jmri/jmrit/beantable/images/SigHeadTable.png new file mode 100644 index 00000000000..3d84ac15021 Binary files /dev/null and b/help/fr/package/jmri/jmrit/beantable/images/SigHeadTable.png differ diff --git a/help/fr/package/jmri/jmrit/blockboss/BlockBossFrame.shtml b/help/fr/package/jmri/jmrit/blockboss/BlockBossFrame.shtml index 262fcab97c1..269455ca695 100644 --- a/help/fr/package/jmri/jmrit/blockboss/BlockBossFrame.shtml +++ b/help/fr/package/jmri/jmrit/blockboss/BlockBossFrame.shtml @@ -263,7 +263,7 @@ "SSL" id="SSL">

                  Logique Simple Signal

                  figure panneau logique simple signaux Une grande partie de la base de la signalisation ABS peut se diff --git a/help/fr/package/jmri/jmrit/display/ControlPanelEditor.shtml b/help/fr/package/jmri/jmrit/display/ControlPanelEditor.shtml index 14dd04e9749..ac748bfb976 100644 --- a/help/fr/package/jmri/jmrit/display/ControlPanelEditor.shtml +++ b/help/fr/package/jmri/jmrit/display/ControlPanelEditor.shtml @@ -57,8 +57,8 @@ Dans l'éditeur de Panneau le menu: Modifier ouvre une fenre d'édition. dans l'éditeur de Panneau de Commande, le menu Modifier ajoute trois - menus additionnels au menus du panneau, Fichier, - Options, Zoom, AddItems.. + menus additionnels au menus du panneau : Fichier, + Options, Zoom, Add Items...

                  Menus éditeur de Panneau de Commande

                  diff --git a/java/src/apps/ActionListBundle_cs.properties b/java/src/apps/ActionListBundle_cs.properties index 0470f1b2350..4d8aabd00c7 100644 --- a/java/src/apps/ActionListBundle_cs.properties +++ b/java/src/apps/ActionListBundle_cs.properties @@ -40,7 +40,7 @@ jmri.jmrit.beantable.RouteTableAction = Otev\u0159\u00edt tabulku cest jmri.jmrit.beantable.LightTableAction = Otev\u0159\u00edt tabulku osv\u011btlen\u00ed jmri.jmrit.beantable.BlockTableAction = Otev\u0159\u00edt tabulku kolejov\u00fdch \u00fasek\u016f jmri.jmrit.beantable.LogixTableAction = Otev\u0159\u00edt tabulku Logix -jmri.jmrit.beantable.OBlockTableAction = Otev\u0159\u00edt tabulku obsazen\u00ed kolejov\u00fdch \u00fasek\u016f +jmri.jmrit.beantable.OBlockTableAction = Otev\u0159\u00edt tabulku blok\u016f obsazen\u00ed jmri.jmrit.beantable.SectionTableAction = Otev\u0159\u00edt tabulku odd\u00edly jmri.jmrit.beantable.TransitTableAction = Otev\u0159\u00edt tabulku tranzit jmri.jmrit.beantable.AudioTableAction = Otev\u0159\u00edt tabulku audio diff --git a/java/src/apps/AppsBundle_cs.properties b/java/src/apps/AppsBundle_cs.properties index f9775f91736..159672b7910 100644 --- a/java/src/apps/AppsBundle_cs.properties +++ b/java/src/apps/AppsBundle_cs.properties @@ -109,8 +109,8 @@ Nov\u00fd form\u00e1t ulo\u017een\u00fdch dat bude pou\u017eit p\u0159i p\u0159\ # Splash screen PressF8ToDebug = Stiskn\u011bte F8 pro znep\u0159\u00edstupn\u011bn\u00ed Logixs. #Displayed when unable to run startup actions -StartupActionsManager.RefusalToInitialize=Unable to run startup actions due to earlier failures. +StartupActionsManager.RefusalToInitialize=Nemohu spustit akce spou\u0161t\u011bn\u00ed z d\u016fvodu d\u0159\u00edv\u011bj\u0161\u00edch selh\u00e1n\u00ed. #Message displayed when at least one preferences panel returns invalid. -InvalidPreferencesMessage=The {0} preferences are invalid.
                  Do you want to correct them? +InvalidPreferencesMessage=P\u0159edvolba {0} nen\u00ed platn\u00e1.
                  Chcete ji opravit? #Title for dialog displaying InvalidPreferencesMessage -InvalidPreferencesTitle=Invalid Preferences +InvalidPreferencesTitle=Neplatn\u00e9 p\u0159edvolby diff --git a/java/src/apps/StartupActionsManager.java b/java/src/apps/StartupActionsManager.java index f513f9fd1c4..a1685ea5be7 100644 --- a/java/src/apps/StartupActionsManager.java +++ b/java/src/apps/StartupActionsManager.java @@ -22,6 +22,7 @@ import jmri.profile.ProfileUtils; import jmri.server.web.app.WebAppManager; import jmri.spi.PreferencesManager; +import jmri.swing.JmriJTablePersistenceManager; import jmri.util.jdom.JDOMUtil; import jmri.util.prefs.AbstractPreferencesManager; import jmri.util.prefs.InitializationException; @@ -145,6 +146,7 @@ public Set> getRequires() { requires.add(GuiLafPreferencesManager.class); requires.add(WarrantPreferences.class); requires.add(WebAppManager.class); + requires.add(JmriJTablePersistenceManager.class); return requires; } diff --git a/java/src/apps/startup/Bundle_cs.properties b/java/src/apps/startup/Bundle_cs.properties index c1721fe55a0..c6f546c505e 100644 --- a/java/src/apps/startup/Bundle_cs.properties +++ b/java/src/apps/startup/Bundle_cs.properties @@ -10,7 +10,7 @@ StartupActionsPreferencesPanel.upBtn.text=Nahoru StartupActionsPreferencesPanel.startupLbl.text=P\u0159idat polo\u017eky, kter\u00e9 maj\u00ed b\u00fdt spu\u0161t\u011bny nebo otev\u0159eny p\u0159i startu aplikace.
                  Polo\u017eky budou spu\u0161t\u011bny nebo otev\u0159eny ve stejn\u00e9m po\u0159ad\u00ed jako jsou v seznamu. StartupActionsPreferencesPanel.removeBtn.text=Odstranit StartupActionsPreferencesPanel.moveLbl.text=P\u0159esunout -StartupActionsPreferencesPanel.recommendationsLbl.text=Ve v\u011bt\u0161in\u011b p\u0159\u00edpad\u016fby skripty m\u011bly b\u00fdt spou\u0161t\u011bny jako posledn\u00ed. +StartupActionsPreferencesPanel.recommendationsLbl.text=Ve v\u011bt\u0161in\u011b p\u0159\u00edpad\u016f by skripty m\u011bly b\u00fdt spou\u0161t\u011bny jako posledn\u00ed. # Descriptions of the Startup Models included in JMRI apps.CreateButtonModel=P\u0159idat tla\u010d\u00edtko do hlavn\u00edho okna @@ -55,8 +55,8 @@ StartupPauseModel.name=Pozastavit na {0} vte\u0159in StartupPauseModelFactory.editModel.messagePrefix=Pozastavit na StartupPauseModelFactory.editModel.messagePostfix=vte\u0159in p\u0159ed startem n\u00e1sleduj\u00edc\u00ed akce. #Error message if script not found for button -ScriptButtonModel.ScriptNotFound=Cannot create button for script {0}; script not found. +ScriptButtonModel.ScriptNotFound=Nemohu vytvo\u0159it tla\u010d\u00edtko pro skript {0}; skript nenalezen. #Error show when route can not be triggered on startup -TriggerRouteModel.RouteNotDefined=Unable to set route "{0}". Route not defined. +TriggerRouteModel.RouteNotDefined=Nemohu nastavit cestu "{0}". Cesta nen\u00ed definov\u00e1na. #Error thrown when startup pause thread is interrupted. -StartupPauseModel.Interrupted={0} second startup pause interrupted early. +StartupPauseModel.Interrupted={0} druh\u00e1 startovac\u00ed pauza byla p\u0159eru\u0161ena brzy. diff --git a/java/src/jmri/ConditionalVariable.java b/java/src/jmri/ConditionalVariable.java index af7ac465009..bc613491d84 100644 --- a/java/src/jmri/ConditionalVariable.java +++ b/java/src/jmri/ConditionalVariable.java @@ -126,7 +126,7 @@ public ConditionalVariable(boolean not, int opern, int type, String name, boolea } break; case Conditional.ITEM_TYPE_ENTRYEXIT: - NamedBean nb = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class).getBySystemName(_name); + NamedBean nb = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class).getBySystemName(_name); if (nb == null) { log.error("invalid entry exit name= \"" + _name + "\" in state variable"); return; @@ -256,7 +256,7 @@ public void setName(String name) { bean = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class).getOBlock(_name); break; case Conditional.ITEM_TYPE_ENTRYEXIT: - bean = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class).getBySystemName(_name); + bean = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class).getBySystemName(_name); break; default: log.error("Type " + itemType + " not set for " + _name); diff --git a/java/src/jmri/MultiMeter.java b/java/src/jmri/MultiMeter.java index cb2c890c9a9..1a3845ca6eb 100644 --- a/java/src/jmri/MultiMeter.java +++ b/java/src/jmri/MultiMeter.java @@ -11,6 +11,7 @@ public interface MultiMeter extends PropertyChangeProvider { public static final String CURRENT = "MultiMeterCurrent"; + public static final String VOLTAGE = "MultiMeterVoltage"; public void enable(); diff --git a/java/src/jmri/NamedBeanBundle.properties b/java/src/jmri/NamedBeanBundle.properties index 10f3e068cd6..9d6314d6176 100644 --- a/java/src/jmri/NamedBeanBundle.properties +++ b/java/src/jmri/NamedBeanBundle.properties @@ -300,3 +300,7 @@ Automatic = Auto rsType = Locomotive FunctionMomentary = Momentary FunctionContinuous = Continuous + +# Keys used in both jmri.jmrix and jmri.jmrit +SendPacketTitle = Send Packet + diff --git a/java/src/jmri/NamedBeanBundle_cs.properties b/java/src/jmri/NamedBeanBundle_cs.properties index 2ac2ab353ca..e59bb9a5784 100644 --- a/java/src/jmri/NamedBeanBundle_cs.properties +++ b/java/src/jmri/NamedBeanBundle_cs.properties @@ -30,8 +30,8 @@ BeanNameSignalSystem = N\u00e1v\u011bstn\u00ed syst\u00e9m BeanNameSignalMastLogic = Logika n\u00e1v\u011bstidel BeanNameSignalAppMap = Zobrazen\u00ed vzhledu n\u00e1v\u011bstidel BeanNameSignalGroup = N\u00e1v\u011bstn\u00ed skupina -BeanNameWarrant = Potvrzen\u00ed -BeanNameOBlock = Kolejov\u00fd \u00fasek obsazen\u00ed +BeanNameWarrant = Povolen\u00ed +BeanNameOBlock = Blok obsazen\u00ed BeanNamePortal = Port\u00e1l # not a real bean but form for LogixTableAction EntryExit = Vjezd odjezd diff --git a/java/src/jmri/NamedBeanBundle_de.properties b/java/src/jmri/NamedBeanBundle_de.properties index 8097a29ad29..f9bc2ada293 100644 --- a/java/src/jmri/NamedBeanBundle_de.properties +++ b/java/src/jmri/NamedBeanBundle_de.properties @@ -269,3 +269,7 @@ ButtonStart = Start RosterTitle = Lokpark Automatic = Automatik Manual = Manuell + + +# Keys used in both jmri.jmrix and jmri.jmrit +SendPacketTitle = Sende Paket diff --git a/java/src/jmri/NamedBeanBundle_es.properties b/java/src/jmri/NamedBeanBundle_es.properties index 20837d92a02..eed66e7b0d6 100644 --- a/java/src/jmri/NamedBeanBundle_es.properties +++ b/java/src/jmri/NamedBeanBundle_es.properties @@ -80,6 +80,8 @@ ButtonSave = Guardar ButtonDone = Hecho ButtonSet = Ajustar ButtonPrint = Imprimir +ButtonRead = Leer +ButtonWrite = Escribir WarningTitle = Atenci\u00f3n ErrorTitle = Error diff --git a/java/src/jmri/NamedBeanBundle_fr.properties b/java/src/jmri/NamedBeanBundle_fr.properties index 02723c5c2a0..89b58bfab61 100644 --- a/java/src/jmri/NamedBeanBundle_fr.properties +++ b/java/src/jmri/NamedBeanBundle_fr.properties @@ -226,6 +226,8 @@ ButtonUpdate = Mise \u00e0 jour ButtonSet = D\u00e9finir ButtonSave = Enregistrer ButtonStop = Arr\u00eat +ButtonRead = \u00c9criture +ButtonWrite = Lecture TooltipOpenFile = S\u00e9lectionner {0} fichier depuis le disque diff --git a/java/src/jmri/NamedBeanBundle_ja_JP.properties b/java/src/jmri/NamedBeanBundle_ja_JP.properties index cec6c578e7b..09e4fba1401 100644 --- a/java/src/jmri/NamedBeanBundle_ja_JP.properties +++ b/java/src/jmri/NamedBeanBundle_ja_JP.properties @@ -1,7 +1,6 @@ # NamedBeanBundle_ja_JP.properties # # Japanese properties for the jmri package of JMRI -# # Translated by Sakae Akanuma BeanStateInconsistent = \u30a4\u30f3\u30b3\u30f3\u30b7\u30b9\u30c6\u30f3\u30c8 @@ -103,6 +102,8 @@ ButtonSave = \u4fdd\u5b58 ButtonYes = \u306f\u3044 ButtonNo = \u3044\u3044\u3048 ButtonStop = \u505c\u6b62 +ButtonRead = \u8aad\u51fa\u3057 +ButtonWrite = \u66f8\u8fbc\u307f ErrorTitle = \u30a8\u30e9\u30fc WarningTitle = \u8b66\u544a diff --git a/java/src/jmri/NamedBeanBundle_nl.properties b/java/src/jmri/NamedBeanBundle_nl.properties index 6c76f965430..db3dff12a70 100644 --- a/java/src/jmri/NamedBeanBundle_nl.properties +++ b/java/src/jmri/NamedBeanBundle_nl.properties @@ -299,3 +299,7 @@ Automatic = Automatisch rsType = Locomotief FunctionMomentary = Momentaan FunctionContinuous = Permanent + + +# Keys used in both jmri.jmrix and jmri.jmrit +SendPacketTitle = Verstuur Packet diff --git a/java/src/jmri/NmraPacket.java b/java/src/jmri/NmraPacket.java index af32f82fa9a..ad0907600ec 100644 --- a/java/src/jmri/NmraPacket.java +++ b/java/src/jmri/NmraPacket.java @@ -387,7 +387,7 @@ public static byte[] accDecPktOpsModeLegacy(int decAddr, int cvNum, int data) { /** * Create a signal accessory instruction packet. - * + *

                  * From the RP: Extended Accessory Decoder Control Packet Format The * Extended Accessory Decoder Control Packet is included for the purpose of * transmitting aspect control to signal decoders or data bytes to more @@ -493,7 +493,7 @@ public static byte[] accSignalDecoderPktOpsMode(int addr, int cvNum, int data) { * @return true if a Signal Decoder Packet; false otherwise */ public static boolean isAccSignalDecoderPkt(byte[] packet) { - if (packet.length != 3 && packet.length != 4) { + if (packet == null || packet.length != 3 && packet.length != 4) { return false; // allow ECC to be present or not } if ((packet[0] & 0xC0) != 0x80) { @@ -662,6 +662,54 @@ public static byte[] altAccSignalDecoderPkt(int outputAddr, int aspect) { return accSignalDecoderPktCommon(lowAddr, boardAddr, aspect); } + /** + * Provide an extended operations mode accessory CV programming packet via a + * simplified interface, given a signal address, using the alternative + * interpretation of S-9.2.1, due to an omission in the address definition + * of extended accessory packets. + * + * @param addr the signal address + * @param cvNum the CV + * @param data the data + * @return a packet + */ + public static byte[] altAccSignalDecoderPktOpsMode(int addr, int cvNum, int data) { + + if (addr < 1 || addr > 2044) { + log.error("invalid address " + addr); + throw new IllegalArgumentException(); + } + + if (cvNum < 1 || cvNum > 1024) { + log.error("invalid CV number " + cvNum); + return null; + } + + if (data < 0 || data > 255) { + log.error("invalid data " + data); + return null; + } + + int outputAddr = addr - 1; // Make the address 0 based + int lowAddr = (outputAddr & 0x03); + int boardAddr = (outputAddr >> 2); // Board Address + int midAddr = (boardAddr & 0x3F); + int highAddr = (~(boardAddr >> 6)) & 0x07; + + int lowCVnum = (cvNum - 1) & 0xFF; + int highCVnum = ((cvNum - 1) >> 8) & 0x03; + + byte[] retVal = new byte[6]; + retVal[0] = (byte) (0x80 | midAddr); + retVal[1] = (byte) (0x01 | (highAddr << 4) | (lowAddr << 1)); + retVal[2] = (byte) (0xEC | highCVnum); + retVal[3] = (byte) (lowCVnum); + retVal[4] = (byte) (0xFF & data); + retVal[5] = (byte) (retVal[0] ^ retVal[1] ^ retVal[2] ^ retVal[3] ^ retVal[4]); + + return retVal; + } + protected static byte[] accSignalDecoderPktCommon(int lowAddr, int boardAddr, int aspect) { if (aspect < 0 || aspect > 31) { @@ -883,11 +931,11 @@ public static byte[] speedStep128Packet(int address, boolean longAddr, int speed * method in that it cannot create a 28 step speed packet for maximum speed. * Input speed value in the range 0 - 28 is converted to speed steps, 0, * estop, 1, 2, ..., 27. - * + *

                  * This method should probably be deprecated. It is used only by * NceThrottle.java and EasyDccThrottle.java which themselves have issues in * the way floating point speed values are converted to integer speed steps. - * + *

                  * A speed and direction instruction is used send information to motors * connected to Multi Function Digital Decoders. Instruction "010" indicates * a Speed and Direction Instruction for reverse operation and instruction @@ -935,7 +983,7 @@ public static byte[] speedStep28Packet(int address, boolean longAddr, int speed, /** * New version of speedStep28Packet to allow access to the whole range of 28 * step speed packets. - * + *

                  * Simply constructs a packet using the 5 bit speed value. This is * consistent with the 128 and 14 step methods which do no further * processing of the speed value. @@ -951,7 +999,7 @@ public static byte[] speedStep28Packet(int address, boolean longAddr, int speed, public static byte[] speedStep28Packet(boolean full, int address, boolean longAddr, int speed, boolean fwd) { log.debug("28 step packet {} {}", address, speed); - if (full != true) { + if (!full) { log.error("invalid method invocation"); return null; // failed! } diff --git a/java/src/jmri/ProgListener.java b/java/src/jmri/ProgListener.java index 8aa6a8cd340..c7466a1302f 100644 --- a/java/src/jmri/ProgListener.java +++ b/java/src/jmri/ProgListener.java @@ -5,6 +5,11 @@ *

                  * This allows a {@link Programmer} object to return delayed status, including * the CV value from a read operation. + * For simplicity, expect these to be returned to be on the + * GUI thread. + * See the discussion in the {@link Programmer#readCV(String CV, ProgListener p) Programmer.readCV(...)}, + * {@link Programmer#writeCV(String CV, int val, ProgListener p) Programmer.writeCV(...)} and + * {@link Programmer#confirmCV(String CV, int val, ProgListener p) Programmer.confirmCV(...)} methods. * *


                  * This file is part of JMRI. diff --git a/java/src/jmri/Programmer.java b/java/src/jmri/Programmer.java index e4b05d8b95c..44ec6e9df7e 100644 --- a/java/src/jmri/Programmer.java +++ b/java/src/jmri/Programmer.java @@ -53,7 +53,10 @@ public interface Programmer { * Handles the legacy DCC case of a single-number address space. *

                  * Note that this returns before the write is complete; you have to provide - * a ProgListener to hear about completion. The exceptions will only be + * a ProgListener to hear about completion. For simplicity, expect the return to be on the + * GUI thread. + *

                  + * Exceptions will only be * thrown at the start, not during the actual programming sequence. A * typical exception would be due to an invalid mode (though that should be * prevented earlier) @@ -76,7 +79,10 @@ public interface Programmer { * defines the acceptable formats. *

                  * Note that this returns before the write is complete; you have to provide - * a ProgListener to hear about completion. The exceptions will only be + * a ProgListener to hear about completion. For simplicity, expect the return to be on the + * GUI thread. + *

                  + * Exceptions will only be * thrown at the start, not during the actual programming sequence. A * typical exception would be due to an invalid mode (though that should be * prevented earlier) @@ -94,10 +100,13 @@ public interface Programmer { *

                  * Handles the legacy DCC case of a single-number address space. *

                  - * Note that this returns before the read is complete; you have to provide a - * ProgListener to hear about completion. The exceptions will only be thrown - * at the start, not during the actual programming sequence. A typical - * exception would be due to an invalid mode (though that should be + * Note that this returns before the write is complete; you have to provide + * a ProgListener to hear about completion. For simplicity, expect the return to be on the + * GUI thread. + *

                  + * Exceptions will only be + * thrown at the start, not during the actual programming sequence. A + * typical exception would be due to an invalid mode (though that should be * prevented earlier) * * @param CV the CV to read @@ -116,10 +125,13 @@ public interface Programmer { * Handles a general address space through a String address. Each programmer * defines the acceptable formats. *

                  - * Note that this returns before the read is complete; you have to provide a - * ProgListener to hear about completion. The exceptions will only be thrown - * at the start, not during the actual programming sequence. A typical - * exception would be due to an invalid mode (though that should be + * Note that this returns before the write is complete; you have to provide + * a ProgListener to hear about completion. For simplicity, expect the return to be on the + * GUI thread. + *

                  + * Exceptions will only be + * thrown at the start, not during the actual programming sequence. A + * typical exception would be due to an invalid mode (though that should be * prevented earlier) * * @param CV the CV to read @@ -134,9 +146,12 @@ public interface Programmer { *

                  * Handles the legacy DCC case of a single-number address space. *

                  - * Note that this returns before the confirm is complete; you have to - * provide a ProgListener to hear about completion. The exceptions will only - * be thrown at the start, not during the actual programming sequence. A + * Note that this returns before the write is complete; you have to provide + * a ProgListener to hear about completion. For simplicity, expect the return to be on the + * GUI thread. + *

                  + * Exceptions will only be + * thrown at the start, not during the actual programming sequence. A * typical exception would be due to an invalid mode (though that should be * prevented earlier) * @@ -157,9 +172,12 @@ public interface Programmer { * Handles a general address space through a String address. Each programmer * defines the acceptable formats. *

                  - * Note that this returns before the confirm is complete; you have to - * provide a ProgListener to hear about completion. The exceptions will only - * be thrown at the start, not during the actual programming sequence. A + * Note that this returns before the write is complete; you have to provide + * a ProgListener to hear about completion. For simplicity, expect the return to be on the + * GUI thread. + *

                  + * Exceptions will only be + * thrown at the start, not during the actual programming sequence. A * typical exception would be due to an invalid mode (though that should be * prevented earlier) * diff --git a/java/src/jmri/UserPreferencesManager.java b/java/src/jmri/UserPreferencesManager.java index e861f885f82..47e569c2258 100644 --- a/java/src/jmri/UserPreferencesManager.java +++ b/java/src/jmri/UserPreferencesManager.java @@ -5,7 +5,6 @@ import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import javax.swing.SortOrder; /** @@ -45,7 +44,7 @@ public interface UserPreferencesManager { * allow that checkBox to be set to a true state when it is next * initialized. This can also be used anywhere else that a simple yes/no, * true/false type preference needs to be stored. - * + *

                  * It should not be used for remembering if a user wants to suppress a * message as there is no means in the GUI for the user to reset the flag. * setPreferenceState() should be used in this instance The name is @@ -660,7 +659,8 @@ public default boolean isWindowPositionSaved(String strClass) { /** * Stores the details of a tables column, so that it can be saved and - * re-applied when jmri is re-started + * re-applied when jmri is re-started. Retained for reading JMRI 4.4 and + * earlier user interface preferences. * * @param table The reference for the table * @param column The column name @@ -675,95 +675,6 @@ public default boolean isWindowPositionSaved(String strClass) { @Deprecated public void setTableColumnPreferences(String table, String column, int order, int width, SortOrder sort, boolean hidden); - /** - * Get the stored position of the column for a given table - * - * @param table The reference for the table - * @param column The column name - * @return -1 if not found - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public int getTableColumnOrder(String table, String column); - - /** - * Get the stored column width for a given table - * - * @param table The reference for the table - * @param column The column name - * @return -1 if not found - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public int getTableColumnWidth(String table, String column); - - /** - * Get the stored column sort order for a given table - * - * @param table The reference for the table - * @param column The column name - * @return {@link javax.swing.SortOrder#UNSORTED} if not found - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public SortOrder getTableColumnSort(String table, String column); - - /** - * Get the stored column hidden state for a given table - * - * @param table The reference for the table - * @param column The column name - * @return 0 if not found - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public boolean getTableColumnHidden(String table, String column); - - /** - * Get a name for a column at index i - * - * @param table The reference for the table - * @param i The column index - * @return null if not found, otherwise the column name - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public String getTableColumnAtNum(String table, int i); - - /** - * Get a list of all the table preferences stored - * - * @return a List of all the tables, if no tables exist then an empty list - * is returned - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public List getTablesList(); - - /** - * Get a list of all the column settings for a specific table - * - * @param table table to retrieve column settings for - * @return a List of all the columns in a table, if the table is not valid - * an empty list is returned - * @deprecated since 4.5.4 without direct replacement. Use the - * {@link jmri.swing.JTablePersistenceManager} API to maintain JTable user - * interface state. - */ - @Deprecated - public List getTablesColumnList(String table); /* Example informational message dialog box. diff --git a/java/src/jmri/configurexml/ClassMigration.properties b/java/src/jmri/configurexml/ClassMigration.properties index 3de10f4f935..2084a4ac6f9 100644 --- a/java/src/jmri/configurexml/ClassMigration.properties +++ b/java/src/jmri/configurexml/ClassMigration.properties @@ -2,7 +2,7 @@ # # Maps previous class names to current class names for the ConfigureXML system. # See http://jmri.org/help/en/html/doc/Technical/XmlPersistance.shtml -# +# # Entries are: # (original/older fully-qualified class name) = (new/current fully-qualified class name) # @@ -28,8 +28,7 @@ jmri.configurexml.TripleTurnoutSignalHeadXml = jmri.managers.configurexml jmri.configurexml.VirtualSignalHeadXml = jmri.managers.configurexml.VirtualSignalHeadXml jmri.jmrit.display.configurexml.LayoutEditorXml = jmri.jmrit.display.layoutEditor.configurexml.LayoutEditorXml - jmri.jmrit.display.configurexml.ControlPanelEditorXml = jmri.jmrit.display.layoutEditor.controlPanelEditor.ControlPanelEditorXml - jmri.jmrit.display.configurexml.PanelEditorXml = jmri.jmrit.display.layoutEditor.panelEditor.PanelEditorXml +jmri.jmrit.signalling.configurexml.EntryExitPairsXml = jmri.jmrit.entryexit.configurexml.EntryExitPairsXml diff --git a/java/src/jmri/implementation/AbstractMultiMeter.java b/java/src/jmri/implementation/AbstractMultiMeter.java new file mode 100644 index 00000000000..94cbf77ddb7 --- /dev/null +++ b/java/src/jmri/implementation/AbstractMultiMeter.java @@ -0,0 +1,155 @@ +package jmri.implementation; + +import java.beans.PropertyChangeListener; +import java.util.Timer; +import java.util.TimerTask; +import jmri.MultiMeter; +import jmri.beans.Bean; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract base class for current meter objects. + * + * @author Mark Underwood (C) 2015 + */ +abstract public class AbstractMultiMeter extends Bean implements MultiMeter { + + protected float current_float = 0.0f; + protected float voltage_float = 0.0f; + + //private boolean is_enabled = false; + private UpdateTask intervalTask = null; + private Timer intervalTimer = null; + private int sleepInterval = 10000; // default to 10 second sleep interval. + + public AbstractMultiMeter(int interval){ + sleepInterval = interval; + } + + protected void initTimer() { + intervalTask = new UpdateTask(); + intervalTimer = new Timer(); + // At some point this will be dynamic intervals... + log.debug("Starting Meter Timer"); + intervalTimer.scheduleAtFixedRate(intervalTask, + sleepInterval, sleepInterval); + } + + /** + * Request an update from the layout. Triggered by a timer. + */ + abstract protected void requestUpdateFromLayout(); + + // Timer task for periodic updates... + private class UpdateTask extends TimerTask { + + private boolean is_enabled = false; + + public UpdateTask() { + super(); + } + + public void enable() { + is_enabled = true; + } + + public void disable() { + is_enabled = false; + } + + @Override + public void run() { + try { + if (is_enabled) { + log.debug("Timer Pop"); + requestUpdateFromLayout(); + } + Thread.sleep(sleepInterval); + } catch (InterruptedException e) { + log.error("Error running timer update task! {}", e.getMessage()); + } + } + } + + // MultiMeter Interface Methods + @Override + public void enable() { + log.debug("Enabling meter."); + intervalTask.enable(); + } + + @Override + public void disable() { + log.debug("Disabling meter."); + intervalTask.disable(); + } + + @Override + public void setCurrent(float c) { + float old = current_float; + current_float = c; + this.firePropertyChange(CURRENT, old, c); + } + + @Override + @Deprecated + public void updateCurrent(float c) { + setCurrent(c); + } + + @Override + public float getCurrent() { + return current_float; + } + + @Override + public void setVoltage(float v) { + float old = voltage_float; + voltage_float = v; + this.firePropertyChange(VOLTAGE, old, v); + } + + @Override + @Deprecated + public void updateVoltage(float v) { + setVoltage(v); + } + + @Override + public float getVoltage() { + return voltage_float; + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public synchronized void addDataUpdateListener(PropertyChangeListener l) { + this.addPropertyChangeListener(CURRENT, l); + this.addPropertyChangeListener(VOLTAGE, l); + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public synchronized void removeDataUpdateListener(PropertyChangeListener l) { + this.removePropertyChangeListener(CURRENT, l); + this.removePropertyChangeListener(VOLTAGE, l); + } + + /** + * {@inheritDoc} + */ + @Override + @Deprecated + public PropertyChangeListener[] getDataUpdateListeners() { + return this.getPropertyChangeListeners(CURRENT); + } + + private final static Logger log = LoggerFactory.getLogger(AbstractMultiMeter.class); + +} diff --git a/java/src/jmri/implementation/AccessoryOpsModeProgrammerFacade.java b/java/src/jmri/implementation/AccessoryOpsModeProgrammerFacade.java index 8e27762c7bb..96cedace9e2 100644 --- a/java/src/jmri/implementation/AccessoryOpsModeProgrammerFacade.java +++ b/java/src/jmri/implementation/AccessoryOpsModeProgrammerFacade.java @@ -1,16 +1,18 @@ package jmri.implementation; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.ArrayList; import java.util.List; +import javax.annotation.Nonnull; import jmri.AddressedProgrammer; import jmri.CommandStation; import jmri.InstanceManager; import jmri.NmraPacket; import jmri.ProgListener; +import jmri.Programmer; import jmri.ProgrammerException; import jmri.ProgrammingMode; import jmri.jmrix.AbstractProgrammerFacade; -import jmri.managers.DefaultProgrammerManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,26 +39,36 @@ // @ToDo("transform to annotations requires e.g. http://alchemy.grimoire.ca/m2/sites/ca.grimoire/todo-annotations/") // @ToDo("get address from underlyng programmer (which might require adding a new subclass structure to Programmer)") // @ToDo("finish mode handling; what gets passed through?") -// @ToDo("write almost certainly needs a delay") // @ToDo("read handling needs to be aligned with other ops mode programmers") // @ToDo("make sure jmri/jmrit/progsupport/ProgServiceModePane shows the modes, and that DP/DP3 displays them as it configures a decoder") public class AccessoryOpsModeProgrammerFacade extends AbstractProgrammerFacade implements ProgListener { /** - * Programmer facade for access to Accessory Decoder Ops Mode programming + * Programmer facade for access to Accessory Decoder Ops Mode programming. * - * @param prog The Ops Mode Programmer we are piggybacking on. + * @param prog The (possibly already decorated) programmer we are + * piggybacking on. * @param addrType A string. "accessory" or "output" causes the address to * be interpreted as an 11 bit accessory output address. * "decoder" causes the address to be interpreted as a 9 bit * accessory decoder address "signal" causes the address to * be interpreted as an 11 bit signal decoder address. + * @param delay A string representing the desired delay between + * programming operations, in milliseconds. + * @param baseProg The underlying undecorated Ops Mode Programmer we are + * piggybacking on. */ - public AccessoryOpsModeProgrammerFacade(AddressedProgrammer prog, String addrType) { + @SuppressFBWarnings(value = "DM_CONVERT_CASE", + justification = "parameter value is never localised") // NOI18N + public AccessoryOpsModeProgrammerFacade(Programmer prog, @Nonnull String addrType, int delay, AddressedProgrammer baseProg) { super(prog); + log.debug("Constructing AccessoryOpsModeProgrammerFacade"); + this._usingProgrammer = null; this.mode = prog.getMode(); this.aprog = prog; - this._addrType = addrType; + this._addrType = (addrType == null) ? "" : addrType.toLowerCase(); // NOI18N + this._delay = delay; + this._baseProg = baseProg; } // ops accessory mode can't read locally @@ -64,7 +76,7 @@ public AccessoryOpsModeProgrammerFacade(AddressedProgrammer prog, String addrTyp @Override public List getSupportedModes() { - List ret = new ArrayList(); + List ret = new ArrayList<>(); ret.add(ProgrammingMode.OPSACCBYTEMODE); ret.add(ProgrammingMode.OPSACCBITMODE); ret.add(ProgrammingMode.OPSACCEXTBYTEMODE); @@ -74,13 +86,15 @@ public List getSupportedModes() { /** * Don't pass this mode through, as the underlying doesn't have it (although - * we should check) + * we should check). + * + * @param p The desired programming mode */ @Override public void setMode(ProgrammingMode p) { } - AddressedProgrammer aprog; + Programmer aprog; @Override public boolean getCanRead() { @@ -103,53 +117,105 @@ public boolean getCanWrite(String addr) { } // members for handling the programmer interface - int _val; // remember the value being read/written for confirmative reply - String _cv; // remember the cv number being read/written - String _addrType; // remember the address type: ("decoder" or null) or ("accessory" or "output") + int _val; // remember the value being read/written for confirmative reply + String _cv; // remember the cv number being read/written + String _addrType; // remember the address type: ("decoder" or null) or ("accessory" or "output") + int _delay; // remember the programming delay, in milliseconds + AddressedProgrammer _baseProg; // remember the underlying programmer // programming interface @Override - synchronized public void writeCV(String cv, int val, ProgListener p) throws ProgrammerException { + public synchronized void writeCV(String cv, int val, ProgListener p) throws ProgrammerException { + log.debug("writeCV entry: ProgListener p is {}", p); _val = val; useProgrammer(p); state = ProgState.PROGRAMMING; byte[] b; // Send DCC commands to implement prog.writeCV(cv, val, this); - if ((_addrType != null) && (_addrType.equalsIgnoreCase("accessory") || _addrType.equalsIgnoreCase("output"))) { // interpret address as accessory address - log.debug("Sending a basic ops mode accessory CV programming packet to the accessory address"); - b = NmraPacket.accDecoderPktOpsMode(aprog.getAddressNumber(), Integer.parseInt(cv), val); - InstanceManager.getDefault(CommandStation.class).sendPacket(b, 1); - } else if ((_addrType != null) && _addrType.equalsIgnoreCase("signal")) { // interpret address as signal address - log.debug("Sending an extended ops mode accessory CV programming packet for signal decoders"); - b = NmraPacket.accSignalDecoderPktOpsMode(aprog.getAddressNumber(), Integer.parseInt(cv), val); - InstanceManager.getDefault(CommandStation.class).sendPacket(b, 1); - } else { // interpet address as decoder address - log.debug("Sending a legacy ops mode accessory CV programming packet for compatibility with older decoders"); - // (Sending both packet types was also observed to benefit timing considerations - spacing effect) - b = NmraPacket.accDecPktOpsModeLegacy(aprog.getAddressNumber(), Integer.parseInt(cv), val); - InstanceManager.getDefault(CommandStation.class).sendPacket(b, 1); - - log.debug("Sending a basic ops mode accessory CV programming packet to the decoder address"); - b = NmraPacket.accDecPktOpsMode(aprog.getAddressNumber(), Integer.parseInt(cv), val); - InstanceManager.getDefault(CommandStation.class).sendPacket(b, 1); + switch (_addrType) { + case "accessory": + case "output": + // interpret address as accessory address + log.debug("Send an accDecoderPktOpsMode: address={}, cv={}, value={}", + _baseProg.getAddressNumber(), Integer.parseInt(cv), val); + b = NmraPacket.accDecoderPktOpsMode(_baseProg.getAddressNumber(), Integer.parseInt(cv), val); + break; + case "signal": + // interpret address as signal address + log.debug("Send an accSignalDecoderPktOpsMode: address={}, cv={}, value={}", + _baseProg.getAddressNumber(), Integer.parseInt(cv), val); + b = NmraPacket.accSignalDecoderPktOpsMode(_baseProg.getAddressNumber(), Integer.parseInt(cv), val); + break; + case "altsignal": + // interpret address as signal address using the alternative interpretation of S-9.2.1 + log.debug("Send an altAccSignalDecoderPktOpsMode: address={}, cv={}, value={}", + _baseProg.getAddressNumber(), Integer.parseInt(cv), val); + b = NmraPacket.altAccSignalDecoderPktOpsMode(_baseProg.getAddressNumber(), Integer.parseInt(cv), val); + break; + case "decoder": + // interpet address as decoder address + log.debug("Send an accDecPktOpsMode: address={}, cv={}, value={}", + _baseProg.getAddressNumber(), Integer.parseInt(cv), val); + b = NmraPacket.accDecPktOpsMode(_baseProg.getAddressNumber(), Integer.parseInt(cv), val); + break; + case "legacy": + // interpet address as decoder address and send legacy packet + log.debug("Send an accDecPktOpsModeLegacy: address={}, cv={}, value={}", + _baseProg.getAddressNumber(), Integer.parseInt(cv), val); + b = NmraPacket.accDecPktOpsModeLegacy(_baseProg.getAddressNumber(), Integer.parseInt(cv), val); + break; + default: + log.error("Unknown Address Type \"{}\"", _addrType); + programmingOpReply(val, ProgListener.UnknownError); + return; } - // and reply done - this.programmingOpReply(val, ProgListener.OK); + InstanceManager.getDefault(CommandStation.class).sendPacket(b, 1); // send packet + + // set up a delayed completion reply + new Thread(new Runnable() { + @Override + public synchronized void run() { + log.debug("delaying {} milliseconds for cv={}, value={}", _delay, Integer.parseInt(cv), val); + if (_delay > 0) { + try { + Thread.sleep(_delay); + } catch (InterruptedException ie) { + log.error("Interrupted while sleeping {}", ie); + } + } + log.debug(" delay elapsed for cv={}, value={}", Integer.parseInt(cv), val); + programmingOpReply(val, ProgListener.OK); + } + }).start(); } @Override - synchronized public void readCV(String cv, jmri.ProgListener p) throws jmri.ProgrammerException { + public synchronized void readCV(String cv, jmri.ProgListener p) throws jmri.ProgrammerException { useProgrammer(p); state = ProgState.PROGRAMMING; prog.readCV(cv, this); } - private jmri.ProgListener _usingProgrammer = null; + @Override + public synchronized void confirmCV(String cv, int val, ProgListener p) throws ProgrammerException { + useProgrammer(p); + state = ProgState.PROGRAMMING; + prog.confirmCV(cv, val, this); + } + + private transient volatile jmri.ProgListener _usingProgrammer; - // internal method to remember who's using the programmer - protected void useProgrammer(jmri.ProgListener p) throws jmri.ProgrammerException { + /** + * Internal method to remember who's using the programmer. + * + * + * @param p the programmer + * @throws ProgrammerException if p is already in use + */ + protected synchronized void useProgrammer(jmri.ProgListener p) throws jmri.ProgrammerException { // test for only one! + log.debug("useProgrammer entry: _usingProgrammer is {}", _usingProgrammer); if (_usingProgrammer != null && _usingProgrammer != p) { if (log.isInfoEnabled()) { log.info("programmer already in use by " + _usingProgrammer); @@ -157,8 +223,8 @@ protected void useProgrammer(jmri.ProgListener p) throws jmri.ProgrammerExceptio throw new jmri.ProgrammerException("programmer in use"); } else { _usingProgrammer = p; - return; } + log.debug("useProgrammer exit: _usingProgrammer is {}", _usingProgrammer); } enum ProgState { @@ -170,10 +236,8 @@ enum ProgState { // get notified of the final result // Note this assumes that there's only one phase to the operation @Override - public void programmingOpReply(int value, int status) { - if (log.isDebugEnabled()) { - log.debug("notifyProgListenerEnd value " + value + " status " + status); - } + public synchronized void programmingOpReply(int value, int status) { + log.debug("notifyProgListenerEnd value={}, status={}", value, status); if (status != OK) { // pass abort up @@ -195,6 +259,7 @@ public void programmingOpReply(int value, int status) { case PROGRAMMING: // the programmingOpReply handler might send an immediate reply, so // clear the current listener _first_ + log.debug("going NOTPROGRAMMING after value {}, status={}", value, status); jmri.ProgListener temp = _usingProgrammer; _usingProgrammer = null; // done state = ProgState.NOTPROGRAMMING; diff --git a/java/src/jmri/implementation/DccSignalHead.java b/java/src/jmri/implementation/DccSignalHead.java index 546c6632a7e..0baf976cd8e 100644 --- a/java/src/jmri/implementation/DccSignalHead.java +++ b/java/src/jmri/implementation/DccSignalHead.java @@ -135,7 +135,7 @@ public void setHeld(boolean newHeld) { protected void updateOutput() { if (c != null) { - int aspect = 8; // SignalHead.DARK, but default set below + int aspect = getOutputForAppearance(SignalHead.DARK); if (getLit()) { Integer app = Integer.valueOf(mAppearance); diff --git a/java/src/jmri/implementation/DefaultLogix.java b/java/src/jmri/implementation/DefaultLogix.java index 6948eacaf77..1507e92aab9 100644 --- a/java/src/jmri/implementation/DefaultLogix.java +++ b/java/src/jmri/implementation/DefaultLogix.java @@ -800,7 +800,7 @@ private void removeListener(JmriSimplePropertyListener listener) { tb.removeMinuteChangeListener(listener); return; case LISTENER_TYPE_ENTRYEXIT: - NamedBean ex = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class).getBySystemName(listener.getDevName()); + NamedBean ex = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class).getBySystemName(listener.getDevName()); if (ex == null) { msg = "entryexit"; // NOI18N break; diff --git a/java/src/jmri/implementation/ImplementationBundle_cs.properties b/java/src/jmri/implementation/ImplementationBundle_cs.properties index 4d7fdd50cc8..8e39cc8cff2 100644 --- a/java/src/jmri/implementation/ImplementationBundle_cs.properties +++ b/java/src/jmri/implementation/ImplementationBundle_cs.properties @@ -39,4 +39,4 @@ InitExMessageTitle = Chyba p\u0159i inicializaci {0} InitExMessageLogs = Pro podrobnosti pros\u00edm zkontrolujte log. InitExMessagePrefs = Bude otev\u0159eno okno p\u0159edvoleb, tak\u017ee toto m\u016f\u017ee b\u00fdt opraveno. #header for list when there are mulitple initialization exceptions -InitExMessageListHeader=The following errors occurred in the order listed: +InitExMessageListHeader=N\u00e1sleduj\u00edc\u00ed chyby se vyskytly v uveden\u00e9m po\u0159ad\u00ed: diff --git a/java/src/jmri/implementation/MultiIndexProgrammerFacade.java b/java/src/jmri/implementation/MultiIndexProgrammerFacade.java index f022c0487c8..49c784d278d 100644 --- a/java/src/jmri/implementation/MultiIndexProgrammerFacade.java +++ b/java/src/jmri/implementation/MultiIndexProgrammerFacade.java @@ -221,6 +221,32 @@ synchronized public void readCV(String CV, jmri.ProgListener p) throws jmri.Prog } } + @Override + synchronized public void confirmCV(String CV, int val, jmri.ProgListener p) throws jmri.ProgrammerException { + _val = val; + useProgrammer(p); + parseCV(CV); + if (valuePI == -1) { + lastValuePI = -1; // next indexed operation needs to write PI, SI + lastValueSI = -1; + + // non-indexed operation + state = ProgState.PROGRAMMING; + prog.confirmCV(CV, val, this); + } else if (useCachePiSi()) { + // indexed operation with set values is same as non-indexed operation + state = ProgState.PROGRAMMING; + prog.confirmCV(CV, val, this); + } else { + lastValuePI = valuePI; // after check in 'if' statement + lastValueSI = valueSI; + + // write index first + state = ProgState.FINISHCONFIRM; + prog.writeCV(indexPI, valuePI, this); + } + } + private jmri.ProgListener _usingProgrammer = null; // internal method to remember who's using the programmer @@ -243,8 +269,10 @@ enum ProgState { PROGRAMMING, /** Waiting for response to first or second index write before a final read operation */ FINISHREAD, - /** Waiting for response to first or second index write before a final read operation */ + /** Waiting for response to first or second index write before a final write operation */ FINISHWRITE, + /** Waiting for response to first or second index write before a final confirm operation */ + FINISHCONFIRM, /** No current operation */ NOTPROGRAMMING } @@ -325,6 +353,25 @@ public void programmingOpReply(int value, int status) { } } break; + case FINISHCONFIRM: + if (valueSI == -1) { + try { + state = ProgState.PROGRAMMING; + prog.confirmCV(_cv, _val, this); + } catch (jmri.ProgrammerException e) { + log.error("Exception doing final confirm", e); + } + } else { + try { + int tempSI = valueSI; + valueSI = -1; + state = ProgState.FINISHCONFIRM; + prog.writeCV(indexSI, tempSI, this); + } catch (jmri.ProgrammerException e) { + log.error("Exception doing write SI for write", e); + } + } + break; default: log.error("Unexpected state on reply: " + state); // clean up as much as possible diff --git a/java/src/jmri/implementation/OpsModeDelayedProgrammerFacade.java b/java/src/jmri/implementation/OpsModeDelayedProgrammerFacade.java new file mode 100644 index 00000000000..b6b2e85df54 --- /dev/null +++ b/java/src/jmri/implementation/OpsModeDelayedProgrammerFacade.java @@ -0,0 +1,172 @@ +package jmri.implementation; + +import jmri.ProgListener; +import jmri.Programmer; +import jmri.ProgrammerException; +import jmri.jmrix.AbstractProgrammerFacade; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Programmer facade for access to Accessory Decoder Ops Mode programming + *

                  + * (Eventually implements four modes, passing all others to underlying + * programmer: + *

                    + *
                  • OPSACCBYTEMODE + *
                  • OPSACCBITMODE + *
                  • OPSACCEXTBYTEMODE + *
                  • OPSACCEXTBITMODE + *
                  + *

                  + * Used through the String write/read/confirm interface. Accepts integers as + * addresses, but then emits NMRA DCC packets through the default CommandStation + * interface (which must be present) + * + * @see jmri.implementation.ProgrammerFacadeSelector + * + * @author Bob Jacobsen Copyright (C) 2014 + */ +// @ToDo("transform to annotations requires e.g. http://alchemy.grimoire.ca/m2/sites/ca.grimoire/todo-annotations/") +// @ToDo("read handling needs to be aligned with other ops mode programmers") +// @ToDo("make sure jmri/jmrit/progsupport/ProgServiceModePane shows the modes, and that DP/DP3 displays them as it configures a decoder") +public class OpsModeDelayedProgrammerFacade extends AbstractProgrammerFacade implements ProgListener { + + /** + * Programmer facade for access to Accessory Decoder Ops Mode programming. + * + * @param prog The Ops Mode Programmer we are piggybacking on. + * @param writeDelay A string representing the desired delay after a write + * operation, in milliseconds. + */ + public OpsModeDelayedProgrammerFacade(Programmer prog, int writeDelay) { + super(prog); + log.debug("Constructing OpsModeDelayedProgrammerFacade"); + this._usingProgrammer = null; + this.prog = prog; + this._readDelay = 0; + this._writeDelay = writeDelay; + } + + // members for handling the programmer interface + int _val; // remember the value being read/written for confirmative reply + String _cv; // remember the cv number being read/written + String _addrType; // remember the address type: ("decoder" or null) or ("accessory" or "output") + int _readDelay; // remember the programming delay, in milliseconds + int _writeDelay; // remember the programming delay, in milliseconds + int _delay; // remember the programming delay, in milliseconds + + // programming interface + @Override + public synchronized void writeCV(String cv, int val, ProgListener p) throws ProgrammerException { + log.debug("writeCV entry: ProgListener p is {}", p); + useProgrammer(p); + state = ProgState.WRITECOMMANDSENT; + prog.writeCV(cv, val, this); + } + + @Override + public synchronized void readCV(String cv, jmri.ProgListener p) throws jmri.ProgrammerException { + useProgrammer(p); + state = ProgState.READCOMMANDSENT; + prog.readCV(cv, this); + } + + @Override + public synchronized void confirmCV(String cv, int val, ProgListener p) throws ProgrammerException { + useProgrammer(p); + state = ProgState.READCOMMANDSENT; + prog.confirmCV(cv, val, this); + } + + private transient volatile jmri.ProgListener _usingProgrammer; + + /** + * Internal method to remember who's using the programmer. + * + * + * @param p the programmer + * @throws ProgrammerException if p is already in use + */ + protected synchronized void useProgrammer(jmri.ProgListener p) throws jmri.ProgrammerException { + // test for only one! + log.debug("useProgrammer entry: _usingProgrammer is {}", _usingProgrammer); + if (_usingProgrammer != null && _usingProgrammer != p) { + if (log.isInfoEnabled()) { + log.info("programmer already in use by " + _usingProgrammer); + } + throw new jmri.ProgrammerException("programmer in use"); + } else { + _usingProgrammer = p; + } + log.debug("useProgrammer exit: _usingProgrammer is {}", _usingProgrammer); + } + + enum ProgState { + + READCOMMANDSENT, WRITECOMMANDSENT, NOTPROGRAMMING + } + ProgState state = ProgState.NOTPROGRAMMING; + + // get notified of the final result + // Note this assumes that there's only one phase to the operation + @Override + public synchronized void programmingOpReply(int value, int status) { + log.debug("notifyProgListenerEnd value={}, status={}", value, status); + + if (status != OK) { + // pass abort up + log.debug("Reset and pass abort up"); + jmri.ProgListener temp = _usingProgrammer; + _usingProgrammer = null; // done + state = ProgState.NOTPROGRAMMING; + temp.programmingOpReply(value, status); + return; + } + + if (_usingProgrammer == null) { + log.error("No listener to notify, reset and ignore"); + state = ProgState.NOTPROGRAMMING; + return; + } + + switch (state) { + case READCOMMANDSENT: + _delay = _readDelay; + break; + case WRITECOMMANDSENT: + _delay = _writeDelay; + break; + default: + log.error("Unexpected state on reply: " + state); + // clean up as much as possible + _usingProgrammer = null; + state = ProgState.NOTPROGRAMMING; + } + + new Thread(new Runnable() { + @Override + public synchronized void run() { + if (_delay > 0) { + log.debug("delaying {} milliseconds", _delay); + try { + Thread.sleep(_delay); + } catch (InterruptedException ie) { + log.error("Interrupted while sleeping {}", ie); + } + } + // the programmingOpReply handler might send an immediate reply, so + // clear the current listener _first_ + log.debug("going NOTPROGRAMMING after value {}, status={}", value, status); + jmri.ProgListener temp = _usingProgrammer; + _usingProgrammer = null; // done + state = ProgState.NOTPROGRAMMING; + log.debug("notifying value " + value + " status " + status); + temp.programmingOpReply(value, status); + } + }).start(); + } + + private final static Logger log = LoggerFactory.getLogger(OpsModeDelayedProgrammerFacade.class); + +} diff --git a/java/src/jmri/implementation/ProgrammerFacadeSelector.java b/java/src/jmri/implementation/ProgrammerFacadeSelector.java index 390ff3715ca..d83ab46579c 100644 --- a/java/src/jmri/implementation/ProgrammerFacadeSelector.java +++ b/java/src/jmri/implementation/ProgrammerFacadeSelector.java @@ -1,5 +1,6 @@ package jmri.implementation; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.List; import jmri.AddressedProgrammer; import jmri.Programmer; @@ -8,7 +9,7 @@ import org.slf4j.LoggerFactory; /** - * Utility to load a specific ProgrammerFacade from an XML element + * Utility to load a specific ProgrammerFacade from an XML element. *

                  * @author Bob Jacobsen Copyright (C) 2013 */ @@ -21,9 +22,13 @@ public class ProgrammerFacadeSelector { * @param element Contains "capability" elements that define the Facades * @param programmer Programmer implementation to decorate * @param allowCache Passed to facades that optionally cache + * @param baseProg The original underlying programmer, less any facades * @return the programmer with added facades */ - public static Programmer loadFacadeElements(Element element, Programmer programmer, boolean allowCache) { + @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", + justification = "cast is checked by conditional surrounding the code block") // NOI18N + public static Programmer loadFacadeElements( + Element element, Programmer programmer, boolean allowCache, Programmer baseProg) { // iterate over any facades and add them List facades = element.getChildren("capability"); if (log.isDebugEnabled()) { @@ -40,90 +45,113 @@ public static Programmer loadFacadeElements(Element element, Programmer programm log.debug("Found " + facades.size() + " capability parameters"); } for (Element parameter : parameters) { + String pname = parameter.getAttributeValue("name"); String pval = parameter.getText(); - if (log.isDebugEnabled()) { - log.debug("Process parameter value: " + pval); - } + log.debug("Found parameter name=\"{}\", value=\"{}\" ", pname, pval); } - if (fname.equals("High Access via Double Index")) { - // going to create a specific one - String top = parameters.get(0).getText(); - String addrCVhigh = parameters.get(1).getText(); - String addrCVlow = parameters.get(2).getText(); - String valueCV = parameters.get(3).getText(); - String modulo = parameters.get(4).getText(); - - jmri.implementation.AddressedHighCvProgrammerFacade pf - = new jmri.implementation.AddressedHighCvProgrammerFacade(programmer, top, addrCVhigh, addrCVlow, valueCV, modulo); - - log.debug("new programmer " + pf); - programmer = pf; // to go around and see if there are more - - } else if (fname.equals("High Access via Partial Index")) { - // going to create a specific one - String top = parameters.get(0).getText(); - String addrCV = parameters.get(1).getText(); - String factor = parameters.get(2).getText(); - String modulo = parameters.get(3).getText(); - - jmri.implementation.OffsetHighCvProgrammerFacade pf - = new jmri.implementation.OffsetHighCvProgrammerFacade(programmer, top, addrCV, factor, modulo); - - log.debug("new programmer " + pf); - programmer = pf; // to go around and see if there are more - - } else if (fname.equals("High Access via Partial Index with Reset")) { - // going to create a specific one - String top = parameters.get(0).getText(); - String addrCV = parameters.get(1).getText(); - String factor = parameters.get(2).getText(); - String modulo = parameters.get(3).getText(); - String indicator = parameters.get(4).getText(); - - jmri.implementation.ResettingOffsetHighCvProgrammerFacade pf - = new jmri.implementation.ResettingOffsetHighCvProgrammerFacade(programmer, top, addrCV, factor, modulo, indicator); - - log.debug("new programmer " + pf); - programmer = pf; // to go around and see if there are more - - } else if (fname.equals("Indexed CV access")) { - // going to create a specific one - String PI = parameters.get(0).getText(); - String SI = (parameters.size() > 1) ? parameters.get(1).getText() : null; - boolean cvFirst = (parameters.size() > 2) ? (parameters.get(2).getText().equals("false") ? false : true) : true; - boolean skipDupIndexWrite = (parameters.size() > 3) ? (parameters.get(3).getText().equals("false") ? false : allowCache) : allowCache; // if not present, use default - - jmri.implementation.MultiIndexProgrammerFacade pf - = new jmri.implementation.MultiIndexProgrammerFacade(programmer, PI, SI, cvFirst, skipDupIndexWrite); - - log.debug("new programmer " + pf); - programmer = pf; // to go around and see if there are more - - } else if (fname.equals("TCS 4 CV access")) { - - jmri.implementation.TwoIndexTcsProgrammerFacade pf - = new jmri.implementation.TwoIndexTcsProgrammerFacade(programmer); - - log.debug("new programmer " + pf); - programmer = pf; // to go around and see if there are more - - } else if (fname.equals("Ops Mode Accessory Programming")) { - if (programmer instanceof AddressedProgrammer) { // create if relevant to current mode, otherwise silently ignore - String addrType = "decoder"; - if (!parameters.isEmpty()) { - addrType = parameters.get(0).getText(); - } - - jmri.implementation.AccessoryOpsModeProgrammerFacade pf - = new jmri.implementation.AccessoryOpsModeProgrammerFacade((AddressedProgrammer) programmer, addrType); - - log.debug("new programmer " + pf); + switch (fname) { + case "High Access via Double Index": { + String top = parameters.get(0).getText(); + String addrCVhigh = parameters.get(1).getText(); + String addrCVlow = parameters.get(2).getText(); + String valueCV = parameters.get(3).getText(); + String modulo = parameters.get(4).getText(); + jmri.implementation.AddressedHighCvProgrammerFacade pf + = new jmri.implementation.AddressedHighCvProgrammerFacade(programmer, top, addrCVhigh, addrCVlow, valueCV, modulo); + log.debug("new programmer '{}' {}", fname, pf); programmer = pf; // to go around and see if there are more + break; } - - } else { - log.error("Cannot create programmer capability named: " + fname); + case "High Access via Partial Index": { + String top = parameters.get(0).getText(); + String addrCV = parameters.get(1).getText(); + String factor = parameters.get(2).getText(); + String modulo = parameters.get(3).getText(); + jmri.implementation.OffsetHighCvProgrammerFacade pf + = new jmri.implementation.OffsetHighCvProgrammerFacade(programmer, top, addrCV, factor, modulo); + log.debug("new programmer '{}' {}", fname, pf); + programmer = pf; // to go around and see if there are more + break; + } + case "High Access via Partial Index with Reset": { + String top = parameters.get(0).getText(); + String addrCV = parameters.get(1).getText(); + String factor = parameters.get(2).getText(); + String modulo = parameters.get(3).getText(); + String indicator = parameters.get(4).getText(); + jmri.implementation.ResettingOffsetHighCvProgrammerFacade pf + = new jmri.implementation.ResettingOffsetHighCvProgrammerFacade(programmer, top, addrCV, factor, modulo, indicator); + log.debug("new programmer '{}' {}", fname, pf); + programmer = pf; // to go around and see if there are more + break; + } + case "Indexed CV access": { + String PI = parameters.get(0).getText(); + String SI = (parameters.size() > 1) ? parameters.get(1).getText() : null; + boolean cvFirst = (parameters.size() > 2) ? (!parameters.get(2).getText().equals("false")) : true; + boolean skipDupIndexWrite = (parameters.size() > 3) ? (parameters.get(3).getText().equals("false") ? false : allowCache) : allowCache; // if not present, use default + jmri.implementation.MultiIndexProgrammerFacade pf + = new jmri.implementation.MultiIndexProgrammerFacade(programmer, PI, SI, cvFirst, skipDupIndexWrite); + log.debug("new programmer '{}' {}", fname, pf); + programmer = pf; // to go around and see if there are more + break; + } + case "TCS 4 CV access": { + jmri.implementation.TwoIndexTcsProgrammerFacade pf + = new jmri.implementation.TwoIndexTcsProgrammerFacade(programmer); + log.debug("new programmer '{}' {}", fname, pf); + programmer = pf; // to go around and see if there are more + break; + } + case "Ops Mode Accessory Programming": + if (AddressedProgrammer.class.isAssignableFrom(baseProg.getClass())) { // create if relevant to current mode, otherwise silently ignore + String addrType = "decoder"; + int delay = 500; + for (Element x : parameters) { + switch (x.getAttributeValue("name")) { + case "Address Type": + addrType = x.getText(); + break; + case "Delay": + delay = Integer.parseInt(x.getText()); + break; + default: + log.error("Unknown parameter \"{}\" for \"{}\"", fname, x.getText()); + break; + } + } + log.debug("\"{}\": addrType=\"{}\", delay=\"{}\", baseProg=\"{}\"", fname, addrType, delay, baseProg); + + jmri.implementation.AccessoryOpsModeProgrammerFacade pf + = new jmri.implementation.AccessoryOpsModeProgrammerFacade(programmer, addrType, delay, (AddressedProgrammer) baseProg); + log.debug("new programmer '{}' {}", fname, pf); + programmer = pf; // to go around and see if there are more + } + break; + case "Ops Mode Delayed Programming": + if (AddressedProgrammer.class.isAssignableFrom(baseProg.getClass())) { // create if relevant to current mode, otherwise silently ignore + int delay = 500; + for (Element x : parameters) { + switch (x.getAttributeValue("name")) { + case "Delay": + delay = Integer.parseInt(x.getText()); + break; + default: + log.error("Unknown parameter \"{}\" for \"{}\"", fname, x.getText()); + break; + } + } + log.debug("\"{}\": delay=\"{}\"", fname, delay); + jmri.implementation.OpsModeDelayedProgrammerFacade pf + = new jmri.implementation.OpsModeDelayedProgrammerFacade(programmer, delay); + log.debug("new programmer '{}' {}", fname, pf); + programmer = pf; // to go around and see if there are more + } + break; + default: + log.error("Cannot create programmer capability named: \"{}\"", fname); + break; } } diff --git a/java/src/jmri/jmris/json/Bundle_cs.properties b/java/src/jmri/jmris/json/Bundle_cs.properties index 92166e51690..0a73188289b 100644 --- a/java/src/jmri/jmris/json/Bundle_cs.properties +++ b/java/src/jmri/jmris/json/Bundle_cs.properties @@ -4,7 +4,7 @@ # #Sun Oct 21 06:02:46 EDT 2012 HeartbeatLabel=Heartbeat interval -HeartbeatToolTip=po\u010det vte\u0159i mezi zpr\u00e1vami udr\u017euj\u00edc\u00edch p\u0159i \u017eivot\u011b.
                  Heartbeat interval mus\u00ed b\u00fdt mezi {0} a {1} vte\u0159inami. +HeartbeatToolTip=po\u010det vte\u0159in mezi zpr\u00e1vami udr\u017euj\u00edc\u00edch p\u0159i \u017eivot\u011b.
                  Heartbeat interval mus\u00ed b\u00fdt mezi {0} a {1} vte\u0159inami. PortToolTip=Port poslochaj\u00edc\u00ed na nov\u00e1 p\u0159ipojen\u00ed.
                  Port mus\u00ed b\u00fdt mezi 1 a 65535 a nem\u016f\u017ee b\u00fdt pou\u017e\u00edv\u00e1n jinou aplikac\u00ed nebo slu\u017ebou. JSONSectionTitle=JSON #LabelPort=\u010c\u00edslo portu @@ -16,7 +16,7 @@ PreferencesTooltip=Nastavit p\u0159edvolby pro JSON server ServerSectionTitle=Server # Messages to client devices -ErrorConflictingCommands = Nelze zpracovat konfliknt\u00ed p\u0159\u00edkazy. +ErrorConflictingCommands = Nelze zpracovat konfliktn\u00ed p\u0159\u00edkazy. ErrorCreatingObject = Nelze vytvo\u0159it {0} s n\u00e1zvem {1}. ErrorInternal = Intern\u00ed {0} chyba manipulace. Viz JRMI logy pro informace. ErrorNoConsistManager = Nen\u00ed k dispozici mana\u017eer souprav. diff --git a/java/src/jmri/jmrit/Bundle.properties b/java/src/jmri/jmrit/Bundle.properties index 3128a4651e5..faebebb3510 100644 --- a/java/src/jmri/jmrit/Bundle.properties +++ b/java/src/jmri/jmrit/Bundle.properties @@ -18,7 +18,7 @@ MenuItemLightTable = Lights MenuItemSignalTable = Signal Heads MenuItemReporterTable = Reporters MenuItemMemoryTable = Memory Variables -MenuItemSimpleSignal = Simple Signal Logic +MenuItemSimpleSignal = Simple Signal Logic... MenuItemRouteTable = Routes MenuItemLRouteTable = LRoutes MenuItemLogixTable = Logix @@ -61,6 +61,7 @@ MenuItemSetupClock = Setup Fast Clock... MenuItemAnalogClock = Analog Clock ButtonRunClock = Run ButtonPauseClock = Pause +ButtonGo = Go MenuItemAmpMeter = Track Current... @@ -159,6 +160,9 @@ ClearAll = Clear all MultiSensor = MultiSensor IndicatorTrack = Indicator Track IndicatorTO = Indicator Turnout +setBackground = View on: +Checkers = Checkers +PanelBgColor = Panel Color #used in dualdecoder, PrintRoster IDnumber = ID number {0} diff --git a/java/src/jmri/jmrit/Bundle_ca.properties b/java/src/jmri/jmrit/Bundle_ca.properties index 9ce81ca4dbc..5655958b2a6 100644 --- a/java/src/jmri/jmrit/Bundle_ca.properties +++ b/java/src/jmri/jmrit/Bundle_ca.properties @@ -20,7 +20,7 @@ MenuItemLightTable = Llums MenuItemSignalTable = Senyals MenuItemReporterTable = Retrosenyal MenuItemMemoryTable = Variables de mem\u00f2ria -MenuItemSimpleSignal = L\u00f2gica de senyals simplificada +MenuItemSimpleSignal=L\u00f2gica de senyals simplificada... MenuItemRouteTable = Itineraris MenuItemLRouteTable = L\u00f2gica d'itineraris MenuItemLogixTable = Logix @@ -149,6 +149,8 @@ ClearAll = Neteja tot MultiSensor = Sensor M\u00faltiple IndicatorTrack = Indicador de Via IndicatorTO = Indicador d'Agulla +setBackground = Fons: + # horizontal alignment (for Palette editors) Length = Longitud diff --git a/java/src/jmri/jmrit/Bundle_cs.properties b/java/src/jmri/jmrit/Bundle_cs.properties index 70f358629e2..7f07372dad2 100644 --- a/java/src/jmri/jmrit/Bundle_cs.properties +++ b/java/src/jmri/jmrit/Bundle_cs.properties @@ -19,11 +19,11 @@ MenuItemLightTable = Osv\u011btlen\u00ed MenuItemSignalTable = N\u00e1v\u011bstn\u00ed \u0161t\u00edty MenuItemReporterTable = Reporter MenuItemMemoryTable = Pam\u011b\u0165 prom\u011bnn\u00fdch -MenuItemSimpleSignal = Jednoduch\u00e1 n\u00e1v\u011bstn\u00ed logika +MenuItemSimpleSignal=Jednoduch\u00e1 n\u00e1v\u011bstn\u00ed logika... MenuItemRouteTable = Cesty MenuItemLRouteTable = LRoutes MenuItemLogixTable = Logix -MenuItemOBlockTable = Obsazen\u00e9 kolejov\u00e9 \u00faseky +MenuItemOBlockTable = Bloky obsazen\u00ed MenuItemBlockTable = Kolejov\u00e9 \u00faseky MenuItemSectionTable = Odd\u00edly MenuItemTransitTable = Tranzity diff --git a/java/src/jmri/jmrit/Bundle_da.properties b/java/src/jmri/jmrit/Bundle_da.properties index 4b1f4f17e75..c776b8fbe5a 100644 --- a/java/src/jmri/jmrit/Bundle_da.properties +++ b/java/src/jmri/jmrit/Bundle_da.properties @@ -19,7 +19,7 @@ MenuItemLightTable = Lys MenuItemSignalTable = Signal Hoved MenuItemReporterTable = Reporters MenuItemMemoryTable = Hukommelses Variabler -MenuItemSimpleSignal = Simpel Signal Logik +MenuItemSimpleSignal=Simpel Signal Logik... MenuItemRouteTable = Ruter MenuItemLRouteTable = LRuter MenuItemLogixTable = Logix @@ -160,6 +160,7 @@ ClearAll = Ryd alt MultiSensor = MultiSensor IndicatorTrack = Indikator Spor IndicatorTO = Indikator Sporskifte +setBackground = Preview Background: #used in dualdecoder, PrintRoster IDnumber = ID nummer {0} diff --git a/java/src/jmri/jmrit/Bundle_de.properties b/java/src/jmri/jmrit/Bundle_de.properties index a2e3956c2e1..6a08e59455e 100644 --- a/java/src/jmri/jmrit/Bundle_de.properties +++ b/java/src/jmri/jmrit/Bundle_de.properties @@ -20,7 +20,7 @@ MenuItemLightTable = Lichte MenuItemSignalTable = Signalschirme MenuItemReporterTable = Melder MenuItemMemoryTable = Speicher -MenuItemSimpleSignal = Einfache Signallogik +MenuItemSimpleSignal=Einfache Signallogik... MenuItemRouteTable = Weichenstra\u00dfen MenuItemLRouteTable = Logixweichenstra\u00dfen MenuItemLogixTable = Logix @@ -160,6 +160,7 @@ ClearAll = Deselektiere Alle MultiSensor = MultiDetektor IndicatorTO = Indikatorweiche IndicatorTrack = Indikatorgleis +setBackground = Hintergrund: #used in dualdecoder IDnumber = ID-Nummer {0} diff --git a/java/src/jmri/jmrit/Bundle_es.properties b/java/src/jmri/jmrit/Bundle_es.properties index a673a709dd2..0a2e735c846 100644 --- a/java/src/jmri/jmrit/Bundle_es.properties +++ b/java/src/jmri/jmrit/Bundle_es.properties @@ -17,7 +17,7 @@ MenuItemLightTable = Luces MenuItemSignalTable = Se\u00f1ales MenuItemReporterTable = Chivatos MenuItemMemoryTable = Variables de memoria -MenuItemSimpleSignal = L\u00f3gica de se\u00f1ales +MenuItemSimpleSignal=L\u00f3gica de se\u00f1ales... MenuItemRouteTable = Tabla de rutas MenuItemLogixTable = Logix MenuItemSensorGroup = Grupos de sensores... diff --git a/java/src/jmri/jmrit/Bundle_fr.properties b/java/src/jmri/jmrit/Bundle_fr.properties index 269c39f81a7..fdd5c754aa3 100644 --- a/java/src/jmri/jmrit/Bundle_fr.properties +++ b/java/src/jmri/jmrit/Bundle_fr.properties @@ -20,7 +20,7 @@ MenuItemLightTable = Lumi\u00e8res MenuItemSignalTable = Feux de Signalisation MenuItemReporterTable = Rapports MenuItemMemoryTable = Variables M\u00e9moires -MenuItemSimpleSignal = Logique Simple Signal +MenuItemSimpleSignal=Logique Simple Signal... MenuItemRouteTable = Itin\u00e9raires MenuItemLRouteTable = LItin\u00e9raires MenuItemLogixTable = Logix @@ -138,6 +138,9 @@ Elements = \u00c9l\u00e9ments Normal = Normal Locked = Verrouill\u00e9 +# used in Display, Maintenance +setBackground = Arri\u00e8re-Plan : + scale = \u00e9chelle {0}: 1 ReminderSaveString = S'il vous pla\u00eet n'oubliez pas de sauvegarder vos {0} sur le disque.
                  (S\u00e9lectionnez "Sauvegarde Configuration..." dans le menu Fichier) diff --git a/java/src/jmri/jmrit/Bundle_it.properties b/java/src/jmri/jmrit/Bundle_it.properties index c3a38bdd190..d0d325438b0 100644 --- a/java/src/jmri/jmrit/Bundle_it.properties +++ b/java/src/jmri/jmrit/Bundle_it.properties @@ -20,7 +20,7 @@ MenuItemLightTable = Luci MenuItemSignalTable = Vela Segnale MenuItemReporterTable = Reporters MenuItemMemoryTable = Variabili in Memoria -MenuItemSimpleSignal = Logica Segnali Semplificata +MenuItemSimpleSignal=Logica Segnali Semplificata... MenuItemRouteTable = Itinerari MenuItemLRouteTable = Logica Itinerari MenuItemLogixTable = Logix @@ -148,6 +148,7 @@ scale = scala {0}:1 MultiSensor = Multi-Sensore IndicatorTrack = Indicatore Binario IndicatorTO = Indicatore Scambio +setBackground = Sfondo: # used in Operations, Display, Roster Options = Opzioni diff --git a/java/src/jmri/jmrit/Bundle_nl.properties b/java/src/jmri/jmrit/Bundle_nl.properties index 4e078078654..ee9d7ffc488 100644 --- a/java/src/jmri/jmrit/Bundle_nl.properties +++ b/java/src/jmri/jmrit/Bundle_nl.properties @@ -19,7 +19,7 @@ MenuItemLightTable = Lampen MenuItemSignalTable = Seinschilden MenuItemReporterTable = Reporters MenuItemMemoryTable = Geheugenvariabelen -MenuItemSimpleSignal = Simpele Seinlogica +MenuItemSimpleSignal=Simpele SeinLogica... MenuItemRouteTable = Wisselstraten MenuItemLRouteTable = LRoutes MenuItemLogixTable = Logix @@ -61,6 +61,7 @@ MenuItemSetupClock = Stel modelklok in... MenuItemAnalogClock = Analoge Klok ButtonRunClock = Loop ButtonPauseClock = Pauseer +ButtonGo = Start MenuItemAmpMeter = Spoorstroom... @@ -159,6 +160,10 @@ ClearAll = Deselecteer alle MultiSensor = MultiSensor IndicatorTrack = Indicatiespoor IndicatorTO = Indicatiewissel +setBackground = Toon op: +Checkers = Ruitjes +PanelBgColor = Als Paneel + #used in dualdecoder IDnumber = ID nummer {0} Legacy = Oude versie diff --git a/java/src/jmri/jmrit/audio/NullAudioSource.java b/java/src/jmri/jmrit/audio/NullAudioSource.java index fbc22739c41..75847e57dcc 100644 --- a/java/src/jmri/jmrit/audio/NullAudioSource.java +++ b/java/src/jmri/jmrit/audio/NullAudioSource.java @@ -36,9 +36,7 @@ public class NullAudioSource extends AbstractAudioSource { * @param systemName AudioSource object system name (e.g. IAS1) */ public NullAudioSource(String systemName) { - super(systemName); - log.debug("New NullAudioSource: {}", systemName); - initialised = init(); + this(systemName,null); } /** diff --git a/java/src/jmri/jmrit/beantable/BeanTableBundle_cs.properties b/java/src/jmri/jmrit/beantable/BeanTableBundle_cs.properties index 3e74f32fb46..69b4dbf17d0 100644 --- a/java/src/jmri/jmrit/beantable/BeanTableBundle_cs.properties +++ b/java/src/jmri/jmrit/beantable/BeanTableBundle_cs.properties @@ -10,7 +10,7 @@ TitleSignalTable = Tabulak n\u00e1v\u011bstn\u00edch desek TitleLightTable = Tabulka osv\u011btlen\u00ed TitleLogixTable = Tabulka Logix TitleTransitTable = Tabulka tranzit -TitleOBlockTable = Tabulka obsazen\u00e9 kolejov\u00e9 \u00faseky +TitleOBlockTable = Tabulka blok\u016f obsazen\u00ed TitleSectionTable = Tabulka odd\u00edly TitleReporterTable = Tabulka Reporter TitleMemoryTable = Tabulka pam\u011bti @@ -18,7 +18,7 @@ TitleAudioTable = Tabulka audio TitleIdTagTable = Tabulka Id Tag TitleSignalMastTable = Tabulka n\u00e1v\u011bstidel TitleSignalMastLogicTable = Tabulka logiky n\u00e1v\u011bst\u00ed -TitleWarrantTable = Tabulka varov\u00e1n\u00ed +TitleWarrantTable = Tabulka povolen\u00ed TitleConditionalTable = Tabulka z\u00e1vislost\u00ed TitleSignalGroupTable = Tabulka n\u00e1v\u011bstn\u00edch skupin TitleRouteTable = Tabulka cest @@ -466,7 +466,7 @@ AspectMatrixHeaderLabel = Pro ka\u017edou povolenou n\u00e1v\u011bst za\u0161krt AspectMatrixHeaderTooltip = Pol\u00ed\u010dko za\u0161krtnuto = Pro = rovn\u011b; od\u0161krtnuto = Proti = do odbo\u010dky MatrixOutputEmpty = Aspo\u0148 jeden z v\u00fdstup\u016f nebyl definov\u00e1n.\nPros\u00edm nastavte nejd\u0159\u00edve v\u0161echny vstupy pro toto n\u00e1v\u011bstidlo. MatrixUnLitDetails = V\u00fdstup pro neosv\u011btleno -MatrixUnlitTooltip = Kdy\u017e aktivn\u00ed, nastavte shodn\u011b n\u00e1v\u011bst n\u00ed\u017ee na zhasnuto/neosv\u011btleno +MatrixUnlitTooltip = Kdy\u017e aktivn\u00ed, nastavte shodn\u011b n\u00e1v\u011bst n\u00ed\u017ee uvedenou na zhasnuto/neosv\u011btleno MatrixMastCopyAspectBits = Kop\u00edrovat matici n\u00e1v\u011bst\u00ed z n\u00e1v\u011bstidla MatrixColWarning = Zvolen\u00fd p\u016fvodn\u00ed m\u00e1 {0} m\u00edsto {1} sloupc\u016f.\nPokra\u010dovat? MatrixColWarningTitle = Po\u010det sloupc\u016f nesouhlas\u00ed diff --git a/java/src/jmri/jmrit/beantable/BeanTableDataModel.java b/java/src/jmri/jmrit/beantable/BeanTableDataModel.java index 2b4accc0d84..c1453be3c60 100644 --- a/java/src/jmri/jmrit/beantable/BeanTableDataModel.java +++ b/java/src/jmri/jmrit/beantable/BeanTableDataModel.java @@ -50,7 +50,6 @@ import jmri.NamedBeanHandleManager; import jmri.UserPreferencesManager; import jmri.swing.JTablePersistenceManager; -import jmri.util.com.sun.TableSorter; import jmri.util.davidflanagan.HardcopyWriter; import jmri.util.swing.XTableColumnModel; import jmri.util.table.ButtonEditor; @@ -471,7 +470,7 @@ public void printTable(HardcopyWriter w) { if (value == null) { columnStrings[j] = spaces.toString(); } else if (value instanceof JComboBox) { - columnStrings[j] = ((JComboBox) value).getSelectedItem().toString(); + columnStrings[j] = ((JComboBox) value).getSelectedItem().toString(); } else { // Boolean or String columnStrings[j] = value.toString(); @@ -548,38 +547,32 @@ protected void printColumns(HardcopyWriter w, String columnStrings[], int column * @param sorter the row sorter for the table; if null, the table will not * be sortable * @return the table - * @throws NullPointerException if name or model are null + * @throws NullPointerException if name or model is null */ public JTable makeJTable(@Nonnull String name, @Nonnull TableModel model, @Nullable RowSorter sorter) { Objects.requireNonNull(name, "the table name must be nonnull"); Objects.requireNonNull(model, "the table model must be nonnull"); - JTable table = new JTable(model); - table.setName(name); - table.setRowSorter(sorter); - table.getTableHeader().setReorderingAllowed(true); - table.setColumnModel(new XTableColumnModel()); - table.createDefaultColumnsFromModel(); - - addMouseListenerToHeader(table); - return table; + return this.configureJTable(name, new JTable(model), sorter); } /** - * Create a new table. + * Configure a new table using the given model and row sorter. * - * @param sorter the sorter and model for the table - * @return a new table - * @deprecated since 4.5.4; use - * {@link #makeJTable(java.lang.String, javax.swing.table.TableModel, javax.swing.RowSorter)} - * instead. + * @param table the table to configure + * @param name the table name + * @param sorter the row sorter for the table; if null, the table will not + * be sortable + * @return the table + * @throws NullPointerException if table or the table name is null */ - @Deprecated - public JTable makeJTable(TableSorter sorter) { - JTable table = new JTable(sorter); + protected JTable configureJTable(@Nonnull String name, @Nonnull JTable table, @Nullable RowSorter sorter) { + Objects.requireNonNull(table, "the table must be nonnull"); + Objects.requireNonNull(name, "the table name must be nonnull"); + table.setRowSorter(sorter); + table.setName(name); table.getTableHeader().setReorderingAllowed(true); table.setColumnModel(new XTableColumnModel()); table.createDefaultColumnsFromModel(); - addMouseListenerToHeader(table); return table; } @@ -785,31 +778,6 @@ protected void addMouseListenerToHeader(JTable table) { table.getTableHeader().addMouseListener(mouseHeaderListener); } - /** - * Rendered obsolete by changes to - * {@link #loadTableColumnDetails(javax.swing.JTable)}. - * - * @param table the table to save - * @deprecated since 4.5.4 without direct replacement - */ - @Deprecated - public void saveTableColumnDetails(JTable table) { - // do nothing - } - - /** - * Rendered obsolete by changes to - * {@link #loadTableColumnDetails(javax.swing.JTable, java.lang.String)}. - * - * @param table the table to save - * @param beantableref the name of the table - * @deprecated since 4.5.4 without direct replacement - */ - @Deprecated - public void saveTableColumnDetails(JTable table, String beantableref) { - // do nothing - } - /** * Persist the state of the table after first setting the table to the last * persisted state. @@ -818,11 +786,10 @@ public void saveTableColumnDetails(JTable table, String beantableref) { * @throws NullPointerException if the name of the table is null */ public void persistTable(@Nonnull JTable table) throws NullPointerException { - JTablePersistenceManager manager = InstanceManager.getNullableDefault(JTablePersistenceManager.class); - if (manager != null) { + InstanceManager.getOptionalDefault(JTablePersistenceManager.class).ifPresent((manager) -> { manager.resetState(table); // throws NPE if table name is null manager.persist(table); - } + }); } /** @@ -832,38 +799,9 @@ public void persistTable(@Nonnull JTable table) throws NullPointerException { * @throws NullPointerException if the name of the table is null */ public void stopPersistingTable(@Nonnull JTable table) throws NullPointerException { - JTablePersistenceManager manager = InstanceManager.getNullableDefault(JTablePersistenceManager.class); - if (manager != null) { + InstanceManager.getOptionalDefault(JTablePersistenceManager.class).ifPresent((manager) -> { manager.stopPersisting(table); // throws NPE if table name is null - } - } - - /** - * Load table column settings from persistent storage. - * - * @param table the table - * @deprecated since 4.5.4; use {@link #persistTable(javax.swing.JTable)} - * instead. - */ - @Deprecated - public void loadTableColumnDetails(JTable table) { - loadTableColumnDetails(table, getMasterClassName()); - } - - /** - * Load table column settings from persistent storage. - * - * @param table the table - * @param beantableref name of the table - * @deprecated since 4.5.4; use {@link #persistTable(javax.swing.JTable)} - * instead. - */ - @Deprecated - public void loadTableColumnDetails(JTable table, String beantableref) { - if (table.getName() == null) { - table.setName(beantableref); - } - this.persistTable(table); + }); } static class HeaderActionListener implements ActionListener { diff --git a/java/src/jmri/jmrit/beantable/BeanTablePane.java b/java/src/jmri/jmrit/beantable/BeanTablePane.java index 5012c20d2b9..ce36817597e 100644 --- a/java/src/jmri/jmrit/beantable/BeanTablePane.java +++ b/java/src/jmri/jmrit/beantable/BeanTablePane.java @@ -9,7 +9,6 @@ import javax.swing.table.TableRowSorter; import jmri.swing.RowSorterUtil; import jmri.util.SystemNameComparator; -import jmri.util.com.sun.TableSorter; /** * Provide a JPanel to display a table of NamedBeans. @@ -82,20 +81,6 @@ public void init(BeanTableDataModel model) { void extras() { } - /** - * Hook to allow sub-typing of JTable created. - * - * @param sorter the sorter model - * @return JTable created - * @deprecated since 4.5.4; use - * {@link jmri.jmrit.beantable.BeanTableDataModel#makeJTable(java.lang.String, javax.swing.table.TableModel, javax.swing.RowSorter)} - * instead. - */ - @Deprecated - protected JTable makeJTable(TableSorter sorter) { - return new JTable(sorter); - } - protected Box getBottomBox() { return bottomBox; } diff --git a/java/src/jmri/jmrit/beantable/ListedTableFrame.java b/java/src/jmri/jmrit/beantable/ListedTableFrame.java index 885a23352f1..462e2135353 100644 --- a/java/src/jmri/jmrit/beantable/ListedTableFrame.java +++ b/java/src/jmri/jmrit/beantable/ListedTableFrame.java @@ -261,7 +261,7 @@ void buildMenus(final TabbedTableItem item) { item.getAAClass().setMenuBar(this); this.addHelpMenu(item.getAAClass().helpTarget(), true); } catch (Exception ex) { - log.error("Error when trying to set menu bar for {}\n{}", item.getClassAsString(), ex); + log.error("Error when trying to set menu bar for {}", item.getClassAsString(), ex); } this.revalidate(); } diff --git a/java/src/jmri/jmrit/beantable/TurnoutTableAction.java b/java/src/jmri/jmrit/beantable/TurnoutTableAction.java index 458aa386fd6..d6b41624c55 100644 --- a/java/src/jmri/jmrit/beantable/TurnoutTableAction.java +++ b/java/src/jmri/jmrit/beantable/TurnoutTableAction.java @@ -58,7 +58,6 @@ import jmri.jmrit.turnoutoperations.TurnoutOperationFrame; import jmri.util.ConnectionNameFromSystemName; import jmri.util.JmriJFrame; -import jmri.util.com.sun.TableSorter; import jmri.util.swing.JmriBeanComboBox; import jmri.util.swing.XTableColumnModel; import org.slf4j.Logger; @@ -700,26 +699,7 @@ protected void configValueColumn(JTable table) { @Override public JTable makeJTable(@Nonnull String name, @Nonnull TableModel model, @Nullable RowSorter sorter) { - JTable table = this.makeJTable(model); - table.setName(name); - table.setRowSorter(sorter); - table.getTableHeader().setReorderingAllowed(true); - table.setColumnModel(new XTableColumnModel()); - table.createDefaultColumnsFromModel(); - - addMouseListenerToHeader(table); - return table; - } - - @Override - public JTable makeJTable(TableSorter sorter) { - JTable table = this.makeJTable((TableModel) sorter); - table.getTableHeader().setReorderingAllowed(true); - table.setColumnModel(new XTableColumnModel()); - table.createDefaultColumnsFromModel(); - - addMouseListenerToHeader(table); - return table; + return this.configureJTable(name, this.makeJTable(model), sorter); } private JTable makeJTable(TableModel model) { @@ -1940,11 +1920,11 @@ public boolean isValid() { return true; } else { boolean validFormat = false; - // try { - validFormat = (InstanceManager.getDefault(TurnoutManager.class).validSystemNameFormat(prefix + "T" + value) == Manager.NameValidity.VALID); - // } catch (jmri.JmriException e) { - // use it for the status bar? - // } + // try { + validFormat = (InstanceManager.getDefault(TurnoutManager.class).validSystemNameFormat(prefix + "T" + value) == Manager.NameValidity.VALID); + // } catch (jmri.JmriException e) { + // use it for the status bar? + // } if (validFormat) { addButton.setEnabled(true); // directly update Create button return true; diff --git a/java/src/jmri/jmrit/beantable/signalmast/RepeaterBundle_cs.properties b/java/src/jmri/jmrit/beantable/signalmast/RepeaterBundle_cs.properties index 80538c8b182..c50df9aabdb 100644 --- a/java/src/jmri/jmrit/beantable/signalmast/RepeaterBundle_cs.properties +++ b/java/src/jmri/jmrit/beantable/signalmast/RepeaterBundle_cs.properties @@ -24,7 +24,7 @@ ButtonAdd = P\u0159idat AddRepeater = P\u0159idat opakova\u010d ColumnMaster = \u0158\u00edd\u00edc\u00ed -ColumnSlave = pod\u0159\u00edzen\u00fd +ColumnSlave = Pod\u0159\u00edzen\u00fd ColumnEnabled = Zp\u0159\u00edstupnit ColumnDelete = Vymazat ColumnDir = Aktualizovat diff --git a/java/src/jmri/jmrit/blockboss/BlockBossAction.java b/java/src/jmri/jmrit/blockboss/BlockBossAction.java index aaa51fee9c0..4099c20b0ae 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossAction.java +++ b/java/src/jmri/jmrit/blockboss/BlockBossAction.java @@ -20,7 +20,7 @@ public BlockBossAction(String s) { } public BlockBossAction() { - this(java.util.ResourceBundle.getBundle("jmri.jmrit.blockboss.BlockBossBundle").getString("Simple_Signal_Logic")); + this(Bundle.getMessage("Simple_Signal_Logic")); } @Override @@ -30,4 +30,5 @@ public void actionPerformed(ActionEvent e) { JFrame f = new BlockBossFrame(); f.setVisible(true); } + } diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle.properties index a1b74ce4efd..6073b8c3f47 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle.properties @@ -1,77 +1,68 @@ # BlockBossBundle.properties -# To change this template, choose Tools | Templates -# and open the template in the editor. +# +# Default properties for SSL -Simple_Signal_Logic=Simple Signal Logic -UnexpectedMode=Unexpected mode: -Held=Held -Approach_Sensor1_=Approach Sensor1 -Sensor2Alt_=Sensor2Alt -Sensor1Alt_=Sensor1Alt -Turnout_=Turnout -Sensor5_=Sensor5 -Sensor4_=Sensor4 -Sensor3_=Sensor3 -Sensor2_=Sensor2 -Sensor1_=Sensor1 -_was_not_found!= \ was not found! -Signal_=Signal -_BlockBossLogic= BlockBossLogic -Signal_logic_for_=Signal logic for -no_button_selected?=no button selected? -_is_not_defined_yet= is not defined yet -Signal_head_=Signal Head -And_Protect_Signal=And Protect Signal -When_Turnout_is_=When Turnout is -And_Sensor/s=And Sensor/s -To_Protect_Signal=To Protect Signal -Watches_Turnout=Watches Turnout -Protects_Sensor/s=Protects Sensor/s -Is_=Is -Red_When_Turnout=Red When Turnout -_Protects_Sensor/s= Protects Sensor/s -Protects_Signal=Protects Signal -__Protects_Sensor/s= Protects Sensor/s -Apply=Apply -Comment =Comment: -___Approach_Lighting_Sensor_= Approach Lighting Sensor -_________Signal_Named_= Signal Named -On_Facing-Point_Turnout=On Facing-Point Turnout -Diverging_Leg_of_Turnout=Diverging Leg of Turnout -Main_Leg_of_Turnout=Main Leg of Turnout -On_Single_Block=On Single Block -Is_Distant_Signal=Is Distant Signal -With_Flashing_Yellow=With Flashing Yellow -Limited_Speed=Limited Speed -Restricting_Speed=Restricting Speed -package.jmri.jmrit.blockboss.BlockBossFrame=package.jmri.jmrit.blockboss.BlockBossFrame -unless_over_ridden_by_an_intermediate_stop_sensor.=unless overridden by an Intermediate Stop Sensor. -Mirrors_the_protected_(following)_signal's_status=Mirrors the protected (following) Signal's status -Enter_the_high_speed_signal_head_for_this_track.=Enter the high speed Signal Head for this track. -For_dual_head_signals_the_fastest_aspect_is_protected.=For dual head Signals, the fastest Aspect is protected. -Enter_the_low_speed_signal_head_for_this_track.=Enter the low speed Signal Head for this track. -to_yellow,_rather_than_green.=to Yellow, rather than Green. -to_flashingred,_rather_than_green.=Flashing Red, rather than Green. -Limits_the_fastest_aspect_displayed=Limits the fastest Aspect displayed -flashing_yellow,_rather_than_green.=to Flashing Yellow, rather than Green. -One_aspect_faster_than_yellow_displays=One Aspect faster than Yellow displays -Enter_protected_turnout_number_here.=Enter protected Turnout number here. -Sensor_active_sets_this_signal_to_Red.=Sensor Active sets this Signal to Red. -leave_blank_for_always_on.=leave blank for always on. -Enter_sensor_that_lights_this_signal_or=Enter Sensor that lights this Signal or -then_hit_return_to_load_its_information.=then hit Return to load its information. -enter_an_existing_signal_head_number=enter an existing Signal Head number, -Enter_a_new_signal_head_number,_or=Enter a new Signal Head number, or -track_facing_double_track=track facing double track. -Single_signal_head_on_single=Single Signal Head on single -Signal_head_for_branching_track=Signal Head for branching track -through_turnout_in_either_direction=through Turnout in either direction. -Signal_head_for_main_track=Signal Head for main track -In_direction_of_traffic=In direction of traffic +Simple_Signal_Logic = Simple Signal Logic +UnexpectedMode = Unexpected mode: +Held = Held +Approach_Sensor1_ = Approach Sensor1 +BeanXNotFound = {0} "{1}" was not found +_BlockBossLogic = BlockBossLogic +SignalLogicForX = Simple Signal Logic for {0} +HeadXNotDefined = Signal Head "{0}" is not defined yet. Add it to the table before continuing. +And_Protect_Signal = and Protect Signal: +WhenTurnoutIsX = When watched Turnout''s state is: {0} +And_Sensors = and Sensor/s: +To_Protect_Signal = To Protect Signal: +WatchesTurnout = Watches Turnout: +ProtectsSensor = Protects Sensor/s: +IsState = state is: {0} +Red_When_Turnout = Red when Turnout: +Protects_Signal = Protects Signal: +Comment = Comment: +ApproachLightingSensorLabel = Approach Lighting Sensor: +SSLHeadNamedLabel = For Signal Head: +On_Facing-Point_Turnout = On Facing-Point Turnout +Diverging_Leg_of_Turnout = Diverging Leg of Turnout +Main_Leg_of_Turnout = Main Leg of Turnout +On_Single_Block = On Single Block +Is_Distant_Signal = Is Distant Signal +With_Flashing_Yellow = With Flashing Yellow +Limited_Speed = Limited Speed +Restricting_Speed = Restricting Speed +unless_over_ridden_by_an_intermediate_stop_sensor. = unless overridden by an Intermediate Stop Sensor. +Mirrors_the_protected_(following)_signals_status = Mirrors the protected (following) Signal's status +Enter_the_high_speed_signal_head_for_this_track. = Enter the high speed Signal Head for this track. +For_dual_head_signals_the_fastest_aspect_is_protected. = For dual head Signals, the fastest Appearance is protected. +Enter_the_low_speed_signal_head_for_this_track. = Enter the low speed Signal Head for this track. +to_yellow_rather_than_green = to Yellow, rather than Green. +to_flashingred_rather_than_green=to Flashing Red, rather than Green. +Limits_the_fastest_aspect_displayed = Limits the fastest Appearance displayed +flashing_yellow_rather_than_green = Flashing Yellow, rather than Green. +One_aspect_faster_than_yellow_displays = One Appearance faster than Yellow displays +Enter_protected_turnout_number_here. = Select the protected Turnout here or enter name for a new one. +Sensor_active_sets_this_signal_to_Red. = This Sensor Active sets the Signal Head to Red. +Enter_sensor_that_lights_this_signal_or = Select or enter name for a new Sensor that lights this Signal Head,
                  or leave blank for Always On. +then_hit_return_to_load_its_information. = the existing information will be loaded for editing. +Enter_a_new_signal_head_number_or = Select a Signal Head to attach SSL to. If present, +Single_signal_head_on_single = Single Signal Head on single track facing double track. +Signal_head_for_branching_track = Signal Head for branching track +through_turnout_in_either_direction = through Turnout in either direction. +Signal_head_for_main_track = Signal Head for main track +In_direction_of_traffic = In direction of traffic. -InUseBlockBossHeader = Is in use with SSL for SignalHead {0}. -InUseWatchedSignal = As a watched Signal +InUseBlockBossHeader = Is in use with SSL for Signal Head {0}. +InUseWatchedSignal = As a watched Signal Head InUseWatchedTurnout = As a watched Turnout InUseWatchedSensor = As monitoring Sensor InUseApproachSensor = Approach Sensor InUseBlockBossFooter = This will be removed from the SSL +InUseThisSslWillBeDeleted = This SSL will be deleted + +ApplyToolTip = Press to create/update logic for this Signal Head. +ApplyErrorDialog = An error occurred creating the Simple Signal Logic.\nCheck the Console log for more information. +CommentToolTip = Your notes will be stored with this SSL +StatusSslStart = Start by selecting a Signal Head at the top +StatusSslCreated = SSL created for Signal Head {0} +StatusSslUpdated = SSL updated for Signal Head {0} +StatusSslLoaded = Check or change the SSL configuration on this pane and click [{0}] diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_ca.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_ca.properties index 07ceb41b0d4..a314715f0c5 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle_ca.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_ca.properties @@ -1,72 +1,53 @@ -#BlockBossBundle_ca.properties -# To change this template, choose Tools | Templates -# and open the template in the editor. +# BlockBossBundle_ca.properties +# # Catalan Translation: Joan de Castro Alemany (joan276dca@yahoo.es) 18/08/2016 -Simple_Signal_Logic=L\u00f2gica Simple de Senyals -UnexpectedMode =Mode Inesperat: -Held=Responsable -Approach_Sensor1_=Apropament del Sensor1 -Sensor2Alt_=Sensor2Alt -Sensor1Alt_=Sensor1Alt -Turnout_=Agulla -Sensor5_=Sensor5 -Sensor4_=Sensor4 -Sensor3_=Sensor3 -Sensor2_=Sensor2 -Sensor1_=Sensor1 -_was_not_found!= \ no s'ha trobat! -Signal_=Senyal -_BlockBossLogic= L\u00f2gica BlockBoss -Signal_logic_for_=L\u00f2gica de Senyal per a -no_button_selected?=Cap bot\u00f3 seleccionat? -_is_not_defined_yet= encara no est\u00e0 definit -Signal_head_=Senyal -And_Protect_Signal=i Protegeix el Senyal -When_Turnout_is_=Quan l'Agulla \u00e9s -And_Sensor/s=I Sensor/s -To_Protect_Signal=Per protegir el Senyal -Watches_Turnout=Controla Agulles -Protects_Sensor/s=Protegieg Sensor/s -Is_=\u00c9s -Red_When_Turnout=Vermell quan l'Agulla -_Protects_Sensor/s= Protecgeix Sensor/s -Protects_Signal=Protegeix el Senyal -__Protects_Sensor/s= Protegeix Sensor/s -Apply=Aplica -Comment =Comentari: -___Approach_Lighting_Sensor_= Sensor de llums d'aproximaci\u00f3 -_________Signal_Named_= Senyal anomenada -On_Facing-Point_Turnout=On Facing-Point Turnout -Diverging_Leg_of_Turnout=Via desviada de l'Agulla -Main_Leg_of_Turnout=Via principal de l'Agulla -On_Single_Block=En un Bloc \u00fanic -Is_Distant_Signal=\u00c9s Senyal distant -With_Flashing_Yellow=Amb Groc Intermitent -Limited_Speed=Velocitat Limitada -package.jmri.jmrit.blockboss.BlockBossFrame=package.jmri.jmrit.blockboss.BlockBossFrame -unless_over_ridden_by_an_intermediate_stop_sensor.=llevat que hi hagi un sensor de parada intermedi. -Mirrors_the_protected_(following)_signal's_status=Reenvia l'estat de la Senyal protegida -Enter_the_high_speed_signal_head_for_this_track.=Entra el senyal d'alta velocitat per a aquesta via. -For_dual_head_signals_the_fastest_aspect_is_protected.=Per a dos senyals, l'Aspecte m\u00e9s r\u00e0pid \u00e9s el protegit. -Enter_the_low_speed_signal_head_for_this_track.=Entra el senyal de baixa velocitat per aquesta via. -to_yellow,_rather_than_green.=a Groc, encomptes de Verd. -Limits_the_fastest_aspect_displayed=Limita l'aspecte que es mostra m\u00e9s r\u00e0pid que es mostra -flashing_yellow,_rather_than_green.=Groc Intermitent, encomptes de Verd. -One_aspect_faster_than_yellow_displays=Un aspecte m\u00e9s r\u00e0pid que el Groc mostrat -Enter_protected_turnout_number_here.=Entra l'Agulla protegida aqu\u00ed. -Sensor_active_sets_this_signal_to_Red.=El Sensor Actiu estableix aquest Senyal a Vermell. -leave_blank_for_always_on.=Deixa en blanc per sempre -Enter_sensor_that_lights_this_signal_or=Entra el Sensor que il\u00b7lumina aquest Senyal o -then_hit_return_to_load_its_information.=despr\u00e9s prem Return per llegir la informaci\u00f3. -enter_an_existing_signal_head_number=entra un n\u00famero de Senyal existent, -Enter_a_new_signal_head_number,_or=Entra un nou n\u00famero de Senyal, o -track_facing_double_track=via travessant una doble via. -Single_signal_head_on_single=Senyal Simple en simple -Signal_head_for_branching_track=Senyal per a via de bifurcaci\u00f3 -through_turnout_in_either_direction=a trav\u00e9s d'agulla en qualsevol sentit -Signal_head_for_main_track=Senyal per Via Principal -In_direction_of_traffic=En el sentit de circulaci\u00f3 +Simple_Signal_Logic = L\u00f2gica Simple de Senyals +UnexpectedMode = Mode Inesperat: +Held = Responsable +Approach_Sensor1_ = Apropament del Sensor1 +BeanXNotFound = {0} "{1}" no s'ha trobat! +_BlockBossLogic = L\u00f2gica BlockBoss +SignalLogicForX = L\u00f2gica de Senyal per a {0} +HeadXNotDefined = Cap {0} encara no est\u00e0 definit +And_Protect_Signal = i Protegeix el Senyal: +WhenTurnoutIsX = Quan l''estat de l''Agulla \u00e9s: {0} +And_Sensors = i Sensor/s: +To_Protect_Signal=Per protegir el Senyal: +WatchesTurnout = Controla Agulles: +ProtectsSensor = Protegeix Sensor/s: +IsState = \u00e9s en estat: {0} +Red_When_Turnout = Vermell quan l'Agulla: +Protects_Signal = Protegeix el Senyal: +Comment = Comentari: +ApproachLightingSensorLabel = Sensor de llums d'aproximaci\u00f3: +SSLHeadNamedLabel = Senyal anomenada: +On_Facing-Point_Turnout = On Facing-Point Turnout +Diverging_Leg_of_Turnout = Via desviada de l'Agulla +Main_Leg_of_Turnout = Via principal de l'Agulla +On_Single_Block = En un Bloc \u00fanic +Is_Distant_Signal = \u00c9s Senyal distant +With_Flashing_Yellow = Amb Groc Intermitent +Limited_Speed = Velocitat Limitada +unless_over_ridden_by_an_intermediate_stop_sensor. = llevat que hi hagi un Sensor de Parada intermedi. +Mirrors_the_protected_(following)_signals_status = Reenvia l'estat de la Senyal protegida +Enter_the_high_speed_signal_head_for_this_track. = Entra el senyal d'alta velocitat per a aquesta via. +For_dual_head_signals_the_fastest_aspect_is_protected. = Per a dos senyals, l'Aspecte m\u00e9s r\u00e0pid \u00e9s el protegit. +Enter_the_low_speed_signal_head_for_this_track. = Entra el senyal de baixa velocitat per aquesta via. +to_yellow_rather_than_green = a Groc, encomptes de Verd. +Limits_the_fastest_aspect_displayed = Limita l'aspecte que es mostra m\u00e9s r\u00e0pid que es mostra +flashing_yellow_rather_than_green = Groc Intermitent, encomptes de Verd. +One_aspect_faster_than_yellow_displays = Un aspecte m\u00e9s r\u00e0pid que el Groc mostrat +Enter_protected_turnout_number_here. = Entra l'Agulla protegida aqu\u00ed. +Sensor_active_sets_this_signal_to_Red. = El Sensor Actiu estableix aquest Senyal a Vermell. +Enter_sensor_that_lights_this_signal_or = Entra el Sensor que il\u00b7lumina aquest Senyal
                  o Deixa en blanc per sempre +then_hit_return_to_load_its_information. = per llegir la informaci\u00f3. +Enter_a_new_signal_head_number_or = Entra un Senyal existent, +Single_signal_head_on_single = Senyal Simple en simple via travessant una doble via. +Signal_head_for_branching_track = Senyal per a via de bifurcaci\u00f3 +through_turnout_in_either_direction = a trav\u00e9s d'agulla en qualsevol sentit +Signal_head_for_main_track = Senyal per Via Principal +In_direction_of_traffic = En el sentit de circulaci\u00f3. InUseBlockBossHeader = \u00c9s en us amb SSL per Senyal {0}. InUseWatchedSignal = Com a Senyal Vigilat diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_da.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_da.properties index 504b99e2fd9..8cf00343733 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle_da.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_da.properties @@ -1,74 +1,68 @@ -# To change this template, choose Tools | Templates -# and open the template in the editor. +# BlockBossBundle_da.properties +# +# Danish properties for SSL -Simple_Signal_Logic=Simple Signal Logic -UnexpectedMode =Unexpected mode: -Held=Held -Approach_Sensor1_=Approach Sensor1 -Sensor2Alt_=Sensor2Alt -Sensor1Alt_=Sensor1Alt -Turnout_=Turnout -Sensor5_=Sensor5 -Sensor4_=Sensor4 -Sensor3_=Sensor3 -Sensor2_=Sensor2 -Sensor1_=Sensor1 -_was_not_found!= \ was not found! -Signal_=Signal -_BlockBossLogic= BlockBossLogic -Signal_logic_for_=Signal logic for -no_button_selected?=no button selected? -_is_not_defined_yet=" is not defined yet -Signal_head_=Signal head " -And_Protect_Signal=And Protect Signal -When_Turnout_is_=When Turnout is -And_Sensor/s=And Sensor/s -To_Protect_Signal=To Protect Signal -Watches_Turnout=Watches Turnout -Protects_Sensor/s=Protects Sensor/s -Is_=Is -Red_When_Turnout=Red When Turnout -_Protects_Sensor/s= Protects Sensor/s -Protects_Signal=Protects Signal -__Protects_Sensor/s= Protects Sensor/s -Apply=Apply -Comment =Comment: -___Approach_Lighting_Sensor_= Approach Lighting Sensor -_________Signal_Named_= Signal Named -On_Facing-Point_Turnout=On Facing-Point Turnout -Diverging_Leg_of_Turnout=Diverging Leg of Turnout -Main_Leg_of_Turnout=Main Leg of Turnout -On_Single_Block=On Single Block -Is_Distant_Signal=Is Distant Signal -With_Flashing_Yellow=With Flashing Yellow -Limited_Speed=Limited Speed -package.jmri.jmrit.blockboss.BlockBossFrame=package.jmri.jmrit.blockboss.BlockBossFrame -unless_over_ridden_by_an_intermediate_stop_sensor.=unless over ridden by an intermediate stop sensor. -Mirrors_the_protected_(following)_signal's_status=Mirrors the protected (following) signal's status -Enter_the_high_speed_signal_head_for_this_track.=Enter the high speed signal head for this track. -For_dual_head_signals_the_fastest_aspect_is_protected.=For dual head signals the fastest aspect is protected. -Enter_the_low_speed_signal_head_for_this_track.=Enter the low speed signal head for this track. -to_yellow,_rather_than_green.=to yellow, rather than green. -Limits_the_fastest_aspect_displayed=Limits the fastest aspect displayed -flashing_yellow,_rather_than_green.=flashing yellow, rather than green. -One_aspect_faster_than_yellow_displays=One aspect faster than yellow displays -Enter_protected_turnout_number_here.=Enter protected turnout number here. -Sensor_active_sets_this_signal_to_Red.=Sensor active sets this signal to Red. -leave_blank_for_always_on.=leave blank for always on. -Enter_sensor_that_lights_this_signal_or=Enter sensor that lights this signal or -then_hit_return_to_load_its_information.=then hit return to load its information. -enter_an_existing_signal_head_number=enter an existing signal head number -Enter_a_new_signal_head_number,_or=Enter a new signal head number, or -track_facing_double_track=track facing double track -Single_signal_head_on_single=Single signal head on single -Signal_head_for_branching_track=Signal head for branching track -through_turnout_in_either_direction=through turnout in either direction -Signal_head_for_main_track=Signal head for main track -In_direction_of_traffic=In direction of traffic +Simple_Signal_Logic = Simple Signal Logic +UnexpectedMode = Unexpected mode: +Held = Held +Approach_Sensor1_ = Approach Sensor1 +BeanXNotFound = {0} "{1}" was not found +_BlockBossLogic = BlockBossLogic +SignalLogicForX = Simple Signal Logic for {0} +HeadXNotDefined = Signal Head "{0}" is not defined yet. Add it to the table before continuing. +And_Protect_Signal = and Protect Signal: +WhenTurnoutIsX = When watched Turnout''s state is: {0} +And_Sensors = and Sensor/s: +To_Protect_Signal = To Protect Signal: +WatchesTurnout = Watches Turnout: +ProtectsSensor = Protects Sensor/s: +IsState = state is: {0} +Red_When_Turnout = Red when Turnout: +Protects_Signal = Protects Signal: +Comment = Comment: +ApproachLightingSensorLabel = Approach Lighting Sensor: +SSLHeadNamedLabel = For Signal Head: +On_Facing-Point_Turnout = On Facing-Point Turnout +Diverging_Leg_of_Turnout = Diverging Leg of Turnout +Main_Leg_of_Turnout = Main Leg of Turnout +On_Single_Block = On Single Block +Is_Distant_Signal = Is Distant Signal +With_Flashing_Yellow = With Flashing Yellow +Limited_Speed = Limited Speed +Restricting_Speed = Restricting Speed +unless_over_ridden_by_an_intermediate_stop_sensor. = unless overridden by an Intermediate Stop Sensor. +Mirrors_the_protected_(following)_signals_status = Mirrors the protected (following) Signal's status +Enter_the_high_speed_signal_head_for_this_track. = Enter the high speed Signal Head for this track. +For_dual_head_signals_the_fastest_aspect_is_protected. = For dual head Signals, the fastest Appearance is protected. +Enter_the_low_speed_signal_head_for_this_track. = Enter the low speed Signal Head for this track. +to_yellow_rather_than_green = to Yellow, rather than Green. +to_flashingred_rather_than_green = to Flashing Red, rather than Green. +Limits_the_fastest_aspect_displayed = Limits the fastest Appearance displayed +flashing_yellow_rather_than_green = Flashing Yellow, rather than Green. +One_aspect_faster_than_yellow_displays = One Appearance faster than Yellow displays +Enter_protected_turnout_number_here. = Select the protected Turnout here or enter name for a new one. +Sensor_active_sets_this_signal_to_Red. = This Sensor Active sets the Signal Head to Red. +Enter_sensor_that_lights_this_signal_or = Select or enter name for a new Sensor that lights this Signal Head,
                  or leave blank for Always On. +then_hit_return_to_load_its_information. = the existing information will be loaded for editing. +Enter_a_new_signal_head_number_or = Select a Signal Head to attach SSL to. If present, +Single_signal_head_on_single = Single Signal Head on single track facing double track. +Signal_head_for_branching_track = Signal Head for branching track +through_turnout_in_either_direction = through Turnout in either direction. +Signal_head_for_main_track = Signal Head for main track +In_direction_of_traffic = In direction of traffic. -InUseBlockBossHeader = Is in use with SSL for SignalHead {0}. -InUseWatchedSignal = As a watched Signal +InUseBlockBossHeader = Is in use with SSL for Signal Head {0}. +InUseWatchedSignal = As a watched Signal Head InUseWatchedTurnout = As a watched Turnout InUseWatchedSensor = As monitoring Sensor InUseApproachSensor = Approach Sensor InUseBlockBossFooter = This will be removed from the SSL +InUseThisSslWillBeDeleted = This SSL will be deleted + +ApplyToolTip = Press to create/update logic for this Signal Head. +ApplyErrorDialog = An error occurred creating the Simple Signal Logic.\nCheck the Console log for more information. +CommentToolTip = Your notes will be stored with this SSL +StatusSslStart=Start by selecting a Signal Head at the top +StatusSslCreated = SSL created for Signal Head {0} +StatusSslUpdated = SSL updated for Signal Head {0} +StatusSslLoaded = Check or change the SSL configuration on this pane and click [{0}] diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_de.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_de.properties index 55395daaef2..90d4b458cbf 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle_de.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_de.properties @@ -1,78 +1,69 @@ -# BlockBossBundel_de.properties -# German properties -# Translation by Egbert Broerse +# BlockBossBundle_de.properties # -# To change this template, choose Tools | Templates -# and open the template in the editor. +# German properties for SSL +# Translation by Egbert Broerse + +Simple_Signal_Logic = Einfache SignalLogik (SSL) +UnexpectedMode = Unerwartete Modus: +Held = Gehalten +Approach_Sensor1_ = Ann\u00e4herungsdetektor1 +BeanXNotFound = {0} "{1}" nicht angetroffen +_BlockBossLogic = BlockBossLogik +SignalLogicForX = Einfache Signallogik f\u00fcr {0} +HeadXNotDefined = Signalschirm "{0}" ist noch nicht definiert. F\u00fcge es zuerst an die Tabelle hinzu. +And_Protect_Signal = und sch\u00fctzt Signalschirm: +WhenTurnoutIsX = bei Zustand der beobachtete Weiche: {0} +And_Sensors = und Detektor(en): +To_Protect_Signal = Zum Schutz von Signalschirm: +WatchesTurnout = Beobachte Weiche: +ProtectsSensor = Sch\u00fctzt Detektor(en): +IsState = ist in Zustand: {0} +Red_When_Turnout = Rot wenn Weiche: +Protects_Signal = Sch\u00fctzt Signal: +Comment = Bemerkung: +ApproachLightingSensorLabel = Beleuchtungsdetektor bei Ann\u00e4herung: +SSLHeadNamedLabel = F\u00fcr Signalschirm: +On_Facing-Point_Turnout = Spitze der Weiche +Diverging_Leg_of_Turnout = Abzweig der Weiche +Main_Leg_of_Turnout = Hauptgleis der Weiche +On_Single_Block = In Normalblock +Is_Distant_Signal = Ist Vorsignal +With_Flashing_Yellow = Mit Gelb blinkend +Limited_Speed = Begrenzte Geschwindigkeit +unless_over_ridden_by_an_intermediate_stop_sensor. = wenn nicht von ein Zwischenstoppdetektor \u00fcberschaltet. +Mirrors_the_protected_(following)_signals_status = Wiederholt Anzeige des beobachteten (n\u00e4chsten) Signalschirms +Enter_the_high_speed_signal_head_for_this_track. = Hochgeschw. Signalschirm f\u00fcr dieses Gleis eingeben. +For_dual_head_signals_the_fastest_aspect_is_protected. = An Doppelschirmsignale, wird das hochgeschw. Begriff gesch\u00fctzt. +Enter_the_low_speed_signal_head_for_this_track. = Niedriggeschw. Signalschirm f\u00fcr dieses Gleis eingeben. +to_yellow_rather_than_green = Gelb, statt Gr\u00fcn. +Limits_the_fastest_aspect_displayed = Begrenzt den schnellsten Signalbegriff +flashing_yellow_rather_than_green = Gelb blinkend, statt Gr\u00fcn. +to_flashingred_rather_than_green = Rot blinkend, statt Gr\u00fcn. +One_aspect_faster_than_yellow_displays = Zeigt einen Begriff schneller als Gelb +Enter_protected_turnout_number_here. = Den gesch\u00fctzten Weichen hier ausw\u00e4hlen oder neuen Namen eingeben. +Sensor_active_sets_this_signal_to_Red. = Detektor Aktiv stellt Schirm auf Rot. +Enter_sensor_that_lights_this_signal_or = Eine Detektor ausw\u00e4hlen (oder neuen Namen eingeben) welche dieses Schirm einblendet,
                  oder leer lassen f\u00fcr Immer An. +then_hit_return_to_load_its_information. = heutige Konfiguration wird eingelesen. +Enter_a_new_signal_head_number_or = Bestehenden Signalschirm ausw\u00e4hlen. Eventuelle +Single_signal_head_on_single = Einziges Signalschirm auf die eingleisige Seite der Weiche. +Signal_head_for_branching_track = Signalschirm auf Abzweig +through_turnout_in_either_direction = durch Weiche in jede Richtung. +Signal_head_for_main_track = Signalschirm auf Hauptgleis +In_direction_of_traffic = In Fahrrichtung. -Simple_Signal_Logic=Einfache Signallogik -UnexpectedMode =Unexpected mode: -Held=Held -Approach_Sensor1_=Approach Detektor1 -Sensor2Alt_=Detektor2Alt -Sensor1Alt_=Detektor1Alt -Turnout_=Weiche -Sensor5_=Detektor5 -Sensor4_=Detektor4 -Sensor3_=Detektor3 -Sensor2_=Detektor2 -Sensor1_=Detektor1 -_was_not_found!= \ was not found! -Signal_=Signal -_BlockBossLogic= BlockBossLogik -Signal_logic_for_=Signal logic for -no_button_selected?=keinen Knopf selektiert? -_is_not_defined_yet= is not defined yet -Signal_head_=Signal Head -And_Protect_Signal=And Protect Signal -When_Turnout_is_=When Turnout is -And_Sensor/s=And Sensor/s -To_Protect_Signal=To Protect Signal -Watches_Turnout=Watches Turnout -Protects_Sensor/s=Protects Sensor/s -Is_=Is -Red_When_Turnout=Red When Turnout -_Protects_Sensor/s= Protects Sensor/s -Protects_Signal=Protects Signal -__Protects_Sensor/s= Protects Sensor/s -Apply=Apply -Comment =Bemerkung: -___Approach_Lighting_Sensor_= Approach Lighting Sensor -_________Signal_Named_= Signal Named -On_Facing-Point_Turnout=On Facing-Point Turnout -Diverging_Leg_of_Turnout=Diverging Leg of Turnout -Main_Leg_of_Turnout=Main Leg of Turnout -On_Single_Block=On Single Block -Is_Distant_Signal=Is Distant Signal -With_Flashing_Yellow=With Flashing Yellow -Limited_Speed=Limited Speed -package.jmri.jmrit.blockboss.BlockBossFrame=package.jmri.jmrit.blockboss.BlockBossFrame -unless_over_ridden_by_an_intermediate_stop_sensor.=unless overridden by an Intermediate Stop Sensor. -Mirrors_the_protected_(following)_signal's_status=Mirrors the protected (following) Signal's status -Enter_the_high_speed_signal_head_for_this_track.=Enter the high speed Signal Head for this track. -For_dual_head_signals_the_fastest_aspect_is_protected.=For dual head Signals, the fastest Aspect is protected. -Enter_the_low_speed_signal_head_for_this_track.=Enter the low speed Signal Head for this track. -to_yellow,_rather_than_green.=to Yellow, rather than Green. -Limits_the_fastest_aspect_displayed=Limits the fastest Aspect displayed -flashing_yellow,_rather_than_green.=Flashing Yellow, rather than Green. -One_aspect_faster_than_yellow_displays=One Aspect faster than Yellow displays -Enter_protected_turnout_number_here.=Enter protected Turnout number here. -Sensor_active_sets_this_signal_to_Red.=Sensor Active sets this Signal to Red. -leave_blank_for_always_on.=leave blank for always on. -Enter_sensor_that_lights_this_signal_or=Enter Sensor that lights this Signal or -then_hit_return_to_load_its_information.=then hit Return to load its information. -enter_an_existing_signal_head_number=enter an existing Signal Head number, -Enter_a_new_signal_head_number,_or=Enter a new Signal Head number, or -track_facing_double_track=track facing double track. -Single_signal_head_on_single=Single Signal Head on single -Signal_head_for_branching_track=Signal Head for branching track -through_turnout_in_either_direction=through Turnout in either direction. -Signal_head_for_main_track=Signal Head for main track -In_direction_of_traffic=In direction of traffic +InUseBlockBossHeader = Wird benutzt von SSL auf Signalschirm {0}. +InUseWatchedSignal = Als beobachteten Signalschirm +InUseWatchedTurnout = Als beobachtete Weiche +InUseWatchedSensor = Als Kontrolldetektor +InUseApproachSensor = Ann\u00e4herungsdetektor +InUseBlockBossFooter = Wird vom SSL weggenommen +Restricting_Speed = Niedrige Geschwindigkeit -InUseBlockBossHeader = Is in use with SSL for SignalHead {0}. -InUseWatchedSignal = As a watched Signal -InUseWatchedTurnout = As a watched Turnout -InUseWatchedSensor = As monitoring Sensor -InUseApproachSensor = Approach Sensor -InUseBlockBossFooter = This will be removed from the SSL +ApplyToolTip = Dr\u00fccke um Logik fur dieses Signalschirm zu erstellen/aktualisieren. +ApplyErrorDialog = Fehler beim Erstellen vom SSL.\nBitte Konsole ansehen f\u00fcr Einzelheiten. +CommentToolTip = Notitz wird mit SSL gespeichert +StatusSslStart = Zuerst obenan einen Signalschirm ausw\u00e4hlen +StatusSslCreated = SSL f\u00fcr Signalschirm {0} erstellt +StatusSslUpdated = SSL f\u00fcr Signalschirm {0} aktualisiert +StatusSslLoaded = \u00dcberpr\u00fcfe Einzelheiten der SSL Konfiguration in diesem Fenster und [{0}] dr\u00fccken +InUseThisSslWillBeDeleted = Diesen Logik wird gel\u00f6scht diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_fr.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_fr.properties index 1d9026fb03b..e3c11b5f11a 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle_fr.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_fr.properties @@ -1,72 +1,54 @@ -# To change this template, choose Tools | Templates -# and open the template in the editor. +# BlockBossBundle_fr.properties # # Updated by BLOREC Herv\u00e9 2016-01-09 Simple_Signal_Logic = Logique Simple Signal -UnexpectedMode = Mode Inattendu: +UnexpectedMode = Mode Inattendu : Held = Tenu Approach_Sensor1_ = Approche Capteur1 -Sensor2Alt_ = Capteur2Alt -Sensor1Alt_ = Capteur1Alt -Turnout_ = Aiguillage -Sensor5_ = Capteur5 -Sensor4_ = Capteur4 -Sensor3_ = Capteur3 -Sensor2_ = Capteur2 -Sensor1_ = Capteur1 -_was_not_found! = \ n'a pas \u00e9t\u00e9 trouv\u00e9! -Signal_ = Signal +BeanXNotFound = {0} "{1}" n'a pas \u00e9t\u00e9 trouv\u00e9! _BlockBossLogic = BlockBossLogic -Signal_logic_for_ = Logique du Signal pour -no_button_selected? = Pas de bouton s\u00e9lectionn\u00e9? -_is_not_defined_yet = N'est pas encore d\u00e9fini -Signal_head_ = TFeu de Signalisation -And_Protect_Signal = Et Signal de protection -When_Turnout_is_ = Quand Aiguillage est -And_Sensor/s = Et le capteur/s -To_Protect_Signal = Pour prot\u00e9ger le Signal -Watches_Turnout = Montres l'Aiguillage -Protects_Sensor/s = Prot\u00e8ge le capteur/s -Is_ =Est -Red_When_Turnout = Rouge quand l'Aiguillage -_Protects_Sensor/s = Prot\u00e8ge le capteur/s -Protects_Signal = Prot\u00e8ge le Signal -__Protects_Sensor/s = Prot\u00e8ge le capteur/s -Apply=Appliquer -Comment =Commentaire: -___Approach_Lighting_Sensor_ = Capteur lumineux d'approche -_________Signal_Named_ = Signal Nomm\u00e9 +SignalLogicForX = Logique du Signal pour {0} +HeadXNotDefined = Feu de Signalisation "{0}" n'est pas encore d\u00e9fini. +And_Protect_Signal = et prot\u00e8ge Signal : +WhenTurnoutIsX = Quand Aiguillage montr\u00e9 est en \u00e9tat : {0} +And_Sensors = et le capteur/s : +To_Protect_Signal = Pour prot\u00e9ger le Signal : +WatchesTurnout = Montres l'Aiguillage : +ProtectsSensor = Prot\u00e8ge le capteur/s : +IsState = est en \u00e9tat: {0} +Red_When_Turnout = Rouge quand l'Aiguillage : +Protects_Signal = Prot\u00e8ge le Signal : +Comment = Commentaire: +ApproachLightingSensorLabel = Capteur lumineux d'approche : +SSLHeadNamedLabel = Pour Signal: On_Facing-Point_Turnout = Sur Aiguillage en Pointe Diverging_Leg_of_Turnout = Voie divergente de l'Aiguillage -Main_Leg_of_Turnout = Voie principale de l'Aiguillage +Main_Leg_of_Turnout = Voie principale de l'Aiguillage On_Single_Block = Sur le Canton unique Is_Distant_Signal = Est Signal Distant With_Flashing_Yellow = Avec Jaune clignotant Limited_Speed = Vitesse limit\u00e9e -package.jmri.jmrit.blockboss.BlockBossFrame =package.jmri.jmrit.blockboss.BlockBossFrame -unless_over_ridden_by_an_intermediate_stop_sensor. = Plus ou moins pilot\u00e9 par un capteur d'arr\u00eat interm\u00e9diaire. -Mirrors_the_protected_(following)_signal's_status = Renvoie l'\u00e9tat du Signal prot\u00e9g\u00e9 (suivant) +unless_over_ridden_by_an_intermediate_stop_sensor. = Plus ou moins pilot\u00e9 par un Capteur d'Arr\u00eat interm\u00e9diaire. +Mirrors_the_protected_(following)_signals_status = Renvoie l'\u00e9tat du Signal prot\u00e9g\u00e9 (suivant) Enter_the_high_speed_signal_head_for_this_track. = Entrer le Feu de Signalisation haute vitesse pour cette piste. For_dual_head_signals_the_fastest_aspect_is_protected. = Pour deux Feux de Signalisation, l'aspect le plus rapide est prot\u00e9g\u00e9. Enter_the_low_speed_signal_head_for_this_track. = Entrez la Feu de Signalisation \u00e0 faible vitesse pour cette voie. -to_yellow,_rather_than_green. = au Jaune, au lieu du Vert. +to_yellow_rather_than_green = au Jaune, au lieu du Vert. +to_flashingred_rather_than_green = a Rouge clignotant, au lieu du Vert. Limits_the_fastest_aspect_displayed = Les limites de l'aspect le plus rapide s'affiche -flashing_yellow,_rather_than_green. = Jaune clignotant, plut\u00f4t que Vert. +flashing_yellow_rather_than_green = Jaune clignotant, plut\u00f4t que Vert. One_aspect_faster_than_yellow_displays = Un aspect plus rapides que les \u00e9crans Jaunes -Enter_protected_turnout_number_here. = Entrer ici le num\u00e9ro de l'Aiguillage prot\u00e9g\u00e9. +Enter_protected_turnout_number_here. = Choisi l'Aiguillage prot\u00e9g\u00e9. Sensor_active_sets_this_signal_to_Red. = Le Capteur actif met ce Signal au Rouge. -leave_blank_for_always_on. = laisser vide pour toujours. -Enter_sensor_that_lights_this_signal_or = Entrer capteur qui allume ce Signal ou -then_hit_return_to_load_its_information. = Puis appuyer sur Retour pour charger ses informations. -enter_an_existing_signal_head_number = entrer un num\u00e9ro de Feu de Signalisation existant. -Enter_a_new_signal_head_number,_or = Entrer un nouveau num\u00e9ro de Feu de Signalisation, ou -track_facing_double_track = voie face \u00e0 double voie -Single_signal_head_on_single = Feu de Signalisation unique sur simple -Signal_head_for_branching_track = Feu de Signalisation pour branchement voie -through_turnout_in_either_direction = par l'Aiguillage dans les deux directions. -Signal_head_for_main_track =Feu de Signalisation pour la voie principale -In_direction_of_traffic = Dans le sens de la circulation +Enter_sensor_that_lights_this_signal_or = Choisi capteur qui allume ce Signal ou laisser vide pour toujours. +then_hit_return_to_load_its_information. = pour charger ses \u00e9ventuelles informations. +Enter_a_new_signal_head_number_or = Choisi une Feu de Signalisation existante +Single_signal_head_on_single = Feu de Signalisation unique sur simple voie face \u00e0 double voie. +Signal_head_for_branching_track = Feu de Signalisation pour branchement voie +through_turnout_in_either_direction = par l'Aiguillage dans les deux directions. +Signal_head_for_main_track = Feu de Signalisation pour la voie principale +In_direction_of_traffic = Dans le sens de la circulation . InUseBlockBossHeader = Est en service avec SSL pour laT\u00eate Signal {0}. InUseWatchedSignal = Comme un Signal surveill\u00e9 @@ -74,5 +56,3 @@ InUseWatchedTurnout = Comme un Aiguillage surveill\u00e9 InUseWatchedSensor = Comme Capteur de surveillance InUseApproachSensor = Capteur d'Approche InUseBlockBossFooter = Ce sera retir\u00e9e de la SSL - - diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_it.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_it.properties index 03d6c98f9a7..f826535adff 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle_it.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_it.properties @@ -1,5 +1,4 @@ -# To change this template, choose Tools | Templates -# and open the template in the editor. +# BlockBossBundle_it.properties # # Traduzione in italiano a cura di Enzo Fortuna ( babbo_enzo@yahoo.com ) @@ -7,36 +6,22 @@ Simple_Signal_Logic = Logica Segnale Semplice UnexpectedMode = Modalit\u00e0 imprevista: Held = Tenuto Approach_Sensor1_ = Approccio sensore1 -Sensor2Alt_ = Sensore2Alt -Sensor1Alt_ = Sensore1Alt -Turnout_ = Scambio -Sensor5_ = Sensore5 -Sensor4_ = Sensore4 -Sensor3_ = Sensore3 -Sensor2_ = Sensore2 -Sensor1_ = Sensore1 -_was_not_found! = \ non \u00e8 stato trovato! -Signal_ = Segnale +BeanXNotFound = {0} "{1}" non \u00e8 stato trovato! _BlockBossLogic = Logica BlockBoss -Signal_logic_for_ = Logica segnali per -no_button_selected? = nessun pulsante selezionato? -_is_not_defined_yet = " non \u00e8 ancora definito -Signal_head_ = Segnale " -And_Protect_Signal = E protegge il segnale -When_Turnout_is_ = Quando lo scambio \u00e8 -And_Sensor/s = E Sensore/i -To_Protect_Signal = Per proteggere segnale -Watches_Turnout = Controlla Scambio -Protects_Sensor/s = Protegge Sensore/i -Is_ = E' -Red_When_Turnout = Rosso quando Scambio -_Protects_Sensor/s = Protegge Sensore/i -Protects_Signal = Protegge Segnale -__Protects_Sensor/s = Protegge Sensore/i -Apply = Applicare +SignalLogicForX = Logica Segnale Semplice per {0} +HeadXNotDefined = Segnale "{0}" non \u00e8 ancora definito. +And_Protect_Signal = e protegge il segnale: +WhenTurnoutIsX = Quando stato del scambio \u00e8: {0} +And_Sensors = e Sensore/i: +To_Protect_Signal=Per proteggere segnale: +WatchesTurnout = Controlla Scambio: +ProtectsSensor = Protegge Sensore/i: +IsState = \u00e8 stato: {0} +Red_When_Turnout = Rosso quando Scambio: +Protects_Signal = Protegge Segnale: Comment = Commento: -___Approach_Lighting_Sensor_ = Approccio sensore Luci -_________Signal_Named_ = Segnale nominato +ApproachLightingSensorLabel = Approccio sensore Luci: +SSLHeadNamedLabel = Per Segnale: On_Facing-Point_Turnout = Sullo scambio coniugato Diverging_Leg_of_Turnout = Ramo deviato dello scambio Main_Leg_of_Turnout = Corretto tracciato dello scambio @@ -44,29 +29,26 @@ On_Single_Block = Sul Blocco Singolo Is_Distant_Signal = \u00e8 il segnale a distanza With_Flashing_Yellow = Con Giallo Lampeggiante Limited_Speed = Velocit\u00e0 limitata -package.jmri.jmrit.blockboss.BlockBossFrame = package.jmri.jmrit.blockboss.BlockBossFrame unless_over_ridden_by_an_intermediate_stop_sensor. = a meno che non prevalga un sensore di fermata intermedia. -Mirrors_the_protected_(following)_signal's_status = Riflette lo stato del segnale protetto (seguente) +Mirrors_the_protected_(following)_signals_status = Riflette lo stato del segnale protetto (seguente) Enter_the_high_speed_signal_head_for_this_track. = Inserire il segnale alta velocit\u00e0 per questo binario. For_dual_head_signals_the_fastest_aspect_is_protected. = Per segnali doppi l'aspetto pi\u00f9 veloce \u00e8 protetto. Enter_the_low_speed_signal_head_for_this_track. = Inserire il segnale a bassa velocit\u00e0 per questo binario. -to_yellow,_rather_than_green. = al giallo, invece che verde. +to_yellow_rather_than_green = al Giallo, invece che Verde. +to_flashingred_rather_than_green = al Rosso lampeggiante, invece che verde. Limits_the_fastest_aspect_displayed = Limita il pi\u00f9 veloce fra gli aspetti visualizzati -flashing_yellow,_rather_than_green. = giallo lampeggiante, invece che verde. -One_aspect_faster_than_yellow_displays = Un aspetto pi\u00f9 veloce del giallo +flashing_yellow_rather_than_green = Giallo lampeggiante, invece che Verde. +One_aspect_faster_than_yellow_displays = Un aspetto pi\u00f9 veloce del Giallo Enter_protected_turnout_number_here. = Inserire qui il numero dello scambio protetto. Sensor_active_sets_this_signal_to_Red. = Sensore attivo imposta questo segnale a Rosso. -leave_blank_for_always_on. = lascia vuoto per sempre acceso. -Enter_sensor_that_lights_this_signal_or = Immettere sensore che illumina questo segnale o -then_hit_return_to_load_its_information. = poi premere invio per caricare le informazioni. -enter_an_existing_signal_head_number = inserire un numero di segnale esistente -Enter_a_new_signal_head_number,_or = Inserire un nuovo numero segnale, o -track_facing_double_track = binario attraversamento doppio binario -Single_signal_head_on_single = Segnale semplice su singolo +Enter_sensor_that_lights_this_signal_or = Immettere sensore che illumina questo segnale
                  o lascia vuoto per sempre acceso. +then_hit_return_to_load_its_information. = per caricare le informazioni. +Enter_a_new_signal_head_number_or = Inserire un segnale esistente +Single_signal_head_on_single = Segnale semplice su singolo binario attraversamento doppio binario Signal_head_for_branching_track = Segnale per il ramo deviato through_turnout_in_either_direction = attraversamento scambio in entrambe le direzioni Signal_head_for_main_track = Segnale per binario principale -In_direction_of_traffic = In direzione del traffico +In_direction_of_traffic = In direzione del traffico. InUseBlockBossHeader = \u00e8 in uso con SSL per Segnale {0}. InUseWatchedSignal = \u00e8 un segnale controllato diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_ja_JP.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_ja_JP.properties index 3db262869de..041501c9195 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossBundle_ja_JP.properties +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_ja_JP.properties @@ -1,69 +1,54 @@ -# Japanese properties file translation BlockBossBundle_ja_JP.properties +# BlockBossBundle_ja_JP.properties +# +# Japanese properties file translation -Simple_Signal_Logic=\u5358\u7d14\u4fe1\u53f7\u6a5f\u8ad6\u7406\u8a2d\u5b9a -UnexpectedMode =\u60f3\u5b9a\u5916\u306e\u30e2\u30fc\u30c9\u3067\u3059: -Held=\u4fdd\u6301 -Approach_Sensor1_=\u30a2\u30d7\u30ed\u30fc\u30c1\u30bb\u30f3\u30b5\u30fc\uff11 -Sensor2Alt_=Sensor2Alt -Sensor1Alt_=Sensor1Alt -Turnout_=\u8ee2\u8f4d\u6a5f -Sensor5_=\u30bb\u30f3\u30b5\u30fc5 -Sensor4_=\u30bb\u30f3\u30b5\u30fc4 -Sensor3_=\u30bb\u30f3\u30b5\u30fc3 -Sensor2_=\u30bb\u30f3\u30b5\u30fc2 -Sensor1_=\u30bb\u30f3\u30b5\u30fc1 -_was_not_found!=\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093! -Signal_=\u4fe1\u53f7\u6a5f -_BlockBossLogic= \u30d6\u30ed\u30c3\u30af\u30dc\u30b9\u8ad6\u7406 -Signal_logic_for_=\u4fe1\u53f7\u6a5f\u306e\u8ad6\u7406\u52d5\u4f5c -no_button_selected?=no button selected? -_is_not_defined_yet="\u306f\u672a\u5b9a\u7fa9\u3067\u3059\u3002 -Signal_head_=\u4fe1\u53f7\u6a5f" -And_Protect_Signal=And Protect Signal -When_Turnout_is_=\u8ee2\u8f4d\u6a5f\u304c -And_Sensor/s=And \u30bb\u30f3\u30b5\u30fc -To_Protect_Signal=To Protect\u4fe1\u53f7\u6a5f -Watches_Turnout=\u95a2\u4e0e\u3059\u308b\u8ee2\u8f4d\u6a5f -Protects_Sensor/s=Protects \u30bb\u30f3\u30b5\u30fc -Is_=\u306f -Red_When_Turnout=\u8d64\u306e\u3068\u304d\u8ee2\u8f4d\u6a5f\u306f -_Protects_Sensor/s= Protects \u30bb\u30f3\u30b5\u30fc -Protects_Signal=Protects \u4fe1\u53f7\u6a5f -__Protects_Sensor/s= Protects \u30bb\u30f3\u30b5\u30fc -Apply=\u9069\u7528 -Comment =\u30b3\u30e1\u30f3\u30c8: -___Approach_Lighting_Sensor_= Approach Lighting Sensor -_________Signal_Named_= \u4fe1\u53f7\u6a5f\u306e\u540d\u79f0 -On_Facing-Point_Turnout=\u9032\u884c\u65b9\u5411\u306e\u8ee2\u8f4d\u6a5f -Diverging_Leg_of_Turnout=Diverging Leg of \u8ee2\u8f4d\u6a5f -Main_Leg_of_Turnout=Main Leg of \u8ee2\u8f4d\u6a5f -On_Single_Block=On \u30b7\u30b0\u30ca\u30eb\u30d6\u30ed\u30c3\u30af -Is_Distant_Signal=\u9060\u65b9\u306e\u4fe1\u53f7\u6a5f\u3067\u3042\u308b -With_Flashing_Yellow=\u9ec4\u8272\u70b9\u6ec5 -Limited_Speed=\u6291\u5236\u901f\u5ea6 -package.jmri.jmrit.blockboss.BlockBossFrame=package.jmri.jmrit.blockboss.BlockBossFrame -unless_over_ridden_by_an_intermediate_stop_sensor.=unless over ridden by an intermediate stop sensor. -Mirrors_the_protected_(following)_signal's_status=Mirrors the protected (following) signal's status -Enter_the_high_speed_signal_head_for_this_track.=Enter the high speed signal head for this track. -For_dual_head_signals_the_fastest_aspect_is_protected.=For dual head signals the fastest aspect is protected. -Enter_the_low_speed_signal_head_for_this_track.=Enter the low speed signal head for this track. -to_yellow,_rather_than_green.=to yellow, \u7dd1\u3067\u306f\u306a\u304f -Limits_the_fastest_aspect_displayed=Limits the fastest aspect displayed -flashing_yellow,_rather_than_green.=flashing yellow, rather than green. -One_aspect_faster_than_yellow_displays=One aspect faster than yellow displays -Enter_protected_turnout_number_here.=Enter protected turnout number here. -Sensor_active_sets_this_signal_to_Red.=Sensor active sets this signal to Red. -leave_blank_for_always_on.=leave blank for always on. -Enter_sensor_that_lights_this_signal_or=Enter sensor that lights this signal or -then_hit_return_to_load_its_information.=then hit return to load its information. -enter_an_existing_signal_head_number=enter an existing signal head number -Enter_a_new_signal_head_number,_or=Enter a new signal head number, or -track_facing_double_track=track facing double track -Single_signal_head_on_single=Single signal head on single
                  -Signal_head_for_branching_track=Signal head for branching track
                  -through_turnout_in_either_direction=through turnout in either direction -Signal_head_for_main_track=Signal head for main track -In_direction_of_traffic=\u4ea4\u901a\u306e\u65b9\u5411 +Simple_Signal_Logic = \u5358\u7d14\u4fe1\u53f7\u6a5f\u8ad6\u7406\u8a2d\u5b9a +UnexpectedMode = \u60f3\u5b9a\u5916\u306e\u30e2\u30fc\u30c9\u3067\u3059: +Held = \u4fdd\u6301 +Approach_Sensor1_ = \u30a2\u30d7\u30ed\u30fc\u30c1\u30bb\u30f3\u30b5\u30fc\uff11 +BeanXNotFound = {0} "{1}" \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093! +_BlockBossLogic = \u30d6\u30ed\u30c3\u30af\u30dc\u30b9\u8ad6\u7406 +SignalLogicForX = \u4fe1\u53f7\u6a5f\u306e\u8ad6\u7406\u52d5\u4f5c{0} +HeadXNotDefined = \u4fe1\u53f7\u6a5f"{0}"\u306f\u672a\u5b9a\u7fa9\u3067\u3059\u3002 +And_Protect_Signal = and Protect \u4fe1\u53f7\u6a5f: +WhenTurnoutIsX = \u8ee2\u8f4d\u6a5f\u304c state {0} +And_Sensors = and \u30bb\u30f3\u30b5\u30fc +To_Protect_Signal = To Protect\u4fe1\u53f7\u6a5f +WatchesTurnout = \u95a2\u4e0e\u3059\u308b\u8ee2\u8f4d\u6a5f +ProtectsSensor = Protects \u30bb\u30f3\u30b5\u30fc +IsState = state \u306f {0} +Red_When_Turnout = \u8d64\u306e\u3068\u304d\u8ee2\u8f4d\u6a5f\u306f +Protects_Signal = Protects \u4fe1\u53f7\u6a5f +Comment = \u30b3\u30e1\u30f3\u30c8: +ApproachLightingSensorLabel = Approach Lighting Sensor: +SSLHeadNamedLabel = \u4fe1\u53f7\u6a5f\u306e\u540d\u79f0 +On_Facing-Point_Turnout = \u9032\u884c\u65b9\u5411\u306e\u8ee2\u8f4d\u6a5f +Diverging_Leg_of_Turnout = Diverging Leg of \u8ee2\u8f4d\u6a5f +Main_Leg_of_Turnout = Main Leg of \u8ee2\u8f4d\u6a5f +On_Single_Block = On \u30b7\u30b0\u30ca\u30eb\u30d6\u30ed\u30c3\u30af +Is_Distant_Signal = \u9060\u65b9\u306e\u4fe1\u53f7\u6a5f\u3067\u3042\u308b +With_Flashing_Yellow = \u9ec4\u8272\u70b9\u6ec5 +Limited_Speed = \u6291\u5236\u901f\u5ea6 +unless_over_ridden_by_an_intermediate_stop_sensor. = unless overridden by an intermediate stop sensor. +Mirrors_the_protected_(following)_signals_status = Mirrors the protected (following) signal's status +Enter_the_high_speed_signal_head_for_this_track. = Enter the high speed signal head for this track. +For_dual_head_signals_the_fastest_aspect_is_protected. = For dual head signals the fastest aspect is protected. +Enter_the_low_speed_signal_head_for_this_track. = Enter the low speed signal head for this track. +to_yellow_rather_than_green = to Yellow, \u7dd1\u3067\u306f\u306a\u304f +Limits_the_fastest_aspect_displayed = Limits the fastest aspect displayed +flashing_yellow_rather_than_green = Flashing Yellow, rather than Green. +to_flashingred_rather_than_green=to Flashing Red, rather than Green. +One_aspect_faster_than_yellow_displays = One aspect faster than Yellow displays +Enter_protected_turnout_number_here. = Select the protected Turnout here. +Sensor_active_sets_this_signal_to_Red. = Sensor active sets this signal head to Red. +Enter_sensor_that_lights_this_signal_or = Select a Sensor that lights this Signal,
                  or leave blank for Always On. +then_hit_return_to_load_its_information. = the existing information will be loaded for editing. +Enter_a_new_signal_head_number_or = Select a Signal Head to attach SSL to. If present, +Single_signal_head_on_single = Single signal head on single track facing double track. +Signal_head_for_branching_track = Signal head for branching track +through_turnout_in_either_direction = through turnout in either direction +Signal_head_for_main_track = Signal head for main track +In_direction_of_traffic = \u4ea4\u901a\u306e\u65b9\u5411 InUseBlockBossHeader = Is in use with SSL for SignalHead {0}. InUseWatchedSignal = As a watched Signal diff --git a/java/src/jmri/jmrit/blockboss/BlockBossBundle_nl.properties b/java/src/jmri/jmrit/blockboss/BlockBossBundle_nl.properties new file mode 100644 index 00000000000..0ba630b134f --- /dev/null +++ b/java/src/jmri/jmrit/blockboss/BlockBossBundle_nl.properties @@ -0,0 +1,68 @@ +# BlockBossBundle_nl.properties +# +# Dutch properties for SSL +# Translation by Egbert Broerse + +Simple_Signal_Logic = Simpele SeinLogica (SSL) +UnexpectedMode = Onbekende modus: +Held = Aangehouden +Approach_Sensor1_ = Naderingsmelder1 +BeanXNotFound = {0} "{1}" niet gevonden +_BlockBossLogic = BlockBossLogic +SignalLogicForX = Simpele SeinLogica voor {0} +HeadXNotDefined = Seinschild "{0}" bestaat nog niet. Maak het eerst aan in de Seinschildentabel. +And_Protect_Signal = en bewaakt Seinschild: +WhenTurnoutIsX = bij stand van de bewaakte Wissel: {0} +And_Sensors = en Terugmelder(s): +To_Protect_Signal = Als vooraanduiding van Seinschild: +WatchesTurnout = Volgt Wissel: +ProtectsSensor = Bewaakt Terugmelder(s): +IsState = in stand {0} is +Red_When_Turnout = Rood als Wissel: +Protects_Signal = Bewaakt Seinschild: +Comment = Notitie: +ApproachLightingSensorLabel = Belichtingsmelder bij nadering: +SSLHeadNamedLabel = Voor Seinschild: +On_Facing-Point_Turnout = Punt van Wissel +Diverging_Leg_of_Turnout = Aftakkend spoor +Main_Leg_of_Turnout = Doorgaand spoor +On_Single_Block = In normaal blok +Is_Distant_Signal = Is Voorsein +With_Flashing_Yellow = Toont Geel knipperend +Limited_Speed = Verlaagde snelheid +unless_over_ridden_by_an_intermediate_stop_sensor. = tenzij door een Stopterugmelder geblokkeerd. +Mirrors_the_protected_(following)_signals_status = Herhaalt Seinbeeld van het bewaakte (eerstvolgende) Seinschild +Enter_the_high_speed_signal_head_for_this_track. = Vul snelle Seinschild in voor dit spoor. +For_dual_head_signals_the_fastest_aspect_is_protected. = Op een mast met 2 schilden wordt het snelste Seinbeeld bewaakt. +Enter_the_low_speed_signal_head_for_this_track. = Vul langzame Seinschild in voor dit spoor. +to_yellow_rather_than_green = Geel i.p.v. Groen. +Limits_the_fastest_aspect_displayed = Verlaagt het snelste Seinbeeld tot +flashing_yellow_rather_than_green = Geel knipperend i.p.v. Groen. +to_flashingred_rather_than_green = Rood knipperend i.p.v. Groen. +One_aspect_faster_than_yellow_displays = Toont 1 Seinbeeld sneller dan Geel als +Enter_protected_turnout_number_here. = Kies hier het te bewaken Wissel of vul naam voor een nieuwe Wissel in. +Sensor_active_sets_this_signal_to_Red. = Deze Terugmelder Actief zet het Seinscherm op Rood. +Enter_sensor_that_lights_this_signal_or = Kies (of vul een nieuwe naam in voor) de Terugmelder die het Scherm inschakelt,
                  of laat veld leeg voor Altijd Aan. +then_hit_return_to_load_its_information. = dan wordt de huidige configuratie ingelezen. +Enter_a_new_signal_head_number_or = Kies allereerst een bestaand Seinschild +Single_signal_head_on_single = Enkel Seinschild op enkelspoor naar dubbelspoor. +Signal_head_for_branching_track = Seinschild op Aftakkend spoor +through_turnout_in_either_direction = door Wissel in beide richtingen. +Signal_head_for_main_track = Seinschild op Doorgaand spoor +In_direction_of_traffic = In rijrichting. + +InUseBlockBossHeader = Is in gebruik in SSL voor Seinschild {0}. +InUseWatchedSignal = Als bewaakt Seinschild +InUseWatchedTurnout = Als bewaakte Wissel +InUseWatchedSensor = Als Controleterugmelder +InUseApproachSensor = Naderingsterugmelder +InUseBlockBossFooter = Wordt verwijderd uit deze SSL +Restricting_Speed = Langzame snelheid +ApplyToolTip = Klik om de logica voor dit Seinschild aan te maken/bij te werken. +ApplyErrorDialog = Fout bij het aanmaken van SSL.\nVoor details zie de Systeemconsole. +CommentToolTip = Notitie wordt opgeslagen met deze SSL +StatusSslStart = Begin door bovenaan een Seinschild te kiezen uit de lijst +StatusSslCreated = SSL voor Seinschild {0} aangemaakt +StatusSslUpdated = SSL voor Seinschild {0} bijgewerkt +StatusSslLoaded = Controleer de SSL kenmerken in dit venster en klik dan op [{0}] +InUseThisSslWillBeDeleted = Deze SSL wordt gewist diff --git a/java/src/jmri/jmrit/blockboss/BlockBossFrame.java b/java/src/jmri/jmrit/blockboss/BlockBossFrame.java index 7958f32cb35..d0282f7aa83 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossFrame.java +++ b/java/src/jmri/jmrit/blockboss/BlockBossFrame.java @@ -1,11 +1,13 @@ package jmri.jmrit.blockboss; +import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.annotation.Nonnull; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; @@ -13,51 +15,59 @@ import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JSeparator; import javax.swing.JTextField; import jmri.InstanceManager; +import jmri.SensorManager; import jmri.SignalHead; +import jmri.SignalHeadManager; +import jmri.util.swing.JmriBeanComboBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Provide a GUI for configuring "Simple Signal Logic" (BlockBossLogic) objects. - *

                  + *

                  * Provides four panels, corresponding to the four possible modes described in * {@link BlockBossLogic}, which are then selected via radio buttons in the GUI. - *

                  + *

                  * The four modes are: - *

                    - *
                  • Single block (s) - *
                  • Facing point (f) - *
                  • Trailing point main (tm) - *
                  • Trailing point diverging (td) - *
                  - *

                  + *

                    + *
                  • Single block (s) + *
                  • Facing point (f) + *
                  • Trailing point main (tm) + *
                  • Trailing point diverging (td) + *
                  + *

                  * The multiple-panel approach to the GUI is used to make layout easier; the * code just flips from one to the other as the user selects a mode. The * individual items all share data models to simplify the logic. * * @author Bob Jacobsen Copyright (C) 2003, 2005 - * - * Revisions to add facing point sensors, approach lighting, limited speed, - * changed layout, and tool tips. Dick Bronson (RJB) 2006 - * + * @author Dick Bronson 2006: Revisions to add facing point sensors, + * approach lighting, limited speed, changed layout, and tool tips. + * @author Egbert Broerse 2017 */ public class BlockBossFrame extends jmri.util.JmriJFrame { JPanel modeSingle = new JPanel(); JRadioButton buttonSingle; - JTextField sSensorField1 = new JTextField(6); - JTextField sSensorField2 = new JTextField(6); - JTextField sSensorField3 = new JTextField(6); - JTextField sSensorField4 = new JTextField(6); - JTextField sSensorField5 = new JTextField(6); - JTextField sNextSignalField1 = new JTextField(6); - JTextField sNextSignalField1Alt = new JTextField(6); + private transient JmriBeanComboBox sSensorComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox sSensorComboBox2 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox sSensorComboBox3 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox sSensorComboBox4 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox sSensorComboBox5 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox sNextSignalComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox sNextSignalComboBox1Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); JCheckBox sLimitBox; JCheckBox sRestrictingBox; JCheckBox sFlashBox; @@ -65,14 +75,23 @@ public class BlockBossFrame extends jmri.util.JmriJFrame { JPanel modeTrailMain = new JPanel(); JRadioButton buttonTrailMain; - JTextField tmSensorField1 = new JTextField(6); - JTextField tmSensorField2 = new JTextField(6); - JTextField tmSensorField3 = new JTextField(6); - JTextField tmSensorField4 = new JTextField(6); - JTextField tmSensorField5 = new JTextField(6); - JTextField tmProtectTurnoutField = new JTextField(6); - JTextField tmNextSignalField1 = new JTextField(6); - JTextField tmNextSignalField1Alt = new JTextField(6); + private transient JmriBeanComboBox tmSensorComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tmSensorComboBox2 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tmSensorComboBox3 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tmSensorComboBox4 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tmSensorComboBox5 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private final JmriBeanComboBox tmProtectTurnoutComboBox = new JmriBeanComboBox( + InstanceManager.turnoutManagerInstance(), + null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tmNextSignalComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tmNextSignalComboBox1Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); JCheckBox tmLimitBox; JCheckBox tmRestrictingBox; JCheckBox tmFlashBox; @@ -80,14 +99,23 @@ public class BlockBossFrame extends jmri.util.JmriJFrame { JPanel modeTrailDiv = new JPanel(); JRadioButton buttonTrailDiv; - JTextField tdSensorField1 = new JTextField(6); - JTextField tdSensorField2 = new JTextField(6); - JTextField tdSensorField3 = new JTextField(6); - JTextField tdSensorField4 = new JTextField(6); - JTextField tdSensorField5 = new JTextField(6); - JTextField tdProtectTurnoutField = new JTextField(6); - JTextField tdNextSignalField1 = new JTextField(6); - JTextField tdNextSignalField1Alt = new JTextField(6); + private transient JmriBeanComboBox tdSensorComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tdSensorComboBox2 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tdSensorComboBox3 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tdSensorComboBox4 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tdSensorComboBox5 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private final JmriBeanComboBox tdProtectTurnoutComboBox = new JmriBeanComboBox( + InstanceManager.turnoutManagerInstance(), + null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tdNextSignalComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox tdNextSignalComboBox1Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); JCheckBox tdLimitBox; JCheckBox tdRestrictingBox; JCheckBox tdFlashBox; @@ -95,20 +123,36 @@ public class BlockBossFrame extends jmri.util.JmriJFrame { JPanel modeFacing = new JPanel(); JRadioButton buttonFacing; - JTextField fSensorField1 = new JTextField(6); - JTextField fSensorField2 = new JTextField(6); - JTextField fSensorField3 = new JTextField(6); - JTextField fSensorField4 = new JTextField(6); - JTextField fSensorField5 = new JTextField(6); - JTextField fProtectTurnoutField = new JTextField(6); - JTextField fNextSignalField1 = new JTextField(6); - JTextField fNextSignalField1Alt = new JTextField(6); - JTextField fNextSignalField2 = new JTextField(6); - JTextField fNextSignalField2Alt = new JTextField(6); - JTextField fNextSensorField1 = new JTextField(6); - JTextField fNextSensorField1Alt = new JTextField(6); - JTextField fNextSensorField2 = new JTextField(6); - JTextField fNextSensorField2Alt = new JTextField(6); + + private transient JmriBeanComboBox fSensorComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fSensorComboBox2 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fSensorComboBox3 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fSensorComboBox4 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fSensorComboBox5 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private final JmriBeanComboBox fProtectTurnoutComboBox = new JmriBeanComboBox( + InstanceManager.turnoutManagerInstance(), + null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSignalComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSignalComboBox1Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSignalComboBox2 = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSignalComboBox2Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSensorComboBox1 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSensorComboBox1Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSensorComboBox2 = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox fNextSensorComboBox2Alt = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); JCheckBox fmLimitBox; JCheckBox fmRestrictingBox; JCheckBox fdLimitBox; @@ -116,44 +160,55 @@ public class BlockBossFrame extends jmri.util.JmriJFrame { JCheckBox fFlashBox; JCheckBox fDistantBox; - JTextField outSignalField; - JTextField approachSensorField1; - + private transient JmriBeanComboBox approachSensor1ComboBox = new JmriBeanComboBox( + InstanceManager.getDefault(SensorManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + private transient JmriBeanComboBox outSignalHeadComboBox = new JmriBeanComboBox( + InstanceManager.getDefault(SignalHeadManager.class), null, JmriBeanComboBox.DisplayOptions.DISPLAYNAME); + JLabel statusBar; JTextField commentField; + JButton cancel; + + // ToolTip strings + String buttonSingleTooltip = Bundle.getMessage("In_direction_of_traffic"); + String buttonTrailMainTooltip = Bundle.getMessage("Signal_head_for_main_track") + + " " + Bundle.getMessage("through_turnout_in_either_direction"); + String buttonTrailDivTooltip = Bundle.getMessage("Signal_head_for_branching_track") + + " " + Bundle.getMessage("through_turnout_in_either_direction"); + String buttonFacingTooltip = Bundle.getMessage("Single_signal_head_on_single"); + String outSignalHeadTooltip = "" + + Bundle.getMessage("Enter_a_new_signal_head_number_or") + + "
                  " + Bundle.getMessage("then_hit_return_to_load_its_information.") + + ""; + String approachSensor1Tooltip = "" + + Bundle.getMessage("Enter_sensor_that_lights_this_signal_or") + + ""; + String sensorFieldTooltip = Bundle.getMessage("Sensor_active_sets_this_signal_to_Red."); + String turnoutFieldTooltip = Bundle.getMessage("Enter_protected_turnout_number_here."); + String flashBoxTooltip = Bundle.getMessage("One_aspect_faster_than_yellow_displays") + + " " + Bundle.getMessage("flashing_yellow_rather_than_green"); + String limitBoxTooltip = Bundle.getMessage("Limits_the_fastest_aspect_displayed") + + " " + Bundle.getMessage("to_yellow_rather_than_green"); + String restrictingBoxTooltip = Bundle.getMessage("Limits_the_fastest_aspect_displayed") + + " " + Bundle.getMessage("to_flashingred_rather_than_green"); + String nextSignalFieldTooltip = Bundle.getMessage("Enter_the_low_speed_signal_head_for_this_track.") + + " " + Bundle.getMessage("For_dual_head_signals_the_fastest_aspect_is_protected."); + String highSignalFieldTooltip = Bundle.getMessage("Enter_the_high_speed_signal_head_for_this_track.") + + " " + Bundle.getMessage("For_dual_head_signals_the_fastest_aspect_is_protected."); + String distantBoxTooltip = Bundle.getMessage("Mirrors_the_protected_(following)_signals_status") + + " " + Bundle.getMessage("unless_over_ridden_by_an_intermediate_stop_sensor."); - static final java.util.ResourceBundle rbt = java.util.ResourceBundle.getBundle("jmri.jmrit.blockboss.BlockBossBundle"); - - String buttonSingleTooltip = rbt.getString("In_direction_of_traffic"); - String buttonTrailMainTooltip = rbt.getString("Signal_head_for_main_track") - + rbt.getString("through_turnout_in_either_direction"); - String buttonTrailDivTooltip = rbt.getString("Signal_head_for_branching_track") - + rbt.getString("through_turnout_in_either_direction"); - String buttonFacingTooltip = rbt.getString("Single_signal_head_on_single") - + rbt.getString("track_facing_double_track"); - String outSignalFieldTooltip = rbt.getString("Enter_a_new_signal_head_number,_or") - + rbt.getString("enter_an_existing_signal_head_number") - + rbt.getString("then_hit_return_to_load_its_information."); - String approachSensor1Tooltip = rbt.getString("Enter_sensor_that_lights_this_signal_or") - + rbt.getString("leave_blank_for_always_on."); - String sensorFieldTooltip = rbt.getString("Sensor_active_sets_this_signal_to_Red."); - String turnoutFieldTooltip = rbt.getString("Enter_protected_turnout_number_here."); - String flashBoxTooltip = rbt.getString("One_aspect_faster_than_yellow_displays") - + rbt.getString("flashing_yellow,_rather_than_green."); - String limitBoxTooltip = rbt.getString("Limits_the_fastest_aspect_displayed") - + rbt.getString("to_yellow,_rather_than_green."); - String restrictingBoxTooltip = rbt.getString("Limits_the_fastest_aspect_displayed") - + rbt.getString("to_flashingred,_rather_than_green."); - String nextSignalFieldTooltip = rbt.getString("Enter_the_low_speed_signal_head_for_this_track.") - + rbt.getString("For_dual_head_signals_the_fastest_aspect_is_protected."); - String highSignalFieldTooltip = rbt.getString("Enter_the_high_speed_signal_head_for_this_track.") - + rbt.getString("For_dual_head_signals_the_fastest_aspect_is_protected."); - String distantBoxTooltip = rbt.getString("Mirrors_the_protected_(following)_signal's_status") - + rbt.getString("unless_over_ridden_by_an_intermediate_stop_sensor."); - + /** + * Ctor for default SSL edit frame. + */ public BlockBossFrame() { - this(rbt.getString("Simple_Signal_Logic")); + this(Bundle.getMessage("Simple_Signal_Logic")); } + /** + * Ctor for named SSL edit frame. + * + * @param frameName the name to use for this frame + */ public BlockBossFrame(String frameName) { // create the frame @@ -167,47 +222,47 @@ public BlockBossFrame(String frameName) { menuBar.add(fileMenu); fileMenu.add(new jmri.configurexml.SaveMenu()); setJMenuBar(menuBar); - addHelpMenu(rbt.getString("package.jmri.jmrit.blockboss.BlockBossFrame"), true); + addHelpMenu("package.jmri.jmrit.blockboss.BlockBossFrame", true); // create GUI items - sLimitBox = new JCheckBox(rbt.getString("Limited_Speed")); - sRestrictingBox = new JCheckBox(rbt.getString("Restricting_Speed")); - tmLimitBox = new JCheckBox(rbt.getString("Limited_Speed")); + sLimitBox = new JCheckBox(Bundle.getMessage("Limited_Speed")); + sRestrictingBox = new JCheckBox(Bundle.getMessage("Restricting_Speed")); + tmLimitBox = new JCheckBox(Bundle.getMessage("Limited_Speed")); tmLimitBox.setModel(sLimitBox.getModel()); - tmRestrictingBox = new JCheckBox(rbt.getString("Restricting_Speed")); + tmRestrictingBox = new JCheckBox(Bundle.getMessage("Restricting_Speed")); tmRestrictingBox.setModel(sRestrictingBox.getModel()); - fmLimitBox = new JCheckBox(rbt.getString("Limited_Speed")); + fmLimitBox = new JCheckBox(Bundle.getMessage("Limited_Speed")); fmLimitBox.setModel(sLimitBox.getModel()); - fmRestrictingBox = new JCheckBox(rbt.getString("Restricting_Speed")); + fmRestrictingBox = new JCheckBox(Bundle.getMessage("Restricting_Speed")); fmRestrictingBox.setModel(sRestrictingBox.getModel()); - tdLimitBox = new JCheckBox(rbt.getString("Limited_Speed")); - tdRestrictingBox = new JCheckBox(rbt.getString("Restricting_Speed")); - fdLimitBox = new JCheckBox(rbt.getString("Limited_Speed")); + tdLimitBox = new JCheckBox(Bundle.getMessage("Limited_Speed")); + tdRestrictingBox = new JCheckBox(Bundle.getMessage("Restricting_Speed")); + fdLimitBox = new JCheckBox(Bundle.getMessage("Limited_Speed")); fdLimitBox.setModel(tdLimitBox.getModel()); - fdRestrictingBox = new JCheckBox(rbt.getString("Restricting_Speed")); + fdRestrictingBox = new JCheckBox(Bundle.getMessage("Restricting_Speed")); fdRestrictingBox.setModel(tdRestrictingBox.getModel()); - sFlashBox = new JCheckBox(rbt.getString("With_Flashing_Yellow")); - tmFlashBox = new JCheckBox(rbt.getString("With_Flashing_Yellow")); + sFlashBox = new JCheckBox(Bundle.getMessage("With_Flashing_Yellow")); + tmFlashBox = new JCheckBox(Bundle.getMessage("With_Flashing_Yellow")); tmFlashBox.setModel(sFlashBox.getModel()); - tdFlashBox = new JCheckBox(rbt.getString("With_Flashing_Yellow")); + tdFlashBox = new JCheckBox(Bundle.getMessage("With_Flashing_Yellow")); tdFlashBox.setModel(sFlashBox.getModel()); - fFlashBox = new JCheckBox(rbt.getString("With_Flashing_Yellow")); + fFlashBox = new JCheckBox(Bundle.getMessage("With_Flashing_Yellow")); fFlashBox.setModel(sFlashBox.getModel()); - sDistantBox = new JCheckBox(rbt.getString("Is_Distant_Signal")); - tmDistantBox = new JCheckBox(rbt.getString("Is_Distant_Signal")); + sDistantBox = new JCheckBox(Bundle.getMessage("Is_Distant_Signal")); + tmDistantBox = new JCheckBox(Bundle.getMessage("Is_Distant_Signal")); tmDistantBox.setModel(sDistantBox.getModel()); - tdDistantBox = new JCheckBox(rbt.getString("Is_Distant_Signal")); + tdDistantBox = new JCheckBox(Bundle.getMessage("Is_Distant_Signal")); tdDistantBox.setModel(sDistantBox.getModel()); - fDistantBox = new JCheckBox(rbt.getString("Is_Distant_Signal")); + fDistantBox = new JCheckBox(Bundle.getMessage("Is_Distant_Signal")); fDistantBox.setModel(sDistantBox.getModel()); - buttonSingle = new JRadioButton(rbt.getString("On_Single_Block")); - buttonTrailMain = new JRadioButton(rbt.getString("Main_Leg_of_Turnout")); - buttonTrailDiv = new JRadioButton(rbt.getString("Diverging_Leg_of_Turnout")); - buttonFacing = new JRadioButton(rbt.getString("On_Facing-Point_Turnout")); + buttonSingle = new JRadioButton(Bundle.getMessage("On_Single_Block")); + buttonTrailMain = new JRadioButton(Bundle.getMessage("Main_Leg_of_Turnout")); + buttonTrailDiv = new JRadioButton(Bundle.getMessage("Diverging_Leg_of_Turnout")); + buttonFacing = new JRadioButton(Bundle.getMessage("On_Facing-Point_Turnout")); ButtonGroup g = new ButtonGroup(); g.add(buttonSingle); g.add(buttonTrailMain); @@ -225,43 +280,86 @@ public void actionPerformed(ActionEvent e) { buttonTrailDiv.addActionListener(a); buttonFacing.addActionListener(a); - // share data models - tmSensorField1.setDocument(sSensorField1.getDocument()); - tdSensorField1.setDocument(sSensorField1.getDocument()); - fSensorField1.setDocument(sSensorField1.getDocument()); - - tmSensorField2.setDocument(sSensorField2.getDocument()); - tdSensorField2.setDocument(sSensorField2.getDocument()); - fSensorField2.setDocument(sSensorField2.getDocument()); - - tmSensorField3.setDocument(sSensorField3.getDocument()); - tdSensorField3.setDocument(sSensorField3.getDocument()); - fSensorField3.setDocument(sSensorField3.getDocument()); - - tmSensorField4.setDocument(sSensorField4.getDocument()); - tdSensorField4.setDocument(sSensorField4.getDocument()); - fSensorField4.setDocument(sSensorField4.getDocument()); - - tmSensorField5.setDocument(sSensorField5.getDocument()); - tdSensorField5.setDocument(sSensorField5.getDocument()); - fSensorField5.setDocument(sSensorField5.getDocument()); - - tdProtectTurnoutField.setDocument(tmProtectTurnoutField.getDocument()); - fProtectTurnoutField.setDocument(tmProtectTurnoutField.getDocument()); - - tdNextSignalField1.setDocument(sNextSignalField1.getDocument()); - tdNextSignalField1Alt.setDocument(sNextSignalField1Alt.getDocument()); - tmNextSignalField1.setDocument(sNextSignalField1.getDocument()); - tmNextSignalField1Alt.setDocument(sNextSignalField1Alt.getDocument()); - fNextSignalField1.setDocument(sNextSignalField1.getDocument()); - fNextSignalField1Alt.setDocument(sNextSignalField1Alt.getDocument()); + // share sensor data models + tmSensorComboBox1.setModel(sSensorComboBox1.getModel()); + tdSensorComboBox1.setModel(sSensorComboBox1.getModel()); + fSensorComboBox1.setModel(sSensorComboBox1.getModel()); + + tmSensorComboBox2.setModel(sSensorComboBox2.getModel()); + tdSensorComboBox2.setModel(sSensorComboBox2.getModel()); + fSensorComboBox2.setModel(sSensorComboBox2.getModel()); + + tmSensorComboBox3.setModel(sSensorComboBox3.getModel()); + tdSensorComboBox3.setModel(sSensorComboBox3.getModel()); + fSensorComboBox3.setModel(sSensorComboBox3.getModel()); + + tmSensorComboBox4.setModel(sSensorComboBox4.getModel()); + tdSensorComboBox4.setModel(sSensorComboBox4.getModel()); + fSensorComboBox4.setModel(sSensorComboBox4.getModel()); + + tmSensorComboBox5.setModel(sSensorComboBox5.getModel()); + tdSensorComboBox5.setModel(sSensorComboBox5.getModel()); + fSensorComboBox5.setModel(sSensorComboBox5.getModel()); + // share turnout data model + tmProtectTurnoutComboBox.setModel(tdProtectTurnoutComboBox.getModel()); + fProtectTurnoutComboBox.setModel(tdProtectTurnoutComboBox.getModel()); + + tdNextSignalComboBox1.setModel(sNextSignalComboBox1.getModel()); + tdNextSignalComboBox1Alt.setModel(sNextSignalComboBox1Alt.getModel()); + tmNextSignalComboBox1.setModel(sNextSignalComboBox1.getModel()); + tmNextSignalComboBox1Alt.setModel(sNextSignalComboBox1Alt.getModel()); + fNextSignalComboBox1.setModel(sNextSignalComboBox1.getModel()); + fNextSignalComboBox1Alt.setModel(sNextSignalComboBox1Alt.getModel()); + + // configure sensor combobox options + setupComboBox(sSensorComboBox1, false, true, true); + setupComboBox(sSensorComboBox2, false, true, true); + setupComboBox(sSensorComboBox3, false, true, true); + setupComboBox(sSensorComboBox4, false, true, true); + setupComboBox(sSensorComboBox5, false, true, true); + setupComboBox(tmSensorComboBox1, false, true, true); + setupComboBox(tmSensorComboBox2, false, true, true); + setupComboBox(tmSensorComboBox3, false, true, true); + setupComboBox(tmSensorComboBox4, false, true, true); + setupComboBox(tmSensorComboBox5, false, true, true); + setupComboBox(tdSensorComboBox1, false, true, true); + setupComboBox(tdSensorComboBox2, false, true, true); + setupComboBox(tdSensorComboBox3, false, true, true); + setupComboBox(tdSensorComboBox4, false, true, true); + setupComboBox(tdSensorComboBox5, false, true, true); + setupComboBox(fSensorComboBox1, false, true, true); + setupComboBox(fSensorComboBox2, false, true, true); + setupComboBox(fSensorComboBox3, false, true, true); + setupComboBox(fSensorComboBox4, false, true, true); + setupComboBox(fSensorComboBox5, false, true, true); + // configure turnout combobox options + setupComboBox(tdProtectTurnoutComboBox, false, true, true); + setupComboBox(tmProtectTurnoutComboBox, false, true, true); + setupComboBox(fProtectTurnoutComboBox, false, true, true); + // configure next signal combobox options + setupComboBox(sNextSignalComboBox1, false, true, true); + setupComboBox(sNextSignalComboBox1Alt, false, true, true); + setupComboBox(tdNextSignalComboBox1, false, true, true); + setupComboBox(tdNextSignalComboBox1Alt, false, true, true); + setupComboBox(tmNextSignalComboBox1, false, true, true); + setupComboBox(tmNextSignalComboBox1Alt, false, true, true); + setupComboBox(fNextSignalComboBox1, false, true, true); + setupComboBox(fNextSignalComboBox1Alt, false, true, true); + setupComboBox(fNextSignalComboBox2, false, true, true); + setupComboBox(fNextSignalComboBox2Alt, false, true, true); + // configure next sensor combobox options + setupComboBox(fNextSensorComboBox1, false, true, true); + setupComboBox(fNextSensorComboBox1Alt, false, true, true); + setupComboBox(fNextSensorComboBox2, false, true, true); + setupComboBox(fNextSensorComboBox2Alt, false, true, true); // add top part of GUI, holds signal head name to drive JPanel line = new JPanel(); - line.add(new JLabel(rbt.getString("_________Signal_Named_"))); - line.add(outSignalField = new JTextField(12)); - outSignalField.setToolTipText(outSignalFieldTooltip); - outSignalField.addActionListener(new ActionListener() { + line.add(new JLabel(Bundle.getMessage("SSLHeadNamedLabel"))); + setupComboBox(outSignalHeadComboBox, true, true, true); + line.add(outSignalHeadComboBox); + outSignalHeadComboBox.setToolTipText(outSignalHeadTooltip); + outSignalHeadComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // user hit enter, use this name to fill in the rest of the fields @@ -293,39 +391,62 @@ public void actionPerformed(ActionEvent e) { getContentPane().add(fillModeFacing()); line = new JPanel(); - line.add(new JLabel(rbt.getString("___Approach_Lighting_Sensor_"))); - line.add(approachSensorField1 = new JTextField(6)); - approachSensorField1.setToolTipText(approachSensor1Tooltip); + line.add(new JLabel(Bundle.getMessage("ApproachLightingSensorLabel"))); + line.add(approachSensor1ComboBox); + setupComboBox(approachSensor1ComboBox, false, true, true); + approachSensor1ComboBox.setToolTipText(approachSensor1Tooltip); line.setAlignmentX(0.5f); getContentPane().add(line); + // add comment element line = new JPanel(); line.setLayout(new FlowLayout()); - line.add(new JLabel(rbt.getString("Comment"))); + line.add(new JLabel(Bundle.getMessage("Comment"))); line.add(commentField = new JTextField(30)); + commentField.setToolTipText(Bundle.getMessage("CommentToolTip")); + getContentPane().add(line); + + // add status bar above buttons + line = new JPanel(); + line.setLayout(new FlowLayout()); + statusBar = new JLabel(Bundle.getMessage("StatusSslStart")); + statusBar.setFont(statusBar.getFont().deriveFont(0.9f * commentField.getFont().getSize())); // a bit smaller + statusBar.setForeground(Color.gray); + line.add(statusBar); getContentPane().add(line); getContentPane().add(new JSeparator(JSeparator.HORIZONTAL)); + JPanel buttons = new JPanel(); + buttons.setLayout(new FlowLayout()); // add OK button at bottom - JButton b = new JButton(rbt.getString("Apply")); // TODO add Bundle to folder and use ButtonApply from NBB - b.setAlignmentX(0.5f); - getContentPane().add(b); - b.addActionListener(new ActionListener() { + cancel = new JButton(Bundle.getMessage("ButtonCancel")); + buttons.add(cancel); + cancel.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + cancelPressed(); + } + }); + JButton apply = new JButton(Bundle.getMessage("ButtonApply")); + apply.setToolTipText(Bundle.getMessage("ApplyToolTip")); + buttons.add(apply); + apply.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - okPressed(); + applyPressed(); } }); + getContentPane().add(buttons); pack(); // set a definite mode selection, which also repacks. buttonSingle.setSelected(true); buttonClicked(); - } -// Panel arrangements all changed to use GridBagLayout format. RJB + // Panel arrangements all changed to use GridBagLayout format. + JPanel fillModeSingle() { modeSingle.setLayout(new GridBagLayout()); @@ -346,37 +467,37 @@ JPanel fillModeSingle() { insets.top = 9; insets.bottom = 9; - modeSingle.add(new JLabel(rbt.getString("__Protects_Sensor/s")), constraints); + modeSingle.add(new JLabel(Bundle.getMessage("ProtectsSensor")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - sSensorField1.setToolTipText(sensorFieldTooltip); - modeSingle.add(sSensorField1, constraints); + sSensorComboBox1.setToolTipText(sensorFieldTooltip); + modeSingle.add(sSensorComboBox1, constraints); constraints.gridx = 2; - sSensorField2.setToolTipText(sensorFieldTooltip); - modeSingle.add(sSensorField2, constraints); + sSensorComboBox2.setToolTipText(sensorFieldTooltip); + modeSingle.add(sSensorComboBox2, constraints); constraints.gridx = 3; - sSensorField3.setToolTipText(sensorFieldTooltip); - modeSingle.add(sSensorField3, constraints); + sSensorComboBox3.setToolTipText(sensorFieldTooltip); + modeSingle.add(sSensorComboBox3, constraints); constraints.gridx = 4; - sSensorField4.setToolTipText(sensorFieldTooltip); - modeSingle.add(sSensorField4, constraints); + sSensorComboBox4.setToolTipText(sensorFieldTooltip); + modeSingle.add(sSensorComboBox4, constraints); constraints.gridx = 5; - sSensorField5.setToolTipText(sensorFieldTooltip); - modeSingle.add(sSensorField5, constraints); + sSensorComboBox5.setToolTipText(sensorFieldTooltip); + modeSingle.add(sSensorComboBox5, constraints); insets.top = 2; constraints.gridx = 0; constraints.gridy = 1; constraints.fill = GridBagConstraints.NONE; - modeSingle.add(new JLabel(rbt.getString("Protects_Signal")), constraints); + modeSingle.add(new JLabel(Bundle.getMessage("Protects_Signal")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - sNextSignalField1.setToolTipText(highSignalFieldTooltip); - modeSingle.add(sNextSignalField1, constraints); + sNextSignalComboBox1.setToolTipText(highSignalFieldTooltip); + modeSingle.add(sNextSignalComboBox1, constraints); constraints.gridx = 2; - sNextSignalField1Alt.setToolTipText(nextSignalFieldTooltip); - modeSingle.add(sNextSignalField1Alt, constraints); + sNextSignalComboBox1Alt.setToolTipText(nextSignalFieldTooltip); + modeSingle.add(sNextSignalComboBox1Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; // ?? @@ -421,51 +542,51 @@ JPanel fillModeTrailMain() { constraints.gridy = 0; insets.top = 9; insets.bottom = 9; - modeTrailMain.add(new JLabel(rbt.getString("_Protects_Sensor/s")), constraints); + modeTrailMain.add(new JLabel(Bundle.getMessage("ProtectsSensor")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - tmSensorField1.setToolTipText(sensorFieldTooltip); - modeTrailMain.add(tmSensorField1, constraints); + tmSensorComboBox1.setToolTipText(sensorFieldTooltip); + modeTrailMain.add(tmSensorComboBox1, constraints); constraints.gridx = 2; - tmSensorField2.setToolTipText(sensorFieldTooltip); - modeTrailMain.add(tmSensorField2, constraints); + tmSensorComboBox2.setToolTipText(sensorFieldTooltip); + modeTrailMain.add(tmSensorComboBox2, constraints); constraints.gridx = 3; - tmSensorField3.setToolTipText(sensorFieldTooltip); - modeTrailMain.add(tmSensorField3, constraints); + tmSensorComboBox3.setToolTipText(sensorFieldTooltip); + modeTrailMain.add(tmSensorComboBox3, constraints); constraints.gridx = 4; - tmSensorField4.setToolTipText(sensorFieldTooltip); - modeTrailMain.add(tmSensorField4, constraints); + tmSensorComboBox4.setToolTipText(sensorFieldTooltip); + modeTrailMain.add(tmSensorComboBox4, constraints); constraints.gridx = 5; - tmSensorField5.setToolTipText(sensorFieldTooltip); - modeTrailMain.add(tmSensorField5, constraints); + tmSensorComboBox5.setToolTipText(sensorFieldTooltip); + modeTrailMain.add(tmSensorComboBox5, constraints); insets.top = 2; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 1; insets.bottom = 9; - modeTrailMain.add(new JLabel(rbt.getString("Red_When_Turnout")), constraints); + modeTrailMain.add(new JLabel(Bundle.getMessage("Red_When_Turnout")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - tmProtectTurnoutField.setToolTipText(turnoutFieldTooltip); - modeTrailMain.add(tmProtectTurnoutField, constraints); + tmProtectTurnoutComboBox.setToolTipText(turnoutFieldTooltip); + modeTrailMain.add(tmProtectTurnoutComboBox, constraints); constraints.gridx = 2; constraints.gridwidth = 2; - modeTrailMain.add(new JLabel(rbt.getString("Is_") + InstanceManager.turnoutManagerInstance().getThrownText()), constraints); + modeTrailMain.add(new JLabel(Bundle.getMessage("IsState", InstanceManager.turnoutManagerInstance().getThrownText())), constraints); constraints.gridwidth = 1; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 4; insets.bottom = 2; - modeTrailMain.add(new JLabel(rbt.getString("Protects_Signal")), constraints); + modeTrailMain.add(new JLabel(Bundle.getMessage("Protects_Signal")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - tmNextSignalField1.setToolTipText(highSignalFieldTooltip); - modeTrailMain.add(tmNextSignalField1, constraints); + tmNextSignalComboBox1.setToolTipText(highSignalFieldTooltip); + modeTrailMain.add(tmNextSignalComboBox1, constraints); constraints.gridx = 2; - tmNextSignalField1Alt.setToolTipText(nextSignalFieldTooltip); - modeTrailMain.add(tmNextSignalField1Alt, constraints); + tmNextSignalComboBox1Alt.setToolTipText(nextSignalFieldTooltip); + modeTrailMain.add(tmNextSignalComboBox1Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; // ?? @@ -510,51 +631,51 @@ JPanel fillModeTrailDiv() { constraints.gridy = 0; insets.top = 9; insets.bottom = 9; - modeTrailDiv.add(new JLabel(rbt.getString("_Protects_Sensor/s")), constraints); + modeTrailDiv.add(new JLabel(Bundle.getMessage("ProtectsSensor")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - tdSensorField1.setToolTipText(sensorFieldTooltip); - modeTrailDiv.add(tdSensorField1, constraints); + tdSensorComboBox1.setToolTipText(sensorFieldTooltip); + modeTrailDiv.add(tdSensorComboBox1, constraints); constraints.gridx = 2; - tdSensorField2.setToolTipText(sensorFieldTooltip); - modeTrailDiv.add(tdSensorField2, constraints); + tdSensorComboBox2.setToolTipText(sensorFieldTooltip); + modeTrailDiv.add(tdSensorComboBox2, constraints); constraints.gridx = 3; - tdSensorField3.setToolTipText(sensorFieldTooltip); - modeTrailDiv.add(tdSensorField3, constraints); + tdSensorComboBox3.setToolTipText(sensorFieldTooltip); + modeTrailDiv.add(tdSensorComboBox3, constraints); constraints.gridx = 4; - tdSensorField4.setToolTipText(sensorFieldTooltip); - modeTrailDiv.add(tdSensorField4, constraints); + tdSensorComboBox4.setToolTipText(sensorFieldTooltip); + modeTrailDiv.add(tdSensorComboBox4, constraints); constraints.gridx = 5; - tdSensorField5.setToolTipText(sensorFieldTooltip); - modeTrailDiv.add(tdSensorField5, constraints); + tdSensorComboBox5.setToolTipText(sensorFieldTooltip); + modeTrailDiv.add(tdSensorComboBox5, constraints); insets.top = 2; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 1; insets.bottom = 9; - modeTrailDiv.add(new JLabel(rbt.getString("Red_When_Turnout")), constraints); + modeTrailDiv.add(new JLabel(Bundle.getMessage("Red_When_Turnout")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - tdProtectTurnoutField.setToolTipText(turnoutFieldTooltip); - modeTrailDiv.add(tdProtectTurnoutField, constraints); + tdProtectTurnoutComboBox.setToolTipText(turnoutFieldTooltip); + modeTrailDiv.add(tdProtectTurnoutComboBox, constraints); constraints.gridx = 2; constraints.gridwidth = 2; - modeTrailDiv.add(new JLabel(rbt.getString("Is_") + InstanceManager.turnoutManagerInstance().getClosedText()), constraints); + modeTrailDiv.add(new JLabel(Bundle.getMessage("IsState", InstanceManager.turnoutManagerInstance().getClosedText())), constraints); constraints.gridwidth = 1; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 4; insets.bottom = 2; - modeTrailDiv.add(new JLabel(rbt.getString("Protects_Signal")), constraints); + modeTrailDiv.add(new JLabel(Bundle.getMessage("Protects_Signal")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - tdNextSignalField1.setToolTipText(highSignalFieldTooltip); - modeTrailDiv.add(tdNextSignalField1, constraints); + tdNextSignalComboBox1.setToolTipText(highSignalFieldTooltip); + modeTrailDiv.add(tdNextSignalComboBox1, constraints); constraints.gridx = 2; - tdNextSignalField1Alt.setToolTipText(nextSignalFieldTooltip); - modeTrailDiv.add(tdNextSignalField1Alt, constraints); + tdNextSignalComboBox1Alt.setToolTipText(nextSignalFieldTooltip); + modeTrailDiv.add(tdNextSignalComboBox1Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; // ?? @@ -600,47 +721,47 @@ JPanel fillModeFacing() { constraints.gridy = 0; insets.top = 9; insets.bottom = 9; - modeFacing.add(new JLabel(rbt.getString("Protects_Sensor/s")), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("ProtectsSensor")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - fSensorField1.setToolTipText(sensorFieldTooltip); - modeFacing.add(fSensorField1, constraints); + fSensorComboBox1.setToolTipText(sensorFieldTooltip); + modeFacing.add(fSensorComboBox1, constraints); constraints.gridx = 2; - fSensorField2.setToolTipText(sensorFieldTooltip); - modeFacing.add(fSensorField2, constraints); + fSensorComboBox2.setToolTipText(sensorFieldTooltip); + modeFacing.add(fSensorComboBox2, constraints); constraints.gridx = 3; - fSensorField3.setToolTipText(sensorFieldTooltip); - modeFacing.add(fSensorField3, constraints); + fSensorComboBox3.setToolTipText(sensorFieldTooltip); + modeFacing.add(fSensorComboBox3, constraints); constraints.gridx = 4; - fSensorField4.setToolTipText(sensorFieldTooltip); - modeFacing.add(fSensorField4, constraints); + fSensorComboBox4.setToolTipText(sensorFieldTooltip); + modeFacing.add(fSensorComboBox4, constraints); constraints.gridx = 5; - fSensorField5.setToolTipText(sensorFieldTooltip); - modeFacing.add(fSensorField5, constraints); + fSensorComboBox5.setToolTipText(sensorFieldTooltip); + modeFacing.add(fSensorComboBox5, constraints); insets.top = 2; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 1; insets.bottom = 9; - modeFacing.add(new JLabel(rbt.getString("Watches_Turnout")), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("WatchesTurnout")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - fProtectTurnoutField.setToolTipText(turnoutFieldTooltip); - modeFacing.add(fProtectTurnoutField, constraints); + fProtectTurnoutComboBox.setToolTipText(turnoutFieldTooltip); + modeFacing.add(fProtectTurnoutComboBox, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 2; insets.bottom = 2; - modeFacing.add(new JLabel(rbt.getString("To_Protect_Signal")), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("To_Protect_Signal")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - fNextSignalField1.setToolTipText(highSignalFieldTooltip); - modeFacing.add(fNextSignalField1, constraints); + fNextSignalComboBox1.setToolTipText(highSignalFieldTooltip); + modeFacing.add(fNextSignalComboBox1, constraints); constraints.gridx = 2; - fNextSignalField1Alt.setToolTipText(nextSignalFieldTooltip); - modeFacing.add(fNextSignalField1Alt, constraints); + fNextSignalComboBox1Alt.setToolTipText(nextSignalFieldTooltip); + modeFacing.add(fNextSignalComboBox1Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; // ?? @@ -657,34 +778,34 @@ JPanel fillModeFacing() { constraints.gridx = 0; constraints.gridy = 3; insets.bottom = 9; - modeFacing.add(new JLabel(rbt.getString("And_Sensor/s")), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("And_Sensors")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - fNextSensorField1.setToolTipText(sensorFieldTooltip); - modeFacing.add(fNextSensorField1, constraints); + fNextSensorComboBox1.setToolTipText(sensorFieldTooltip); + modeFacing.add(fNextSensorComboBox1, constraints); constraints.gridx = 2; - fNextSensorField1Alt.setToolTipText(sensorFieldTooltip); - modeFacing.add(fNextSensorField1Alt, constraints); + fNextSensorComboBox1Alt.setToolTipText(sensorFieldTooltip); + modeFacing.add(fNextSensorComboBox1Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; - modeFacing.add(new JLabel(rbt.getString("When_Turnout_is_") + InstanceManager.turnoutManagerInstance().getClosedText()), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("WhenTurnoutIsX", InstanceManager.turnoutManagerInstance().getClosedText())), constraints); constraints.gridwidth = 1; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.gridy = 4; insets.bottom = 2; - modeFacing.add(new JLabel(rbt.getString("And_Protect_Signal")), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("And_Protect_Signal")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - fNextSignalField2.setToolTipText(highSignalFieldTooltip); - modeFacing.add(fNextSignalField2, constraints); + fNextSignalComboBox2.setToolTipText(highSignalFieldTooltip); + modeFacing.add(fNextSignalComboBox2, constraints); constraints.gridx = 2; - fNextSignalField2Alt.setToolTipText(nextSignalFieldTooltip); - modeFacing.add(fNextSignalField2Alt, constraints); + fNextSignalComboBox2Alt.setToolTipText(nextSignalFieldTooltip); + modeFacing.add(fNextSignalComboBox2Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; - // ?? + q = new JPanel(); q.setLayout(new FlowLayout()); q.add(fdLimitBox); @@ -698,17 +819,17 @@ JPanel fillModeFacing() { constraints.gridx = 0; constraints.gridy = 5; insets.bottom = 9; - modeFacing.add(new JLabel(rbt.getString("And_Sensor/s")), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("And_Sensors")), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 1; - fNextSensorField2.setToolTipText(sensorFieldTooltip); - modeFacing.add(fNextSensorField2, constraints); + fNextSensorComboBox2.setToolTipText(sensorFieldTooltip); + modeFacing.add(fNextSensorComboBox2, constraints); constraints.gridx = 2; - fNextSensorField2Alt.setToolTipText(sensorFieldTooltip); - modeFacing.add(fNextSensorField2Alt, constraints); + fNextSensorComboBox2Alt.setToolTipText(sensorFieldTooltip); + modeFacing.add(fNextSensorComboBox2Alt, constraints); constraints.gridx = 3; constraints.gridwidth = 2; - modeFacing.add(new JLabel(rbt.getString("When_Turnout_is_") + InstanceManager.turnoutManagerInstance().getThrownText()), constraints); + modeFacing.add(new JLabel(Bundle.getMessage("WhenTurnoutIsX", InstanceManager.turnoutManagerInstance().getThrownText())), constraints); constraints.gridwidth = 1; constraints.gridy = 6; @@ -726,22 +847,26 @@ JPanel fillModeFacing() { return modeFacing; } - void okPressed() { + void applyPressed() { // check signal head exists - if (sh == null && InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(outSignalField.getText()) == null) { - setTitle(rbt.getString("Simple_Signal_Logic")); - JOptionPane.showMessageDialog(this, rbt.getString("Signal_head_") + outSignalField.getText() + rbt.getString("_is_not_defined_yet")); + if (sh == null && InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(outSignalHeadComboBox.getDisplayName()) == null) { + setTitle(Bundle.getMessage("Simple_Signal_Logic")); + statusBar.setText(Bundle.getMessage("HeadXNotDefined", outSignalHeadComboBox.getDisplayName())); + // JOptionPane.showMessageDialog(this, Bundle.getMessage("HeadXNotDefined", outSignalHeadComboBox.getDisplayName())); return; } SignalHead head = sh; if (sh == null) { - head = InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(outSignalField.getText()); + head = InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(outSignalHeadComboBox.getDisplayName()); + statusBar.setText(Bundle.getMessage("StatusSslCreated", outSignalHeadComboBox.getDisplayName())); + } else { + statusBar.setText(Bundle.getMessage("StatusSslUpdated", outSignalHeadComboBox.getDisplayName())); } // it does try { BlockBossLogic b = BlockBossLogic.getStoppedObject(head); - b.setApproachSensor1(approachSensorField1.getText()); + b.setApproachSensor1(approachSensor1ComboBox.getDisplayName()); if (buttonSingle.isSelected()) { loadSingle(b); } else if (buttonTrailMain.isSelected()) { @@ -751,25 +876,34 @@ void okPressed() { } else if (buttonFacing.isSelected()) { loadFacing(b); } else { - log.error(rbt.getString("no_button_selected?")); + log.error("no SSL type radio button was selected"); // NOI18N return; } + cancel.setText(Bundle.getMessage("ButtonClose")); // when Apply has been clicked at least once, this is not Cancel } catch (Exception e) { - log.error("An error occurred creating the boss logic " + e.toString()); - JOptionPane.showMessageDialog(this, "An error occurred creating the Simple Signal Logic\nPlease check the console log for more information"); + log.error("An error occurred creating the Simple Signal Logic for" + e.toString()); + statusBar.setText(Bundle.getMessage("ApplyErrorDialog")); + // JOptionPane.showMessageDialog(this, Bundle.getMessage("ApplyErrorDialog")); } } + void cancelPressed() { + // close pane + this.setVisible(false); + statusBar.setText(""); + super.dispose(); + } + void loadSingle(BlockBossLogic b) { - b.setSensor1(sSensorField1.getText()); - b.setSensor2(sSensorField2.getText()); - b.setSensor3(sSensorField3.getText()); - b.setSensor4(sSensorField4.getText()); - b.setSensor5(sSensorField5.getText()); + b.setSensor1(sSensorComboBox1.getDisplayName()); + b.setSensor2(sSensorComboBox2.getDisplayName()); + b.setSensor3(sSensorComboBox3.getDisplayName()); + b.setSensor4(sSensorComboBox4.getDisplayName()); + b.setSensor5(sSensorComboBox5.getDisplayName()); b.setMode(BlockBossLogic.SINGLEBLOCK); - b.setWatchedSignal1(sNextSignalField1.getText(), sFlashBox.isSelected()); - b.setWatchedSignal1Alt(sNextSignalField1Alt.getText()); + b.setWatchedSignal1(sNextSignalComboBox1.getDisplayName(), sFlashBox.isSelected()); + b.setWatchedSignal1Alt(sNextSignalComboBox1Alt.getDisplayName()); b.setLimitSpeed1(sLimitBox.isSelected()); b.setRestrictingSpeed1(sRestrictingBox.isSelected()); b.setDistantSignal(sDistantBox.isSelected()); @@ -781,17 +915,17 @@ void loadSingle(BlockBossLogic b) { } void loadTrailMain(BlockBossLogic b) { - b.setSensor1(tmSensorField1.getText()); - b.setSensor2(tmSensorField2.getText()); - b.setSensor3(tmSensorField3.getText()); - b.setSensor4(tmSensorField4.getText()); - b.setSensor5(tmSensorField5.getText()); + b.setSensor1(tmSensorComboBox1.getDisplayName()); + b.setSensor2(tmSensorComboBox2.getDisplayName()); + b.setSensor3(tmSensorComboBox3.getDisplayName()); + b.setSensor4(tmSensorComboBox4.getDisplayName()); + b.setSensor5(tmSensorComboBox5.getDisplayName()); b.setMode(BlockBossLogic.TRAILINGMAIN); - b.setTurnout(tmProtectTurnoutField.getText()); + b.setTurnout(tmProtectTurnoutComboBox.getDisplayName()); - b.setWatchedSignal1(tmNextSignalField1.getText(), tmFlashBox.isSelected()); - b.setWatchedSignal1Alt(tmNextSignalField1Alt.getText()); + b.setWatchedSignal1(tmNextSignalComboBox1.getDisplayName(), tmFlashBox.isSelected()); + b.setWatchedSignal1Alt(tmNextSignalComboBox1Alt.getDisplayName()); b.setLimitSpeed1(tmLimitBox.isSelected()); b.setRestrictingSpeed1(tmRestrictingBox.isSelected()); b.setDistantSignal(tmDistantBox.isSelected()); @@ -803,17 +937,17 @@ void loadTrailMain(BlockBossLogic b) { } void loadTrailDiv(BlockBossLogic b) { - b.setSensor1(tdSensorField1.getText()); - b.setSensor2(tdSensorField2.getText()); - b.setSensor3(tdSensorField3.getText()); - b.setSensor4(tdSensorField4.getText()); - b.setSensor5(tdSensorField5.getText()); + b.setSensor1(tdSensorComboBox1.getDisplayName()); + b.setSensor2(tdSensorComboBox2.getDisplayName()); + b.setSensor3(tdSensorComboBox3.getDisplayName()); + b.setSensor4(tdSensorComboBox4.getDisplayName()); + b.setSensor5(tdSensorComboBox5.getDisplayName()); b.setMode(BlockBossLogic.TRAILINGDIVERGING); - b.setTurnout(tdProtectTurnoutField.getText()); + b.setTurnout(tdProtectTurnoutComboBox.getDisplayName()); - b.setWatchedSignal1(tdNextSignalField1.getText(), tdFlashBox.isSelected()); - b.setWatchedSignal1Alt(tdNextSignalField1Alt.getText()); + b.setWatchedSignal1(tdNextSignalComboBox1.getDisplayName(), tdFlashBox.isSelected()); + b.setWatchedSignal1Alt(tdNextSignalComboBox1Alt.getDisplayName()); b.setLimitSpeed2(tdLimitBox.isSelected()); b.setRestrictingSpeed1(tdRestrictingBox.isSelected()); b.setDistantSignal(tdDistantBox.isSelected()); @@ -825,23 +959,23 @@ void loadTrailDiv(BlockBossLogic b) { } void loadFacing(BlockBossLogic b) { - b.setSensor1(fSensorField1.getText()); - b.setSensor2(fSensorField2.getText()); - b.setSensor3(fSensorField3.getText()); - b.setSensor4(fSensorField4.getText()); - b.setSensor5(fSensorField5.getText()); + b.setSensor1(fSensorComboBox1.getDisplayName()); + b.setSensor2(fSensorComboBox2.getDisplayName()); + b.setSensor3(fSensorComboBox3.getDisplayName()); + b.setSensor4(fSensorComboBox4.getDisplayName()); + b.setSensor5(fSensorComboBox5.getDisplayName()); b.setMode(BlockBossLogic.FACING); - b.setTurnout(fProtectTurnoutField.getText()); + b.setTurnout(fProtectTurnoutComboBox.getDisplayName()); - b.setWatchedSignal1(fNextSignalField1.getText(), fFlashBox.isSelected()); - b.setWatchedSignal1Alt(fNextSignalField1Alt.getText()); - b.setWatchedSignal2(fNextSignalField2.getText()); - b.setWatchedSignal2Alt(fNextSignalField2Alt.getText()); - b.setWatchedSensor1(fNextSensorField1.getText()); - b.setWatchedSensor1Alt(fNextSensorField1Alt.getText()); - b.setWatchedSensor2(fNextSensorField2.getText()); - b.setWatchedSensor2Alt(fNextSensorField2Alt.getText()); + b.setWatchedSignal1(fNextSignalComboBox1.getDisplayName(), fFlashBox.isSelected()); + b.setWatchedSignal1Alt(fNextSignalComboBox1Alt.getDisplayName()); + b.setWatchedSignal2(fNextSignalComboBox2.getDisplayName()); + b.setWatchedSignal2Alt(fNextSignalComboBox2Alt.getDisplayName()); + b.setWatchedSensor1(fNextSensorComboBox1.getDisplayName()); + b.setWatchedSensor1Alt(fNextSensorComboBox1Alt.getDisplayName()); + b.setWatchedSensor2(fNextSensorComboBox2.getDisplayName()); + b.setWatchedSensor2Alt(fNextSensorComboBox2Alt.getDisplayName()); b.setLimitSpeed1(fmLimitBox.isSelected()); b.setRestrictingSpeed1(fmRestrictingBox.isSelected()); b.setLimitSpeed2(fdLimitBox.isSelected()); @@ -856,44 +990,43 @@ void loadFacing(BlockBossLogic b) { } void activate() { - // check signal head exists - if (sh == null && InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(outSignalField.getText()) == null) { + if (sh == null && InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(outSignalHeadComboBox.getDisplayName()) == null) { // head not exist, just title the window and leave - setTitle(rbt.getString("Simple_Signal_Logic")); + setTitle(Bundle.getMessage("Simple_Signal_Logic")); return; } - // find existing logic + // find existing logic BlockBossLogic b; if (sh != null) { b = BlockBossLogic.getExisting(sh); } else { - b = BlockBossLogic.getExisting(outSignalField.getText()); + b = BlockBossLogic.getExisting(outSignalHeadComboBox.getDisplayName()); } - setTitle(rbt.getString("Signal_logic_for_") + " " + outSignalField.getText()); + setTitle(Bundle.getMessage("SignalLogicForX", outSignalHeadComboBox.getDisplayName())); - approachSensorField1.setText(b.getApproachSensor1()); + approachSensor1ComboBox.setText(b.getApproachSensor1()); - sSensorField1.setText(b.getSensor1()); - sSensorField2.setText(b.getSensor2()); - sSensorField3.setText(b.getSensor3()); - sSensorField4.setText(b.getSensor4()); - sSensorField5.setText(b.getSensor5()); + sSensorComboBox1.setText(b.getSensor1()); + sSensorComboBox2.setText(b.getSensor2()); + sSensorComboBox3.setText(b.getSensor3()); + sSensorComboBox4.setText(b.getSensor4()); + sSensorComboBox5.setText(b.getSensor5()); - tmProtectTurnoutField.setText(b.getTurnout()); + tmProtectTurnoutComboBox.setText(b.getTurnout()); - sNextSignalField1.setText(b.getWatchedSignal1()); - sNextSignalField1Alt.setText(b.getWatchedSignal1Alt()); + sNextSignalComboBox1.setText(b.getWatchedSignal1()); + sNextSignalComboBox1Alt.setText(b.getWatchedSignal1Alt()); - fNextSignalField2.setText(b.getWatchedSignal2()); - fNextSignalField2Alt.setText(b.getWatchedSignal2Alt()); + fNextSignalComboBox2.setText(b.getWatchedSignal2()); + fNextSignalComboBox2Alt.setText(b.getWatchedSignal2Alt()); - fNextSensorField1.setText(b.getWatchedSensor1()); - fNextSensorField1Alt.setText(b.getWatchedSensor1Alt()); - fNextSensorField2.setText(b.getWatchedSensor2()); - fNextSensorField2Alt.setText(b.getWatchedSensor2Alt()); + fNextSensorComboBox1.setText(b.getWatchedSensor1()); + fNextSensorComboBox1Alt.setText(b.getWatchedSensor1Alt()); + fNextSensorComboBox2.setText(b.getWatchedSensor2()); + fNextSensorComboBox2Alt.setText(b.getWatchedSensor2Alt()); sLimitBox.setSelected(b.getLimitSpeed1()); sRestrictingBox.setSelected(b.getRestrictingSpeed1()); @@ -915,6 +1048,7 @@ void activate() { buttonFacing.setSelected(true); } + statusBar.setText(Bundle.getMessage("StatusSslLoaded", Bundle.getMessage("ButtonApply"))); // do setup of visible panels buttonClicked(); } @@ -933,7 +1067,7 @@ void buttonClicked() { } else if (buttonFacing.isSelected()) { modeFacing.setVisible(true); } else { - log.debug(rbt.getString("no_button_selected?")); + log.debug("buttonClicked(): no SSL type radio button was selected"); } modeSingle.revalidate(); modeTrailMain.revalidate(); @@ -949,28 +1083,54 @@ void buttonClicked() { SignalHead sh = null; /** - * Programmatically open the frame to edit a specific signal by head. + * Programmatically open the frame to edit a specific SSL by signal head. * * @param sh signal head of which the name should be entered in the Edit pane */ public void setSignal(SignalHead sh) { this.sh = sh; - outSignalField.setText(sh.getDisplayName()); - outSignalField.setEnabled(false); + outSignalHeadComboBox.setText(sh.getDisplayName()); + outSignalHeadComboBox.setEnabled(false); activate(); } /** - * Programmatically open the frame to edit a specific signal by name. + * Programmatically open the frame to edit a specific SSL by signal head system name. * * @param name system or user name of the signal head to be entered in the Edit pane */ public void setSignal(String name) { sh = null; - outSignalField.setText(name); - outSignalField.setEnabled(true); + outSignalHeadComboBox.setText(name); + outSignalHeadComboBox.setEnabled(true); activate(); } + /** + * Set up editable JmriBeanComboBoxes for SSL pane. + * Copied from LayoutEditor + * @see jmri.jmrit.display.layoutEditor.LayoutEditor#setupComboBox(JmriBeanComboBox, boolean, boolean, boolean) + * @author G. Warner 2017 + * + * @param inComboBox the editable JmriBeanComboBoxes to set up + * @param inValidateMode boolean: if true, valid text == green, invalid text + * == red background; if false, valid text == green, + * invalid text == yellow background + * @param inEnable boolean to enable / disable the JmriBeanComboBox + * @param inFirstBlank boolean to enable / disable the first item being + * blank + */ + public static void setupComboBox(@Nonnull JmriBeanComboBox inComboBox, boolean inValidateMode, boolean inEnable, boolean inFirstBlank) { + inComboBox.setEnabled(inEnable); + inComboBox.setEditable(true); + inComboBox.setValidateMode(inValidateMode); + inComboBox.setText(""); + log.debug("SSL setupComboBox called"); + inComboBox.setMaximumRowCount(15); // no context sensitive calculation + inComboBox.setFirstItemBlank(inFirstBlank); + inComboBox.setSelectedIndex(-1); + } + private final static Logger log = LoggerFactory.getLogger(BlockBossLogic.class); + } diff --git a/java/src/jmri/jmrit/blockboss/BlockBossLogic.java b/java/src/jmri/jmrit/blockboss/BlockBossLogic.java index dee54b9f88c..0dcc8178370 100644 --- a/java/src/jmri/jmrit/blockboss/BlockBossLogic.java +++ b/java/src/jmri/jmrit/blockboss/BlockBossLogic.java @@ -92,7 +92,7 @@ * shows, instead of one speed faster. E.g. if the (protected) next signal is * red, this one should be red, instead of yellow. In this case, this signal is * called a "distant signal", as it provides a "distant" view of the protected - * signal's appearance. Note that when in this mode, this signal still protects + * signal heads's appearance. Note that when in this mode, this signal still protects * the interveneing track, etc. *

                  * The "hold" unbound parameter can be used to set this logic to show red, @@ -115,9 +115,8 @@ * the green signal). * * @author Bob Jacobsen Copyright (C) 2003, 2005 - * - * Revisions to add facing point sensors, approach lighting, and check box to - * limit speed. Dick Bronosn (RJB) 2006 + * @author Dick Bronson 2006 Revisions to add facing point sensors, approach lighting + * and check box to limit speed. */ public class BlockBossLogic extends Siglet implements java.beans.VetoableChangeListener { @@ -141,12 +140,12 @@ private BlockBossLogic() { } /** - * Create an object to drive a specific signal. + * Create an object to drive a specific signal head. * - * @param name System or user name of the driven signal, which must exist + * @param name System or user name of the driven signal head, which must exist */ public BlockBossLogic(String name) { - super(name + rb.getString("_BlockBossLogic")); + super(name + Bundle.getMessage("_BlockBossLogic")); this.name = name; if (log.isTraceEnabled()) { log.trace("Create BBL " + name); @@ -156,8 +155,8 @@ public BlockBossLogic(String name) { jmri.InstanceManager.sensorManagerInstance().addVetoableChangeListener(this); SignalHead driveHead = InstanceManager.getDefault(jmri.SignalHeadManager.class).getSignalHead(name); if (driveHead == null) { - log.warn(rb.getString("Signal_") + name + rb.getString("_was_not_found!")); - throw new IllegalArgumentException("SignalHead \""+name+"\" does not exist"); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSignalHead"), name)); + throw new IllegalArgumentException("SignalHead \"" + name + "\" does not exist"); } driveSignal = nbhm.getNamedBeanHandle(name, driveHead); } @@ -165,7 +164,7 @@ public BlockBossLogic(String name) { /** * The "driven signal" is controlled by this element. * - * @return system name of the driven signal + * @return system name of the driven signal head */ public String getDrivenSignal() { return driveSignal.getName(); @@ -176,7 +175,6 @@ public NamedBeanHandle getDrivenSignalNamedBean() { } protected jmri.NamedBeanHandleManager nbhm = jmri.InstanceManager.getDefault(jmri.NamedBeanHandleManager.class); - protected static final java.util.ResourceBundle rb = java.util.ResourceBundle.getBundle("jmri.jmrit.blockboss.BlockBossBundle"); public void setSensor1(String name) { if (name == null || name.equals("")) { @@ -186,7 +184,7 @@ public void setSensor1(String name) { try { watchSensor1 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor1_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "1", name)); } } @@ -198,7 +196,7 @@ public void setSensor2(String name) { try { watchSensor2 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor2_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "2", name)); } } @@ -210,7 +208,7 @@ public void setSensor3(String name) { try { watchSensor3 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor3_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "3", name)); } } @@ -222,7 +220,7 @@ public void setSensor4(String name) { try { watchSensor4 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor4_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "4", name)); } } @@ -234,12 +232,12 @@ public void setSensor5(String name) { try { watchSensor5 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor5_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "5", name)); } } /** - * Return the system name of the sensor being monitored. + * Return the system name of the sensors 1-5 being monitored. * * @return system name; null if no sensor configured */ @@ -286,7 +284,7 @@ public void setTurnout(String name) { try { watchTurnout = nbhm.getNamedBeanHandle(name, InstanceManager.turnoutManagerInstance().provideTurnout(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Turnout_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameTurnout"), name)); } } @@ -329,16 +327,16 @@ public void setWatchedSignal1(String name, boolean useFlash) { if (head != null) { watchedSignal1 = nbhm.getNamedBeanHandle(name, head); } else { - log.warn(rb.getString("Signal_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSignalHead"), name)); watchedSignal1 = null; } protectWithFlashing = useFlash; } /** - * Return the system name of the signal being monitored for first route. + * Return the system name of the signal head being monitored for first route. * - * @return system name; null if no primary signal configured + * @return system name; null if no primary signal head is configured */ public String getWatchedSignal1() { if (watchedSignal1 == null) { @@ -356,16 +354,16 @@ public void setWatchedSignal1Alt(String name) { if (head != null) { watchedSignal1Alt = nbhm.getNamedBeanHandle(name, head); } else { - log.warn(rb.getString("Signal_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSignalHead"), name)); watchedSignal1Alt = null; } } /** - * Return the system name of the alternate signal being monitored for first + * Return the system name of the alternate signal head being monitored for first * route. * - * @return system name; null if no signal configured + * @return system name; null if no signal head is configured */ public String getWatchedSignal1Alt() { if (watchedSignal1Alt == null) { @@ -383,15 +381,15 @@ public void setWatchedSignal2(String name) { if (head != null) { watchedSignal2 = nbhm.getNamedBeanHandle(name, head); } else { - log.warn(rb.getString("Signal_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSignalHead"), name)); watchedSignal2 = null; } } /** - * Return the system name of the signal being monitored for the 2nd route. + * Return the system name of the signal head being monitored for the 2nd route. * - * @return system name; null if no signal configured + * @return system name; null if no signal head is configured */ public String getWatchedSignal2() { if (watchedSignal2 == null) { @@ -409,16 +407,16 @@ public void setWatchedSignal2Alt(String name) { if (head != null) { watchedSignal2Alt = nbhm.getNamedBeanHandle(name, head); } else { - log.warn(rb.getString("Signal_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSignalHead"), name)); watchedSignal2Alt = null; } } /** - * Return the system name of the secondary signal being monitored for the + * Return the system name of the secondary signal head being monitored for the * 2nd route. * - * @return system name; null if no secondary signal configured + * @return system name; null if no secondary signal head is configured */ public String getWatchedSignal2Alt() { if (watchedSignal2Alt == null) { @@ -435,16 +433,15 @@ public void setWatchedSensor1(String name) { try { watchedSensor1 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor1_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "1", name)); watchedSensor1 = null; } - } /** - * Return the original name of the sensor being monitored. + * Return the original name of the sensor1 being monitored. * - * @return original name; null if no sensor configured + * @return original name; null if no sensor is configured */ public String getWatchedSensor1() { if (watchedSensor1 == null) { @@ -461,16 +458,15 @@ public void setWatchedSensor1Alt(String name) { try { watchedSensor1Alt = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor1Alt_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "1Alt", name)); watchedSensor1Alt = null; } - } /** - * Return the system name of the sensor being monitored. + * Return the system name of the sensor1Alt being monitored. * - * @return system name; null if no sensor configured + * @return system name; null if no sensor is configured */ public String getWatchedSensor1Alt() { if (watchedSensor1Alt == null) { @@ -487,16 +483,15 @@ public void setWatchedSensor2(String name) { try { watchedSensor2 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor2_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "2", name)); watchedSensor2 = null; } - } /** - * Return the system name of the sensor being monitored. + * Return the system name of the sensor2 being monitored. * - * @return system name; null if no sensor configured + * @return system name; null if no sensor is configured */ public String getWatchedSensor2() { if (watchedSensor2 == null) { @@ -513,15 +508,15 @@ public void setWatchedSensor2Alt(String name) { try { watchedSensor2Alt = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); } catch (IllegalArgumentException ex) { - log.warn(rb.getString("Sensor2Alt_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("BeanNameSensor") + "2Alt", name)); watchedSensor2Alt = null; } } /** - * Return the system name of the sensor being monitored. + * Return the system name of the sensor2Alt being monitored. * - * @return system name; null if no sensor configured + * @return system name; null if no sensor is configured */ public String getWatchedSensor2Alt() { if (watchedSensor2Alt == null) { @@ -579,7 +574,7 @@ public boolean getDistantSignal() { /** * Provide the current value of the "hold" parameter. *

                  - * If true, the output is forced to a RED "stop" aspect. + * If true, the output is forced to a RED "stop" appearance. * This allows CTC and other higher-level functions to control * permission to enter this section of track. * @@ -591,7 +586,7 @@ public boolean getHold() { /** * Set the current value of the "hold" parameter. - * If true, the output is forced to a RED "stop" aspect. + * If true, the output is forced to a RED "stop" appearance. * This allows CTC and other higher-level functions to * control permission to enter this section of track. * @@ -637,13 +632,13 @@ public void setApproachSensor1(String name) { } approachSensor1 = nbhm.getNamedBeanHandle(name, InstanceManager.sensorManagerInstance().provideSensor(name)); if (approachSensor1.getBean() == null) { - log.warn(rb.getString("Approach_Sensor1_") + name + rb.getString("_was_not_found!")); + log.warn(Bundle.getMessage("BeanXNotFound", Bundle.getMessage("Approach_Sensor1_"), name)); } } /** - * Return the system name of the sensor being monitored + * Return the system name of the sensor being monitored. * * @return system name; null if no sensor configured */ @@ -739,7 +734,7 @@ public void defineIO() { driveSignal.getBean().addPropertyChangeListener(new java.beans.PropertyChangeListener() { @Override public void propertyChange(java.beans.PropertyChangeEvent e) { - if (e.getPropertyName().equals(rb.getString("Held"))) { + if (e.getPropertyName().equals(Bundle.getMessage("Held"))) { setOutput(); } } @@ -783,7 +778,7 @@ public void setOutput() { doFacing(); break; default: - log.error(rb.getString("UnexpectedMode") + mode + "_Signal_" + getDrivenSignal()); + log.error(Bundle.getMessage("UnexpectedMode") + mode + "_Signal_" + getDrivenSignal()); } } @@ -906,7 +901,7 @@ void doSingleBlock() { appearance = SignalHead.RED; } - // check if signal if held, forcing a red aspect by this calculation + // check if signal if held, forcing a red appearance by this calculation if (((SignalHead) outputs[0]).getHeld()) { appearance = SignalHead.RED; } @@ -917,9 +912,7 @@ void doSingleBlock() { // show result if changed if (appearance != oldAppearance) { ((SignalHead) outputs[0]).setAppearance(appearance); - if (log.isDebugEnabled()) { - log.debug("Change appearance of " + name + " to " + appearance); - } + log.debug("Change appearance of {} to: {}", name, appearance); } } @@ -972,7 +965,7 @@ void doTrailingMain() { appearance = SignalHead.RED; } - // check if signal if held, forcing a red aspect by this calculation + // check if signal if held, forcing a red appearance by this calculation if (((SignalHead) outputs[0]).getHeld()) { appearance = SignalHead.RED; } @@ -983,9 +976,7 @@ void doTrailingMain() { // show result if changed if (appearance != oldAppearance) { ((SignalHead) outputs[0]).setAppearance(appearance); - if (log.isDebugEnabled()) { - log.debug("Change appearance of " + name + " to " + appearance); - } + log.debug("Change appearance of {} to:{}", name, appearance); } } @@ -1038,7 +1029,7 @@ void doTrailingDiverging() { appearance = SignalHead.RED; } - // check if signal if held, forcing a red aspect by this calculation + // check if signal if held, forcing a red appearance by this calculation if (((SignalHead) outputs[0]).getHeld()) { appearance = SignalHead.RED; } @@ -1050,7 +1041,7 @@ void doTrailingDiverging() { if (appearance != oldAppearance) { ((SignalHead) outputs[0]).setAppearance(appearance); if (log.isDebugEnabled()) { - log.debug("Change appearance of " + name + " to " + appearance); + log.debug("Change appearance of {} to: {}", name, appearance); } } } @@ -1135,7 +1126,7 @@ void doFacing() { appearance = SignalHead.RED; } - // check if signal if held, forcing a red aspect by this calculation + // check if signal if held, forcing a red appearance by this calculation if (((SignalHead) outputs[0]).getHeld()) { appearance = SignalHead.RED; } @@ -1150,7 +1141,7 @@ void doFacing() { } /** - * Handle the approach lighting logic for all modes + * Handle the approach lighting logic for all modes. */ void doApproach() { if (approachSensor1 != null && approachSensor1.getBean().getKnownState() == Sensor.INACTIVE) { @@ -1183,7 +1174,7 @@ public static Enumeration entries() { } /** - * Ensure that this BlockBossLogic object is available for later retrieval + * Ensure that this BlockBossLogic object is available for later retrieval. */ public void retain() { bblList.add(this); @@ -1270,14 +1261,14 @@ public static BlockBossLogic getExisting(@Nonnull SignalHead sh) { @Override public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans.PropertyVetoException { NamedBean nb = (NamedBean) evt.getOldValue(); - if ("CanDelete".equals(evt.getPropertyName())) { //IN18N + if ("CanDelete".equals(evt.getPropertyName())) { // NOI18N StringBuilder message = new StringBuilder(); - message.append(Bundle.getMessage("InUseBlockBossHeader", getDrivenSignal())); //IN18N + message.append(Bundle.getMessage("InUseBlockBossHeader", getDrivenSignal())); boolean found = false; if (nb instanceof SignalHead) { if (getDrivenSignalNamedBean().getBean().equals(nb)) { - message.append("
                  This SSL will be deleted"); + message.append("
                  " + Bundle.getMessage("InUseThisSslWillBeDeleted") + ""); throw new java.beans.PropertyVetoException(message.toString(), evt); } if ((watchedSignal1 != null && watchedSignal1.getBean().equals(nb)) @@ -1329,10 +1320,10 @@ public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans message.append("

                "); } if (found) { - message.append(Bundle.getMessage("InUseBlockBossFooter")); //IN18N + message.append(Bundle.getMessage("InUseBlockBossFooter")); // NOI18N throw new java.beans.PropertyVetoException(message.toString(), evt); } - } else if ("DoDelete".equals(evt.getPropertyName())) { //IN18N + } else if ("DoDelete".equals(evt.getPropertyName())) { // NOI18N if (nb instanceof SignalHead) { if (getDrivenSignalNamedBean().getBean().equals(nb)) { stop(); @@ -1420,4 +1411,5 @@ public void vetoableChange(java.beans.PropertyChangeEvent evt) throws java.beans } private final static Logger log = LoggerFactory.getLogger(BlockBossLogic.class); + } diff --git a/java/src/jmri/jmrit/catalog/CatalogBundle.properties b/java/src/jmri/jmrit/catalog/CatalogBundle.properties index d736bbaed3f..be868390a8e 100644 --- a/java/src/jmri/jmrit/catalog/CatalogBundle.properties +++ b/java/src/jmri/jmrit/catalog/CatalogBundle.properties @@ -10,8 +10,6 @@ selectIndexNode = Select a node, then use the Edit menu to add or edit subNodes dragIconsInstr = Drag icons from the file system or catalog directories and drop them onto the nodes of your Image index tree. BeanNameCatalog = Catalog - -setBackground = Set Background numImagesInNode = Node "{0}" has {1} image files. numImagesInDir = Directory "{0}" has {1} image files. numImagesShown = {0} {1} displayed ({2} previously displayed) diff --git a/java/src/jmri/jmrit/catalog/CatalogBundle_ca.properties b/java/src/jmri/jmrit/catalog/CatalogBundle_ca.properties index 102d1d82bc3..8a90609350b 100644 --- a/java/src/jmri/jmrit/catalog/CatalogBundle_ca.properties +++ b/java/src/jmri/jmrit/catalog/CatalogBundle_ca.properties @@ -11,8 +11,6 @@ selectIndexNode = Seleccioneu un node per afegir o editar subnodes dragIcons = Arrossegueu les icones del {0} panell de visualitzaci\u00f3 cap a nodes a l'arbre {1}. BeanNameCatalog = Cat\u00e0leg - -setBackground = Estableix el fons numImagesInNode = Node "{0}" t\u00e9 {1} fitxers d'imatge. numImagesInDir = El directori "{0}" t\u00e9 {1} fitxers d'imatge. numImagesShown = ({0} mostrat anteriorment) diff --git a/java/src/jmri/jmrit/catalog/CatalogBundle_da.properties b/java/src/jmri/jmrit/catalog/CatalogBundle_da.properties index be781947b7f..b1712df0ef7 100644 --- a/java/src/jmri/jmrit/catalog/CatalogBundle_da.properties +++ b/java/src/jmri/jmrit/catalog/CatalogBundle_da.properties @@ -10,8 +10,6 @@ selectIndexNode = Select a node to add subNodes or edit dragIcons = Drag icons from the {0} viewing panel to nodes in the {1} tree. BeanNameCatalog = Catalog - -setBackground = Set Background numImagesInNode = Node "{0}" has {1} image files. numImagesInDir = Directory "{0}" has {1} image files. numImagesShown = ({0} previously displayed) diff --git a/java/src/jmri/jmrit/catalog/CatalogBundle_fr.properties b/java/src/jmri/jmrit/catalog/CatalogBundle_fr.properties index ac9727f57fd..4e62642996d 100644 --- a/java/src/jmri/jmrit/catalog/CatalogBundle_fr.properties +++ b/java/src/jmri/jmrit/catalog/CatalogBundle_fr.properties @@ -10,8 +10,6 @@ selectIndexNode = S\u00e9lectionnez un n\u0153ud pour ajouter ou modifier des so dragIcons = Faites glisser les ic\u00f4nes depuis le panneau d'affichage "{0}" pour les n\u0153uds de l'arbre "{1}" . BeanNameCatalog = Catalogue - -setBackground = D\u00e9finir l'Arri\u00e8re-Plan numImagesInNode = N\u0153ud " "{0}" " a "{1}" fichiers image. numImagesInDir = R\u00e9pertoire " "{0}" " a "{1}" fichiers image. numImagesShown = ( "{0}" pr\u00e9c\u00e9demment affich\u00e9e) @@ -46,7 +44,7 @@ openDirMenu = Ouvrir un R\u00e9pertoire de Fichiers Syst\u00e8me searchFSMenu = Recherche de Fichiers Syst\u00e8me pour les ic\u00f4nes DirNotFound = Pas de sous-r\u00e9pertoires contenant les fichiers d'image. NoImagesInDir = R\u00e9pertoire ne poss\u00e8de pas tous les fichiers d'image. -addDirectory = R\u00e9pertoire " "{0}" " contient des fichiers d'image. Ajouter au catalogue? +addDirectory = R\u00e9pertoire "{0}" contient des fichiers d'image. Ajouter au catalogue? loadDir1 = S\u00e9lectionner tout loadDir2 = Fichier image diff --git a/java/src/jmri/jmrit/catalog/CatalogBundle_it.properties b/java/src/jmri/jmrit/catalog/CatalogBundle_it.properties index 5cd817b0c02..248db8cc28b 100644 --- a/java/src/jmri/jmrit/catalog/CatalogBundle_it.properties +++ b/java/src/jmri/jmrit/catalog/CatalogBundle_it.properties @@ -9,8 +9,6 @@ selectNode = Selezionare una directory per visualizzarne le immagini ImageIndex = Indice immagini: selectIndexNode = Selezionare un nodo per aggiungere i sotto-nodi o modifica dragIcons = Trascinare le icone dal pannello di visualizzazione {0} ai nodi dell'albero {1}. - -setBackground = Seleziona sfondo numImagesInNode = Nodo "{0}" ha il file immagine {1}. numImagesInDir = Directory "{0}" ha il file immagine {1}. numImagesShown = ({0} visualizzato in precedenza) diff --git a/java/src/jmri/jmrit/catalog/CatalogBundle_nl.properties b/java/src/jmri/jmrit/catalog/CatalogBundle_nl.properties index 08e051c1f6b..03183d2eee2 100644 --- a/java/src/jmri/jmrit/catalog/CatalogBundle_nl.properties +++ b/java/src/jmri/jmrit/catalog/CatalogBundle_nl.properties @@ -11,8 +11,6 @@ selectIndexNode = Selecteer een map en gebruik het Bewerk-menu om submappen toe dragIconsInstr = Sleep symbolen uit het bestandssysteem of de catalogus-mappen naar mappen in je Afbeeldingenindex-boom. BeanNameCatalog = Symbolencatalogus - -setBackground = Stel achtergrond in numImagesInNode = Map "{0}" bevat {1} afbeeldingsbestanden. numImagesInDir = Map "{0}" bevat {1} afbeeldingsbestanden. numImagesShown = {0} {1} getoond ({2} eerder vertoond) diff --git a/java/src/jmri/jmrit/catalog/CatalogPane.java b/java/src/jmri/jmrit/catalog/CatalogPane.java index 138e870a6f1..9396c283cfc 100644 --- a/java/src/jmri/jmrit/catalog/CatalogPane.java +++ b/java/src/jmri/jmrit/catalog/CatalogPane.java @@ -17,25 +17,13 @@ /** * Create a JPanel containing a tree of resources. - *

                + *

                * The tree has two top-level visible nodes. One, "icons", represents the * contents of the icons directory in the resources tree in the .jar file. The * other, "files", is all files found in the "resources" filetree in the * preferences directory. Note that this means that files in the distribution * directory are _not_ included. * - *


                - * This file is part of JMRI. - *

                - * JMRI is free software; you can redistribute it and/or modify it under the - * terms of version 2 of the GNU General Public License as published by the Free - * Software Foundation. See the "COPYING" file for a copy of this license. - *

                - * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. - *

                - * * @author Bob Jacobsen Copyright 2002 */ public class CatalogPane extends JPanel { @@ -132,4 +120,5 @@ public NamedIcon getSelectedIcon() { JTree dTree; private final static Logger log = LoggerFactory.getLogger(CatalogPane.class); + } diff --git a/java/src/jmri/jmrit/catalog/CatalogPanel.java b/java/src/jmri/jmrit/catalog/CatalogPanel.java index e9488c5b43e..274f5cf31c4 100644 --- a/java/src/jmri/jmrit/catalog/CatalogPanel.java +++ b/java/src/jmri/jmrit/catalog/CatalogPanel.java @@ -4,6 +4,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -21,19 +22,19 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import javax.swing.AbstractAction; import javax.swing.BoxLayout; -import javax.swing.ButtonGroup; +import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; -import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; @@ -47,6 +48,8 @@ import jmri.CatalogTreeManager; import jmri.InstanceManager; import jmri.util.FileUtil; +import jmri.util.swing.DrawSquares; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,11 +58,10 @@ * panel also displays image files files contained in a node of a tree. Drag and * Drop is implemented to drag a display of an icon to the display of an icon * that may be added to the panel. - *

                + *

                * This panel is used in the Icon Editors and also in the ImageIndex Editor. * * @author Pete Cressman Copyright 2009 - * */ public class CatalogPanel extends JPanel implements MouseListener { @@ -69,10 +71,14 @@ public class CatalogPanel extends JPanel implements MouseListener { JPanel _selectedImage; static Color _grayColor = new Color(235, 235, 235); + static Color _darkGrayColor = new Color(150, 150, 150); + protected Color[] colorChoice = new Color[] {Color.white, _grayColor, _darkGrayColor}; protected Color _currentBackground = _grayColor; + protected BufferedImage[] _backgrounds; // array of Image backgrounds JLabel _previewLabel = new JLabel(" "); - protected JPanel _preview; + protected ImagePanel _preview; + protected JScrollPane js; boolean _noDrag; JScrollPane _treePane; @@ -98,9 +104,6 @@ public CatalogPanel(String label1, String label2) { p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(p1); p.add(makePreviewPanel()); -// JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, p1, makePreviewPanel()); -// sp.setResizeWeight(0.2); -// add(sp); add(p); add(makeButtonPanel()); } @@ -118,10 +121,10 @@ public void setToolTipText(String tip) { protected void init(boolean treeDnD) { _model = new DefaultTreeModel(new CatalogTreeNode("mainRoot")); - if (treeDnD) { // index editor (right pane) + if (treeDnD) { // index editor (right pane) _dTree = new DropJTree(_model); _noDrag = true; - } else { // Catalog (left pane index editor or all icon editors) + } else { // Catalog (left pane index editor or all icon editors) _dTree = new JTree(_model); _noDrag = false; } @@ -139,7 +142,6 @@ protected void init(boolean treeDnD) { }); _dTree.setExpandsSelectedPaths(true); _treePane.setViewportView(_dTree); -// setupPanel(); } public void updatePanel() { @@ -205,7 +207,7 @@ public void addTree(CatalogTree tree) { } /** - * Recursively add the branch nodes to display tree + * Recursively add the branch nodes to display tree. */ @SuppressWarnings("unchecked") private void addTreeBranch(CatalogTreeNode node) { @@ -277,7 +279,7 @@ private CatalogTreeNode match(CatalogTreeNode cRoot, TreeNode[] nodes, int idx) } /** - * Find the corresponding CatalogTreeManager tree to the displayed branch + * Find the corresponding CatalogTreeManager tree to the displayed branch. */ private CatalogTree getCorespondingModel(CatalogTreeNode node) { TreeNode[] nodes = node.getPath(); @@ -337,7 +339,7 @@ public void removeNodeFromModel(CatalogTreeNode node) { /** * Make a change to a node in the displayed tree. Either its name or the - * contents of its leaves (image references) + * contents of its leaves (image references). * * @param node the node to change * @param name new name for the node @@ -358,7 +360,7 @@ public boolean nodeChange(CatalogTreeNode node, String name) { } /** - * Node names in the path to the root must be unique + * Check that Node names in the path to the root are unique. */ private boolean nameOK(CatalogTreeNode node, String name) { TreeNode[] nodes = node.getPath(); @@ -381,60 +383,78 @@ private boolean nameOK(CatalogTreeNode node, String name) { * log.debug("nodeName= "+n.getUserObject()+" has "+n.getLeaves().size()+" * leaves."); } } */ + /** - * Setup a display pane for a tree that shows only directory nodes (no file - * leaves) The leaves (icon images) will be displayed in this panel. + * Set up a display pane for a tree that shows only directory nodes (no file + * leaves). The leaves (icon images) will be displayed in this panel. */ private JPanel makePreviewPanel() { JPanel previewPanel = new JPanel(); previewPanel.setLayout(new BoxLayout(previewPanel, BoxLayout.Y_AXIS)); previewPanel.add(_previewLabel); - _preview = new JPanel(); - JScrollPane js = new JScrollPane(_preview); + _preview = new ImagePanel(); + log.debug("Catalog ImagePanel created"); + _preview.setLayout(new BoxLayout(_preview, BoxLayout.Y_AXIS)); + _preview.setOpaque(false); + js = new JScrollPane(_preview); previewPanel.add(js); + + // create array of backgrounds + _backgrounds = new BufferedImage[4]; + for (int i = 0; i <= 2; i++) { + _backgrounds[i] = DrawSquares.getImage(500, 500, 15, colorChoice[i], colorChoice[i]); + } + _backgrounds[3] = DrawSquares.getImage(500, 500, 15, Color.white, _grayColor); + return previewPanel; } + /** + * Create panel element containing a "View on:" drop down list. + * @see jmri.jmrit.catalog.PreviewDialog#setupPanel() + * + * @return the JPanel with label and drop down + */ private JPanel makeButtonPanel() { - JRadioButton whiteButton = new JRadioButton(Bundle.getMessage("White"), false); - JRadioButton grayButton = new JRadioButton(Bundle.getMessage("LightGray"), true); - JRadioButton darkButton = new JRadioButton(Bundle.getMessage("DarkGray"), false); - whiteButton.addActionListener((ActionEvent e) -> { - _currentBackground = Color.white; - setBackground(_preview); - }); - grayButton.addActionListener((ActionEvent e) -> { - _currentBackground = _grayColor; - setBackground(_preview); - }); - darkButton.addActionListener((ActionEvent e) -> { - _currentBackground = new Color(150, 150, 150); - setBackground(_preview); + JComboBox bgColorBox = new JComboBox<>(); + bgColorBox.addItem(Bundle.getMessage("White")); + bgColorBox.addItem(Bundle.getMessage("LightGray")); + bgColorBox.addItem(Bundle.getMessage("DarkGray")); + bgColorBox.addItem(Bundle.getMessage("Checkers")); // checkers option + bgColorBox.setSelectedIndex(0); // start as "White" + bgColorBox.addActionListener((ActionEvent e) -> { + // load background image + _preview.setImage(_backgrounds[bgColorBox.getSelectedIndex()]); + log.debug("Catalog setImage called"); + _preview.setOpaque(false); + // _preview.repaint(); // force redraw + _preview.invalidate(); }); + JPanel backgroundPanel = new JPanel(); backgroundPanel.setLayout(new BoxLayout(backgroundPanel, BoxLayout.Y_AXIS)); JPanel pp = new JPanel(); + pp.setLayout(new FlowLayout(FlowLayout.CENTER)); pp.add(new JLabel(Bundle.getMessage("setBackground"))); + pp.add(bgColorBox); backgroundPanel.add(pp); - JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); - ButtonGroup selGroup = new ButtonGroup(); - selGroup.add(whiteButton); - selGroup.add(grayButton); - selGroup.add(darkButton); - buttonPanel.add(whiteButton); - buttonPanel.add(grayButton); - buttonPanel.add(darkButton); - backgroundPanel.add(buttonPanel); backgroundPanel.setMaximumSize(backgroundPanel.getPreferredSize()); return backgroundPanel; } + /** + * Reset the background to _currentBackground. + * Visible on JPanels and JLabels, not on ImagePanels used as Preview background. + * + * @param container the parent to set plus all its children's background color + * @deprecated since 4.9.6 use transparent icon panels on a graphic ImagePanel background + * @see jmri.util.swing.ImagePanel#setImage(Image) + */ + @Deprecated public void setBackground(Container container) { container.setBackground(_currentBackground); Component[] comp = container.getComponents(); for (Component comp1 : comp) { - comp1.setBackground(_currentBackground); if (comp1 instanceof java.awt.Container) { setBackground((Container) comp1); } @@ -452,7 +472,6 @@ protected void resetPanel() { comp1.removeMouseListener(this); } _preview.removeAll(); - setBackground(_preview); _preview.repaint(); } @@ -468,7 +487,7 @@ public void uncaughtException(Thread t, Throwable e) { private boolean _noMemory = false; /** - * Display the icons in the preview panel + * Display the icons in the preview panel. */ private String setIcons() { Thread.UncaughtExceptionHandler exceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); @@ -515,7 +534,7 @@ private String setIcons() { } if (c.gridx < numCol) { c.gridx++; - } else if (c.gridy < numRow) { //start next row + } else if (c.gridy < numRow) { // start next row c.gridy++; if (!newCol) { c.gridx = 0; @@ -544,18 +563,18 @@ private String setIcons() { continue; } } -// nameLabel.setText(leaf.getName()); nameLabel.setName(leaf.getName()); -// nameLabel.setVerticalTextPosition(JLabel.TOP); - nameLabel.setBackground(_currentBackground); + nameLabel.setOpaque(false); nameLabel.setIcon(icon); JPanel p = new JPanel(); + p.setOpaque(false); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(nameLabel); JLabel label = new JLabel(Bundle.getMessage("scale", CatalogPanel.printDbl(scale, 2))); p.add(label); label = new JLabel(leaf.getName()); + label.setOpaque(false); p.add(label); if (_noDrag) { p.addMouseListener(this); @@ -613,7 +632,7 @@ public static void packParentFrame(Component comp) { } /** - * Utility returns a number as a string + * Utility returning a number as a string. * * @param z double * @param decimalPlaces number of decimal places @@ -716,7 +735,7 @@ private void rename(NamedIcon icon) { // deselect to refresh panel _dTree.setSelectionPath(null); _dTree.setSelectionPath(path); -// updatePanel(); + // updatePanel(); InstanceManager.getDefault(ImageIndexEditor.class).indexChanged(true); } } @@ -732,6 +751,7 @@ private void rename(NamedIcon icon) { * to DnD. _selectedImage = null; return (NamedIcon)l.getIcon(); } return * null; } */ + private void showPopUp(MouseEvent e, NamedIcon icon) { if (log.isDebugEnabled()) { log.debug("showPopUp {}", icon.toString()); @@ -867,4 +887,5 @@ public void drop(DropTargetDropEvent e) { } private final static Logger log = LoggerFactory.getLogger(CatalogPanel.class); + } diff --git a/java/src/jmri/jmrit/catalog/CatalogTreeLeaf.java b/java/src/jmri/jmrit/catalog/CatalogTreeLeaf.java index 0c45ea94334..6e25f12940d 100644 --- a/java/src/jmri/jmrit/catalog/CatalogTreeLeaf.java +++ b/java/src/jmri/jmrit/catalog/CatalogTreeLeaf.java @@ -35,4 +35,5 @@ public String getPath() { public int getSize() { return _size; } + } diff --git a/java/src/jmri/jmrit/catalog/DirectorySearcher.java b/java/src/jmri/jmrit/catalog/DirectorySearcher.java index 8a624e2943a..656b288d7c5 100644 --- a/java/src/jmri/jmrit/catalog/DirectorySearcher.java +++ b/java/src/jmri/jmrit/catalog/DirectorySearcher.java @@ -298,7 +298,7 @@ public void actionPerformed(ActionEvent a) { } } - // Cancel -Quit + // Cancel - Quit class CActionListener implements ActionListener { @Override diff --git a/java/src/jmri/jmrit/catalog/DragJLabel.java b/java/src/jmri/jmrit/catalog/DragJLabel.java index 553140f8843..834104f939a 100644 --- a/java/src/jmri/jmrit/catalog/DragJLabel.java +++ b/java/src/jmri/jmrit/catalog/DragJLabel.java @@ -17,22 +17,9 @@ import org.slf4j.LoggerFactory; /** - * Gives a JLabel the capability to Drag and Drop - *
                - *


                - * This file is part of JMRI. - *

                - * JMRI is free software; you can redistribute it and/or modify it under the - * terms of version 2 of the GNU General Public License as published by the Free - * Software Foundation. See the "COPYING" file for a copy of this license. - *

                - * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. - *

                + * Gives a JLabel the capability to Drag and Drop. * * @author Pete Cressman Copyright 2009, 2016 - * */ public class DragJLabel extends JLabel implements DragGestureListener, DragSourceListener, Transferable { @@ -62,7 +49,8 @@ private void init(DataFlavor flavor) { /** * Source can override to prohibit dragging if data is incomplete - * when dragGestureRecognized() is called + * when dragGestureRecognized() is called. + * * @return Source's choice to allow drag */ protected boolean okToDrag() { @@ -74,9 +62,7 @@ protected boolean okToDrag() { */ @Override public void dragGestureRecognized(DragGestureEvent e) { - if (log.isDebugEnabled()) { - log.debug("DragJLabel.dragGestureRecognized "); - } + log.debug("DragJLabel.dragGestureRecognized "); if (okToDrag()) { e.startDrag(DragSource.DefaultCopyDrop, this, this); } @@ -87,29 +73,27 @@ public void dragGestureRecognized(DragGestureEvent e) { */ @Override public void dragDropEnd(DragSourceDropEvent e) { - if (log.isDebugEnabled()) { - log.debug("DragJLabel.dragDropEnd "); - } + log.debug("DragJLabel.dragDropEnd "); } @Override public void dragEnter(DragSourceDragEvent e) { - //if (log.isDebugEnabled()) log.debug("DragJLabel.DragSourceDragEvent "); + // log.debug("DragJLabel.DragSourceDragEvent "); } @Override public void dragExit(DragSourceEvent e) { - //if (log.isDebugEnabled()) log.debug("DragJLabel.dragExit "); + // log.debug("DragJLabel.dragExit "); } @Override public void dragOver(DragSourceDragEvent e) { - //if (log.isDebugEnabled()) log.debug("DragJLabel.dragOver "); + // log.debug("DragJLabel.dragOver "); } @Override public void dropActionChanged(DragSourceDragEvent e) { - //if (log.isDebugEnabled()) log.debug("DragJLabel.dropActionChanged "); + // log.debug("DragJLabel.dropActionChanged "); } /** @@ -117,13 +101,13 @@ public void dropActionChanged(DragSourceDragEvent e) { */ @Override public DataFlavor[] getTransferDataFlavors() { - //if (log.isDebugEnabled()) log.debug("DragJLabel.getTransferDataFlavors "); + // log.debug("DragJLabel.getTransferDataFlavors "); return new DataFlavor[]{_dataFlavor, DataFlavor.stringFlavor}; } @Override public boolean isDataFlavorSupported(DataFlavor flavor) { - //if (log.isDebugEnabled()) log.debug("DragJLabel.isDataFlavorSupported "); + // log.debug("DragJLabel.isDataFlavorSupported "); if (DataFlavor.stringFlavor.equals(flavor)) { return true; } @@ -132,9 +116,7 @@ public boolean isDataFlavorSupported(DataFlavor flavor) { @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { - if (log.isDebugEnabled()) { - log.debug("DragJLabel.getTransferData "); - } + log.debug("DragJLabel.getTransferData "); if (_dataFlavor.equals(flavor)) { return getIcon(); } @@ -146,4 +128,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(DragJLabel.class); + } diff --git a/java/src/jmri/jmrit/catalog/ImageIndexEditor.java b/java/src/jmri/jmrit/catalog/ImageIndexEditor.java index 064e6dc806c..1a81320f2f8 100644 --- a/java/src/jmri/jmrit/catalog/ImageIndexEditor.java +++ b/java/src/jmri/jmrit/catalog/ImageIndexEditor.java @@ -29,18 +29,6 @@ /** * A JFrame for creating and editing an Image Index. - *
                - *
                - * This file is part of JMRI. - *

                - * JMRI is free software; you can redistribute it and/or modify it under the - * terms of version 2 of the GNU General Public License as published by the Free - * Software Foundation. See the "COPYING" file for a copy of this license. - *

                - * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. - *

                * * @author Pete Cressman Copyright 2009 * diff --git a/java/src/jmri/jmrit/catalog/NamedIcon.java b/java/src/jmri/jmrit/catalog/NamedIcon.java index 3c4f82abef7..929e3ff279c 100644 --- a/java/src/jmri/jmrit/catalog/NamedIcon.java +++ b/java/src/jmri/jmrit/catalog/NamedIcon.java @@ -31,7 +31,7 @@ * * @see jmri.jmrit.display.configurexml.PositionableLabelXml * @author Bob Jacobsen Copyright 2002, 2008 - * @author Pete Cressman Copyright: Copyright (c) 2009, 2010 + * @author Pete Cressman Copyright (c) 2009, 2010 */ public class NamedIcon extends ImageIcon { @@ -62,7 +62,7 @@ public NamedIcon(NamedIcon pOld, Component comp) { * Create a named icon that includes an image to be loaded from a URL. *

                * The default access form is "file:", so a bare pathname to an icon file - * will also work for the URL argument + * will also work for the URL argument. * * @param pUrl URL of image file to load * @param pName Human-readable name for the icon @@ -71,11 +71,11 @@ public NamedIcon(String pUrl, String pName) { super(FileUtil.findURL(pUrl)); URL u = FileUtil.findURL(pUrl); if (u == null) { - log.warn("Could not load image from " + pUrl + " (file does not exist)"); + log.warn("Could not load image from {} (file does not exist)", pUrl); } mDefaultImage = getImage(); if (mDefaultImage == null) { - log.warn("Could not load image from " + pUrl + " (image is null)"); + log.warn("Could not load image from {} (image is null)", pUrl); } mName = pName; mURL = FileUtil.getPortableFilename(pUrl); @@ -224,10 +224,7 @@ public Image getOriginalImage() { * @return new Image object containing the rotated input image */ public Image createRotatedImage(Image pImage, Component pComponent, int pRotation) { - if (log.isDebugEnabled()) { - log.debug("createRotatedImage: pRotation= " + pRotation - + ", mRotation= " + mRotation); - } + log.debug("createRotatedImage: pRotation= {}, mRotation= {}", pRotation, mRotation); if (pRotation == 0) { return pImage; } @@ -323,8 +320,8 @@ public void setLoad(int d, double s, Component comp) { public void transformImage(int w, int h, AffineTransform t, Component comp) { if (w <= 0 || h <= 0) { if (log.isDebugEnabled()) { - log.debug("transformImage bad coords " - + ((jmri.jmrit.display.Positionable) comp).getNameString()); + log.debug("transformImage bad coords {}", + ((jmri.jmrit.display.Positionable) comp).getNameString()); } return; } @@ -481,4 +478,5 @@ public void flip(int flip, Component comp) { } private final static Logger log = LoggerFactory.getLogger(NamedIcon.class); + } diff --git a/java/src/jmri/jmrit/catalog/PreviewDialog.java b/java/src/jmri/jmrit/catalog/PreviewDialog.java index eaf31d4c42e..b192ae96b46 100644 --- a/java/src/jmri/jmrit/catalog/PreviewDialog.java +++ b/java/src/jmri/jmrit/catalog/PreviewDialog.java @@ -4,6 +4,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.Frame; import java.awt.GridBagConstraints; @@ -12,21 +13,23 @@ import java.awt.datatransfer.DataFlavor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.File; import java.util.ArrayList; import javax.swing.Box; import javax.swing.BoxLayout; -import javax.swing.ButtonGroup; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTextField; import jmri.InstanceManager; +import jmri.util.swing.DrawSquares; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +37,9 @@ * Create a Dialog to display the images in a file system directory. *

                * PreviewDialog is not modal to allow dragNdrop of icons from it to catalog panels and - * functioning of the catalog panels without dismissing this dialog + * functioning of the catalog panels without dismissing this dialog. + * Component is used in @link{jmri.jmrit.catalog.DirectorySearcher}, acessed + * from @link{jmri.jmrit.catalog.ImageIndexEditor} File menu items. * * @author Pete Cressman Copyright 2009 */ @@ -42,10 +47,14 @@ public class PreviewDialog extends JDialog { JPanel _selectedImage; static Color _grayColor = new Color(235, 235, 235); - Color _currentBackground = _grayColor; + static Color _darkGrayColor = new Color(150, 150, 150); + protected Color[] colorChoice = new Color[] {Color.white, _grayColor, _darkGrayColor}; + protected Color _currentBackground = _grayColor; + protected BufferedImage[] _backgrounds; // array of Image backgrounds JLabel _previewLabel = new JLabel(); - JPanel _preview; + protected ImagePanel _preview; + protected JScrollPane js; int _cnt; // number of files displayed when setIcons() method runs int _startNum; // total number of files displayed from a directory @@ -89,7 +98,7 @@ public void windowClosing(java.awt.event.WindowEvent e) { p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalStrut(5)); - JPanel previewPanel = setupPanel(); // provide panel for images, add to bottom of window + JPanel previewPanel = setupPanel(); // provide panel for images, add to bottom of window _startNum = startNum; needsMore = setIcons(startNum); if (_noMemory) { @@ -97,7 +106,7 @@ public void windowClosing(java.awt.event.WindowEvent e) { Bundle.getMessage("OutOfMemory", _cnt), Bundle.getMessage("ErrorTitle"), JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new String[]{Bundle.getMessage("ButtonStop"), Bundle.getMessage("ShowContents")}, 1); - if (choice==0) { + if (choice == 0) { return; } } @@ -152,10 +161,12 @@ ActionListener getLookActionListener() { return _lookAction; } - - /** - * Setup a display panel to display icons + * Set up a display panel to display icons. + * Includes a "View on:" drop down list. + * @see jmri.jmrit.catalog.CatalogPanel#makeButtonPanel() + * + * @return the JPanel with preview pane and background color drop down */ private JPanel setupPanel() { JPanel previewPanel = new JPanel(); @@ -164,67 +175,41 @@ private JPanel setupPanel() { p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(_previewLabel); previewPanel.add(p); - _preview = new JPanel(); - JScrollPane js = new JScrollPane(_preview); + _preview = new ImagePanel(); + log.debug("Preview ImagePanel created"); + _preview.setLayout(new BoxLayout(_preview, BoxLayout.Y_AXIS)); + _preview.setOpaque(false); + js = new JScrollPane(_preview); previewPanel.add(js); - JRadioButton whiteButton = new JRadioButton(Bundle.getMessage("White"), false); - JRadioButton grayButton = new JRadioButton(Bundle.getMessage("LightGray"), true); - JRadioButton darkButton = new JRadioButton(Bundle.getMessage("DarkGray"), false); - whiteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setBackGround(Color.white); - } - }); - grayButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setBackGround(_grayColor); - } - }); - darkButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - setBackGround(new Color(150, 150, 150)); - } + + // create array of backgrounds + _backgrounds = new BufferedImage[4]; + for (int i = 0; i <= 2; i++) { + _backgrounds[i] = DrawSquares.getImage(500, 500, 15, colorChoice[i], colorChoice[i]); + } + _backgrounds[3] = DrawSquares.getImage(500, 500, 15, Color.white, _grayColor); + + JComboBox bgColorBox = new JComboBox<>(); + bgColorBox.addItem(Bundle.getMessage("White")); + bgColorBox.addItem(Bundle.getMessage("LightGray")); + bgColorBox.addItem(Bundle.getMessage("DarkGray")); + bgColorBox.addItem(Bundle.getMessage("Checkers")); // checkers option, under development + bgColorBox.setSelectedIndex(0); // white + bgColorBox.addActionListener((ActionEvent e) -> { + // load background image + _preview.setImage(_backgrounds[bgColorBox.getSelectedIndex()]); + log.debug("Preview setImage called"); + _preview.setOpaque(false); + // _preview.repaint(); // force redraw + _preview.invalidate(); }); JPanel pp = new JPanel(); + pp.setLayout(new FlowLayout(FlowLayout.CENTER)); pp.add(new JLabel(Bundle.getMessage("setBackground"))); + pp.add(bgColorBox); previewPanel.add(pp); - JPanel panel = new JPanel(); - panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); - ButtonGroup selGroup = new ButtonGroup(); - selGroup.add(whiteButton); - selGroup.add(grayButton); - selGroup.add(darkButton); - panel.add(whiteButton); - panel.add(grayButton); - panel.add(darkButton); - previewPanel.add(panel); - return previewPanel; - } - private void setBackGround(Color color) { - _preview.setBackground(color); - _currentBackground = color; - Component[] comp = _preview.getComponents(); - for (int i = 0; i < comp.length; i++) { - JLabel l = null; - if (comp[i].getClass().getName().equals("javax.swing.JPanel")) { - JPanel p = (JPanel) comp[i]; - p.setBackground(color); - l = (JLabel) p.getComponent(0); - } else if (comp[i].getClass().getName().equals("javax.swing.JLabel")) { - l = (JLabel) comp[i]; - } else { - if (log.isDebugEnabled()) { - log.debug("setBackGround label #{}, class= {}", i, comp[i].getClass().getName()); - } - return; - } - l.setBackground(color); - } - _preview.invalidate(); + return previewPanel; } void resetPanel() { @@ -232,16 +217,9 @@ void resetPanel() { if (_preview == null) { return; } - if (log.isDebugEnabled()) { - log.debug("resetPanel"); - } - Component[] comp = _preview.getComponents(); - for (int i = comp.length - 1; i >= 0; i--) { - _preview.remove(i); - comp[i] = null; - } + log.debug("resetPanel"); _preview.removeAll(); - _preview.setBackground(_currentBackground); + _preview.setImage(_backgrounds[0]); _preview.invalidate(); pack(); } @@ -276,9 +254,7 @@ private boolean setIcons(int startNum) { _noMemory = false; Thread.setDefaultUncaughtExceptionHandler(new MemoryExceptionHandler()); // allow room for ImageFetcher threads - if (log.isDebugEnabled()) { - log.debug("setIcons: startNum= {}", startNum); - } + log.debug("setIcons: startNum= {}", startNum); GridBagLayout gridbag = new GridBagLayout(); _preview.setLayout(gridbag); GridBagConstraints c = new GridBagConstraints(); @@ -290,104 +266,106 @@ private boolean setIcons(int startNum) { c.gridx = 0; _cnt = 0; // number of images displayed in this panel int cnt = 0; // total number of images in directory - File[] files = _currentDir.listFiles(); // all files, filtered below - int nCols = 1; - int nRows = 1; - int nAvail = 1; - - long memoryAvailable = availableMemory(); - long memoryUsed = 0; // estmate - for (int i = 0; i < files.length; i++) { - String ext = jmri.util.FileChooserFilter.getFileExtension(files[i]); - for (int k = 0; k < _filter.length; k++) { - if (ext != null && ext.equalsIgnoreCase(_filter[k])) { - // files[i] filtered to be an image file - if (cnt < startNum) { + if (_currentDir.listFiles() != null) { // prevent findbugs NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE + File[] files = _currentDir.listFiles(); // all files, filtered below + int nCols = 1; + int nRows = 1; + int nAvail = 1; + + long memoryAvailable = availableMemory(); + long memoryUsed = 0; // estimate + for (int i = 0; i < files.length; i++) { + String ext = jmri.util.FileChooserFilter.getFileExtension(files[i]); + for (int k = 0; k < _filter.length; k++) { + if (ext != null && ext.equalsIgnoreCase(_filter[k])) { + // files[i] filtered to be an image file + if (cnt < startNum) { + cnt++; + continue; + } + String name = files[i].getName(); + int index = name.indexOf('.'); + if (index > 0) { + name = name.substring(0, index); + } + String path = files[i].getAbsolutePath(); + NamedIcon icon = new NamedIcon(path, name); + long size = icon.getIconWidth() * icon.getIconHeight(); + log.debug("Memory calculation icon size= {} memoryAvailable= {} memoryUsed= {}", size, memoryAvailable, memoryUsed); + + if (memoryAvailable < 4 * size) { + _noMemory = true; + log.debug("Memory calculation caught icon size= {} testSize= {} memoryAvailable= {}", size, 4 * size, memoryAvailable); + break; + } + double scale = icon.reduceTo(CatalogPanel.ICON_WIDTH, + CatalogPanel.ICON_HEIGHT, CatalogPanel.ICON_SCALE); + if (_noMemory) { + log.debug("MemoryExceptionHandler caught icon size={} ", size); + break; + } + if (scale < 1.0) { + size *= 4; + } else { + size += 1000; + } + memoryUsed += size; + memoryAvailable -= size; + _cnt++; cnt++; - continue; - } - String name = files[i].getName(); - int index = name.indexOf('.'); - if (index > 0) { - name = name.substring(0, index); - } - String path = files[i].getAbsolutePath(); - NamedIcon icon = new NamedIcon(path, name); - long size = icon.getIconWidth()*icon.getIconHeight(); - log.debug("Memory calculation icon size= {} memoryAvailable= {} memoryUsed= {}", size, memoryAvailable, memoryUsed); - - if (memoryAvailable < 4*size) { - _noMemory = true; - log.debug("Memory calculation caught icon size= {} testSize= {} memoryAvailable= {}", size, 4*size, memoryAvailable); - break; - } - double scale = icon.reduceTo(CatalogPanel.ICON_WIDTH, - CatalogPanel.ICON_HEIGHT, CatalogPanel.ICON_SCALE); - if (_noMemory) { - log.debug("MemoryExceptionHandler caught icon size={} ", size); - break; - } - if (scale < 1.0) { - size *= 4; - } else { - size += 1000; - } - memoryUsed += size; - memoryAvailable -= size; - _cnt++; - cnt++; - if (_cnt > nAvail) { - nCols++; - nRows++; - nAvail = nCols*nRows; - c.gridx = nCols-1; - c.gridy = 0; - } else if (_cnt > nAvail - nRows) { - if (c.gridx < nCols-1) { - c.gridx++; + if (_cnt > nAvail) { + nCols++; + nRows++; + nAvail = nCols * nRows; + c.gridx = nCols - 1; + c.gridy = 0; + } else if (_cnt > nAvail - nRows) { + if (c.gridx < nCols - 1) { + c.gridx++; + } else { + c.gridx = 0; + c.gridy++; + } } else { - c.gridx = 0; c.gridy++; } - } else { - c.gridy++; - } - c.insets = new Insets(5, 5, 0, 0); - JLabel image; - try { - image = new DragJLabel(new DataFlavor(ImageIndexEditor.IconDataFlavorMime)); - } catch (java.lang.ClassNotFoundException cnfe) { - cnfe.printStackTrace(); - image = new JLabel(cnfe.getMessage()); - } - image.setOpaque(true); - //image.setName(name); - image.setBackground(_currentBackground); - image.setIcon(icon); - JPanel p = new JPanel(); - p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); - p.add(image); - if (name.length() > 18) { - name = name.substring(0, 18); - } - JLabel nameLabel = new JLabel(name); - JLabel label = new JLabel(Bundle.getMessage("scale", CatalogPanel.printDbl(scale, 2))); - p.add(label); - p.add(nameLabel); - gridbag.setConstraints(p, c); - if (log.isDebugEnabled()) { + c.insets = new Insets(5, 5, 0, 0); + JLabel image; + try { + image = new DragJLabel(new DataFlavor(ImageIndexEditor.IconDataFlavorMime)); + } catch (java.lang.ClassNotFoundException cnfe) { + cnfe.printStackTrace(); + image = new JLabel(cnfe.getMessage()); + } + image.setOpaque(false); + image.setName(name); + image.setIcon(icon); + JPanel p = new JPanel(); + p.setOpaque(false); + p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); + p.add(image); + if (name.length() > 18) { + name = name.substring(0, 18); + } + JLabel nameLabel = new JLabel(name); + nameLabel.setOpaque(false); + JLabel label = new JLabel(Bundle.getMessage("scale", CatalogPanel.printDbl(scale, 2))); + label.setOpaque(false); + p.add(label); + p.add(nameLabel); + gridbag.setConstraints(p, c); log.debug("{} inserted at ({}, {})", name, c.gridx, c.gridy); + _preview.add(p); + } + if (_noMemory) { + break; } - _preview.add(p); - } - if (_noMemory) { - break; } } + c.gridy++; + c.gridx++; } - c.gridy++; - c.gridx++; JLabel bottom = new JLabel(); gridbag.setConstraints(bottom, c); _preview.add(bottom); diff --git a/java/src/jmri/jmrit/conditional/ConditionalEditBase.java b/java/src/jmri/jmrit/conditional/ConditionalEditBase.java index bcfda1e5b1b..41234111e27 100644 --- a/java/src/jmri/jmrit/conditional/ConditionalEditBase.java +++ b/java/src/jmri/jmrit/conditional/ConditionalEditBase.java @@ -37,6 +37,7 @@ import jmri.SignalMastManager; import jmri.Turnout; import jmri.TurnoutManager; +import jmri.jmrit.entryexit.EntryExitPairs; import jmri.jmrit.logix.OBlock; import jmri.jmrit.logix.OBlockManager; import jmri.jmrit.logix.Warrant; @@ -44,9 +45,8 @@ import jmri.jmrit.picker.PickFrame; import jmri.jmrit.picker.PickListModel; import jmri.jmrit.picker.PickSinglePanel; -import jmri.jmrit.signalling.EntryExitPairs; import jmri.util.JmriJFrame; -import jmri.util.swing.JmriBeanComboBox; +import jmri.util.swing.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -286,6 +286,7 @@ JmriBeanComboBox createNameBox(int itemType) { return null; // Skip any other items. } nameBox.setFirstItemBlank(true); + JComboBoxUtil.setupComboBoxMaxRows(nameBox); return nameBox; } @@ -1227,7 +1228,7 @@ String validateEntryExitReference(String name) { NamedBean nb = null; if (name != null) { if (name.length() > 0) { - nb = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class).getNamedBean(name); + nb = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class).getNamedBean(name); if (nb != null) { return nb.getSystemName(); } diff --git a/java/src/jmri/jmrit/conditional/ConditionalListEdit.java b/java/src/jmri/jmrit/conditional/ConditionalListEdit.java index 6d84f2dd293..6e8ffe03403 100644 --- a/java/src/jmri/jmrit/conditional/ConditionalListEdit.java +++ b/java/src/jmri/jmrit/conditional/ConditionalListEdit.java @@ -54,6 +54,7 @@ import jmri.jmrit.sensorgroup.SensorGroupFrame; import jmri.util.FileUtil; import jmri.util.JmriJFrame; +import jmri.util.swing.*; import jmri.util.table.ButtonEditor; import jmri.util.table.ButtonRenderer; import org.slf4j.Logger; @@ -1688,6 +1689,7 @@ void makeEditVariableWindow(int row) { for (int i = 0; i <= Conditional.ITEM_TYPE_LAST_STATE_VAR; i++) { _variableTypeBox.addItem(ConditionalVariable.getItemTypeString(i)); } + JComboBoxUtil.setupComboBoxMaxRows(_variableTypeBox); panel1.add(makeEditPanel(_variableTypeBox, "LabelVariableType", "VariableTypeHint")); // NOI18N panel1.add(Box.createHorizontalStrut(STRUT)); @@ -2325,6 +2327,7 @@ void loadSelectLogixBox() { } } _selectLogixBox.setSelectedItem(itemKey); + JComboBoxUtil.setupComboBoxMaxRows(_selectLogixBox); loadSelectConditionalBox(lgxName); } @@ -2375,6 +2378,7 @@ void loadSelectConditionalBox(String logixName) { } } _selectConditionalBox.setSelectedItem(itemKey); + JComboBoxUtil.setupComboBoxMaxRows(_selectConditionalBox); } // ------------ Variable update processes ------------ @@ -2693,6 +2697,7 @@ void makeEditActionWindow(int row) { for (int i = 0; i <= Conditional.ITEM_TYPE_LAST_ACTION; i++) { _actionItemTypeBox.addItem(DefaultConditionalAction.getItemTypeString(i)); } + JComboBoxUtil.setupComboBoxMaxRows(_actionItemTypeBox); panel1.add(makeEditPanel(_actionItemTypeBox, "LabelActionItem", "ActionItemHint")); // NOI18N panel1.add(Box.createHorizontalStrut(STRUT)); diff --git a/java/src/jmri/jmrit/conditional/ConditionalTreeEdit.java b/java/src/jmri/jmrit/conditional/ConditionalTreeEdit.java index 7b23059735a..8fb2caab021 100644 --- a/java/src/jmri/jmrit/conditional/ConditionalTreeEdit.java +++ b/java/src/jmri/jmrit/conditional/ConditionalTreeEdit.java @@ -58,6 +58,7 @@ import jmri.jmrit.logix.Warrant; import jmri.util.FileUtil; import jmri.util.JmriJFrame; +import jmri.util.swing.*; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -2028,6 +2029,7 @@ void buildVariableComponents() { for (int i = 0; i <= Conditional.ITEM_TYPE_LAST_STATE_VAR; i++) { _variableTypeBox.addItem(ConditionalVariable.getItemTypeString(i)); } + JComboBoxUtil.setupComboBoxMaxRows(_variableTypeBox); _variableTypeBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { @@ -2718,6 +2720,7 @@ void loadSelectLogixBox() { } } _selectLogixBox.setSelectedItem(itemKey); + JComboBoxUtil.setupComboBoxMaxRows(_selectLogixBox); loadSelectConditionalBox(lgxName); } @@ -2768,6 +2771,7 @@ void loadSelectConditionalBox(String logixName) { } } _selectConditionalBox.setSelectedItem(itemKey); + JComboBoxUtil.setupComboBoxMaxRows(_selectConditionalBox); } /** @@ -3194,6 +3198,7 @@ void buildActionComponents() { for (int i = 0; i <= Conditional.ITEM_TYPE_LAST_ACTION; i++) { _actionItemTypeBox.addItem(DefaultConditionalAction.getItemTypeString(i)); } + JComboBoxUtil.setupComboBoxMaxRows(_actionItemTypeBox); _actionItemTypeBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { diff --git a/java/src/jmri/jmrit/dispatcher/AutoAllocate.java b/java/src/jmri/jmrit/dispatcher/AutoAllocate.java index f4982c02925..3b3e5517fd3 100644 --- a/java/src/jmri/jmrit/dispatcher/AutoAllocate.java +++ b/java/src/jmri/jmrit/dispatcher/AutoAllocate.java @@ -1,7 +1,6 @@ package jmri.jmrit.dispatcher; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import jmri.Block; import jmri.InstanceManager; @@ -50,8 +49,7 @@ * The dispatcher is free to switch AutoAllocate on or off at any tine in * DispatcherFrame. When AutoAllocate is switched off, all existing * AllocationPlan objects are discarded. - *

                - * + *

                *
                *


                * This file is part of JMRI. @@ -85,9 +83,9 @@ public AutoAllocate(DispatcherFrame d) { // operational variables private DispatcherFrame _dispatcher = null; private ConnectivityUtil _conUtil = null; - private List _planList = new ArrayList(); + private List _planList = new ArrayList<>(); private int nextPlanNum = 1; - private List orderedRequests = new ArrayList(); + private List orderedRequests = new ArrayList<>(); /** * This is the entry point to AutoAllocate when it is triggered. @@ -110,18 +108,17 @@ protected synchronized void scanAllocationRequestList(List li log.error("error in allocation request list - AllocationRequest is null"); continue; } - log.debug("Allocating Train [" + ar.getActiveTrainName() + "] section [" + ar.getSectionName() + "]"); + log.debug("Allocating Train [{}] section [{}]", ar.getActiveTrainName(), ar.getSectionName()); Transit arTransit = ar.getActiveTrain().getTransit(); if (ar.getActiveTrain().getAllocateMethod() == ActiveTrain.ALLOCATE_BY_SAFE_SECTIONS) { - log.debug("Allocating Train [" + ar.getActiveTrainName() + "] Using Safe Sections"); + log.debug("Allocating Train [{}] Using Safe Sections", ar.getActiveTrainName()); // if the last allocated section is safe but not occupied short cut out of here - if (ar.getActiveTrain().getLastAllocatedSection() != null && - arTransit.getTransitSectionFromSectionAndSeq(ar.getActiveTrain().getLastAllocatedSection(), - ar.getActiveTrain().getLastAllocatedSectionSeqNumber()).isSafe() && - ar.getActiveTrain().getLastAllocatedSection().getState() == Section.FREE) { + if (ar.getActiveTrain().getLastAllocatedSection() != null + && arTransit.getTransitSectionFromSectionAndSeq(ar.getActiveTrain().getLastAllocatedSection(), + ar.getActiveTrain().getLastAllocatedSectionSeqNumber()).isSafe() + && ar.getActiveTrain().getLastAllocatedSection().getState() == Section.FREE) { - log.debug( - "Allocating Train [" + ar.getActiveTrainName() + "] has not arrived at Passing Point"); + log.debug("Allocating Train [{}] has not arrived at Passing Point", ar.getActiveTrainName()); continue; } // Check all forward sections till a passing point. @@ -145,29 +142,17 @@ protected synchronized void scanAllocationRequestList(List li } if (!skip) { boolean areForwardsFree = false; - log.debug(("index [" + - ix + - "] Limit [" + - iLimit + - "] transitsize [" + - arTransit.getTransitSectionList().size() + - "]")); - for (ix = iStart; ix != iLimit; ix = ix + iIncrement) { - log.debug(("index [" + - ix + - "] Limit [" + - iLimit + - "] transitsize [" + - arTransit.getTransitSectionList().size() + - "]")); + log.debug("index [{}] Limit [{}] transitsize [{}]", ix, iLimit, arTransit.getTransitSectionList().size()); + for (ix = iStart; ix != iLimit; ix += iIncrement) { + log.debug("index [{}] Limit [{}] transitsize [{}]", ix, iLimit, arTransit.getTransitSectionList().size()); // ensure all blocks section and blocks free till next Passing Point, check alternates if they exist. - Section sS = null; + Section sS; ArrayList sectionsInSeq = arTransit.getTransitSectionListBySeq(ix); areForwardsFree = false; //Posit will be bad log.debug("Search ALternates Size[{}]", sectionsInSeq.size()); int seqNumberfound = 0; - for (int iSectionsInSeq = 0; iSectionsInSeq < sectionsInSeq.size() && - !areForwardsFree; iSectionsInSeq = iSectionsInSeq + 1) { + for (int iSectionsInSeq = 0; iSectionsInSeq < sectionsInSeq.size() + && !areForwardsFree; iSectionsInSeq++) { log.debug("iSectionInSeq[{}]", iSectionsInSeq); sS = sectionsInSeq.get(iSectionsInSeq).getSection(); seqNumberfound = iSectionsInSeq; // save for later @@ -175,10 +160,10 @@ protected synchronized void scanAllocationRequestList(List li log.debug("SectionName[{}] getState[{}] occupancy[{}] ", sS.getUserName(), sS.getState(), sS.getOccupancy()); if (sS.getState() != Section.FREE) { - log.debug(("Forward section unavailable[" + sS.getUserName() + "]")); + log.debug("Forward section unavailable[{}]", sS.getUserName()); areForwardsFree = false; } else if (sS.getOccupancy() != Section.UNOCCUPIED) { - log.debug(("Forward section is not unoccupied [" + sS.getUserName() + "]")); + log.debug("Forward section is not unoccupied [{}]", sS.getUserName()); areForwardsFree = false; } else { areForwardsFree = true; @@ -192,7 +177,7 @@ protected synchronized void scanAllocationRequestList(List li break; } } - log.debug("ForwardsFree[" + areForwardsFree + "]"); + log.debug("ForwardsFree[{}]", areForwardsFree); if (!areForwardsFree) { continue; } @@ -202,8 +187,8 @@ protected synchronized void scanAllocationRequestList(List li } } log.debug("Using Regular"); - if (InstanceManager.getDefault(DispatcherFrame.class).getSignalType() == DispatcherFrame.SIGNALMAST && - isSignalHeldAtStartOfSection(ar)) { + if (InstanceManager.getDefault(DispatcherFrame.class).getSignalType() == DispatcherFrame.SIGNALMAST + && isSignalHeldAtStartOfSection(ar)) { continue; } if (getPlanThisTrain(ar.getActiveTrain()) != null) { @@ -215,12 +200,12 @@ protected synchronized void scanAllocationRequestList(List li } } else if (!waitingForStartTime(ar)) { // train isn't waiting, continue only if requested Section is currently free and not occupied - if ((ar.getSection().getState() == Section.FREE) && - (ar.getSection().getOccupancy() != Section.OCCUPIED) && - (_dispatcher.getSignalType() == DispatcherFrame.SIGNALHEAD || - (_dispatcher.getSignalType() == DispatcherFrame.SIGNALMAST && - _dispatcher.checkBlocksNotInAllocatedSection(ar.getSection(), - ar) == null))) { + if ((ar.getSection().getState() == Section.FREE) + && (ar.getSection().getOccupancy() != Section.OCCUPIED) + && (_dispatcher.getSignalType() == DispatcherFrame.SIGNALHEAD + || (_dispatcher.getSignalType() == DispatcherFrame.SIGNALMAST + && _dispatcher.checkBlocksNotInAllocatedSection(ar.getSection(), + ar) == null))) { // requested Section is currently free and not occupied List activeTrainsList = _dispatcher.getActiveTrainsList(); if (activeTrainsList.size() == 1) { @@ -246,8 +231,8 @@ protected synchronized void scanAllocationRequestList(List li // check if allocating this Section might block a higher priority train for (int j = 0; j < activeTrainsList.size(); j++) { ActiveTrain at = activeTrainsList.get(j); - if ((at != ar.getActiveTrain()) && - (at.getPriority() > ar.getActiveTrain().getPriority())) { + if ((at != ar.getActiveTrain()) + && (at.getPriority() > ar.getActiveTrain().getPriority())) { if (willLevelXingsBlockTrain(at)) { okToAllocate = false; } @@ -262,8 +247,8 @@ protected synchronized void scanAllocationRequestList(List li // are trains moving in same direction through the requested Section? if (sameDirection(ar, nt)) { // trains will move in the same direction thru requested section - if (firstTrainLeadsSecond(ar.getActiveTrain(), nt) && - (nt.getPriority() > ar.getActiveTrain().getPriority())) { + if (firstTrainLeadsSecond(ar.getActiveTrain(), nt) + && (nt.getPriority() > ar.getActiveTrain().getPriority())) { // a higher priority train is trailing this train, can we let it pass? if (checkForPassingPlan(ar, nt, neededByTrainList)) { // PASSING_MEET plan created @@ -388,23 +373,15 @@ private void copyAndSortARs(List list) { for (int i = 0; i < list.size(); i++) { orderedRequests.add(list.get(i)); } - orderedRequests.sort(new arSorterComparer()); - } - private class arSorterComparer implements Comparator{ - @Override - public int compare(AllocationRequest e1, AllocationRequest e2) { - if(e1.getActiveTrain().getPriority() < e2.getActiveTrain().getPriority()){ - return 1; - } else if(e1.getActiveTrain().getPriority() > e2.getActiveTrain().getPriority()) { + orderedRequests.sort((AllocationRequest e1, AllocationRequest e2) -> { + if (e1.getActiveTrain().getPriority() < e2.getActiveTrain().getPriority()) { + return 1; + } else if (e1.getActiveTrain().getPriority() > e2.getActiveTrain().getPriority()) { return -1; } else { - if (e1.getActiveTrain().getTrainName().compareTo(e2.getActiveTrain().getTrainName()) > 0 ) { - return 1; - } else { - return -1; - } - } + return e1.getActiveTrain().getTrainName().compareTo(e2.getActiveTrain().getTrainName()); } + }); } private AllocationPlan getPlanThisTrain(ActiveTrain at) { @@ -490,8 +467,8 @@ private boolean allocateIfLessThanThreeAhead(AllocationRequest ar) { // check for type of allocating N ahead or until passing allocateBySafeSections = true; } - if ((allocateBySafeSections && aSectionList.size() >= 1) || - (!allocateBySafeSections && aSectionList.size() >= (allocateSectionsAhead + 1))) { + if ((allocateBySafeSections && aSectionList.size() >= 1) + || (!allocateBySafeSections && aSectionList.size() >= (allocateSectionsAhead + 1))) { int curSeq = ar.getSectionSeqNumber() - 1; if (ar.getActiveTrain().isAllocationReversed()) { curSeq = ar.getSectionSeqNumber() + 1; @@ -506,11 +483,11 @@ private boolean allocateIfLessThanThreeAhead(AllocationRequest ar) { curAS = as; } } - if (allocateBySafeSections && - (curAS != null) && - ((curAS.getSection().getOccupancy() != jmri.Section.OCCUPIED) && - ar.getActiveTrain().getTransit().getTransitSectionFromSectionAndSeq(curAS.getSection(), - curSeq).isSafe())) { + if (allocateBySafeSections + && (curAS != null) + && ((curAS.getSection().getOccupancy() != jmri.Section.OCCUPIED) + && ar.getActiveTrain().getTransit().getTransitSectionFromSectionAndSeq(curAS.getSection(), + curSeq).isSafe())) { //last allocated section exists and is not occupied but is a Passing point // block further allocations till occupied. log.debug("auto allocating Section returning false"); @@ -528,7 +505,7 @@ private boolean allocateIfLessThanThreeAhead(AllocationRequest ar) { numberAllocatedButUnoccupied++; } } - log.debug("FinalCounter[{}]",numberAllocatedButUnoccupied); + log.debug("FinalCounter[{}]", numberAllocatedButUnoccupied); if (numberAllocatedButUnoccupied < allocateSectionsAhead) { _dispatcher.allocateSection(ar, null); return true; @@ -1301,13 +1278,13 @@ private boolean willLevelXingsBlockTrain(ActiveTrain at) { Block bAC = lx.getLayoutBlockAC().getBlock(); Block bBD = lx.getLayoutBlockBD().getBlock(); if (at.getTransit().containsBlock(bAC) || at.getTransit().containsBlock(bBD)) { - if (DispatcherFrame.instance().getSignalType() == DispatcherFrame.SIGNALMAST) { + if (InstanceManager.getDefault(DispatcherFrame.class).getSignalType() == DispatcherFrame.SIGNALMAST) { return true; } else { // temp - return false - continious trains always meet for ever and no one moves... return false; } - // return true; + // return true; } } return false; @@ -1331,12 +1308,10 @@ private boolean containsLevelXing(Section s) { } } } - if (_levelXingList.size() > 0) { - return true; - } - return false; + return _levelXingList.size() > 0; } - List _levelXingList = new ArrayList(); + + List _levelXingList = new ArrayList<>(); private boolean isSignalHeldAtStartOfSection(AllocationRequest ar) { @@ -1359,9 +1334,9 @@ private boolean isSignalHeldAtStartOfSection(AllocationRequest ar) { if (!sec.equals(mActiveTrain.getNextSectionToAllocate())) { log.error("Allocation request section does not match active train next section to allocate"); - log.error("Section to allocate " + sec.getDisplayName()); + log.error("Section to allocate {}", sec.getDisplayName()); if (mActiveTrain.getNextSectionToAllocate() != null) { - log.error("Active Train expected " + mActiveTrain.getNextSectionToAllocate().getDisplayName()); + log.error("Active Train expected {}", mActiveTrain.getNextSectionToAllocate().getDisplayName()); } return false; } diff --git a/java/src/jmri/jmrit/display/DisplayBundle_cs.properties b/java/src/jmri/jmrit/display/DisplayBundle_cs.properties index c3f48dee2cb..0a9592aa68e 100644 --- a/java/src/jmri/jmrit/display/DisplayBundle_cs.properties +++ b/java/src/jmri/jmrit/display/DisplayBundle_cs.properties @@ -28,7 +28,7 @@ CloseEditor = Zav\u0159\u00edt editor renamePanelMenu = P\u0159ejmenovat panel OpenIconChooser = Otev\u0159\u00edt v\u00fdb\u011br ikon DeletePanel = Vymazat tento panel... -MenuWarrant = Varov\u00e1n\u00ed +MenuWarrant = Povolen\u00ed AddLoco = P\u0159idat lokomotivu AddLocoRoster = P\u0159idat lokomotivu z evidence RemoveMarkers = Odebrat zna\u010dky @@ -60,11 +60,11 @@ ChoiceText3 = Klikn\u011bte 'Ovl\u00e1d\u00e1n\u00ed editoru panel' pro jin\u00f ChoiceText4 = Klikn\u011bte 'Editor situa\u010dn\u00ed dispozice' pro kresl\u00edc\u00ed editor. PanelEditor = Panel editor ControlPanelEditor = Panel editor ovl\u00e1d\u00e1n\u00ed -LayoutEditor = Editor dispozice koleji\u0161t\u011b +LayoutEditor = Editor sch\u00e9matu koleji\u0161t\u011b namelabel = N\u00e1zev: {0} -Angle = \u00dahel = {0} +Angle = \u00dahel: {0} enterDegrees = Zadejte stupn\u011b pooto\u010den\u00ed -Scale = M\u011b\u0159\u00edtko procent {0} +Scale = M\u011b\u0159\u00edtko procent: {0} enterScale = Zadejte m\u011b\u0159\u00edtko procent enterZoom = Zadejte p\u0159ibl\u00ed\u017een\u00ed procent @@ -119,11 +119,11 @@ addToTable = P\u0159idat polo\u017eku do tabulky FontStyle = Styp p\u00edsma Plain = B\u011b\u017en\u00e9 Italic = Kurz\u00edva -Bold = Itali +Bold = Tu\u010dn\u00e9 FontColor = Barva p\u00edsma FontBackgroundColor = Barva pozad\u00ed LocoColor = Barva zna\u010dky lokomotivy -IconToolTip = Prav\u00fdm klikem zobrazit menu, pro p\u0159esun t\u00e1hnout s kl\u00e1vesou modifik\u00e1tor +IconToolTip = Kl\u00e1vesou Alt + klikem my\u0161i zobrazit menu, pro p\u0159esun t\u00e1hnout s kl\u00e1vesou modifik\u00e1tor Fixed = Upevn\u011bn\u00fd Disable = Zak\u00e1zat Tristate = T\u0159\u00edstavov\u00fd @@ -139,10 +139,10 @@ EditBorder = Ohrani\u010den\u00ed EditTooltip = Popisek OverlayText = P\u0159ekr\u00fdt obr\u00e1zek textem... ChangeText = Zm\u011bnit text... -SetXY=Nastavit x & y{0} -SetLevel=Nastavit \u00farove\u0148{0} -ShowTooltip = Uk\u00e1zet popisek -SetTooltip=Nastavit popisek{0} +SetXY = Nastavit x & y {0} +SetLevel = Nastavit vrstvu {0} +ShowTooltip = Uk\u00e1zat popisek +SetTooltip = Nastavit popisek {0} SetSysNameTooltip= Nastavit popisek na u\u017eivatelsk\u00fd n\u00e1zev (syst\u00e9mov\u00fd n\u00e1zev) #SetBorder = Nastavit ohrani\u010den\u00ed... SetHidden = Skr\u00fdt kdy\u017e se neupravuje @@ -156,10 +156,10 @@ AlignXFirst = Zarovnat svisle na prvn\u00ed vybran\u00fd AlignYFirst = Zarovnat vodorovn\u011b na prvn\u00ed vybran\u00fd Transform = Transformovat... #shear = Zbavit se... -Rescale = M\u011b\u0159\u00edtko (procento){0} -Rotate = Oto\u010dit (stupe\u0148){0} -NoZoom = Nep\u0159ibli\u017eovat -Zoom = P\u0159ibl\u00ed\u017eit (procento){0} +scale = M\u011b\u0159\u00edtko (procento) {0} +rotate = Oto\u010dit (stupe\u0148) {0} +NoZoom = Nep\u0159ibli\u017eovat +Zoom = P\u0159ibl\u00ed\u017eit (procento) {0} ZoomFit = P\u0159ibl\u00ed\u017eit akor\u00e1t Hidden = Skryto NotHidden = Neskryto @@ -208,7 +208,7 @@ BadIcon = Obr\u00e1zek nenalezen IconUrlError = Soubor obr\u00e1zku pro {0} nenalezen UrlErrorPrompt1 = Pro tuto polo\u017eku v panelu se nezobraz\u00ed \u017e\u00e1dn\u00fd obr\u00e1zek. UrlErrorPrompt1A= Zadejte spr\u00e1vn\u00fd n\u00e1zev souboru v textov\u00e9m pol\u00ed\u010dku nebo -UrlErrorPrompt1B= p\u0159et\u00e1hn\u011bte obr\u00e1zek z adres\u00e1\u0159e n\u00ed\u017ee do textov\u00e9ho pol\u00ed\u010dka. +UrlErrorPrompt1B= p\u0159et\u00e1hn\u011bte obr\u00e1zek z adres\u00e1\u0159e n\u00ed\u017ee uveden\u00e9ho do textov\u00e9ho pol\u00ed\u010dka. UrlErrorPrompt2 = Stiskn\u011bte [{0}] pro pou\u017eit\u00ed jm\u00e9na souboru v textov\u00e9m pol\u00ed\u010dku pro obr\u00e1zek. UrlErrorPrompt3 = Stiskn\u011bte [{0}] pro vyjmut\u00ed obr\u00e1zku kdy\u017e je panel ulo\u017een. UrlErrorPrompt3A= Ulo\u017een\u00ed panelu ud\u011bl\u00e1 zm\u011bny trval\u00e9. @@ -236,7 +236,7 @@ RPSreporter = RPS Reporter Background = Pozad\u00ed Icon = Obr\u00e1zek #MultiSensor = V\u00edcen\u00e1sobn\u00fd sn\u00edma\u010d -Spinner = Spinner +Spinner = \u010c\u00edseln\u00edk #InputBox = Vstupn\u00ed pol\u00ed\u010dko Text = Text/\u0160t\u00edtek BlockLabel = \u0160t\u00edtek obsahu \u00faseku @@ -245,8 +245,8 @@ AddItem = P\u0159idat {0} EditItem = Upravit {0} obr\u00e1zek... addItemToPanel = P\u0159idat {0} do panelu, editItemInPanel = Upravit {0} v panelu, -TableSelect = Vybrat {0} z tabulky, potom stisknout {1} -IconSelect = Vybrat {0} obr\u00e1zek, potom stisknout {1} +TableSelect = Vybrat {0} z tabulky, potom stisknout [{1}] +IconSelect = Vybrat {0} obr\u00e1zek, potom stisknout [{1}] #addIconToPanel= To add this Icon to the Panel, #addMemValueToPanel= To add a Memory value to the Panel, #addReportValueToPanel= To add a Reporter value to the Panel, @@ -257,8 +257,8 @@ IconSelect = Vybrat {0} obr\u00e1zek, potom stisknout {1} # Fixed Size Edit SetFixedWidth = Nastavit pevnou \u0161\u00ed\u0159ku StateColors = Stav barev -SetFixedSize = Nastavit pevnou velikost -SetMarginSize = Nastavit velikost okraje +SetFixedSize = Nastavit pevnou velikost {0} +SetMarginSize = Nastavit velikost okraje {0} ChangeToText = Zm\u011bnit na text ChangeToIcon = Zm\u011bnit na obr\u00e1zek @@ -266,8 +266,8 @@ FixedSizeHeight = Nastavit pevnou v\u00fd\u0161ku pro textov\u00e9 pole FixedSizeWidth = Nastavit pevnou \u0161\u00ed\u0159ku pro textov\u00e9 pole # Border Width Menu -SetBorderSize = Nastavit velikost okraje -BorderColorMenu = Barva okraje +SetBorderSize = Nastavit velikost hrany {0} +BorderColorMenu = Barva hrany # Titles of Icon Editor Frames #IconEditor = Add Icon (plain) @@ -279,8 +279,8 @@ EditSl = Upravit k\u0159i\u017eovatkovou v\u00fdhybku EditMemoryValue = Upravit hodnotu v pam\u011bti EditBlockValue = Upravit hodnotu \u00faseku EditCurrentBlockValue = Upravit hodnotu aktu\u00e1ln\u00edho \u00faseku -SelectMultiSensor=P\u0159at\u00e1hnout sn\u00edma\u010d z tabulky do \u010derven\u00fdch pol\u00ed\u010dek, potom stisknout [{0}] -AddSpinner = P\u0159idat Spinner +SelectMultiSensor = P\u0159at\u00e1hnout sn\u00edma\u010d z tabulky do \u010derven\u00fdch pol\u00ed\u010dek, potom stisknout [{0}] +AddSpinner = P\u0159idat \u010d\u00edseln\u00edk AddInputBox = P\u0159idat vstupn\u00ed pol\u00ed\u010dko NumColsLabel = \u0160\u00ed\u0159ka sloupce @@ -396,8 +396,8 @@ SignalMastIconLoadError2 = Nemohu nahr\u00e1t obr\u00e1zek {0}\n {1} \npro n\u0 SignalMastIconLoadErrorTitle = Chyba obr\u00e1zku SignalMastLogic = Logika n\u00e1v\u011bstidel -DragOccupancyName = P\u0159et\u00e1hn\u011bte n\u00e1zev za\u0159\u00edzen\u00ed (OBlock nebo sn\u00edma\u010d) do pole detektoru obsazen\u00ed. -DragErrorName = P\u0159et\u00e1hn\u011bte n\u00e1zev sn\u00edma\u010de pro zobrazen\u00ed chybov\u00e9 podm\u00ednky na pole sn\u00edma\u010d chyby. +DragOccupancyName = P\u0159et\u00e1hn\u011bte n\u00e1zev za\u0159\u00edzen\u00ed (blok obsazen\u00ed nebo sn\u00edma\u010d) do pole {0}. +DragErrorName = P\u0159et\u00e1hn\u011bte n\u00e1zev sn\u00edma\u010de pro zobrazen\u00ed chybov\u00e9 podm\u00ednky do pole {0}. ClosePicklist = Uzav\u0159\u00edt v\u00fdb\u011brov\u00fd seznam noRowSelected = Vyberte \u0159\u00e1dek v tabulce ktar\u00fd poskytuje za\u0159\u00edzen\u00ed pro tento obr\u00e1zek. @@ -412,11 +412,82 @@ TransitErrorTitle = Chyba vytv\u00e1\u0159en\u00ed tranzitu TransitCreatedTitle = Tranzit vytvo\u0159en TransitCreatedMessage = Trantit {0} vytvo\u0159en \u00fasp\u011b\u0161n\u011b MenuTerminateTrain = Ukon\u010dit vlak -MenuAllocateExtra = P\u0159id\u011bli dodate\u010dn\u00fd odd\u00edl +MenuAllocateExtra = P\u0159id\u011blit dodate\u010dn\u00fd odd\u00edl MenuNewTrain = Vytvo\u0159it nov\u00fd vlak MenuRestartTrain = Restartovat VetoFoundInPanel = Nalezen {0} kr\u00e1t jako obr\u00e1zek VetoInUseEditorHeader = Je pou\u017eit v Editor panelu {0} VetoReferencesWillBeRemoved = Tyto polo\u017eky a odkazy budou odstran\u011bny. -borderColor=Barva okraje +ChoiceText5=Klikn\u011bte 'Editor \u0159adi\u010d\u016f' pro ovl\u00e1dac\u00ed panel +PanelDefaultName=Panel {0} +SwitchboardEditor=Editor \u0159adi\u010d\u016f +FontSize=Velikost p\u00edsma +Bold/italic=Tu\u010dn\u00e9/kurz\u00edva +SetBackgroundColor=Nastavit barvu pozad\u00ed +DefaultTextColor=Nastavit v\u00fdchoz\u00ed barvu textu +Level=Vrstva +Border=Hrana +Margin=Okraj +ToolTipGenericMac=Kl\u00e1vesou Control + klikem my\u0161i zobrazit menu, kl\u00e1vesou Command + tla\u010d\u00edtkem my\u0161i p\u0159et\u00e1hnout. +ToolTipGenericWin=Prav\u00fdm tla\u010d\u00edtkem my\u0161i zobrazit menu, prav\u00fdm tla\u010d\u00edtkem my\u0161i p\u0159et\u00e1hnout. +TextLabel=Text \u0161t\u00edtku +TextDecoLabel=Dekorace textu +TextBorderLabel=Hodnoty +TextExampleLabel=Vzor +TooltipEnterText=Zadejte text pro zobrazen\u00ed +TooltipLabel=Text popisku +FontTabTitle=P\u00edsmo +FontTabTooltip=Velikost p\u00edsma a dekorace +BorderTabTooltip=Nastaven\u00ed hrahy a okraje +EditTabTooltip=Upravit obsah textu +width=\u0160\u00ed\u0159ka +height=V\u00fd\u0161ka +SizeTabTooltip=Nastavit velikost a um\u00edst\u011bn\u00ed +SizeTabTitle=Velikost a um\u00edst\u011bn\u00ed +warningNullText=S pr\u00e1zdn\u00fdm textem polo\u017eka zmiz\u00ed! +RightCrossOver=Kolejov\u00e1 spojka prav\u00e1 +LeftCrossOver=Kolejov\u00e1 spojka lev\u00e1 +borderColor=Barva hrany +borderSize=Velikost hrany +marginSize=Velikost okraje +EditTrackSegment=Upravt \u010d\u00e1st trati +Line=P\u0159\u00edmka +Circle=Kru\u017enice +Ellipse=Elipsa +Bezier=Bezier +SwitchboardDefaultName=\u0158adi\u010de v\u00fdhybek {0} +MenuPanelsMnemonic=P +MenuEditMnemonic=E +MenuFileMnemonic=F +MenuToolsMnemonic=T +SwitchboardBanner=Kliknut\u00edm p\u0159epnete stav +SwitchboardHelpTitle=N\u00e1pov\u011bda +Help1=Panel \u0159adi\u010d\u016f se vypln\u00ed automaticky.\nKlikn\u011bte pro nastaven\u00ed v\u00fdhybky atd.\nPou\u017eijte m\u00edstn\u00ed nab\u00eddku pro nastaven\u00ed podrobnost\u00ed. +Help2=Za\u0161edl\u00e1 tla\u010d\u00edtka nejsou p\u0159ipojena ke sch\u00e9matu koleji\u0161t\u011b. +EditTitleMessageTitle=Upravit n\u00e1zev \u0159adi\u010de +CheckBoxHideUnconnected=Aktualizovat nep\u0159ipojen\u00e9 p\u0159ep\u00edna\u010de +Buttons=Tla\u010d\u00edtko +Sliders=Posuvn\u00edk +Keys=P\u0159ep\u00edna\u010d +Symbols=Symbol +SelectRangeTitle=Vyberte rozsah adres pro zobrazen\u00ed +ButtonUpdate=Aktualizovat \u0159adi\u010d +SwitchShape=P\u0159epnout tvar +BeanTypeLabel=Bean typu +ConnectionLabel=P\u0159ipojen\u00ed +NumberOfColumns=P\u0159ep\u00edna\u010d\u016f na \u0159\u00e1dek: +From=Z +UpTo=a\u017e do +PreviousToolTip=P\u0159edch\u00e1zej\u00edc\u00ed rozsah +NextToolTip=N\u00e1sleduj\u00edc\u00ed rozsah +ColorIdenticalWarning=Barva textu by odpov\u00eddala barv\u011b pozad\u00ed,\nvytv\u00e1\u0159en\u00ed \u0161t\u00edtk\u016f bude ne\u010diteln\u00e9. Pokra\u010dovat? +ConnectNewMenu=P\u0159ipojit k nov\u00e9 polo\u017ece {0} +ErrorSwitchAddFailed=Nemohu p\u0159ipojit k nov\u00e9 polo\u017ece +EnterNewName=Zadejte nov\u00fd u\u017eivatelsk\u00fd n\u00e1zev pro "{0}": +EditNameTitle=Upravit u\u017eivatelsk\u00fd n\u00e1zev {0} +NoUserName=nen\u00ed u\u017eivatelsk\u00fd n\u00e1zev +MenuInvertItem=Obr\u00e1tit {0} +TextValueLabel=Text pro zobrazen\u00ed +EditTextLabel=Obsah +DetectionSensor=Sn\u00edma\u010d detekce diff --git a/java/src/jmri/jmrit/display/DisplayBundle_fr.properties b/java/src/jmri/jmrit/display/DisplayBundle_fr.properties index e701d6560c5..bde87f0d1fa 100644 --- a/java/src/jmri/jmrit/display/DisplayBundle_fr.properties +++ b/java/src/jmri/jmrit/display/DisplayBundle_fr.properties @@ -184,7 +184,7 @@ EnterLink = Entrer Lien PromptNewName = Entrer un nouveau nom: -CheckBoxGlobalFlags = remplacer Position individuelle et Commande D\u00e9finie +CheckBoxGlobalFlags = Remplacer Position individuelle et Commande D\u00e9finie CheckBoxEditable = \u00c9l\u00e9ments des menus contextuels du Panneau actif CheckBoxPositionable = Tous les \u00e9l\u00e9ments du panneau peuvent \u00eatre repositionn\u00e9s CheckBoxHidden = Montrer Tous les objets cach\u00e9s @@ -200,7 +200,7 @@ ScrollHorizontal = L'Horizontale seulement ScrollVertical = La Verticale seulement TitleChangeIcon = Changer d'ic\u00f4ne -LabelEditor = \u00c8diteur +LabelEditor = \u00c9diteur findIconMenu=Trouver des Ic\u00f4nes editIndexMenu=Cr\u00e9er/modifier des Image ... openDirMenu=Ouvrir un r\u00e9pertoire de Fichiers Syst\u00e8me ... diff --git a/java/src/jmri/jmrit/display/controlPanelEditor/ControlPanelBundle_cs.properties b/java/src/jmri/jmrit/display/controlPanelEditor/ControlPanelBundle_cs.properties new file mode 100644 index 00000000000..23bd98e37ea --- /dev/null +++ b/java/src/jmri/jmrit/display/controlPanelEditor/ControlPanelBundle_cs.properties @@ -0,0 +1,216 @@ +# ControlPanelBundle_cs.properties +# +# Czech properties for the jmrit.display.controlPanel package +# Translation: Petr Sidlo + +#Title = Control Panel Editor (not used) +AboutWarrant = O povolen\u00edch +AboutOBlock = O bloc\u00edch obsazen\u00ed a br\u00e1n\u00e1ch +OpenCircuitMenu = Otev\u0159\u00edt stavitele obvod\u016f + +#CircuitBuilder menu items +CircuitBuilder = Stavitel obvod\u016f +newCircuitItem = P\u0159idat obvod detektoru +editCircuitItem = Upravit obvod bloku obsazen\u00ed +OpenCircuitItem = Uravit "{0}" kolej +OpenPortalTitle = Upravit "{0}" br\u00e1nu +OpenDirectionTitle= Upravit "{0}" sm\u011brov\u00e9 \u0161ipky br\u00e1ny +OpenPortalTitle2= P\u0159idat/upravit br\u00e1nu mezi "{0}" a "{1}" +OpenPathTitle = P\u0159idat/upravit "{0}" cesty +noCircuitsItem = Nen\u00ed definov\u00e1n obvod detektoru +editCircuitPathsItem= P\u0159idat/upravit obvod cest +editPortalsItem = P\u0159idat/upravit obvod br\u00e1ny +editDirectionItem = Upravit sm\u011brov\u00e9 ikony br\u00e1ny +circuitErrorsItem= Kontroly chyb +blockNeedsIconsItem = Obvody bez ikon +iconsNeedConversionItem = Zv\u00fdrazn\u011bte ikony obvod\u016f kolej\u00ed, kter\u00e9 pot\u0159ebuj\u00ed zm\u011bnit +iconsNeedsBlocksItem = Zv\u00fdrazn\u011bte indik\u00e1tor koleje bez obvod\u016f +blocksNeedConversionItem = Obvody jejich\u017e ikony pot\u0159ebuj\u00ed zm\u011bnit +portalsMisplaced = Br\u00e1ny bez ikon nebo chybn\u00fdch ikon +portalsInPlace = Ikona br\u00e1ny je um\u00edst\u011bna spr\u00e1vn\u011b +CheckPortalPaths = Zkontrolujte chyby bran blok\u016f a cest +noTrackCircuits = Nen\u00ed definov\u00e1n \u017e\u00e1dn\u00fd obvod koleje (blok obsazen\u00ed) +circuitsHaveIcons = V\u0161echny obvody (bloky obsazen\u00ed) jsou zastoupeny ikonou +IconsHaveCircuits = Ka\u017ed\u00e1 ikona indik\u00e1toru koleje pat\u0159\u00ed do obvodu koleje +circuitIconsConverted = V\u0161echny obvody (bloky obsazen\u00ed) jsou zastoupeny ikonou indik\u00e1toru koleje +ArrowIconsTitle = Ikona vjezd + +SelectType = Vybrat typ +SelectLevel = Vybrat vrstvu +selectLevel = Vrstva {0} polo\u017eky +MemoryInput = Vstup pam\u011bti +Shape = Tvar + +#ShapeDrawer menu items +drawShapes = Kreslit tvary +drawSth = Kreslit {0}... +#drawRectangle = etc. replaced by drawSth{}... +lineWidth = Tlou\u0161\u0165ka \u010d\u00e1ry +thin = Tenk\u00e1 +thick = Tlust\u00e1 +lineColor = Barva \u010d\u00e1ry +fillColor = Barva v\u00fdpln\u011b +transparency = Barva pr\u016fhlednosti +transparent = Pr\u016fhledn\u00fd +opaque = Nepr\u016fhledn\u00fd +cornerRadius = Polom\u011br rohu +circleRadius = Pr\u016fm\u011br kruhu +editShape = Upravit {0} tvar... +newShape = Nov\u00fd {0} tvar +Polygon = Mnoho\u00faheln\u00edk +Rectangle = Obd\u00e9ln\u00edk +roundRect = Zaoblen\u00fd obd\u00e9ln\u00edk +disableShapeSelect= Zak\u00e1zat vybran\u00e9 tvary + +drawInstructions1 = Nastavte atributy pro tvar. Potom vytvo\u0159te +drawInstructions2 = "v\u00fdb\u011brov\u00fd obd\u00e9ln\u00edk" pro v\u00fdb\u011br tvaru. +drawInstructions2a = Klik\u00e1n\u00edm my\u0161i vytvo\u0159\u00edte vrcholy mnoho\u00faheln\u00edku. +drawInstructions2b = Dvojklikem na vrchol dokon\u010d\u00edte mnoho\u00faheln\u00edk. +drawInstructions3a = (Voliteln\u00e9) Pokud chcete \u0159\u00eddit viditelnost tvaru +drawInstructions3b = zadejte n\u00e1zev sn\u00edma\u010de do pole [{0}] dole. +VisibleSensor = Viditelnost nebo \u0159\u00edzen\u00ed vrstvy +SensorMsg = Aktivn\u00ed sn\u00edma\u010d m\u016f\u017ee bu\u010f skr\u00fdt tvar nebo zm\u011bnit vrstvu jeho zobrazen\u00ed +HideOnSensor = Skr\u00fdt tvar +ChangeLevel = Zm\u011bnit vrstvu +SameLevel = Stejn\u00e1 vrstva + +TitleCircuitDialog = Nov\u00fd obvod koleje (blok obsazen\u00ed) +ButtonAddCircuit = P\u0159idat obvod bloku obsazen\u00ed +ButtonOpenCircuit = Uk\u00e1zat blok obsazen\u00ed +ButtonConvertIcon= P\u0159ev\u00e9st ikony +ButtonDelete = Vymazat obvod bloku obsazen\u00ed +buttonAddPath = Ulo\u017eit cestu +buttonDeletePath= Vymazat cestu +buttonClearSelection = Uvolnit v\u00fdb\u011br +buttonChangeName = Zm\u011bnit n\u00e1zev +buttonDeletePortal= Vymazat br\u00e1nu +ButtonNextCircuit = Dal\u0161\u00ed obvod +OpenSensorPicklist= Otev\u0159\u00edt v\u00fdb\u011brov\u00fd seznam sn\u00edma\u010d\u016f + +#labels +createOBlock = Vytvo\u0159it kolejov\u00fd obvod bloku obsazen\u00ed +sysnameOBlock = Syst\u00e9mov\u00fd n\u00e1zev bloku obsazen\u00ed mus\u00ed za\u010d\u00ednat na "OB" +selectOBlock = Vyberte blok obsazen\u00ed kolejov\u00e9ho obvodu: +numTrackElements= Po\u010det ikon kolej\u00ed v obvodu: +Segments = Segmenty +ErrorSensor = Chybov\u00fd sn\u00edma\u010d +#ErrorSensorMsg = Error Sensor: +ErrorPortal = Chyba br\u00e1ny +blockState = Stav obvodu (bloku obsazen\u00ed): +AddRemoveIcons = Vyberte (nebo zru\u0161te v\u00fdb\u011br) v\u0161ech ikon kolej\u00ed kter\u00e9 zobrazuj\u00ed tento kolejov\u00fd obvod bloku obsazen\u00ed +blockName = N\u00e1zev obvodu: +portalName = N\u00e1zev br\u00e1ny +makePortal = Vytvo\u0159it br\u00e1nu +PortalTitle = Br\u00e1na do a mimo obvod obvod {0} +selectPortal = Pro vytvo\u0159en\u00ed ikony pro br\u00e1ny v seznamu, vyberte jej ze seznamu, +dragIcon = potom p\u0159et\u00e1hn\u011bte vybranou ikonu do polohy mezi mezi obvody na panelu. +portalIconPosition=Ikona br\u00e1ny se mus\u00ed dot\u00fdkat obou blok\u016f br\u00e1ny. +placeIconOnGap = P\u0159et\u00e1hn\u011bte zv\u00fdrazn\u011bnou ikonu na m\u00edsto, kter\u00e9 p\u0159eklene dva zv\u00fdrazn\u011bn\u00e9 obvody blok\u016f. +enterNameToDrag = Pro vytvo\u0159en\u00ed nov\u00e9 br\u00e1ny zadejte text do pole N\u00e1zev br\u00e1ny, +dragNewIcon = potom p\u0159et\u00e1hn\u011bte vybranou ikonu na panel a vytvo\u0159te br\u00e1nu a jeho ikonu. +PathTitle = Cesta p\u0159es kolejov\u00fd obvod {0} +pathName = N\u00e1zev cesty +enterNewPath = Pro vytvo\u0159en\u00ed nov\u00e9 cesty zadejte text do pole N\u00e1zev cesty +selectPathIcons = potom vyberte ikony koleje a br\u00e1ny kter\u00e9 zobrazuj\u00ed cestu. +pressAddButton = potom stikn\u011bte tla\u010d\u00edtko {0}. +selectPath = Pro \u00fapravu cesty v seznamu, vyberte ji ze seznamu +editPathIcons = potom vyberte nebo zru\u0161te v\u00fdb\u011br ikony br\u00e1ny a koleje. +throwPathTO = Pro z\u00edsk\u00e1n\u00ed spr\u00e1vn\u00e9 polohy v\u00fdhybky na cest\u011b +holdShiftDown = stiskn\u011bte kl\u00e1vesu Shift a klikn\u011bte na v\u00fdhybku. +makePath = Vytvo\u0159it cestu +#DragOccupancyName = Drag name of Sensor that can detect occupancy to the {0} field. +editCiruit = Upravit obvod +PortalDirection1= Nastavit ikony kter\u00e9 indikuj\u00ed vstup do bloku "{0}". +PortalDirection2= Ikona ukazuje sm\u011br pohybu +PortalDirection3= kdy je p\u0159id\u011bleno a nastaveno povolen\u00ed. +PortalDirection4= Vyberte br\u00e1nu a zobrazte jej\u00ed sm\u011br vstupu do bloku. + + +PortalDirection5= Vyberte po\u017eadovanou ikonu n\u00ed\u017ee uvedenou a zm\u011b\u0148te ikonu sm\u011bru. +noIcon = \u017d\u00e1dn\u00e1 ikona +parallelPortal = Ob\u011b br\u00e1ny {0} a {1} jsou mezi {2} a {3}.\nPokud to nen\u00ed spr\u00e1vn\u011b vyma\u017ete jednu z nich. +NoSensorManager = Pro tento protokol nen\u00ed \u017e\u00e1dn\u00fd mana\u017eer sn\u00edma\u010d\u016f, tvar nem\u016f\u017ee z\u00edskat \u017e\u00e1dn\u00fd sn\u00edma\u010d. + +detectorSensorName = Zadejte n\u00e1zev sn\u00edma\u010de kter\u00fd detekuje obsazenost pro tento kolejov\u00fd obvod +detectorErrorName = Zadejte n\u00e1zev sn\u00edma\u010de kter\u00fd indikuje probl\u00e9my s nap\u00e1jen\u00edm pro tento kolejov\u00fd obvod + +selectAdjacentCircuit = Vyberte sousedn\u00ed kolejov\u00fd obvod k "{0}" abyste vytvo\u0159ili br\u00e1nu mezi nimi. + +ToolTipConvertIcon = P\u0159eveden\u00ed ikon obvod\u016f na ikonu indik\u00e1tor koleje (m\u016f\u017ee b\u00fdt pot\u0159eba p\u0159esm\u011brov\u00e1n\u00ed nebo p\u0159em\u00edst\u011bn\u00ed) +ToolTipDeleteCircuit= Odstra\u0148te tento kolejov\u00fd obvod, ale ponechte jeho ikony, pokud existuj\u00ed. +TooltipBlockName = Zadejte n\u00e1zev pro zm\u011bnu u\u017eivatelsk\u00e9ho jm\u00e9na objektu bloku obsazen\u00ed pro tento obvod. +TooltipBlockLength = Zadejte d\u00e9lku pro cesty v tomto objektu bloku obsazen\u00ed. +TooltipPathLength = Zadejte d\u00e9lku pro v\u00fd\u0161e uvedenou cestu. +TooltipPathUnitButton = Kliknut\u00edm p\u0159epnete jednotku d\u00e9lky mezi metrick\u00fdm a imperi\u00e1ln\u00edm. +ToolTipAddPath = Zadejte n\u00e1zev a vyberte ikony, kter\u00e9 zobrazuj\u00ed \ nkolej a br\u00e1ny cesty. Pot\u00e9 stiskn\u011bte toto tla\u010d\u00edtko. +ToolTipDeletePath = Smaz\u00e1n\u00ed cesty vybran\u00e9 v seznamu z kolejov\u00e9ho obvodu. +#ToolTipEditPath = Select a path from the list to display it. Then add or delete the icons of the path. +ToolTipClearList = Vymazat v\u00fdb\u011br v seznamu. +TooltipPathName = Zadejte n\u00e1zev cesty pomoc\u00ed tohoto kolejov\u00e9ho obvodu. +TooltipPortalName = Zadejte n\u00e1zev pro vytvo\u0159en\u00ed nov\u00e9 br\u00e1ny pro blok obsazen\u00ed "{0}". +ToolTipChangeName = Zadejte jin\u00fd n\u00e1zev pro zm\u011bnu n\u00e1zvu v\u00fdb\u011bru ve v\u00fd\u0161e uveden\u00e9m seznamu. +ToolTipDeletePortal= Odstranit vybranou br\u00e1nu a jej\u00ed ikonu. +ToolTipPickLists = Tabulka seznamu v\u00fdb\u011bru zobrazuje v\u00fdb\u011br sn\u00edma\u010d\u016f pro detekci. + +# error/warning messages +NeedDataTitle = Zadejte pros\u00edm data +#enterOBlockName +AskTitle = Co ud\u011bl\u00e1me? +blockExists = Obvod "{0}" nebo "{1}" ji\u017e existuje. Chcete jej upravit? +AlreadyEditing = Prob\u00edh\u00e1 \u00faprava obvodu detekce. Pros\u00edm dokon\u010dete ji p\u0159ed zah\u00e1jen\u00edm nov\u00e9 \u00fapravy. +whichCircuit = Kter\u00fd kolejov\u00fd obvod pro ikonu? +iconBlockConflict = Tato ikona zobrazuje kolejov\u00fd obvod "{0}". Chcete jej zm\u011bnit na zobrazen\u00ed obvodu "{1}"? +incompleteCircuit = Ne\u00fapln\u00fd kolejov\u00fd obvod +notIndicatorIcon = Ne v\u0161echny ikony koleje jsou ikony indik\u00e1tor\u016f. Chcete je p\u0159ev\u00e9st? +noSensor = \u017d\u00e1dn\u00fd detek\u010dn\u00ed sn\u00edma\u010d +noDetecterSensor = Nen\u00ed zad\u00e1n \u017e\u00e1dn\u00fd detek\u010dn\u00ed sn\u00edma\u010d. Bude to blok bez detekce a nem\u016f\u017ee b\u00fdt zahrnut do z\u00e1v\u011bru j\u00edzdn\u00ed cesty. +badSensorName = "{0}" nen\u00ed platn\u00fd n\u00e1zev sn\u00edma\u010de. +mixedSensors = Nen\u00ed zad\u00e1n \u017e\u00e1dn\u00fd sn\u00edma\u010d. Chcete pou\u017e\u00edt sn\u00edma\u010d chyb pro obsazenost? +makePaths = Po\u017eadavek cesty +pathsNeedConversion = V\u0161echny ikony mus\u00ed b\u00fdt ikony indik\u00e1tor\u016f pro vytv\u00e1\u0159en\u00ed tras. P\u0159ejete si je p\u0159ev\u00e9st na ikony indik\u00e1toru? +noIcons = \u017d\u00e1dn\u00e9 ikony +needIcons = Obvod bloku "{0}" pot\u0159ebuje alespo\u0148 jednu ikonu koleje.\nPou\u017eijte nab\u00eddku "{1}" pro p\u0159id\u00e1n\u00ed ikon indik\u00e1toru koleje. +needConversion = Obvod bloku "{0}" pot\u0159ebuje p\u0159ev\u00e9st ikony koleje na ikony indik\u00e1toru koleje.\nPou\u017eijete kontextovou nab\u00eddku "{1}" a kliknut\u00edm na [{2}] je p\u0159evedete na ikony. +iconNotOnAdjacent = Ikona br\u00e1ny "{0}" nep\u0159ipojuje obvod "{1}" k sousedn\u00edmu okruhu. +badPath = Neplatn\u00e1 cesta +iconNotInCircuit = Tato ikona nen\u00ed sou\u010d\u00e1st\u00ed kolejov\u00e9ho obvodu "{0}". +portalNotInCircuit = Tato br\u00e1na nen\u00ed sou\u010d\u00e1st\u00ed kolejov\u00e9ho obvodu "{0}". +portalNeedsBlock = Br\u00e1na "{0}" mus\u00ed m\u00edt blok obsazen\u00ed na ka\u017ed\u00e9 stran\u011b. +needPortalName = Zadejte n\u00e1zev nov\u00e9 br\u00e1ny nebo vyberte br\u00e1nu z v\u00fd\u0161e uveden\u00e9ho seznamu. +needPathName = Zadejte n\u00e1zev nov\u00e9 cesty nebo vyberte cestu z v\u00fd\u0161e uveden\u00e9ho seznamu. +iconNotOnBlock = Ikona br\u00e1ny se nep\u0159ipojuje k okruhu "{0}".\n{1}.\nP\u0159esunout na p\u0159ipojen\u00ed blok\u016f nebo zvolit jinou ikonu. +repositionPortal= Chcete zm\u011bnit p\u0159ipojen\u00ed br\u00e1ny "{0}" mezi obvody "{1}" a "{2}"? +portalIconExists= Br\u00e1na "{0}" je definov\u00e1na. Viz zv\u00fdrazn\u011bn\u00e1 ikona. +portalExists = Br\u00e1na s n\u00e1zvem "{0}" ji\u017e existuje mezi bloky obsazen\u00ed "{1}" a "{2}". +changeBlockName = Zadejte u\u017eivatelsk\u00e9 jm\u00e9no obvodu bloku obsazen\u00ed. +changePortalName= Zvolte br\u00e1nu z v\u00fd\u0161e uveden\u00e9ho seznamu. Zadejte zm\u011bnu n\u00e1zvu a stiskn\u011bte "{0}". +changePathName = Vyberte cestu z v\u00fd\u0161e uveden\u00e9ho seznamu. Zadejte zm\u011bnu n\u00e1zvu a stiskn\u011bte "{0}". +confirmBlockDelete = Opravdu chcete smazat obvod a v\u0161echny jeho cesty a v\u0161echny jeho br\u00e1ny? +confirmPortalDelete = Vymazat br\u00e1nu "{0}" a jeho ikonu? +duplicatePathName = Cesta "{0}" je n\u00e1zev jin\u00e9 cesty v obvodu {1}. +noSuchPortal = Nen\u00ed \u017e\u00e1dn\u00e1 br\u00e1na s n\u00e1zvem "{0}". +portalHasIcon = Br\u00e1na "{0}" m\u00e1 ikonu. Ta je nyn\u00ed zv\u00fdrazn\u011bna. +invalidPortal = Br\u00e1na "{0}" je p\u0159ipojena k bloku obsazen\u00ed "{1}" je neplatn\u00e1 - pouze jeden blok. +noPathIcons = Pro zobrazen\u00ed cesty v obvodu mus\u00ed b\u00fdt vybr\u00e1na alespo\u0148 jedna ikona koleje. +turnoutNotSet = V\u00fdhybka "{0}" mus\u00ed b\u00fdt nastavena na "P\u0159\u00edmo" nebo "Do odbo\u010dky". +tooManyPortals = Cesta nesm\u00ed m\u00edt v\u00edce ne\u017e dv\u011b ikony bran. +tooFewPortals = Cesta mus\u00ed m\u00edt alespo\u0148 jednu br\u00e1nu. +balloonTrack = Je cesta "{0}" kolejov\u00e1 smy\u010dka?\n({1} je vstupn\u00ed i v\u00fdstupn\u00ed br\u00e1na) +sensorFail = Pro "{0}" selhal sn\u00edma\u010d kv\u016fli {1}. +noPortalIcon = Br\u00e1na "{0}" nem\u00e1 ikonu. Chcete p\u0159idat ikonu br\u00e1ny? +portalIconMisplaced = Ikona br\u00e1ny "{0}" je um\u00edst\u011bna nespr\u00e1vn\u011b nebo\np\u0159\u00edslu\u0161n\u00fd obvod m\u00e1 nekonvertovan\u00e9 ikony. +blocksEtcOK = Aktu\u00e1ln\u011b definovan\u00e9 bloky, br\u00e1ny a cesty jsou konzistentn\u00ed a bez chyb. +cantSaveIcon = Pozn\u00e1mka: Informace o ikon\u00e1ch obvodu pro nezm\u011bn\u011bn\u00e9 ikony nelze ulo\u017eit. +replacePortalBlock = Nahradit p\u0159ipojen\u00ed br\u00e1ny {0} na {1} s {0} na {2}?\nPokud bude akce provedena, cesty {0} na {1} nyn\u00ed p\u0159ejdou na {2}. +savePath = Chcete ulo\u017eit cestu "{0}"? +changePath = Cesta "{0}" byla zm\u011bn\u011bna. Chcete prov\u00e9st tuto zm\u011bnu? +samePath = Cesta je stejn\u00e1 jako cesta "{0}".\nChcete zm\u011bnit jm\u00e9no na "{1}"? +noPortalIcons = Cesta m\u00e1 br\u00e1ny, ale \u017e\u00e1dn\u00e9 ikony bran nejsou definov\u00e1ny. +samePathName = Cesta "{0}" je ji\u017e definov\u00e1na. Vyberte jin\u00e9 jm\u00e9no. +hasPathErrors = Obvod bloku m\u00e1 ne\u00faplnou definici cesty. Chcete skon\u010dit? +noPaths = Obvod bloku "{0}" nem\u00e1 \u017e\u00e1dn\u00e9 cesty. +waitForPalette = Po\u010dkejte, a\u017e se na\u010dte Paleta polo\u017eky... +multipleBlockSelections= Zvolte blok zv\u00fdrazn\u011bn\u00e1 br\u00e1na by se m\u011bla p\u0159ipojit k "{0}". +multipleSelections = Ikony jsou naskl\u00e1d\u00e1ny nad sebou.\nVyberte jednu kterou chcete. +multipleBlocks = Pro br\u00e1nu {0} zvolte blok kter\u00fd s n\u00ed soused\u00ed. +MustBeFloat = {0} je neplatn\u00e9 \u010d\u00edslo. Mus\u00ed to b\u00fdt kladn\u00e9 desetinn\u00e9 \u010d\u00edslo. diff --git a/java/src/jmri/jmrit/display/layoutEditor/BlockValueFile.java b/java/src/jmri/jmrit/display/layoutEditor/BlockValueFile.java index c0d15ef397c..8a2e11401bd 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/BlockValueFile.java +++ b/java/src/jmri/jmrit/display/layoutEditor/BlockValueFile.java @@ -27,6 +27,7 @@ * manipulates files conforming to the block_value DTD. * * @author Dave Duchamp Copyright (C) 2008 + * @author George Warner Copyright (C) 2017 */ public class BlockValueFile extends XmlFile { @@ -48,7 +49,7 @@ public BlockValueFile() { * Reads Block values from a file in the user's preferences directory. * If the file containing block values does not exist this routine returns quietly. * If a Block named in the file does not exist currently, that entry is quietly ignored. - * + * * @throws JDOMException on rootFromName if all methods fail * @throws IOException if an I/O error occurs while reading a file */ @@ -58,7 +59,7 @@ public void readBlockValues() throws JDOMException, IOException { List blocks = blockManager.getSystemNameList(); // check if file exists if (checkFile(defaultFileName)) { - // file is present, + // file is present, root = rootFromName(defaultFileName); if ((root != null) && (blocks.size() > 0)) { // there is a file and there are Blocks defined @@ -112,8 +113,8 @@ public void readBlockValues() throws JDOMException, IOException { * Writes out block values to a file in the user's preferences directory * If there are no defined Blocks, no file is written. * If none of the defined Blocks have values, no file is written. - * - * @throws IOException + * + * @throws IOException */ public void writeBlockValues() throws IOException { log.debug("entered writeBlockValues"); diff --git a/java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.java b/java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.java index 49218cfade9..bda04d46e63 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.java +++ b/java/src/jmri/jmrit/display/layoutEditor/ConnectivityUtil.java @@ -43,6 +43,7 @@ * method. *

                * @author Dave Duchamp Copyright (c) 2009 + * @author George Warner Copyright (C) 2017 */ public class ConnectivityUtil { diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java index 5e0457914e3..c99da849b65 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutBlock.java @@ -93,6 +93,7 @@ * configuration is saved. *

                * @author Dave Duchamp Copyright (c) 2004-2008 + * @author George Warner Copyright (C) 2017 */ public class LayoutBlock extends AbstractNamedBean implements PropertyChangeListener { diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockConnectivityTools.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockConnectivityTools.java index ad359438b76..1dfaec1c4fa 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockConnectivityTools.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockConnectivityTools.java @@ -21,6 +21,7 @@ * layout blocks is usable and free. * * @author Kevin Dickerson Copyright (C) 2011 + * @author George Warner Copyright (C) 2017 */ public class LayoutBlockConnectivityTools { diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.java index 8ea5c018e91..db9001aef8f 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutBlockManager.java @@ -31,6 +31,7 @@ * the user for the most part. * * @author Dave Duchamp Copyright (C) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutBlockManager extends AbstractManager implements jmri.InstanceManagerAutoDefault { diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutConnectivity.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutConnectivity.java index f4f7b8e6395..cdfad88f4b4 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutConnectivity.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutConnectivity.java @@ -42,6 +42,7 @@ * LayoutEditor panels. *

                * @author Dave Duchamp Copyright (c) 2007-2008 + * @author George Warner Copyright (C) 2017 */ public class LayoutConnectivity { diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java index e61715ff32e..e363877d5da 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java @@ -13,7 +13,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.GraphicsEnvironment; import java.awt.MouseInfo; import java.awt.Point; import java.awt.PointerInfo; @@ -71,7 +70,6 @@ import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; -import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; @@ -88,8 +86,6 @@ import javax.swing.JTextField; import javax.swing.JViewport; import javax.swing.KeyStroke; -import javax.swing.ListCellRenderer; -import javax.swing.ListModel; import javax.swing.SwingUtilities; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; @@ -100,7 +96,6 @@ import javax.swing.event.PopupMenuListener; import javax.swing.filechooser.FileFilter; import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.plaf.basic.BasicComboPopup; import jmri.Block; import jmri.BlockManager; import jmri.ConfigureManager; @@ -142,14 +137,14 @@ import jmri.jmrit.display.SignalMastIcon; import jmri.jmrit.display.ToolTip; import jmri.jmrit.display.panelEditor.PanelEditor; -import jmri.jmrit.signalling.AddEntryExitPairAction; +import jmri.jmrit.entryexit.AddEntryExitPairAction; import jmri.util.ColorUtil; import jmri.util.FileChooserFilter; import jmri.util.FileUtil; import jmri.util.JmriJFrame; import jmri.util.MathUtil; import jmri.util.SystemType; -import jmri.util.swing.JmriBeanComboBox; +import jmri.util.swing.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -173,6 +168,7 @@ * as some of the control design. * * @author Dave Duchamp Copyright: (c) 2004-2007 + * @author George Warner Copyright: (c) 2017 */ @SuppressWarnings("serial") @SuppressFBWarnings(value = "SE_TRANSIENT_FIELD_NOT_RESTORED") //no Serializable support at present @@ -2087,54 +2083,20 @@ public static void setupComboBox(@Nonnull JmriBeanComboBox inComboBox, boolean i * blank */ public static void setupComboBox(@Nonnull JmriBeanComboBox inComboBox, boolean inValidateMode, boolean inEnable, boolean inFirstBlank) { + log.debug("LE setupComboBox called"); + inComboBox.setEnabled(inEnable); inComboBox.setEditable(true); inComboBox.setValidateMode(inValidateMode); inComboBox.setText(""); - log.debug("LE setupComboBox called"); - setupComboBoxMaxRows(inComboBox); + // set the max number of rows that will fit onscreen + JComboBoxUtil.setupComboBoxMaxRows(inComboBox); inComboBox.setFirstItemBlank(inFirstBlank); inComboBox.setSelectedIndex(-1); } //setupComboBox - /** - * set the maximum number of rows based on screen size - * - * @param inComboBox the combo box - */ - public static void setupComboBoxMaxRows(@Nonnull JmriBeanComboBox inComboBox) { - // find the max height of all popup items - BasicComboPopup popup = (BasicComboPopup) inComboBox.getAccessibleContext().getAccessibleChild(0); - JList list = popup.getList(); - ListModel lm = list.getModel(); - ListCellRenderer renderer = list.getCellRenderer(); - int maxItemHeight = 12; // pick some absolute minimum here - for (int i = 0; i < lm.getSize(); ++i) { - Object value = lm.getElementAt(i); - Component c = renderer.getListCellRendererComponent(list, value, i, false, false); - maxItemHeight = Math.max(maxItemHeight, c.getPreferredSize().height); - } - - int itemsPerScreen = inComboBox.getMaximumRowCount(); - // calculate the number of items that will fit on the screen - if (!GraphicsEnvironment.isHeadless()) { - // note: this line returns the maximum available size, accounting all - // taskbars etc. no matter where they are aligned: - Rectangle maxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); - itemsPerScreen = (int) maxWindowBounds.getHeight() / maxItemHeight; - } - - // calculate an even division of the number of items (min 8) - // that will fit on the screen - int c = Math.max(8, inComboBox.getItemCount()); - while (c > itemsPerScreen) { - c /= 2; // keeps this a even division of the number of items - }; - inComboBox.setMaximumRowCount(c); - } - /** * Grabs a subset of the possible KeyEvent constants and puts them into a * hash for fast lookups later. These lookups are used to enable bundles to @@ -2653,7 +2615,11 @@ public void menuCanceled(MenuEvent event) { JMenuItem turntableItem = new JMenuItem(Bundle.getMessage("AddTurntable")); optionsAddMenu.add(turntableItem); turntableItem.addActionListener((ActionEvent event) -> { - addTurntable(windowCenter()); + Point2D pt = windowCenter(); + if (selectionActive) { + pt = MathUtil.midPoint(getSelectionRect()); + } + addTurntable(pt); //note: panel resized in addTurntable setDirty(); redrawPanel(); @@ -2664,6 +2630,9 @@ public void menuCanceled(MenuEvent event) { optionsAddMenu.add(reporterItem); reporterItem.addActionListener((ActionEvent event) -> { Point2D pt = windowCenter(); + if (selectionActive) { + pt = MathUtil.midPoint(getSelectionRect()); + } enterReporter((int) pt.getX(), (int) pt.getY()); //note: panel resized in enterReporter setDirty(); @@ -2724,6 +2693,17 @@ public void menuCanceled(MenuEvent event) { JMenu trackMenu = new JMenu(Bundle.getMessage("TrackMenuTitle")); optionMenu.add(trackMenu); + // set track drawing options menu item + JMenuItem jmi = new JMenuItem(Bundle.getMessage("SetTrackDrawingOptions")); + trackMenu.add(jmi); + jmi.setToolTipText(Bundle.getMessage("SetTrackDrawingOptionsToolTip")); + jmi.addActionListener((ActionEvent event) -> { + LayoutTrackDrawingOptionsDialog ltdod + = new LayoutTrackDrawingOptionsDialog( + this, true, getLayoutTrackDrawingOptions()); + ltdod.setVisible(true); + }); + //set track width menu item JMenuItem widthItem = new JMenuItem(Bundle.getMessage("SetTrackWidth") + "..."); trackMenu.add(widthItem); @@ -2866,6 +2846,23 @@ public void menuCanceled(MenuEvent event) { return optionMenu; } //setupOptionMenu + /*============================================*\ + |* LayoutTrackDrawingOptions accessor methods *| + \*============================================*/ + private LayoutTrackDrawingOptions layoutTrackDrawingOptions = null; + + public LayoutTrackDrawingOptions getLayoutTrackDrawingOptions() { + if (layoutTrackDrawingOptions == null) { + layoutTrackDrawingOptions = new LayoutTrackDrawingOptions(getLayoutName()); + } + return layoutTrackDrawingOptions; + } + + public void setLayoutTrackDrawingOptions(LayoutTrackDrawingOptions ltdo) { + layoutTrackDrawingOptions = ltdo; + redrawPanel(); + } + private JCheckBoxMenuItem skipTurnoutCheckBoxMenuItem = null; private AddEntryExitPairAction addEntryExitPairAction = null; @@ -4925,7 +4922,7 @@ public void setScroll(int state) { */ public void addTurntable(@Nonnull Point2D pt) { //get unique name - String name = finder.uniqueName("TUR", numLayoutTurntables++); + String name = finder.uniqueName("TUR", ++numLayoutTurntables); LayoutTurntable lt = new LayoutTurntable(name, pt, this); layoutTrackList.add(lt); @@ -5209,7 +5206,6 @@ public void mousePressed(MouseEvent event) { // } // return result; //} - // this is a method to iterate over a list of lists of items // calling the predicate tester.test on each one // and return the first one that matches @@ -5228,7 +5224,6 @@ public void mousePressed(MouseEvent event) { // } // return result; //} - private boolean checkControls(boolean useRectangles) { Optional opt = layoutTrackList.stream().filter(o -> { LayoutTrack layoutTrack = (LayoutTrack) o; @@ -5312,7 +5307,7 @@ private TrackSegment checkTrackSegmentPopUps(@Nonnull Point2D loc) { // the points below and test if this location is in any of those // rectangles just create a hit rectangle for the location and // see if any of the points below are in it instead... - Rectangle2D r = trackControlCircleRectAt(loc); + Rectangle2D r = trackControlRectAt(loc); //check Track Segments, if any for (TrackSegment ts : getTrackSegments()) { @@ -5729,8 +5724,11 @@ private void showEditPopUps(MouseEvent event) { } } else if (LayoutTrack.isPopupHitType(foundPointType)) { ((LayoutTrack) foundObject).showPopup(event); + } else if ((foundPointType >= LayoutTrack.TURNOUT_A) + && (foundPointType <= LayoutTrack.TURNOUT_D)) { + // don't curently have edit popup for these } else { - log.warn("Unknown foundPointType:" + foundPointType); + log.info("Unknown foundPointType:" + foundPointType); } } else { do { @@ -5883,7 +5881,7 @@ public void actionPerformed(ActionEvent event) { popup.show((Component) p, p.getWidth() / 2 + (int) ((getZoom() - 1.0) * p.getX()), p.getHeight() / 2 + (int) ((getZoom() - 1.0) * p.getY())); - /*popup.show((Component)p, event.getX(), event.getY());*/ + /*popup.show((Component)pt, event.getX(), event.getY());*/ } //showPopUp() private long whenReleased = 0; //used to identify event that was popup trigger @@ -6907,7 +6905,7 @@ public void addAnchor() { protected PositionablePoint addAnchor(@Nonnull Point2D p) { //get unique name - String name = finder.uniqueName("A", numAnchors++); + String name = finder.uniqueName("A", ++numAnchors); //create object PositionablePoint o = new PositionablePoint(name, @@ -6925,7 +6923,7 @@ protected PositionablePoint addAnchor(@Nonnull Point2D p) { */ public void addEndBumper() { //get unique name - String name = finder.uniqueName("EB", numEndBumpers++); + String name = finder.uniqueName("EB", ++numEndBumpers); //create object PositionablePoint o = new PositionablePoint(name, @@ -6941,7 +6939,7 @@ public void addEndBumper() { */ public void addEdgeConnector() { //get unique name - String name = finder.uniqueName("EC", numEdgeConnectors++); + String name = finder.uniqueName("EC", ++numEdgeConnectors); //create object PositionablePoint o = new PositionablePoint(name, @@ -6957,7 +6955,7 @@ public void addEdgeConnector() { */ public void addTrackSegment() { //get unique name - String name = finder.uniqueName("T", numTrackSegments++); + String name = finder.uniqueName("T", ++numTrackSegments); //create object newTrack = new TrackSegment(name, (LayoutTrack) beginObject, beginPointType, @@ -6999,7 +6997,7 @@ public void addTrackSegment() { */ public void addLevelXing() { //get unique name - String name = finder.uniqueName("X", numLevelXings++); + String name = finder.uniqueName("X", ++numLevelXings); //create object LevelXing o = new LevelXing(name, currentPoint, this); @@ -7051,7 +7049,7 @@ public void addLayoutSlip(int type) { } //get unique name - String name = finder.uniqueName("SL", numLayoutSlips++); + String name = finder.uniqueName("SL", ++numLayoutSlips); //create object LayoutSlip o = new LayoutSlip(name, currentPoint, rot, this, type); @@ -7130,7 +7128,7 @@ public void addLayoutTurnout(int type) { } //get unique name - String name = finder.uniqueName("TO", numLayoutTurnouts++); + String name = finder.uniqueName("TO", ++numLayoutTurnouts); //create object LayoutTurnout o = new LayoutTurnout(name, type, currentPoint, rot, xScale, yScale, this); @@ -8619,6 +8617,9 @@ void addIcon() { public LocoIcon addLocoIcon(@Nonnull String name) { LocoIcon l = new LocoIcon(this); Point2D pt = windowCenter(); + if (selectionActive) { + pt = MathUtil.midPoint(getSelectionRect()); + } l.setLocation((int) pt.getX(), (int) pt.getY()); putLocoIcon(l, name); l.setPositionable(true); @@ -8944,6 +8945,10 @@ public double getYScale() { return yScale; } + public Color getDefaultBackgroundColor() { + return defaultBackgroundColor; + } + public String getDefaultTrackColor() { return ColorUtil.colorToColorName(defaultTrackColor); } @@ -9329,32 +9334,27 @@ private boolean highlightBlockInComboBox(@Nonnull JmriBeanComboBox inComboBox) { if (inComboBox != null) { block = (Block) inComboBox.getNamedBean(); } - result = highlightBlock(block); - return result; + return highlightBlock(block); } //highlightBlockInComboBox /** * highlight the specified block + * * @param inBlock the block * @return true if block was highlighted */ public boolean highlightBlock(@Nullable Block inBlock) { boolean result = false; //assume failure (pessimist!) - LayoutBlockManager lbm = InstanceManager.getDefault(LayoutBlockManager.class); - - Manager m = blockIDComboBox.getManager(); - List l = m.getNamedBeanList(); + blockIDComboBox.setSelectedBean(inBlock); + LayoutBlockManager lbm = InstanceManager.getDefault(LayoutBlockManager.class); + List l = blockIDComboBox.getManager().getNamedBeanList(); for (NamedBean nb : l) { Block b = (Block) nb; LayoutBlock lb = lbm.getLayoutBlock(b); - if (lb != null) { boolean enable = ((inBlock != null) && b.equals(inBlock)); - if (enable) { - blockIDComboBox.setSelectedBean(nb); - } lb.setUseExtraColor(enable); result |= enable; } @@ -9364,6 +9364,7 @@ public boolean highlightBlock(@Nullable Block inBlock) { /** * highlight the specified layout block + * * @param inLayoutBlock the layout block * @return true if layout block was highlighted */ @@ -9498,22 +9499,31 @@ public void setConnections() { //reset the panel changed bit resetDirty(); - } //setConnections + } //these are convenience methods to return rectangles - //to do point-in-rect (hit) testing + //to use when (hit point-in-rect testing + // //compute the control point rect at inPoint - public Rectangle2D trackControlPointRectAt(@Nonnull Point2D inPoint) { + public Rectangle2D trackEditControlRectAt(@Nonnull Point2D inPoint) { return new Rectangle2D.Double(inPoint.getX() - SIZE, inPoint.getY() - SIZE, SIZE2, SIZE2); - } //controlPointRectAt + } - //compute the turnout circle rect at inPoint - public Rectangle2D trackControlCircleRectAt(@Nonnull Point2D inPoint) { + //compute the turnout circle control rect at inPoint + public Rectangle2D trackControlRectAt(@Nonnull Point2D inPoint) { return new Rectangle2D.Double(inPoint.getX() - circleRadius, inPoint.getY() - circleRadius, circleDiameter, circleDiameter); } + //these are convenience methods to return circles used to draw onscreen + // + //compute the control point rect at inPoint + public Ellipse2D trackEditControlCircleAt(@Nonnull Point2D inPoint) { + return new Ellipse2D.Double(inPoint.getX() - SIZE, + inPoint.getY() - SIZE, SIZE2, SIZE2); + } + //compute the turnout circle at inPoint (used for drawing) public Ellipse2D trackControlCircleAt(@Nonnull Point2D inPoint) { return new Ellipse2D.Double(inPoint.getX() - circleRadius, @@ -9542,20 +9552,21 @@ protected void draw(Graphics2D g2) { g2.setRenderingHints(antialiasing); } + // things that only get drawn in edit mode if (isEditable()) { if (getDrawGrid()) { drawPanelGrid(g2); } - drawHiddenLayoutTracks(g2); + drawLayoutTracksHidden(g2); } + drawLayoutTracksBallast(g2); + drawLayoutTracksTies(g2); + drawLayoutTracksRails2(g2); + drawLayoutTracksBlockLines(g2); + drawLayoutTracksRails1(g2); - List trackSegments = getTrackSegments(); - drawTrackSegments(g2, trackSegments, true, false); //dashed, non-mainline - drawTrackSegments(g2, trackSegments, true, true); //dashed, mainline - drawTrackSegments(g2, trackSegments, false, false); //non-dashed, non-mainline - drawTrackSegments(g2, trackSegments, false, true); //non-dashed, mainline - - drawLayoutTracks(g2); + drawPositionablePoints(g2, false); + drawPositionablePoints(g2, true); // things that only get drawn in edit mode if (isEditable()) { @@ -9578,68 +9589,183 @@ protected void draw(Graphics2D g2) { } } // draw - private boolean main = true; - private float trackWidth = sideTrackWidth; + private void drawLayoutTracksHidden(Graphics2D g2) { + //setup for drawing hidden sideline rails + g2.setStroke(new BasicStroke(1.0f)); + g2.setColor(getLayoutTrackDrawingOptions().getSideRailColor()); + boolean main = false, block = false, hidden = true, dashed = false; + draw1(g2, main, block, hidden, dashed); + draw1(g2, main, block, hidden, dashed = true); + //setup for drawing mainline rails + g2.setStroke(new BasicStroke(2.0f)); + g2.setColor(getLayoutTrackDrawingOptions().getMainRailColor()); + draw1(g2, main, block, hidden, dashed = false); + draw1(g2, main, block, hidden, dashed = true); + } - //had to make this protected so the LayoutTrack classes could access it - //also returned the current value of trackWidth for the callers to use - protected float setTrackStrokeWidth(Graphics2D g2, boolean needMain) { - log.debug("setTrackStrokeWidth(g2, {}), main: {}", needMain, main); - if (main != needMain) { - main = needMain; + private void drawLayoutTracksBallast(Graphics2D g2) { + //setup for drawing sideline ballast + int ballastWidth = getLayoutTrackDrawingOptions().getSideBallastWidth(); + if (ballastWidth > 0) { + g2.setStroke(new BasicStroke(ballastWidth, + BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g2.setColor(getLayoutTrackDrawingOptions().getSideBallastColor()); + draw1(g2, false); + } - //change track stroke width - trackWidth = main ? mainlineTrackWidth : sideTrackWidth; - g2.setStroke(new BasicStroke(trackWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); + //setup for drawing mainline ballast + ballastWidth = getLayoutTrackDrawingOptions().getMainBallastWidth(); + if (ballastWidth > 0) { + g2.setStroke(new BasicStroke(ballastWidth, + BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g2.setColor(getLayoutTrackDrawingOptions().getMainBallastColor()); + draw1(g2, true); } - return trackWidth; - } //setTrackStrokeWidth + } - protected float getTrackStrokeWidth() { - return trackWidth; + private void drawLayoutTracksTies(Graphics2D g2) { + //setup for drawing sideline ties + int tieLength = getLayoutTrackDrawingOptions().getSideTieLength(); + if (tieLength > 0) { + int tieWidth = getLayoutTrackDrawingOptions().getSideTieWidth(); + int tieGap = getLayoutTrackDrawingOptions().getSideTieGap(); + g2.setStroke(new BasicStroke(tieLength, + BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.F, + new float[]{tieWidth, tieGap}, 0)); + g2.setColor(getLayoutTrackDrawingOptions().getSideTieColor()); + draw1(g2, false); + } + + //setup for drawing mainline ties + tieLength = getLayoutTrackDrawingOptions().getMainTieLength(); + if (tieLength > 0) { + int tieWidth = getLayoutTrackDrawingOptions().getMainTieWidth(); + int tieGap = getLayoutTrackDrawingOptions().getMainTieGap(); + g2.setStroke(new BasicStroke(tieLength, + BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.F, + new float[]{tieWidth, tieGap}, 0)); + g2.setColor(getLayoutTrackDrawingOptions().getMainTieColor()); + draw1(g2, true); + } } - private void drawHiddenLayoutTracks(Graphics2D g2) { - g2.setColor(defaultTrackColor); - setTrackStrokeWidth(g2, false); - for (LayoutTrack tr : layoutTrackList) { - // TrackSegments drawn seperately - if (!(tr instanceof TrackSegment)) { - if (tr.isHidden()) { - tr.draw(g2); + private void drawLayoutTracksRails1(Graphics2D g2) { + if ((getLayoutTrackDrawingOptions().getSideRailCount() & 1) == 1) { + //setup for drawing sideline rails + g2.setStroke(new BasicStroke( + getLayoutTrackDrawingOptions().getSideRailWidth(), + BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g2.setColor(getLayoutTrackDrawingOptions().getSideRailColor()); + draw1(g2, false, false, false, false); + draw1(g2, false, false, false, true); + } + if ((getLayoutTrackDrawingOptions().getMainRailCount() & 1) == 1) { + //setup for drawing mainline rails + g2.setStroke(new BasicStroke( + getLayoutTrackDrawingOptions().getMainRailWidth(), + BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + g2.setColor(getLayoutTrackDrawingOptions().getMainRailColor()); + draw1(g2, true, false, false, false); + draw1(g2, true, false, false, true); + } + } + + private void drawLayoutTracksRails2(Graphics2D g2) { + if (getLayoutTrackDrawingOptions().getSideRailCount() > 1) { + //setup for drawing sideline rails + int railWidth = getLayoutTrackDrawingOptions().getSideRailWidth(); + float railDisplacement = ((railWidth * 2.F) + + getLayoutTrackDrawingOptions().getSideRailGap()) / 2.F; + g2.setStroke(new BasicStroke(railWidth, + BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); + g2.setColor(getLayoutTrackDrawingOptions().getSideRailColor()); + draw2(g2, false, railDisplacement); + } + + if (getLayoutTrackDrawingOptions().getMainRailCount() > 1) { + //setup for drawing mainline rails + int railWidth = getLayoutTrackDrawingOptions().getMainRailWidth(); + float railDisplacement = ((railWidth * 2.F) + + getLayoutTrackDrawingOptions().getMainRailGap()) / 2.F; + g2.setStroke(new BasicStroke(railWidth, + BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); + g2.setColor(getLayoutTrackDrawingOptions().getMainRailColor()); + draw2(g2, true, railDisplacement); + } + } + + private void drawLayoutTracksBlockLines(Graphics2D g2) { + //setup for drawing sideline ties + g2.setStroke(new BasicStroke( + getLayoutTrackDrawingOptions().getSideBlockLineWidth(), + BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + //note: color is set in layout track's draw1 when isBlock is true + draw1(g2, false, true, false, false); + //setup for drawing mainline ties + g2.setStroke(new BasicStroke( + getLayoutTrackDrawingOptions().getMainBlockLineWidth(), + BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + //note: color is set in layout track's draw1 when isBlock is true + draw1(g2, true, true, false, false); + } + + // isDashed defaults to false + private void draw1(Graphics2D g2, + boolean isMain, + boolean isBlock, + boolean isHidden) { + draw1(g2, isMain, isBlock, isHidden, false); + } + + // isHidden defaults to false + private void draw1(Graphics2D g2, + boolean isMain, + boolean isBlock) { + draw1(g2, isMain, isBlock, false); + } + + // isBlock defaults to false + private void draw1(Graphics2D g2, boolean isMain) { + draw1(g2, isMain, false); + } + + private void draw1(Graphics2D g2, + boolean isMain, + boolean isBlock, + boolean isHidden, + boolean isDashed) { + for (LayoutTrack layoutTrack : layoutTrackList) { + if (!(layoutTrack instanceof PositionablePoint)) { + if ((isHidden == layoutTrack.isHidden()) + && (!isDashed || ((layoutTrack instanceof TrackSegment) + && (((TrackSegment) layoutTrack).isDashed())))) { + layoutTrack.draw1(g2, isMain, isBlock); } } } - } //drawHiddenLayoutTracks + } - private void drawLayoutTracks(Graphics2D g2) { - for (LayoutTrack tr : layoutTrackList) { - // TrackSegments drawn seperately - if (!(tr instanceof TrackSegment)) { - if (!tr.isHidden()) { - tr.draw(g2); - } + private void drawPositionablePoints(Graphics2D g2, boolean isMain) { + for (LayoutTrack layoutTrack : layoutTrackList) { + if (layoutTrack instanceof PositionablePoint) { + layoutTrack.draw1(g2, isMain, false); } } - } //drawLayoutTracks + } - private void drawTrackSegments(Graphics2D g2, - List trackSegments, - boolean dashed, - boolean mainline) { - setTrackStrokeWidth(g2, mainline); - for (TrackSegment ts : trackSegments) { - if ((ts.isDashed() == dashed) && (ts.isMainline() == mainline)) { - ts.draw(g2); + private void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { + for (LayoutTrack layoutTrack : layoutTrackList) { + if (!layoutTrack.isHidden()) { + layoutTrack.draw2(g2, isMain, railDisplacement); } } - } //drawTrackSegments + } private void drawTrackSegmentInProgress(Graphics2D g2) { //check for segment in progress if (isEditable() && (beginObject != null) && trackButton.isSelected()) { g2.setColor(defaultTrackColor); - setTrackStrokeWidth(g2, false); + g2.setStroke(new BasicStroke(sideTrackWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); g2.draw(new Line2D.Double(beginLocation, currentLocation)); // highlight unconnected endpoints of all tracks @@ -9663,7 +9789,13 @@ private void drawTrackSegmentInProgress(Graphics2D g2) { private void drawLayoutTrackEditControls(Graphics2D g2) { g2.setStroke(new BasicStroke(1.0F, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); + for (LayoutTrack tr : layoutTrackList) { +// if (tr instanceof TrackSegment) { +// int showHide = _layoutTrackSelection.contains(tr) +// ? TrackSegment.SHOWCON : TrackSegment.HIDECON; +// ((TrackSegment) tr).hideConstructionLines(showHide); +// } tr.drawEditControls(g2); } } @@ -9686,7 +9818,7 @@ private void drawTurnoutControls(Graphics2D g2) { } } } - } // drawTurnoutControls + } private Rectangle2D getSelectionRect() { double selX = Math.min(selectionX, selectionX + selectionWidth); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java index 3345c4532eb..ab87dace5fb 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorAuxTools.java @@ -21,6 +21,7 @@ * directly from LayoutEditor or LayoutEditor specific modules. *

                * @author Dave Duchamp Copyright (c) 2008 + * @author George Warner Copyright (C) 2017 */ public class LayoutEditorAuxTools { @@ -207,7 +208,7 @@ private void checkConnectivity(LayoutConnectivity c, boolean[] found) { } // Check to see if this connectivity is already in the list - // This occurs for the first layout editor panel when there + // This occurs for the first layout editor panel when there // are multiple panels connected by edge connectors. if (cList.contains(c)) { log.debug("checkConnectivity: Duplicate connection: '{}'", c); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties index 856612d9d73..2a09c3677f3 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties @@ -345,13 +345,15 @@ SetGridSizesMessageTitle = Grid Sizes EnterTitle = Enter New Title EditTitleMessageTitle = Edit Layout Name +SetTrackDrawingOptions = Set Track Drawing Options +SetTrackDrawingOptionsToolTip = Select this item to change your track drawing options SetTrackWidth = Set Track Line Width SetLocation = Save Location and Size TrackColorSubMenu = Default Track Colors DefaultTrackColor = Set Default Track Color DefaultOccupiedTrackColor = Set Default Occupied Track Color DefaultAlternativeTrackColor = Set Default Alternative Track Color -#DefaultTextColor = Set Default Text Color +#DefaultTextColor Moved to DisplayBundle.properties TurnoutOptions = Turnout Options TurnoutCircleColor = Set Turnout Circle Color TurnoutCircleSize = Set Turnout Circle Size @@ -634,3 +636,71 @@ CheckUnBlockedTracksMenuTitle = Un-Blocked Tracks CheckUnBlockedTracksMenuToolTip = Select this to check for tracks that do not have an assigned block CheckNonContiguousBlocksMenuTitle = Non-Contiguous Blocks CheckNonContiguousBlocksMenuToolTip = Select this to check for blocks that are not contiguous + +#LayoutTrackDrawingOptionsDialog properties +# +# the presets +ClassicPresetName = Classic JMRI +CustomPresetName = Custom +DraftingPresetName = Drafting +GarishPresetName = Garish +RealisticOhPresetName = Realistic Oh! +RealisticPresetName = Realistic + +#the top labels text and tooltips +MainlineColumnToolTip = This column is for mainline options +MainlineLabelText = Mainline +OptionLabelText = Options +OptionToolTip = This column contains the available options +SidelineColumnToolTip = This column is for sideline options +SidelineLabelText = Sideline + +#the option labels text and tooltips +BallastColorLabelText = Ballast Color +BallastColorToolTip = Click one of the buttons to the right to set the color of the ballast +BallastWidthLabelText = Ballast Width +BallastWidthToolTip = Click one of the buttons to the right to set the width of the ballast +BlockLineWidthLabelText = Block Line Width +BlockLineWidthToolTip = Click one of the buttons to the right to set the width of the block line +RailColorLabelText = Rail Color +RailColorToolTip = Click one of the buttons to the right to set the color of the rails +RailCountLabelText = Rail Count +RailCountToolTip = Click one of the buttons to the right to set the number of rails +RailGapLabelText = Rail Gap +RailGapToolTip = Click one of the buttons to the right to set the distance between the rails +RailWidthLabelText = Rail Width +RailWidthToolTip = Click one of the buttons to the right to set the width of the rails +TieColorLabelText = Tie Color +TieColorToolTip = Click one of the buttons to the right to set the color of the ties +TieGapLabelText = Tie Gap +TieGapToolTip = Click one of the buttons to the right to set the distance between the ties +TieLengthLabelText = Tie Length +TieLengthToolTip = Click one of the buttons to the right to set the length of the ties +TieWidthLabelText = Tie Width +TieWidthToolTip = Click one of the buttons to the right to set the width of the ties + +#the mainline option tooltips +MainBallastColorToolTip = Click this button to set the color of the mainline ballast +MainBallastWidthToolTip = Click this button to set the width of mainline ballast +MainBlockLineWidthToolTip = Click this button to set the width of mainline block lines +MainRailColorToolTip = Click this button to set the color of mainline rails +MainRailCountToolTip = Click this button to set the number of mainline rails +MainRailGapToolTip = Click this button to set the distance between mainline rails +MainRailWidthToolTip = Click this button to set the width of mainline rails +MainTieColorToolTip = Click this button to set the color of mainline ties +MainTieGapToolTip = Click this button to set the distance between ties +MainTieLengthToolTip = Click this button to set the length of mainline ties +MainTieWidthToolTip = Click this button to set the width of mainline ties + +#the sideline option tooltips +SideBallastColorToolTip = Click this button to set the color of sideline ballast +SideBallastWidthToolTip = Click this button to set the width of sideline ballast +SideBlockLineWidthToolTip = Click this button to set the width of sideline block lines +SideRailColorToolTip = Click this button to set the color of sideline rails +SideRailCountToolTip = Click this button to set the number of sideline rails +SideRailGapToolTip = Click this button to set the distance between sideline rails +SideRailWidthToolTip = Click this button to set the width of sideline rails +SideTieColorToolTip = Click this button to set the color of sideline ties +SideTieGapToolTip = Click this button to set the distance between sideline ties +SideTieLengthToolTip = Click this button to set the length of sideline ties +SideTieWidthToolTip = Click this button to set the width of sideline ties diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java index ef3064b5858..9324345d92d 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java @@ -22,6 +22,8 @@ /** * A collection of tools to check various things on the layout editor panel. + * + * @author George Warner Copyright (C) 2017 */ public class LayoutEditorChecks { @@ -328,6 +330,7 @@ private void setupCheckNonContiguousBlocksMenu() { //if (layoutTrack.getName().equals("TO1") // || layoutTrack.getName().equals("TO2") // || layoutTrack.getName().equals("TO3")) { + // log.debug("*Stop here!"); //} layoutTrack.checkForNonContiguousBlocks(blockNamesToTrackNameSetMaps); @@ -412,6 +415,6 @@ private Set getCheckMarkedMenuItemNames(@Nonnull JMenu menu) { return results; } // getCheckMarkedMenuItemNames - private final static Logger log = LoggerFactory.getLogger(LayoutEditorChecks.class - ); + private final static Logger log = LoggerFactory.getLogger(LayoutEditorChecks.class); } + diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorComponent.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorComponent.java index 35a688f22dc..e9fb16f992c 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorComponent.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorComponent.java @@ -12,6 +12,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/* + * This is an intermediate component used to put the Layout Editor + * into the component layers hierarchy so that objects can be drawn + * in front of or behind layout editor objects. + * + * @author George Warner Copyright (C) 2017 +*/ + class LayoutEditorComponent extends JComponent { private final LayoutEditor layoutEditor; diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorFindItems.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorFindItems.java index d62b0bdf849..67d5c882281 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorFindItems.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorFindItems.java @@ -14,6 +14,9 @@ /** * A collection of tools to find various object on the layout editor panel. + * + * @author Dave Duchamp Copyright (c) 2004-2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutEditorFindItems { diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorTools.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorTools.java index 621b2571363..bb5cfe71e81 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorTools.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorTools.java @@ -63,7 +63,7 @@ import jmri.jmrit.signalling.SignallingGuiTools; import jmri.util.JmriJFrame; import jmri.util.MathUtil; -import jmri.util.swing.JmriBeanComboBox; +import jmri.util.swing.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,6 +74,7 @@ * The tools in this module are accessed via the Tools menu in Layout Editor. * * @author Dave Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutEditorTools { @@ -12126,7 +12127,7 @@ static class BeanDetails { BeanDetails(@Nonnull String beanType, @Nonnull Manager manager) { beanCombo = new JmriBeanComboBox(manager); beanCombo.setFirstItemBlank(true); - LayoutEditor.setupComboBoxMaxRows(beanCombo); + JComboBoxUtil.setupComboBoxMaxRows(beanCombo); // I18N translate from type (Sensor) to BeanNameSensor // to use NamedBeanBundle property @@ -13468,7 +13469,7 @@ private String setupNearLogixSlip(Turnout turn, int nearState, String turnoutName = turn.getDisplayName(); String farTurnoutName = farTurn.getDisplayName(); - String logixName = "SYS_LAYOUTSLIP:" + slip.ident; + String logixName = "IX_LAYOUTSLIP:" + slip.ident; String sensorName = "IS:" + logixName + "C" + number; try { Sensor sensor = InstanceManager.sensorManagerInstance().provideSensor(sensorName); @@ -13543,19 +13544,19 @@ private String setupNearLogixSlip(Turnout turn, int nearState, private void addNearSensorToSlipLogic(String name) { if ((name != null) && !name.isEmpty()) { // return if a sensor by this name is already present - if (logic.getSensor1().equals(name)) { + if (logic.getSensor1() != null && logic.getSensor1().equals(name)) { return; } - if (logic.getSensor2().equals(name)) { + if (logic.getSensor2() != null && logic.getSensor2().equals(name)) { return; } - if (logic.getSensor3().equals(name)) { + if (logic.getSensor3() != null && logic.getSensor3().equals(name)) { return; } - if (logic.getSensor4().equals(name)) { + if (logic.getSensor4() != null && logic.getSensor4().equals(name)) { return; } - if (logic.getSensor5().equals(name)) { + if (logic.getSensor5() != null && logic.getSensor5().equals(name)) { return; } // add in the first available slot diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java index 4ec55d107a8..f712632406a 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java @@ -1,11 +1,13 @@ package jmri.jmrit.display.layoutEditor; import static java.lang.Integer.parseInt; +import static java.lang.Math.PI; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; +import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; @@ -44,11 +46,13 @@ * double-slips, B and C. *

                * {@literal - * ==A==-==D== + * \\ // + * A==-==D * \\ // * X * // \\ - * ==B==-==C== + * B==-==C + * // \\ * literal} *

                * For drawing purposes, each LayoutSlip carries a center point and @@ -64,6 +68,7 @@ * placed here by Set Signals at Level Crossing in Tools menu. * * @author Dave Duchamp Copyright (c) 2004-2007 + * @author George Warner Copyright (c) 2017 */ public class LayoutSlip extends LayoutTurnout { @@ -553,12 +558,12 @@ protected int findHitPointType(@Nonnull Point2D hitPoint, boolean useRectangles, if (useRectangles) { // calculate turnout's left control rectangle - Rectangle2D leftRectangle = layoutEditor.trackControlCircleRectAt(leftCenter); + Rectangle2D leftRectangle = layoutEditor.trackControlRectAt(leftCenter); if (leftRectangle.contains(hitPoint)) { //point is in this turnout's left control rectangle result = SLIP_LEFT; } - Rectangle2D rightRectangle = layoutEditor.trackControlCircleRectAt(rightCenter); + Rectangle2D rightRectangle = layoutEditor.trackControlRectAt(rightCenter); if (rightRectangle.contains(hitPoint)) { //point is in this turnout's right control rectangle result = SLIP_RIGHT; @@ -581,7 +586,7 @@ protected int findHitPointType(@Nonnull Point2D hitPoint, boolean useRectangles, // see if the passed in point is in one of those rectangles // we can create a rectangle for the passed in point and then // test if any of the points below are in that rectangle instead. - Rectangle2D r = layoutEditor.trackControlPointRectAt(hitPoint); + Rectangle2D r = layoutEditor.trackEditControlRectAt(hitPoint); if (!requireUnconnected || (getConnectA() == null)) { //check the A connection point @@ -1105,145 +1110,326 @@ private void updateState() { } } - /** - * draw this slip - * - * @param g2 the graphics port to draw to - */ - protected void draw(Graphics2D g2) { - LayoutBlock b = getLayoutBlock(); - Color mainColourA = defaultTrackColor; - Color subColourA = defaultTrackColor; - if (b != null) { - mainColourA = b.getBlockColor(); - subColourA = b.getBlockTrackColor(); - } - - b = getLayoutBlockB(); - Color mainColourB = defaultTrackColor; - Color subColourB = defaultTrackColor; - if (b != null) { - mainColourB = b.getBlockColor(); - subColourB = b.getBlockTrackColor(); - } - - b = getLayoutBlockC(); - Color mainColourC = defaultTrackColor; - Color subColourC = defaultTrackColor; - if (b != null) { - mainColourC = b.getBlockColor(); - subColourC = b.getBlockTrackColor(); - } - - b = getLayoutBlockD(); - Color mainColourD = defaultTrackColor; - Color subColourD = defaultTrackColor; - if (b != null) { - mainColourD = b.getBlockColor(); - subColourD = b.getBlockTrackColor(); - } - - layoutEditor.setTrackStrokeWidth(g2, isMainline()); - - boolean isMainA = (connectA != null) && (((TrackSegment) connectA).isMainline()); - boolean isMainB = (connectB != null) && (((TrackSegment) connectB).isMainline()); - boolean isMainC = (connectC != null) && (((TrackSegment) connectC).isMainline()); - boolean isMainD = (connectD != null) && (((TrackSegment) connectD).isMainline()); - - if (getSlipState() == STATE_AC) { - g2.setColor(mainColourA); - layoutEditor.setTrackStrokeWidth(g2, isMainA); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointC))); - - g2.setColor(mainColourC); - layoutEditor.setTrackStrokeWidth(g2, isMainC); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointA))); - } else { - g2.setColor(subColourA); - layoutEditor.setTrackStrokeWidth(g2, isMainA); - g2.draw(new Line2D.Double(pointA, MathUtil.oneThirdPoint(pointA, pointC))); - - g2.setColor(subColourC); - layoutEditor.setTrackStrokeWidth(g2, isMainC); - g2.draw(new Line2D.Double(pointC, MathUtil.oneThirdPoint(pointC, pointA))); + protected void draw1(Graphics2D g2, boolean drawMain, boolean isBlock) { + Point2D pA = getCoordsA(); + Point2D pB = getCoordsB(); + Point2D pC = getCoordsC(); + Point2D pD = getCoordsD(); + + boolean mainlineA = isMainlineA(); + boolean mainlineB = isMainlineB(); + boolean mainlineC = isMainlineC(); + boolean mainlineD = isMainlineD(); + + Color color = g2.getColor(); + + // if this isn't a block line all these will be the same color + Color colorA = color; + Color colorB = color; + Color colorC = color; + Color colorD = color; + + if (isBlock) { + LayoutBlock lb = getLayoutBlock(); + colorA = (lb == null) ? color : lb.getBlockColor(); + lb = getLayoutBlockB(); + colorB = (lb == null) ? color : lb.getBlockColor(); + lb = getLayoutBlockC(); + colorC = (lb == null) ? color : lb.getBlockColor(); + lb = getLayoutBlockD(); + colorD = (lb == null) ? color : lb.getBlockColor(); + } + + Point2D oneThirdPointAC = MathUtil.oneThirdPoint(pA, pC); + Point2D midPointAC = MathUtil.midPoint(pA, pC); + Point2D twoThirdsPointAC = MathUtil.twoThirdsPoint(pA, pC); + + Point2D oneThirdPointBD = MathUtil.oneThirdPoint(pB, pD); + Point2D midPointBD = MathUtil.midPoint(pB, pD); + Point2D twoThirdsPointBD = MathUtil.twoThirdsPoint(pB, pD); + + Point2D midPointAD = MathUtil.midPoint(oneThirdPointAC, twoThirdsPointBD); + Point2D midPointBC = MathUtil.midPoint(oneThirdPointBD, twoThirdsPointAC); + + int slipState = getSlipState(); + + if (!isBlock || (slipState == STATE_AD)) { + // draw A<===>D + if (drawMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, oneThirdPointAC)); + g2.draw(new Line2D.Double(oneThirdPointAC, midPointAD)); + } + if (drawMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(midPointAD, twoThirdsPointBD)); + g2.draw(new Line2D.Double(twoThirdsPointBD, pD)); + } } - if (getSlipState() == STATE_BD) { - g2.setColor(mainColourB); - layoutEditor.setTrackStrokeWidth(g2, isMainB); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointB, pointD))); - - g2.setColor(mainColourD); - layoutEditor.setTrackStrokeWidth(g2, isMainD); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointD, pointB))); + if (!isBlock || (slipState == STATE_AC)) { + // draw A<===>C + if (drawMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, midPointAC)); + } + if (drawMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(midPointAC, pC)); + } } else { - g2.setColor(subColourB); - layoutEditor.setTrackStrokeWidth(g2, isMainB); - g2.draw(new Line2D.Double(pointB, MathUtil.oneThirdPoint(pointB, pointD))); - - g2.setColor(subColourD); - layoutEditor.setTrackStrokeWidth(g2, isMainD); - g2.draw(new Line2D.Double(pointD, MathUtil.oneThirdPoint(pointD, pointB))); + // draw A<= =>C + if (drawMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, oneThirdPointAC)); + } + if (drawMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(twoThirdsPointAC, pC)); + } } - if (getSlipState() == STATE_AD) { - g2.setColor(mainColourA); - layoutEditor.setTrackStrokeWidth(g2, isMainA); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointD))); - - g2.setColor(mainColourD); - layoutEditor.setTrackStrokeWidth(g2, isMainD); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointD, pointA))); + if (!isBlock || (slipState == STATE_BD)) { + // draw B<===>D + if (drawMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pB, midPointBD)); + } + if (drawMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(midPointBD, pD)); + } } else { - g2.setColor(subColourA); - layoutEditor.setTrackStrokeWidth(g2, isMainA); - g2.draw(new Line2D.Double(pointA, MathUtil.oneThirdPoint(pointA, pointD))); - - g2.setColor(subColourD); - layoutEditor.setTrackStrokeWidth(g2, isMainD); - g2.draw(new Line2D.Double(pointD, MathUtil.oneThirdPoint(pointD, pointA))); + // draw B<= =>D + if (drawMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pB, oneThirdPointBD)); + } + if (drawMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(twoThirdsPointBD, pD)); + } } - if (getSlipState() == STATE_BC) { - g2.setColor(mainColourB); - layoutEditor.setTrackStrokeWidth(g2, isMainB); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointB, pointC))); - - g2.setColor(mainColourC); - layoutEditor.setTrackStrokeWidth(g2, isMainC); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointB))); - } else if (getSlipType() == DOUBLE_SLIP) { - g2.setColor(subColourB); - layoutEditor.setTrackStrokeWidth(g2, isMainB); - g2.draw(new Line2D.Double(pointB, MathUtil.oneThirdPoint(pointB, pointC))); - - g2.setColor(subColourC); - layoutEditor.setTrackStrokeWidth(g2, isMainC); - g2.draw(new Line2D.Double(pointC, MathUtil.oneThirdPoint(pointC, pointB))); - } - } // draw + if (getTurnoutType() == DOUBLE_SLIP) { + if (!isBlock || (slipState == STATE_BC)) { + // draw B<===>C + if (drawMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pB, oneThirdPointBD)); + g2.draw(new Line2D.Double(oneThirdPointBD, midPointBC)); + } + if (drawMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(midPointBC, twoThirdsPointAC)); + g2.draw(new Line2D.Double(twoThirdsPointAC, pC)); + } + } + } // DOUBLE_SLIP + } // draw1 /** * {@inheritDoc} */ @Override - protected void drawUnconnected(Graphics2D g2) { - if (getConnectA() == null) { - g2.fill(layoutEditor.trackControlCircleAt(getCoordsA())); - } - - if (getConnectB() == null) { - g2.fill(layoutEditor.trackControlCircleAt(getCoordsB())); - } - - if (getConnectC() == null) { - g2.fill(layoutEditor.trackControlCircleAt(getCoordsC())); + protected void draw2(Graphics2D g2, boolean drawMain, float railDisplacement) { + Point2D pA = getCoordsA(); + Point2D pB = getCoordsB(); + Point2D pC = getCoordsC(); + Point2D pD = getCoordsD(); + Point2D pM = getCoordsCenter(); + + Point2D vAC = MathUtil.normalize(MathUtil.subtract(pC, pA), railDisplacement); + double dirAC_DEG = MathUtil.computeAngleDEG(pA, pC); + Point2D vACo = MathUtil.orthogonal(vAC); + Point2D pAL = MathUtil.subtract(pA, vACo); + Point2D pAR = MathUtil.add(pA, vACo); + Point2D pCL = MathUtil.subtract(pC, vACo); + Point2D pCR = MathUtil.add(pC, vACo); + + Point2D vBD = MathUtil.normalize(MathUtil.subtract(pD, pB), railDisplacement); + double dirBD_DEG = MathUtil.computeAngleDEG(pB, pD); + Point2D vBDo = MathUtil.orthogonal(vBD); + Point2D pBL = MathUtil.subtract(pB, vBDo); + Point2D pBR = MathUtil.add(pB, vBDo); + Point2D pDL = MathUtil.subtract(pD, vBDo); + Point2D pDR = MathUtil.add(pD, vBDo); + + double deltaDEG = MathUtil.absDiffAngleDEG(dirAC_DEG, dirBD_DEG); + double deltaRAD = Math.toRadians(deltaDEG); + + double hypotV = railDisplacement / Math.cos((PI - deltaRAD) / 2.0); + double hypotK = railDisplacement / Math.cos(deltaRAD / 2.0); + + log.debug("dir AC: {}, BD: {}, diff: {}", dirAC_DEG, dirBD_DEG, deltaDEG); + + Point2D vDisK = MathUtil.normalize(MathUtil.subtract(vAC, vBD), hypotK); + Point2D vDisV = MathUtil.normalize(MathUtil.orthogonal(vDisK), hypotV); + Point2D pKL = MathUtil.subtract(pM, vDisK); + Point2D pKR = MathUtil.add(pM, vDisK); + Point2D pVL = MathUtil.add(pM, vDisV); + Point2D pVR = MathUtil.subtract(pM, vDisV); + + // this is the vector (rail gaps) for the diamond parts + double railGap = 2.0 / Math.sin(deltaRAD); + Point2D vAC2 = MathUtil.normalize(vAC, railGap); + Point2D vBD2 = MathUtil.normalize(vBD, railGap); + // KR and VR toward A, KL and VL toward C + Point2D pKRtA = MathUtil.subtract(pKR, vAC2); + Point2D pVRtA = MathUtil.subtract(pVR, vAC2); + Point2D pKLtC = MathUtil.add(pKL, vAC2); + Point2D pVLtC = MathUtil.add(pVL, vAC2); + + // VR and KL toward B, KR and VL toward D + Point2D pVRtB = MathUtil.subtract(pVR, vBD2); + Point2D pKLtB = MathUtil.subtract(pKL, vBD2); + Point2D pKRtD = MathUtil.add(pKR, vBD2); + Point2D pVLtD = MathUtil.add(pVL, vBD2); + + // outer (closed) switch points + Point2D pAPL = MathUtil.add(pAL, MathUtil.subtract(pVL, pAR)); + Point2D pBPR = MathUtil.add(pBR, MathUtil.subtract(pVL, pBL)); + Point2D pCPR = MathUtil.add(pCR, MathUtil.subtract(pVR, pCL)); + Point2D pDPL = MathUtil.add(pDL, MathUtil.subtract(pVR, pDR)); + + // this is the vector (rail gaps) for the inner (open) switch points + Point2D vACo2 = MathUtil.normalize(vACo, 2.0); + Point2D vBDo2 = MathUtil.normalize(vBDo, 2.0); + Point2D pASL = MathUtil.add(pAPL, vACo2); + Point2D pBSR = MathUtil.subtract(pBPR, vBDo2); + Point2D pCSR = MathUtil.subtract(pCPR, vACo2); + Point2D pDSL = MathUtil.add(pDPL, vBDo2); + + Point2D pVLP = MathUtil.add(pVLtD, vAC2); + Point2D pVRP = MathUtil.subtract(pVRtA, vBD2); + + Point2D pKLH = MathUtil.midPoint(pM, pKL); + Point2D pKRH = MathUtil.midPoint(pM, pKR); + + boolean mainlineA = isMainlineA(); + boolean mainlineB = isMainlineB(); + boolean mainlineC = isMainlineC(); + boolean mainlineD = isMainlineD(); + + if (drawMain == mainlineA) { + g2.draw(new Line2D.Double(pAR, pVL)); + g2.draw(new Line2D.Double(pVLtD, pKL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pAL.getX(), pAL.getY()); + path.lineTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pKL.getX(), pKL.getY(), pDPL.getX(), pDPL.getY()); + g2.draw(path); + } + if (drawMain == mainlineB) { + g2.draw(new Line2D.Double(pBL, pVL)); + g2.draw(new Line2D.Double(pVLtC, pKR)); + if (getTurnoutType() == DOUBLE_SLIP) { + GeneralPath path = new GeneralPath(); + path.moveTo(pBR.getX(), pBR.getY()); + path.lineTo(pBPR.getX(), pBPR.getY()); + path.quadTo(pKR.getX(), pKR.getY(), pCPR.getX(), pCPR.getY()); + g2.draw(path); + } else { + g2.draw(new Line2D.Double(pBR, pKR)); + } } - if (getConnectD() == null) { - g2.fill(layoutEditor.trackControlCircleAt(getCoordsD())); + if (drawMain == mainlineC) { + g2.draw(new Line2D.Double(pCL, pVR)); + g2.draw(new Line2D.Double(pVRtB, pKR)); + if (getTurnoutType() == DOUBLE_SLIP) { + GeneralPath path = new GeneralPath(); + path.moveTo(pCR.getX(), pCR.getY()); + path.lineTo(pCPR.getX(), pCPR.getY()); + path.quadTo(pKR.getX(), pKR.getY(), pBPR.getX(), pBPR.getY()); + g2.draw(path); + } else { + g2.draw(new Line2D.Double(pCR, pKR)); + } } - } + if (drawMain == mainlineD) { + g2.draw(new Line2D.Double(pDR, pVR)); + g2.draw(new Line2D.Double(pVRtA, pKL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pDL.getX(), pDL.getY()); + path.lineTo(pDPL.getX(), pDPL.getY()); + path.quadTo(pKL.getX(), pKL.getY(), pAPL.getX(), pAPL.getY()); + g2.draw(path); + } + + int slipState = getSlipState(); + if (slipState == STATE_AD) { + if (drawMain == mainlineA) { + g2.draw(new Line2D.Double(pASL, pKL)); + g2.draw(new Line2D.Double(pVLP, pKLH)); + } + if (drawMain == mainlineB) { + g2.draw(new Line2D.Double(pBPR, pKR)); + g2.draw(new Line2D.Double(pVLtC, pKRH)); + } + if (drawMain == mainlineC) { + g2.draw(new Line2D.Double(pCPR, pKR)); + g2.draw(new Line2D.Double(pVRtB, pKRH)); + } + if (drawMain == mainlineD) { + g2.draw(new Line2D.Double(pDSL, pKL)); + g2.draw(new Line2D.Double(pVRP, pKLH)); + } + } else if (slipState == STATE_AC) { + if (drawMain == mainlineA) { + g2.draw(new Line2D.Double(pAPL, pKL)); + g2.draw(new Line2D.Double(pVLtD, pKLH)); + } + if (drawMain == mainlineB) { + g2.draw(new Line2D.Double(pBSR, pKR)); + g2.draw(new Line2D.Double(pVLP, pKRH)); + } + if (drawMain == mainlineC) { + g2.draw(new Line2D.Double(pCPR, pKR)); + g2.draw(new Line2D.Double(pVRtB, pKRH)); + } + if (drawMain == mainlineD) { + g2.draw(new Line2D.Double(pDSL, pKL)); + g2.draw(new Line2D.Double(pVRP, pKLH)); + } + } else if (slipState == STATE_BD) { + if (drawMain == mainlineA) { + g2.draw(new Line2D.Double(pASL, pKL)); + g2.draw(new Line2D.Double(pVLP, pKLH)); + } + if (drawMain == mainlineB) { + g2.draw(new Line2D.Double(pBPR, pKR)); + g2.draw(new Line2D.Double(pVLtC, pKRH)); + } + if (drawMain == mainlineC) { + g2.draw(new Line2D.Double(pCSR, pKR)); + g2.draw(new Line2D.Double(pVRP, pKRH)); + } + if (drawMain == mainlineD) { + g2.draw(new Line2D.Double(pDPL, pKL)); + g2.draw(new Line2D.Double(pVRtA, pKLH)); + } + } else if ((getTurnoutType() == DOUBLE_SLIP) + && (slipState == STATE_BC)) { + if (drawMain == mainlineA) { + g2.draw(new Line2D.Double(pAPL, pKL)); + g2.draw(new Line2D.Double(pVLtD, pKLH)); + } + if (drawMain == mainlineB) { + g2.draw(new Line2D.Double(pBSR, pKR)); + g2.draw(new Line2D.Double(pVLP, pKRH)); + } + if (drawMain == mainlineC) { + g2.draw(new Line2D.Double(pCSR, pKR)); + g2.draw(new Line2D.Double(pVRP, pKRH)); + } + if (drawMain == mainlineD) { + g2.draw(new Line2D.Double(pDPL, pKL)); + g2.draw(new Line2D.Double(pVRtA, pKLH)); + } + } // DOUBLE_SLIP + } // draw2 + @Override protected void drawTurnoutControls(Graphics2D g2) { // drawHidden left/right turnout control circles Point2D leftCircleCenter = getCoordsLeft(); @@ -1251,37 +1437,7 @@ protected void drawTurnoutControls(Graphics2D g2) { Point2D rightCircleCenter = getCoordsRight(); g2.draw(layoutEditor.trackControlCircleAt(rightCircleCenter)); - } // drawTurnoutControls - - protected void drawEditControls(Graphics2D g2) { - if (getConnectA() == null) { - g2.setColor(Color.magenta); - } else { - g2.setColor(Color.blue); - } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsA())); - - if (getConnectB() == null) { - g2.setColor(Color.red); - } else { - g2.setColor(Color.green); - } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsB())); - - if (getConnectC() == null) { - g2.setColor(Color.red); - } else { - g2.setColor(Color.green); - } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsC())); - - if (getConnectD() == null) { - g2.setColor(Color.red); - } else { - g2.setColor(Color.green); - } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsD())); - } // drawEditControls + } // drawTurnoutControls static class TurnoutState { @@ -1608,5 +1764,6 @@ public List checkForFreeConnections() { //NOTE: LayoutSlip uses the checkForNonContiguousBlocks // and collectContiguousTracksNamesInBlockNamed methods // inherited from LayoutTurnout + // private final static Logger log = LoggerFactory.getLogger(LayoutSlip.class); } diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrack.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrack.java index 2b44c5cc42c..2485d37dd83 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrack.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrack.java @@ -70,6 +70,10 @@ public abstract class LayoutTrack { // package-private static Color defaultTrackColor = Color.black; + //TODO: Add accessor methods + //TODO: Should these be 1)Global, 2)Per-layout, 3)Per-Block or 4)Per-Track? + static Color defaultBallastColor = Color.gray; + static Color defaultTieColor = new Color(122, 74, 50); /** * constructor method @@ -114,15 +118,27 @@ public static void setDefaultTrackColor(@Nullable Color color) { defaultTrackColor = color; } - protected Color setColorForTrackBlock(Graphics2D g2, @Nullable LayoutBlock lb, boolean forceBlockTrackColor) { - Color result = defaultTrackColor; - if (lb != null) { + protected Color getColorForTrackBlock( + @Nullable LayoutBlock layoutBlock, boolean forceBlockTrackColor) { + Color result = ColorUtil.CLEAR; // transparent + if (layoutBlock != null) { if (forceBlockTrackColor) { - result = lb.getBlockTrackColor(); + result = layoutBlock.getBlockTrackColor(); } else { - result = lb.getBlockColor(); + result = layoutBlock.getBlockColor(); } } + return result; + } + + // optional prameter forceTrack = false + protected Color getColorForTrackBlock(@Nullable LayoutBlock lb) { + return getColorForTrackBlock(lb, false); + } + + protected Color setColorForTrackBlock(Graphics2D g2, + @Nullable LayoutBlock layoutBlock, boolean forceBlockTrackColor) { + Color result = getColorForTrackBlock(layoutBlock, forceBlockTrackColor); g2.setColor(result); return result; } @@ -132,12 +148,37 @@ protected Color setColorForTrackBlock(Graphics2D g2, @Nullable LayoutBlock lb) { return setColorForTrackBlock(g2, lb, false); } + public abstract boolean isMainline(); + + /** + * draw one line (Ballast, ties, center or 3rd rail, block lines) + * + * @param g2 the graphics context + * @param isMain true if drawing mainlines + * @param isBlock true if drawing block lines + */ + protected abstract void draw1(Graphics2D g2, boolean isMain, boolean isBlock); + /** - * one draw routine to rule them all... + * draw two lines (rails) + * + * @param g2 the graphics context + * @param isMain true if drawing mainlines + * @param railDisplacement the offset from center to draw the lines + */ + protected abstract void draw2(Graphics2D g2, boolean isMain, float railDisplacement); + + /** + * draw hidden track * * @param g2 the graphics context */ - protected abstract void draw(Graphics2D g2); + //protected abstract void drawHidden(Graphics2D g2); + //note: placeholder until I get this implemented in all sub-classes + //TODO: replace with abstract declaration (above) + protected void drawHidden(Graphics2D g2) { + //nothing to do here... move along... + } /** * highlight unconnected connections @@ -539,19 +580,17 @@ public boolean isDisconnected(int connectionType) { /** * check this track and its neighbors for non-contiguous blocks *

                - * For each (non-null) blocks of this track do: - * #1) If it's got an entry in the blockNamesToTrackNameSetMap then - * #2) If this track is not in one of the TrackNameSets for this block - * #3) add a new set (with this block/track) to - * blockNamesToTrackNameSetMap and - * #4) check all the connections in this - * block (by calling the 2nd method below) + * For each (non-null) blocks of this track do: #1) If it's got an entry in + * the blockNamesToTrackNameSetMap then #2) If this track is not in one of + * the TrackNameSets for this block #3) add a new set (with this + * block/track) to blockNamesToTrackNameSetMap and #4) check all the + * connections in this block (by calling the 2nd method below) *

                - * Basically, we're maintaining contiguous track sets for each block found - * (in blockNamesToTrackNameSetMap) + * Basically, we're maintaining contiguous track sets for each block found + * (in blockNamesToTrackNameSetMap) * - * @param blockNamesToTrackNameSetMaps hashmap of key:block names to - * lists of track name sets for those blocks + * @param blockNamesToTrackNameSetMaps hashmap of key:block names to lists + * of track name sets for those blocks *

                * note: used by LayoutEditorChecks.setupCheckNonContiguousBlocksMenu() */ @@ -561,7 +600,7 @@ public abstract void checkForNonContiguousBlocks( /** * recursive routine to check for all contiguous tracks in this blockName * - * @param blockName the block that we're checking for + * @param blockName the block that we're checking for * @param TrackNameSet the set of track names in this block */ public abstract void collectContiguousTracksNamesInBlockNamed( @@ -570,10 +609,11 @@ public abstract void collectContiguousTracksNamesInBlockNamed( /** * Assign all the layout blocks in this track - * @param layoutBlock to this layout block - * (used by the Tools menu's "Assign block to selection" item) + * + * @param layoutBlock to this layout block (used by the Tools menu's "Assign + * block to selection" item) */ public abstract void setAllLayoutBlocks(LayoutBlock layoutBlock); - + private final static Logger log = LoggerFactory.getLogger(LayoutTrack.class); } diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java new file mode 100644 index 00000000000..f57f838e3e9 --- /dev/null +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java @@ -0,0 +1,415 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package jmri.jmrit.display.layoutEditor; + +import java.awt.Color; +import javax.annotation.Nonnull; + +/** + * + * @author George Warner Copyright (C) 2017 + */ +public class LayoutTrackDrawingOptions implements Cloneable { + + private String name; + + public LayoutTrackDrawingOptions(String name) { + this.name = name; + } + + public LayoutTrackDrawingOptions(LayoutTrackDrawingOptions ltdo) { + name = ltdo.getName(); + sideBallastWidth = ltdo.getSideBallastWidth(); + sideBallastColor = ltdo.getSideBallastColor(); + sideTieLength = ltdo.getSideTieLength(); + sideTieWidth = ltdo.getSideTieWidth(); + sideTieColor = ltdo.getSideTieColor(); + sideTieGap = ltdo.getSideTieGap(); + sideRailCount = ltdo.getSideRailCount(); + sideRailWidth = ltdo.getSideRailWidth(); + sideRailGap = ltdo.getSideRailGap(); + sideRailColor = ltdo.getSideRailColor(); + sideBlockLineWidth = ltdo.getSideBlockLineWidth(); + mainBallastWidth = ltdo.getMainBallastWidth(); + mainBallastColor = ltdo.getMainBallastColor(); + mainTieLength = ltdo.getMainTieLength(); + mainTieWidth = ltdo.getMainTieWidth(); + mainTieGap = ltdo.getMainTieGap(); + mainTieColor = ltdo.getMainTieColor(); + mainRailCount = ltdo.getMainRailCount(); + mainRailWidth = ltdo.getMainRailWidth(); + mainRailGap = ltdo.getMainRailGap(); + mainRailColor = ltdo.getMainRailColor(); + mainBlockLineWidth = ltdo.getMainBlockLineWidth(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + private int sideBallastWidth = 13; // defaults to zero (off) + + public int getSideBallastWidth() { + return sideBallastWidth; + } + + public void setSideBallastWidth(int val) { + sideBallastWidth = val; + } + + private Color sideBallastColor = Color.decode("#AEACAD"); + + public Color getSideBallastColor() { + return sideBallastColor; + } + + public void setSideBallastColor(@Nonnull Color val) { + sideBallastColor = val; + } + + private int sideTieLength = 9; + + public int getSideTieLength() { + return sideTieLength; + } + + public void setSideTieLength(int val) { + sideTieLength = val; + } + + private Color sideTieColor = Color.decode("#391E16"); + + public Color getSideTieColor() { + return sideTieColor; + } + + public void setSideTieColor(@Nonnull Color val) { + sideTieColor = val; + } + + private int sideTieWidth = 3; + + public int getSideTieWidth() { + return sideTieWidth; + } + + public void setSideTieWidth(int val) { + sideTieWidth = val; + } + + private int sideTieGap = 4; + + public int getSideTieGap() { + return sideTieGap; + } + + public void setSideTieGap(int val) { + sideTieGap = val; + } + + private int sideRailCount = 2; + + public int getSideRailCount() { + return sideRailCount; + } + + public void setSideRailCount(int val) { + sideRailCount = val; + } + + private int sideRailWidth = 1; + + public int getSideRailWidth() { + return sideRailWidth; + } + + public void setSideRailWidth(int val) { + sideRailWidth = val; + } + + private int sideRailGap = 3; + + public int getSideRailGap() { + return sideRailGap; + } + + public void setSideRailGap(int val) { + sideRailGap = val; + } + + private Color sideRailColor = Color.decode("#9B705E"); + + public Color getSideRailColor() { + return sideRailColor; + } + + public void setSideRailColor(@Nonnull Color val) { + sideRailColor = val; + } + + private int sideBlockLineWidth = 3; + + public int getSideBlockLineWidth() { + return sideBlockLineWidth; + } + + public void setSideBlockLineWidth(int val) { + sideBlockLineWidth = val; + } + + private int mainBallastWidth = 15; // defaults to zero (off) + + public int getMainBallastWidth() { + return mainBallastWidth; + } + + public void setMainBallastWidth(int val) { + mainBallastWidth = val; + } + + private Color mainBallastColor = Color.decode("#9E9C9D"); + + public Color getMainBallastColor() { + return mainBallastColor; + } + + public void setMainBallastColor(@Nonnull Color val) { + mainBallastColor = val; + } + + private int mainTieLength = 11; + + public int getMainTieLength() { + return mainTieLength; + } + + public void setMainTieLength(int val) { + mainTieLength = val; + } + + private Color mainTieColor = Color.decode("#D5CFCC"); + + public Color getMainTieColor() { + return mainTieColor; + } + + public void setMainTieColor(@Nonnull Color val) { + mainTieColor = val; + } + + private int mainTieWidth = 2; + + public int getMainTieWidth() { + return mainTieWidth; + } + + public void setMainTieWidth(int val) { + mainTieWidth = val; + } + + private int mainTieGap = 5; + + public int getMainTieGap() { + return mainTieGap; + } + + public void setMainTieGap(int val) { + mainTieGap = val; + } + + private int mainRailCount = 2; + + public int getMainRailCount() { + return mainRailCount; + } + + public void setMainRailCount(int val) { + mainRailCount = val; + } + + private int mainRailWidth = 2; + + public int getMainRailWidth() { + return mainRailWidth; + } + + public void setMainRailWidth(int val) { + mainRailWidth = val; + } + + private int mainRailGap = 3; + + public int getMainRailGap() { + return mainRailGap; + } + + public void setMainRailGap(int val) { + mainRailGap = val; + } + + private Color mainRailColor = Color.decode("#C0BFBF"); + + public Color getMainRailColor() { + return mainRailColor; + } + + public void setMainRailColor(@Nonnull Color val) { + mainRailColor = val; + } + + private int mainBlockLineWidth = 3; + + public int getMainBlockLineWidth() { + return mainBlockLineWidth; + } + + public void setMainBlockLineWidth(int val) { + mainBlockLineWidth = val; + } + + // + public boolean equalsAllButName(@Nonnull LayoutTrackDrawingOptions ltdo) { + boolean result = true; // assume success (optimist!) + if (this != ltdo) { + result = false; // assume failure (pessimist!) + if (ltdo != null) { + String tempName = name; + name = ltdo.getName(); + result = this.equals(ltdo); + name = tempName; + } + } + return result; + } + + @Override + public boolean equals(Object obj) { + boolean result = true; // assume success (optimist!) + if (obj != this) { + result = false; // assume failure (pessimist!) + if ((obj != null) && (getClass() == obj.getClass())) { + LayoutTrackDrawingOptions ltdo = (LayoutTrackDrawingOptions) obj; + + do { + if (!name.equals(ltdo.getName())) { + break; + } + if (sideBallastWidth != ltdo.getSideBallastWidth()) { + break; + } + if (!sideBallastColor.equals(ltdo.getSideBallastColor())) { + break; + } + if (sideTieLength != ltdo.getSideTieLength()) { + break; + } + if (!sideTieColor.equals(ltdo.getSideTieColor())) { + break; + } + + if (sideTieGap != ltdo.getSideTieGap()) { + break; + } + if (sideRailCount != ltdo.getSideRailCount()) { + break; + } + if (sideRailWidth != ltdo.getSideRailWidth()) { + break; + } + if (sideRailGap != ltdo.getSideRailGap()) { + break; + } + if (!sideRailColor.equals(ltdo.getSideRailColor())) { + break; + } + + if (sideBlockLineWidth != ltdo.getSideBlockLineWidth()) { + break; + } + + if (mainBallastWidth != ltdo.getMainBallastWidth()) { + break; + } + if (!mainBallastColor.equals(ltdo.getMainBallastColor())) { + break; + } + + if (mainTieLength != ltdo.getMainTieLength()) { + break; + } + if (!mainTieColor.equals(ltdo.getMainTieColor())) { + break; + } + + if (mainTieWidth != ltdo.getMainTieWidth()) { + break; + } + if (mainTieGap != ltdo.getMainTieGap()) { + break; + } + if (mainRailCount != ltdo.getMainRailCount()) { + break; + } + if (mainRailWidth != ltdo.getMainRailWidth()) { + break; + } + if (mainRailGap != ltdo.getMainRailGap()) { + break; + } + if (!mainRailColor.equals(ltdo.getMainRailColor())) { + break; + } + if (mainBlockLineWidth != ltdo.getMainBlockLineWidth()) { + break; + } + } while (false); + result = true; + } + } + return result; + } + + /** + * Hash on the header + */ + @Override + public int hashCode() { + int result = 7; + result = (37 * result) + (name != null ? name.hashCode() : 0); + + // sideline values + result = (37 * result) + sideBallastWidth; + result = (37 * result) + (sideBallastColor == null ? 0 : sideBallastColor.hashCode()); + result = (37 * result) + sideTieLength; + result = (37 * result) + (sideTieColor == null ? 0 : sideTieColor.hashCode()); + result = (37 * result) + sideTieGap; + result = (37 * result) + sideRailCount; + result = (37 * result) + sideRailWidth; + result = (37 * result) + sideRailGap; + result = (37 * result) + (sideRailColor == null ? 0 : sideRailColor.hashCode()); + result = (37 * result) + sideBlockLineWidth; + + // mainline values + result = (37 * result) + mainBallastWidth; + result = (37 * result) + (mainBallastColor == null ? 0 : mainBallastColor.hashCode()); + result = (37 * result) + mainTieLength; + result = (37 * result) + (mainTieColor == null ? 0 : mainTieColor.hashCode()); + result = (37 * result) + mainTieWidth; + result = (37 * result) + mainTieGap; + result = (37 * result) + mainRailCount; + result = (37 * result) + mainRailWidth; + result = (37 * result) + mainRailGap; + result = (37 * result) + (mainRailColor == null ? 0 : mainRailColor.hashCode()); + result = (37 * result) + mainBlockLineWidth; + + return result; + } + +} diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form new file mode 100644 index 00000000000..44e9157e9a3 --- /dev/null +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form @@ -0,0 +1,1316 @@ + + +

                + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java new file mode 100644 index 00000000000..a8df9175e54 --- /dev/null +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java @@ -0,0 +1,1251 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package jmri.jmrit.display.layoutEditor; + +import java.awt.Color; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.util.ArrayList; +import java.util.List; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JColorChooser; +import javax.swing.JDialog; +import javax.swing.JSpinner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Handle changing layout editor drawing options + * + * @author George Warner Copyright (C) 2017 + */ +public class LayoutTrackDrawingOptionsDialog extends JDialog { + + private final LayoutEditor layoutEditor; + private final LayoutTrackDrawingOptions leLTDOptions; + private LayoutTrackDrawingOptions ltdOptions = null; + + private String classicPresetName = Bundle.getMessage("ClassicPresetName"); + private String draftingPresetName = Bundle.getMessage("DraftingPresetName"); + private String realisticPresetName = Bundle.getMessage("RealisticPresetName"); + private String realisticOhPresetName = Bundle.getMessage("RealisticOhPresetName"); + private String garishPresetName = Bundle.getMessage("GarishPresetName"); + private String customPresetName = Bundle.getMessage("CustomPresetName"); + + private final List ltdoList = new ArrayList<>(); + + /** + * Creates new form LayoutTrackDrawingOptionsDialog + */ + public LayoutTrackDrawingOptionsDialog(Frame parentFrame, boolean modal, + LayoutTrackDrawingOptions ltdOptions) { + super(parentFrame, modal); + + this.layoutEditor = (LayoutEditor) parentFrame; + this.leLTDOptions = ltdOptions; + this.ltdOptions = new LayoutTrackDrawingOptions(ltdOptions); + + initComponents(); + setLocationRelativeTo(parentFrame); + definePresets(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + buttonGroup1 = new javax.swing.ButtonGroup(); + OptionsPanel = new javax.swing.JPanel(); + optionLabel = new javax.swing.JLabel(); + mainlineLabel = new javax.swing.JLabel(); + railCountLabel = new javax.swing.JLabel(); + mainRailCountSpinner = new javax.swing.JSpinner(); + sideRailCountSpinner = new javax.swing.JSpinner(); + railWidthLabel = new javax.swing.JLabel(); + mainRailWidthSpinner = new javax.swing.JSpinner(); + sideRailWidthSpinner = new javax.swing.JSpinner(); + railGapLabel = new javax.swing.JLabel(); + sideRailGapSpinner = new javax.swing.JSpinner(); + mainRailGapSpinner = new javax.swing.JSpinner(); + javax.swing.JLabel railColorLabel = new javax.swing.JLabel(); + mainRailColorButton = new javax.swing.JButton(); + sideRailColorButton = new javax.swing.JButton(); + blockLineWidthLabel = new javax.swing.JLabel(); + mainBlockLineWidthSpinner = new javax.swing.JSpinner(); + sideBlockLineWidthSpinner = new javax.swing.JSpinner(); + ballastWidthLabel = new javax.swing.JLabel(); + mainBallastWidthSpinner = new javax.swing.JSpinner(); + sideBallastWidthSpinner = new javax.swing.JSpinner(); + javax.swing.JLabel ballastColorLabel = new javax.swing.JLabel(); + mainBallastColorButton = new javax.swing.JButton(); + sideBallastColorButton = new javax.swing.JButton(); + tieLengthLabel = new javax.swing.JLabel(); + mainTieLengthSpinner = new javax.swing.JSpinner(); + sideTieLengthSpinner = new javax.swing.JSpinner(); + tieWidthLabel = new javax.swing.JLabel(); + mainTieWidthSpinner = new javax.swing.JSpinner(); + sideTieWidthSpinner = new javax.swing.JSpinner(); + tieGapLabel = new javax.swing.JLabel(); + mainTieGapSpinner = new javax.swing.JSpinner(); + sideTieGapSpinner = new javax.swing.JSpinner(); + javax.swing.JLabel tieColorLabel = new javax.swing.JLabel(); + mainTieColorButton = new javax.swing.JButton(); + sideTieColorButton = new javax.swing.JButton(); + sidelineLabel = new javax.swing.JLabel(); + presetsComboBox = new javax.swing.JComboBox<>(); + cancelButton = new javax.swing.JButton(); + okButton = new javax.swing.JButton(); + presetsLabel = new javax.swing.JLabel(); + applyButton = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setMaximumSize(new java.awt.Dimension(512, 329)); + setMinimumSize(new java.awt.Dimension(512, 329)); + setResizable(false); + setSize(new java.awt.Dimension(512, 329)); + + OptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(ltdOptions.getName())); + OptionsPanel.setMaximumSize(new java.awt.Dimension(800, 529)); + OptionsPanel.setMinimumSize(new java.awt.Dimension(800, 529)); + OptionsPanel.setPreferredSize(new java.awt.Dimension(800, 529)); + OptionsPanel.setSize(new java.awt.Dimension(800, 529)); + + optionLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + optionLabel.setText(Bundle.getMessage("OptionLabelText")); + optionLabel.setToolTipText(Bundle.getMessage("OptionToolTip")); + optionLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + optionLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + optionLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + optionLabel.setSize(new java.awt.Dimension(256, 16)); + + mainlineLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + mainlineLabel.setText(Bundle.getMessage("MainlineLabelText")); + mainlineLabel.setToolTipText(Bundle.getMessage("MainlineColumnToolTip")); + mainlineLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + mainlineLabel.setMinimumSize(new java.awt.Dimension(64, 16)); + mainlineLabel.setPreferredSize(new java.awt.Dimension(64, 16)); + mainlineLabel.setSize(new java.awt.Dimension(64, 16)); + + railCountLabel.setText(Bundle.getMessage("RailCountLabelText")); + railCountLabel.setToolTipText(Bundle.getMessage("RailCountToolTip")); + railCountLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + railCountLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + railCountLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + railCountLabel.setSize(new java.awt.Dimension(256, 16)); + + mainRailCountSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 0, 3, 1)); + mainRailCountSpinner.setToolTipText(Bundle.getMessage("MainRailCountToolTip")); + mainRailCountSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainRailCountSpinner.setName(""); // NOI18N + mainRailCountSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainRailCountSpinner.setSize(new java.awt.Dimension(64, 16)); + mainRailCountSpinner.setValue(ltdOptions.getMainRailCount()); + mainRailCountSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainRailCountSpinnerStateChanged(evt); + } + }); + + sideRailCountSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 0, 3, 1)); + sideRailCountSpinner.setToolTipText(Bundle.getMessage("SideRailCountToolTip")); + sideRailCountSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideRailCountSpinner.setName(""); // NOI18N + sideRailCountSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideRailCountSpinner.setSize(new java.awt.Dimension(64, 16)); + sideRailCountSpinner.setValue(ltdOptions.getSideRailCount()); + sideRailCountSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideRailCountSpinnerStateChanged(evt); + } + }); + + railWidthLabel.setText(Bundle.getMessage("RailWidthLabelText")); + railWidthLabel.setToolTipText(Bundle.getMessage("RailWidthToolTip")); + railWidthLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + railWidthLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + railWidthLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + railWidthLabel.setSize(new java.awt.Dimension(256, 16)); + + mainRailWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); + mainRailWidthSpinner.setToolTipText(Bundle.getMessage("MainRailWidthToolTip")); + mainRailWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainRailWidthSpinner.setName(""); // NOI18N + mainRailWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainRailWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + mainRailWidthSpinner.setValue(ltdOptions.getMainRailWidth()); + mainRailWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainRailWidthSpinnerStateChanged(evt); + } + }); + + sideRailWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); + sideRailWidthSpinner.setToolTipText(Bundle.getMessage("SideRailWidthToolTip")); + sideRailWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideRailWidthSpinner.setName(""); // NOI18N + sideRailWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideRailWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + sideRailWidthSpinner.setValue(ltdOptions.getSideRailWidth()); + sideRailWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideRailWidthSpinnerStateChanged(evt); + } + }); + + railGapLabel.setText(Bundle.getMessage("RailGapLabelText")); + railGapLabel.setToolTipText(Bundle.getMessage("RailGapToolTip")); + railGapLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + railGapLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + railGapLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + railGapLabel.setSize(new java.awt.Dimension(256, 16)); + + sideRailGapSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); + sideRailGapSpinner.setToolTipText(Bundle.getMessage("SideRailGapToolTip")); + sideRailGapSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideRailGapSpinner.setName(""); // NOI18N + sideRailGapSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideRailGapSpinner.setSize(new java.awt.Dimension(64, 16)); + sideRailGapSpinner.setValue(ltdOptions.getSideRailGap()); + sideRailGapSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideRailGapSpinnerStateChanged(evt); + } + }); + + mainRailGapSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); + mainRailGapSpinner.setToolTipText(Bundle.getMessage("MainRailGapToolTip")); + mainRailGapSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainRailGapSpinner.setName(""); // NOI18N + mainRailGapSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainRailGapSpinner.setSize(new java.awt.Dimension(64, 16)); + mainRailGapSpinner.setValue(ltdOptions.getMainRailGap()); + mainRailGapSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainRailGapSpinnerStateChanged(evt); + } + }); + + railColorLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + railColorLabel.setText(Bundle.getMessage("RailColorLabelText")); + railColorLabel.setToolTipText(Bundle.getMessage("RailColorToolTip")); + railColorLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + railColorLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + railColorLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + railColorLabel.setSize(new java.awt.Dimension(256, 16)); + + mainRailColorButton.setBackground(ltdOptions.getMainRailColor()); + mainRailColorButton.setToolTipText(Bundle.getMessage("MainRailColorToolTip")); + mainRailColorButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + mainRailColorButton.setMaximumSize(new java.awt.Dimension(32767, 32767)); + mainRailColorButton.setMinimumSize(new java.awt.Dimension(64, 16)); + mainRailColorButton.setOpaque(true); + mainRailColorButton.setPreferredSize(new java.awt.Dimension(64, 16)); + mainRailColorButton.setSize(new java.awt.Dimension(64, 16)); + mainRailColorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mainRailColorButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout mainRailColorButtonLayout = new javax.swing.GroupLayout(mainRailColorButton); + mainRailColorButton.setLayout(mainRailColorButtonLayout); + mainRailColorButtonLayout.setHorizontalGroup( + mainRailColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 60, Short.MAX_VALUE) + ); + mainRailColorButtonLayout.setVerticalGroup( + mainRailColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 12, Short.MAX_VALUE) + ); + + sideRailColorButton.setBackground(ltdOptions.getSideRailColor()); + sideRailColorButton.setToolTipText(Bundle.getMessage("SideRailColorToolTip")); + sideRailColorButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + sideRailColorButton.setMaximumSize(new java.awt.Dimension(32767, 32767)); + sideRailColorButton.setMinimumSize(new java.awt.Dimension(64, 16)); + sideRailColorButton.setOpaque(true); + sideRailColorButton.setPreferredSize(new java.awt.Dimension(64, 16)); + sideRailColorButton.setSize(new java.awt.Dimension(64, 16)); + sideRailColorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + sideRailColorButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout sideRailColorButtonLayout = new javax.swing.GroupLayout(sideRailColorButton); + sideRailColorButton.setLayout(sideRailColorButtonLayout); + sideRailColorButtonLayout.setHorizontalGroup( + sideRailColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 60, Short.MAX_VALUE) + ); + sideRailColorButtonLayout.setVerticalGroup( + sideRailColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 12, Short.MAX_VALUE) + ); + + blockLineWidthLabel.setText(Bundle.getMessage("BlockLineWidthLabelText")); + blockLineWidthLabel.setToolTipText(Bundle.getMessage("BlockLineWidthToolTip")); + blockLineWidthLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + blockLineWidthLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + blockLineWidthLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + blockLineWidthLabel.setSize(new java.awt.Dimension(256, 16)); + + mainBlockLineWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); + mainBlockLineWidthSpinner.setToolTipText(Bundle.getMessage("MainBlockLineWidthToolTip")); + mainBlockLineWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainBlockLineWidthSpinner.setName(""); // NOI18N + mainBlockLineWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainBlockLineWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + mainBlockLineWidthSpinner.setValue(ltdOptions.getMainBlockLineWidth()); + mainBlockLineWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainBlockLineWidthSpinnerStateChanged(evt); + } + }); + + sideBlockLineWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1)); + sideBlockLineWidthSpinner.setToolTipText(Bundle.getMessage("SideBlockLineWidthToolTip")); + sideBlockLineWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideBlockLineWidthSpinner.setName(""); // NOI18N + sideBlockLineWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideBlockLineWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + sideBlockLineWidthSpinner.setValue(ltdOptions.getSideBlockLineWidth()); + sideBlockLineWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideBlockLineWidthSpinnerStateChanged(evt); + } + }); + + ballastWidthLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + ballastWidthLabel.setText(Bundle.getMessage("BallastWidthLabelText")); + ballastWidthLabel.setToolTipText(Bundle.getMessage("BallastWidthToolTip")); + ballastWidthLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + ballastWidthLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + ballastWidthLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + ballastWidthLabel.setSize(new java.awt.Dimension(256, 16)); + + mainBallastWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + mainBallastWidthSpinner.setToolTipText(Bundle.getMessage("MainBallastWidthToolTip")); + mainBallastWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainBallastWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainBallastWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + mainBallastWidthSpinner.setValue(ltdOptions.getMainBallastWidth()); + mainBallastWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainBallastWidthSpinnerStateChanged(evt); + } + }); + + sideBallastWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + sideBallastWidthSpinner.setToolTipText(Bundle.getMessage("SideBallastWidthToolTip")); + sideBallastWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideBallastWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideBallastWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + sideBallastWidthSpinner.setValue(ltdOptions.getSideBallastWidth()); + sideBallastWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideBallastWidthSpinnerStateChanged(evt); + } + }); + + ballastColorLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + ballastColorLabel.setText(Bundle.getMessage("BallastColorLabelText")); + ballastColorLabel.setToolTipText(Bundle.getMessage("BallastColorToolTip")); + ballastColorLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + ballastColorLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + ballastColorLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + ballastColorLabel.setSize(new java.awt.Dimension(256, 16)); + + mainBallastColorButton.setBackground(ltdOptions.getMainBallastColor()); + mainBallastColorButton.setToolTipText(Bundle.getMessage("MainBallastColorToolTip")); + mainBallastColorButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + mainBallastColorButton.setMaximumSize(new java.awt.Dimension(32767, 32767)); + mainBallastColorButton.setMinimumSize(new java.awt.Dimension(64, 16)); + mainBallastColorButton.setOpaque(true); + mainBallastColorButton.setPreferredSize(new java.awt.Dimension(64, 16)); + mainBallastColorButton.setSize(new java.awt.Dimension(64, 16)); + mainBallastColorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mainBallastColorButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout mainBallastColorButtonLayout = new javax.swing.GroupLayout(mainBallastColorButton); + mainBallastColorButton.setLayout(mainBallastColorButtonLayout); + mainBallastColorButtonLayout.setHorizontalGroup( + mainBallastColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 60, Short.MAX_VALUE) + ); + mainBallastColorButtonLayout.setVerticalGroup( + mainBallastColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 12, Short.MAX_VALUE) + ); + + sideBallastColorButton.setBackground(ltdOptions.getSideBallastColor()); + sideBallastColorButton.setToolTipText(Bundle.getMessage("SideBallastColorToolTip")); + sideBallastColorButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + sideBallastColorButton.setMaximumSize(new java.awt.Dimension(32767, 32767)); + sideBallastColorButton.setMinimumSize(new java.awt.Dimension(64, 16)); + sideBallastColorButton.setOpaque(true); + sideBallastColorButton.setPreferredSize(new java.awt.Dimension(64, 16)); + sideBallastColorButton.setSize(new java.awt.Dimension(64, 16)); + sideBallastColorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + sideBallastColorButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout sideBallastColorButtonLayout = new javax.swing.GroupLayout(sideBallastColorButton); + sideBallastColorButton.setLayout(sideBallastColorButtonLayout); + sideBallastColorButtonLayout.setHorizontalGroup( + sideBallastColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 60, Short.MAX_VALUE) + ); + sideBallastColorButtonLayout.setVerticalGroup( + sideBallastColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 12, Short.MAX_VALUE) + ); + + tieLengthLabel.setText(Bundle.getMessage("TieLengthLabelText")); + tieLengthLabel.setToolTipText(Bundle.getMessage("TieLengthToolTip")); + tieLengthLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + tieLengthLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + tieLengthLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + tieLengthLabel.setSize(new java.awt.Dimension(256, 16)); + + mainTieLengthSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + mainTieLengthSpinner.setToolTipText(Bundle.getMessage("MainTieLengthToolTip")); + mainTieLengthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainTieLengthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainTieLengthSpinner.setSize(new java.awt.Dimension(64, 16)); + mainTieLengthSpinner.setValue(ltdOptions.getMainTieLength()); + mainTieLengthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainTieLengthSpinnerStateChanged(evt); + } + }); + + sideTieLengthSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + sideTieLengthSpinner.setToolTipText(Bundle.getMessage("SideTieLengthToolTip")); + sideTieLengthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideTieLengthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideTieLengthSpinner.setSize(new java.awt.Dimension(64, 16)); + sideTieLengthSpinner.setValue(ltdOptions.getSideTieLength()); + sideTieLengthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideTieLengthSpinnerStateChanged(evt); + } + }); + + tieWidthLabel.setText(Bundle.getMessage("TieWidthLabelText")); + tieWidthLabel.setToolTipText(Bundle.getMessage("TieWidthToolTip")); + tieWidthLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + tieWidthLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + tieWidthLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + tieWidthLabel.setSize(new java.awt.Dimension(256, 16)); + + mainTieWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + mainTieWidthSpinner.setToolTipText(Bundle.getMessage("MainTieWidthToolTip")); + mainTieWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainTieWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainTieWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + mainTieWidthSpinner.setValue(ltdOptions.getMainTieWidth()); + mainTieWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainTieWidthSpinnerStateChanged(evt); + } + }); + + sideTieWidthSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + sideTieWidthSpinner.setToolTipText(Bundle.getMessage("SideTieWidthToolTip")); + sideTieWidthSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideTieWidthSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideTieWidthSpinner.setSize(new java.awt.Dimension(64, 16)); + sideTieWidthSpinner.setValue(ltdOptions.getSideTieWidth()); + sideTieWidthSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideTieWidthSpinnerStateChanged(evt); + } + }); + + tieGapLabel.setText(Bundle.getMessage("TieGapLabelText")); + tieGapLabel.setToolTipText(Bundle.getMessage("TieGapToolTip")); + tieGapLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + tieGapLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + tieGapLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + tieGapLabel.setSize(new java.awt.Dimension(256, 16)); + + mainTieGapSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + mainTieGapSpinner.setToolTipText(Bundle.getMessage("MainTieGapToolTip")); + mainTieGapSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + mainTieGapSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + mainTieGapSpinner.setSize(new java.awt.Dimension(64, 16)); + mainTieGapSpinner.setValue(ltdOptions.getMainTieGap()); + mainTieGapSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + mainTieGapSpinnerStateChanged(evt); + } + }); + + sideTieGapSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); + sideTieGapSpinner.setToolTipText(Bundle.getMessage("SideTieGapToolTip")); + sideTieGapSpinner.setMinimumSize(new java.awt.Dimension(64, 16)); + sideTieGapSpinner.setPreferredSize(new java.awt.Dimension(64, 16)); + sideTieGapSpinner.setSize(new java.awt.Dimension(64, 16)); + sideTieGapSpinner.setValue(ltdOptions.getSideTieGap()); + sideTieGapSpinner.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + sideTieGapSpinnerStateChanged(evt); + } + }); + + tieColorLabel.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N + tieColorLabel.setText(Bundle.getMessage("TieColorLabelText")); + tieColorLabel.setToolTipText(Bundle.getMessage("TieColorToolTip")); + tieColorLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + tieColorLabel.setMinimumSize(new java.awt.Dimension(256, 16)); + tieColorLabel.setPreferredSize(new java.awt.Dimension(256, 16)); + tieColorLabel.setSize(new java.awt.Dimension(256, 16)); + + mainTieColorButton.setBackground(ltdOptions.getMainTieColor()); + mainTieColorButton.setToolTipText(Bundle.getMessage("MainTieColorToolTip")); + mainTieColorButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + mainTieColorButton.setMaximumSize(new java.awt.Dimension(32767, 32767)); + mainTieColorButton.setMinimumSize(new java.awt.Dimension(64, 16)); + mainTieColorButton.setOpaque(true); + mainTieColorButton.setPreferredSize(new java.awt.Dimension(64, 16)); + mainTieColorButton.setSize(new java.awt.Dimension(64, 16)); + mainTieColorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mainTieColorButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout mainTieColorButtonLayout = new javax.swing.GroupLayout(mainTieColorButton); + mainTieColorButton.setLayout(mainTieColorButtonLayout); + mainTieColorButtonLayout.setHorizontalGroup( + mainTieColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 60, Short.MAX_VALUE) + ); + mainTieColorButtonLayout.setVerticalGroup( + mainTieColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 12, Short.MAX_VALUE) + ); + + sideTieColorButton.setBackground(ltdOptions.getSideTieColor()); + sideTieColorButton.setToolTipText(Bundle.getMessage("SideTieColorToolTip")); + sideTieColorButton.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + sideTieColorButton.setMaximumSize(new java.awt.Dimension(32767, 32767)); + sideTieColorButton.setMinimumSize(new java.awt.Dimension(64, 16)); + sideTieColorButton.setOpaque(true); + sideTieColorButton.setPreferredSize(new java.awt.Dimension(64, 16)); + sideTieColorButton.setSize(new java.awt.Dimension(64, 16)); + sideTieColorButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + sideTieColorButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout sideTieColorButtonLayout = new javax.swing.GroupLayout(sideTieColorButton); + sideTieColorButton.setLayout(sideTieColorButtonLayout); + sideTieColorButtonLayout.setHorizontalGroup( + sideTieColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 60, Short.MAX_VALUE) + ); + sideTieColorButtonLayout.setVerticalGroup( + sideTieColorButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 12, Short.MAX_VALUE) + ); + + sidelineLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N + sidelineLabel.setText(Bundle.getMessage("SidelineLabelText")); + sidelineLabel.setToolTipText(Bundle.getMessage("SidelineColumnToolTip")); + sidelineLabel.setMaximumSize(new java.awt.Dimension(32767, 32767)); + sidelineLabel.setMinimumSize(new java.awt.Dimension(64, 16)); + sidelineLabel.setPreferredSize(new java.awt.Dimension(64, 16)); + sidelineLabel.setSize(new java.awt.Dimension(64, 16)); + + javax.swing.GroupLayout OptionsPanelLayout = new javax.swing.GroupLayout(OptionsPanel); + OptionsPanel.setLayout(OptionsPanelLayout); + OptionsPanelLayout.setHorizontalGroup( + OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(OptionsPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(tieColorLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tieGapLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tieWidthLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(tieLengthLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(ballastColorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(ballastWidthLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(blockLineWidthLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(railColorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(railGapLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(optionLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(railWidthLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(railCountLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(mainlineLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainRailCountSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainRailWidthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainRailGapSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainRailColorButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainBlockLineWidthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainBallastWidthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainBallastColorButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainTieLengthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainTieWidthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainTieGapSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(mainTieColorButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, OptionsPanelLayout.createSequentialGroup() + .addGap(12, 12, 12) + .addComponent(sideTieColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(OptionsPanelLayout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(sideRailCountSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideRailWidthSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideRailGapSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideRailColorButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideBlockLineWidthSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideBallastWidthSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideBallastColorButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideTieLengthSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideTieWidthSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sideTieGapSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(sidelineLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + ); + + OptionsPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {mainBallastColorButton, mainBallastWidthSpinner, mainBlockLineWidthSpinner, mainRailColorButton, mainRailCountSpinner, mainRailGapSpinner, mainRailWidthSpinner, mainTieColorButton, mainTieGapSpinner, mainTieLengthSpinner, mainTieWidthSpinner, mainlineLabel, sideBallastColorButton, sideBallastWidthSpinner, sideBlockLineWidthSpinner, sideRailColorButton, sideRailCountSpinner, sideRailGapSpinner, sideRailWidthSpinner, sideTieColorButton, sideTieGapSpinner, sideTieLengthSpinner, sideTieWidthSpinner, sidelineLabel}); + + OptionsPanelLayout.setVerticalGroup( + OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(OptionsPanelLayout.createSequentialGroup() + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(OptionsPanelLayout.createSequentialGroup() + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(OptionsPanelLayout.createSequentialGroup() + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(sidelineLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainlineLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(optionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(railCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainRailCountSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideRailCountSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(railWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainRailWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideRailWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(railGapLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainRailGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideRailGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(railColorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainRailColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideRailColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(blockLineWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainBlockLineWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideBlockLineWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ballastWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainBallastWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideBallastWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ballastColorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideBallastColorButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(mainBallastColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tieLengthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainTieLengthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideTieLengthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tieWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainTieWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideTieWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tieGapLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(mainTieGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideTieGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tieColorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(sideTieColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(mainTieColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + OptionsPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {ballastColorLabel, ballastWidthLabel, blockLineWidthLabel, mainBallastColorButton, mainBallastWidthSpinner, mainBlockLineWidthSpinner, mainRailColorButton, mainRailCountSpinner, mainRailGapSpinner, mainRailWidthSpinner, mainTieColorButton, mainTieGapSpinner, mainTieLengthSpinner, mainTieWidthSpinner, mainlineLabel, optionLabel, railColorLabel, railCountLabel, railGapLabel, railWidthLabel, sideBallastColorButton, sideBallastWidthSpinner, sideBlockLineWidthSpinner, sideRailColorButton, sideRailCountSpinner, sideRailGapSpinner, sideRailWidthSpinner, sideTieColorButton, sideTieGapSpinner, sideTieLengthSpinner, sideTieWidthSpinner, sidelineLabel, tieColorLabel, tieGapLabel, tieLengthLabel, tieWidthLabel}); + + presetsComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Classic JMRI", "Drafting", "Realistic", "Realistic Oh!", "Garrish", "--", "Custom" })); + presetsComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + presetsComboBoxActionPerformed(evt); + } + }); + + cancelButton.setText("Cancel"); + cancelButton.setActionCommand("cancelActionCommand"); + cancelButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cancelButtonActionPerformed(evt); + } + }); + + okButton.setText("Ok"); + okButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + okButtonActionPerformed(evt); + } + }); + + presetsLabel.setText("Presets:"); + + applyButton.setText("Apply"); + applyButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + applyButtonActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(presetsLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(presetsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(applyButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(okButton)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(OptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 506, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(OptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(presetsLabel) + .addComponent(presetsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cancelButton) + .addComponent(okButton) + .addComponent(applyButton)) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + /*==========================*\ + |* action performed methods *| + \*==========================*/ + + private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed + log.debug("okButtonActionPerformed({}", evt); + ltdOptions.setName(layoutEditor.getLayoutName()); + layoutEditor.setLayoutTrackDrawingOptions(ltdOptions); + ltdOptions = null; + setVisible(false); + dispose(); + }//GEN-LAST:event_okButtonActionPerformed + + private void presetsComboBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:event_presetsComboBoxActionPerformed + log.debug("presetsComboBoxActionPerformed({}", evt); + int modifiers = evt.getModifiers(); + if (modifiers != 0) { // don't do this unless it's a mouse click + String presetName = (String) presetsComboBox.getSelectedItem(); + for (LayoutTrackDrawingOptions ltdo : ltdoList) { + if (ltdo.getName().equals(presetName)) { + if (!ltdOptions.getName().equals(ltdo.getName())) { + ltdOptions = ltdo; + setupControls(); + OptionsPanel.setBorder(BorderFactory.createTitledBorder(presetName)); + presetsComboBox.setSelectedItem(presetName); + } + break; + } + } + } + }//GEN-LAST:event_presetsComboBoxActionPerformed + + private void cancelButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed + log.debug("cancelButtonActionPerformed({}", evt); + // restore orginal settings + layoutEditor.setLayoutTrackDrawingOptions(leLTDOptions); + setVisible(false); + dispose(); + }//GEN-LAST:event_cancelButtonActionPerformed + + private void sideTieGapSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideTieGapSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideTieGap(value.intValue()); + log.debug("sideTieGapSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideTieGapSpinnerStateChanged + + private void mainTieGapSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainTieGapSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainTieGap(value.intValue()); + log.debug("mainTieGapSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainTieGapSpinnerStateChanged + + private void sideTieWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideTieWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideTieWidth(value.intValue()); + log.debug("sideTieWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideTieWidthSpinnerStateChanged + + private void mainTieWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainTieWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainTieWidth(value.intValue()); + log.debug("mainTieWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainTieWidthSpinnerStateChanged + + private void sideTieLengthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideTieLengthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideTieLength(value.intValue()); + log.debug("sideTieLengthSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideTieLengthSpinnerStateChanged + + private void mainTieLengthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainTieLengthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainTieLength(value.intValue()); + log.debug("mainTieLengthSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainTieLengthSpinnerStateChanged + + private void sideBallastWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideBallastWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideBallastWidth(value.intValue()); + log.debug("sideBallastWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideBallastWidthSpinnerStateChanged + + private void mainBallastWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainBallastWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainBallastWidth(value.intValue()); + log.debug("mainBallastWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainBallastWidthSpinnerStateChanged + + private void sideBlockLineWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideBlockLineWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideBlockLineWidth(value.intValue()); + log.debug("sideBlockLineWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideBlockLineWidthSpinnerStateChanged + + private void mainBlockLineWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainBlockLineWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainBlockLineWidth(value.intValue()); + log.debug("mainBlockLineWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainBlockLineWidthSpinnerStateChanged + + private void mainRailGapSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainRailGapSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainRailGap(value.intValue()); + log.debug("sideRailGapSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainRailGapSpinnerStateChanged + + private void sideRailGapSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideRailGapSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideRailGap(value.intValue()); + log.debug("mainRailGapSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideRailGapSpinnerStateChanged + + private void sideRailWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideRailWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideRailWidth(value.intValue()); + log.debug("sideRailWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideRailWidthSpinnerStateChanged + + private void mainRailWidthSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainRailWidthSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainRailWidth(value.intValue()); + log.debug("mainRailWidthSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainRailWidthSpinnerStateChanged + + private void sideRailCountSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sideRailCountSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setSideRailCount(value.intValue()); + log.debug("sideRailCountSpinnerStateChanged({})", value); + }//GEN-LAST:event_sideRailCountSpinnerStateChanged + + private void mainRailCountSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mainRailCountSpinnerStateChanged + JSpinner spinner = (JSpinner) evt.getSource(); + Integer value = (Integer) spinner.getValue(); + makeCustomPreset(); + ltdOptions.setMainRailCount(value.intValue()); + log.debug("mainRailCountSpinnerStateChanged({})", value); + }//GEN-LAST:event_mainRailCountSpinnerStateChanged + + private void applyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyButtonActionPerformed + LayoutTrackDrawingOptions ltdo = new LayoutTrackDrawingOptions(ltdOptions); + ltdo.setName(layoutEditor.getLayoutName()); + layoutEditor.setLayoutTrackDrawingOptions(ltdo); + }//GEN-LAST:event_applyButtonActionPerformed + + private void mainRailColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainRailColorButtonActionPerformed + JButton button = (JButton) evt.getSource(); + Color value = button.getBackground(); + Color newColor = JColorChooser.showDialog(null, "Choose a color", value); + if ((newColor != null) && !newColor.equals(value)) { + makeCustomPreset(); + button.setBackground(newColor); + ltdOptions.setMainRailColor(newColor); + } + log.info("*mainRailColorButtonActionPerformed({})", newColor); + }//GEN-LAST:event_mainRailColorButtonActionPerformed + + private void sideRailColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sideRailColorButtonActionPerformed + JButton button = (JButton) evt.getSource(); + Color value = button.getBackground(); + Color newColor = JColorChooser.showDialog(null, "Choose a color", value); + if ((newColor != null) && !newColor.equals(value)) { + makeCustomPreset(); + button.setBackground(newColor); + ltdOptions.setSideRailColor(newColor); + } + log.info("*sideRailColorButtonActionPerformed({})", newColor); + }//GEN-LAST:event_sideRailColorButtonActionPerformed + + private void mainBallastColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainBallastColorButtonActionPerformed + JButton button = (JButton) evt.getSource(); + Color value = button.getBackground(); + Color newColor = JColorChooser.showDialog(null, "Choose a color", value); + if ((newColor != null) && !newColor.equals(value)) { + makeCustomPreset(); + button.setBackground(newColor); + ltdOptions.setMainBallastColor(newColor); + } + log.info("*mainBallastColorButtonActionPerformed({})", newColor); + }//GEN-LAST:event_mainBallastColorButtonActionPerformed + + private void sideBallastColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sideBallastColorButtonActionPerformed + JButton button = (JButton) evt.getSource(); + Color value = button.getBackground(); + Color newColor = JColorChooser.showDialog(null, "Choose a color", value); + if ((newColor != null) && !newColor.equals(value)) { + makeCustomPreset(); + button.setBackground(newColor); + ltdOptions.setSideBallastColor(newColor); + } + log.info("*sideBallastColorButtonActionPerformed({})", newColor); + }//GEN-LAST:event_sideBallastColorButtonActionPerformed + + private void mainTieColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mainTieColorButtonActionPerformed + JButton button = (JButton) evt.getSource(); + Color value = button.getBackground(); + Color newColor = JColorChooser.showDialog(null, "Choose a color", value); + if ((newColor != null) && !newColor.equals(value)) { + makeCustomPreset(); + button.setBackground(newColor); + ltdOptions.setMainTieColor(newColor); + } + log.info("*mainTieColorButtonActionPerformed({})", newColor); + }//GEN-LAST:event_mainTieColorButtonActionPerformed + + private void sideTieColorButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sideTieColorButtonActionPerformed + JButton button = (JButton) evt.getSource(); + Color value = button.getBackground(); + Color newColor = JColorChooser.showDialog(null, "Choose a color", value); + if ((newColor != null) && !newColor.equals(value)) { + makeCustomPreset(); + button.setBackground(newColor); + ltdOptions.setSideTieColor(newColor); + } + log.info("*sideTieColorButtonActionPerformed({})", newColor); + }//GEN-LAST:event_sideTieColorButtonActionPerformed + + /*=========================*\ + |* local (private) methods *| + \*=========================*/ + private void setupControls() { + copyToCustom = false; // prevent xxx.setValue's from creating custom preset + + mainBallastColorButton.setBackground(ltdOptions.getMainBallastColor()); + mainBallastWidthSpinner.setValue(ltdOptions.getMainBallastWidth()); + mainBlockLineWidthSpinner.setValue(ltdOptions.getMainBlockLineWidth()); + mainRailColorButton.setBackground(ltdOptions.getMainRailColor()); + mainRailCountSpinner.setValue(ltdOptions.getMainRailCount()); + mainRailGapSpinner.setValue(ltdOptions.getMainRailGap()); + mainRailWidthSpinner.setValue(ltdOptions.getMainRailWidth()); + mainTieColorButton.setBackground(ltdOptions.getMainTieColor()); + mainTieGapSpinner.setValue(ltdOptions.getMainTieGap()); + mainTieLengthSpinner.setValue(ltdOptions.getMainTieLength()); + mainTieWidthSpinner.setValue(ltdOptions.getMainTieWidth()); + sideBallastColorButton.setBackground(ltdOptions.getSideBallastColor()); + sideBallastWidthSpinner.setValue(ltdOptions.getSideBallastWidth()); + sideBlockLineWidthSpinner.setValue(ltdOptions.getSideBlockLineWidth()); + sideRailColorButton.setBackground(ltdOptions.getSideRailColor()); + sideRailCountSpinner.setValue(ltdOptions.getSideRailCount()); + sideRailGapSpinner.setValue(ltdOptions.getSideRailGap()); + sideRailWidthSpinner.setValue(ltdOptions.getSideRailWidth()); + sideTieColorButton.setBackground(ltdOptions.getSideTieColor()); + sideTieGapSpinner.setValue(ltdOptions.getSideTieGap()); + sideTieLengthSpinner.setValue(ltdOptions.getSideTieLength()); + sideTieWidthSpinner.setValue(ltdOptions.getSideTieWidth()); + copyToCustom = true; + } // setupControls + + // used to prevent xxx.setValue's in setupControls from creating custom preset + private boolean copyToCustom = true; + + private void makeCustomPreset() { + if (copyToCustom && !ltdOptions.getName().equals(customPresetName)) { + ltdOptions = new LayoutTrackDrawingOptions(ltdOptions); + ltdOptions.setName(customPresetName); + if (!ltdoList.get(ltdoList.size() - 1).getName().equals(customPresetName)) { + ltdoList.add(ltdOptions); + presetsComboBox.addItem(ltdOptions.getName()); + } + presetsComboBox.setSelectedItem(ltdOptions.getName()); + OptionsPanel.setBorder(BorderFactory.createTitledBorder((String) customPresetName)); + } + } + // define the presets + + private void definePresets() { + LayoutTrackDrawingOptions tempLTDO = new LayoutTrackDrawingOptions(classicPresetName); + tempLTDO.setMainBallastColor(Color.BLACK); + tempLTDO.setMainBallastWidth(0); + tempLTDO.setMainBlockLineWidth(4); + tempLTDO.setMainRailColor(Color.BLACK); + tempLTDO.setMainRailCount(0); + tempLTDO.setMainRailGap(0); + tempLTDO.setMainRailWidth(1); + tempLTDO.setMainTieColor(Color.BLACK); + tempLTDO.setMainTieGap(0); + tempLTDO.setMainTieLength(0); + tempLTDO.setMainTieWidth(0); + tempLTDO.setSideBallastColor(Color.BLACK); + tempLTDO.setSideBallastWidth(0); + tempLTDO.setSideBlockLineWidth(2); + tempLTDO.setSideRailColor(Color.BLACK); + tempLTDO.setSideRailCount(0); + tempLTDO.setSideRailGap(0); + tempLTDO.setSideRailWidth(1); + tempLTDO.setSideTieColor(Color.BLACK); + tempLTDO.setSideTieGap(0); + tempLTDO.setSideTieLength(0); + tempLTDO.setSideTieWidth(0); + ltdoList.add(tempLTDO); + + tempLTDO = new LayoutTrackDrawingOptions(draftingPresetName); + tempLTDO.setMainBallastColor(Color.BLACK); + tempLTDO.setMainBallastWidth(0); + tempLTDO.setMainBlockLineWidth(4); + tempLTDO.setMainRailColor(Color.DARK_GRAY); + tempLTDO.setMainRailCount(0); + tempLTDO.setMainRailGap(0); + tempLTDO.setMainRailWidth(1); + tempLTDO.setMainTieColor(Color.BLACK); + tempLTDO.setMainTieGap(0); + tempLTDO.setMainTieLength(0); + tempLTDO.setMainTieWidth(0); + tempLTDO.setSideBallastColor(Color.BLACK); + tempLTDO.setSideBallastWidth(0); + tempLTDO.setSideBlockLineWidth(2); + tempLTDO.setSideRailColor(Color.DARK_GRAY); + tempLTDO.setSideRailCount(0); + tempLTDO.setSideRailGap(0); + tempLTDO.setSideRailWidth(1); + tempLTDO.setSideTieColor(Color.BLACK); + tempLTDO.setSideTieGap(0); + tempLTDO.setSideTieLength(0); + tempLTDO.setSideTieWidth(0); + ltdoList.add(tempLTDO); + + tempLTDO = new LayoutTrackDrawingOptions(realisticPresetName); + tempLTDO.setMainBallastColor(Color.decode("#A0A0A0")); + tempLTDO.setMainBallastWidth(13); + tempLTDO.setMainBlockLineWidth(2); + tempLTDO.setMainRailColor(Color.LIGHT_GRAY); + tempLTDO.setMainRailCount(2); + tempLTDO.setMainRailGap(3); + tempLTDO.setMainRailWidth(2); + tempLTDO.setMainTieColor(Color.decode("#E0E0E0")); + tempLTDO.setMainTieGap(7); + tempLTDO.setMainTieLength(11); + tempLTDO.setMainTieWidth(1); + tempLTDO.setSideBallastColor(Color.GRAY); + tempLTDO.setSideBallastWidth(11); + tempLTDO.setSideBlockLineWidth(2); + tempLTDO.setSideRailColor(Color.decode("#9B705E")); + tempLTDO.setSideRailCount(2); + tempLTDO.setSideRailGap(3); + tempLTDO.setSideRailWidth(1); + tempLTDO.setSideTieColor(Color.decode("#391E16")); + tempLTDO.setSideTieGap(6); + tempLTDO.setSideTieLength(9); + tempLTDO.setSideTieWidth(3); + ltdoList.add(tempLTDO); + + tempLTDO = new LayoutTrackDrawingOptions(realisticOhPresetName); + tempLTDO.setMainBallastColor(Color.decode("#A0A0A0")); + tempLTDO.setMainBallastWidth(16); + tempLTDO.setMainBlockLineWidth(3); + tempLTDO.setMainRailColor(Color.LIGHT_GRAY); + tempLTDO.setMainRailCount(3); + tempLTDO.setMainRailGap(6); + tempLTDO.setMainRailWidth(2); + tempLTDO.setMainTieColor(Color.decode("#E0E0E0")); + tempLTDO.setMainTieGap(7); + tempLTDO.setMainTieLength(14); + tempLTDO.setMainTieWidth(1); + tempLTDO.setSideBallastColor(Color.GRAY); + tempLTDO.setSideBallastWidth(14); + tempLTDO.setSideBlockLineWidth(2); + tempLTDO.setSideRailColor(Color.decode("#9B705E")); + tempLTDO.setSideRailCount(3); + tempLTDO.setSideRailGap(6); + tempLTDO.setSideRailWidth(1); + tempLTDO.setSideTieColor(Color.decode("#391E16")); + tempLTDO.setSideTieGap(6); + tempLTDO.setSideTieLength(12); + tempLTDO.setSideTieWidth(3); + ltdoList.add(tempLTDO); + + tempLTDO = new LayoutTrackDrawingOptions(garishPresetName); + tempLTDO.setMainBallastColor(Color.decode("#B25A2B")); + tempLTDO.setMainBallastWidth(13); + tempLTDO.setMainBlockLineWidth(2); + tempLTDO.setMainRailColor(Color.decode("#39FF12")); + tempLTDO.setMainRailCount(2); + tempLTDO.setMainRailGap(3); + tempLTDO.setMainRailWidth(2); + tempLTDO.setMainTieColor(Color.decode("#468FE3")); + tempLTDO.setMainTieGap(5); + tempLTDO.setMainTieLength(11); + tempLTDO.setMainTieWidth(2); + tempLTDO.setSideBallastColor(Color.decode("#CA0024")); + tempLTDO.setSideBallastWidth(11); + tempLTDO.setSideBlockLineWidth(2); + tempLTDO.setSideRailColor(Color.decode("#FDB3C2")); + tempLTDO.setSideRailCount(2); + tempLTDO.setSideRailGap(3); + tempLTDO.setSideRailWidth(1); + tempLTDO.setSideTieColor(Color.decode("#F26308")); + tempLTDO.setSideTieGap(4); + tempLTDO.setSideTieLength(9); + tempLTDO.setSideTieWidth(3); + ltdoList.add(tempLTDO); + + ltdoList.add(ltdOptions); + + presetsComboBox.removeAllItems(); + ltdoList.forEach((ltdo) -> { + presetsComboBox.addItem(ltdo.getName()); + }); + presetsComboBox.setSelectedItem(leLTDOptions.getName()); + } // definePresets + + /*===========================*\ + |* local (private) variables *| + \*===========================*/ + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JPanel OptionsPanel; + private javax.swing.JButton applyButton; + private javax.swing.JLabel ballastWidthLabel; + private javax.swing.JLabel blockLineWidthLabel; + private javax.swing.ButtonGroup buttonGroup1; + private javax.swing.JButton cancelButton; + private javax.swing.JButton mainBallastColorButton; + private javax.swing.JSpinner mainBallastWidthSpinner; + private javax.swing.JSpinner mainBlockLineWidthSpinner; + private javax.swing.JButton mainRailColorButton; + private javax.swing.JSpinner mainRailCountSpinner; + private javax.swing.JSpinner mainRailGapSpinner; + private javax.swing.JSpinner mainRailWidthSpinner; + private javax.swing.JButton mainTieColorButton; + private javax.swing.JSpinner mainTieGapSpinner; + private javax.swing.JSpinner mainTieLengthSpinner; + private javax.swing.JSpinner mainTieWidthSpinner; + private javax.swing.JLabel mainlineLabel; + private javax.swing.JButton okButton; + private javax.swing.JLabel optionLabel; + private javax.swing.JComboBox presetsComboBox; + private javax.swing.JLabel presetsLabel; + private javax.swing.JLabel railCountLabel; + private javax.swing.JLabel railGapLabel; + private javax.swing.JLabel railWidthLabel; + private javax.swing.JButton sideBallastColorButton; + private javax.swing.JSpinner sideBallastWidthSpinner; + private javax.swing.JSpinner sideBlockLineWidthSpinner; + private javax.swing.JButton sideRailColorButton; + private javax.swing.JSpinner sideRailCountSpinner; + private javax.swing.JSpinner sideRailGapSpinner; + private javax.swing.JSpinner sideRailWidthSpinner; + private javax.swing.JButton sideTieColorButton; + private javax.swing.JSpinner sideTieGapSpinner; + private javax.swing.JSpinner sideTieLengthSpinner; + private javax.swing.JSpinner sideTieWidthSpinner; + private javax.swing.JLabel sidelineLabel; + private javax.swing.JLabel tieGapLabel; + private javax.swing.JLabel tieLengthLabel; + private javax.swing.JLabel tieWidthLabel; + // End of variables declaration//GEN-END:variables + + /*====================*\ + |* initialize logging *| + \*====================*/ + private transient final static Logger log + = LoggerFactory.getLogger(LayoutTrackDrawingOptionsDialog.class); +} diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java index 7dba5fc8433..4cd7f39a645 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java @@ -1095,10 +1095,10 @@ private void drawSlipState(Graphics2D g2, int state) { Point2D D = MathUtil.subtract(layoutSlip.getCoordsD(), cenP); Point2D ctrP = new Point2D.Double(20.0, 20.0); - A = MathUtil.add(MathUtil.multiply(MathUtil.normalize(A), 18.0), ctrP); - B = MathUtil.add(MathUtil.multiply(MathUtil.normalize(B), 18.0), ctrP); - C = MathUtil.add(MathUtil.multiply(MathUtil.normalize(C), 18.0), ctrP); - D = MathUtil.add(MathUtil.multiply(MathUtil.normalize(D), 18.0), ctrP); + A = MathUtil.add(MathUtil.normalize(A, 18.0), ctrP); + B = MathUtil.add(MathUtil.normalize(B, 18.0), ctrP); + C = MathUtil.add(MathUtil.normalize(C, 18.0), ctrP); + D = MathUtil.add(MathUtil.normalize(D, 18.0), ctrP); g2.setColor(Color.black); g2.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java index cdd2adf4ef4..fa49e0a195e 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java @@ -6,6 +6,7 @@ import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; +import java.awt.geom.GeneralPath; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; @@ -131,6 +132,7 @@ * required to be able to correctly interpret the use of signal heads. * * @author Dave Duchamp Copyright (c) 2004-2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutTurnout extends LayoutTrack { @@ -1761,6 +1763,10 @@ public boolean isMainlineD() { return false; } + public boolean isMainline() { + return (isMainlineA() || isMainlineB() || isMainlineC() || isMainlineD()); + } + /** * {@inheritDoc} */ @@ -1770,7 +1776,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean //note: optimization here: instead of creating rectangles for all the // points to check below, we create a rectangle for the test point // and test if the points below are in that rectangle instead. - Rectangle2D r = layoutEditor.trackControlCircleRectAt(hitPoint); + Rectangle2D r = layoutEditor.trackControlRectAt(hitPoint); Point2D p, minPoint = MathUtil.zeroPoint2D; double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); @@ -3010,372 +3016,905 @@ public void setAdditionalViewPopUpMenu(JPopupMenu popup) { } /** - * draw this turnout - * - * @param g2 the graphics port to draw to + * {@inheritDoc} */ - protected void draw(Graphics2D g2) { - Turnout to = getTurnout(); - - Point2D pointA = getCoordsA(); - Point2D pointB = getCoordsB(); - Point2D pointC = getCoordsC(); - Point2D pointD = getCoordsD(); - - setColorForTrackBlock(g2, getLayoutBlock()); - - if (getTurnoutType() == DOUBLE_XOVER) { - // double crossover turnout - if (to == null) { - // no physical turnout linked - draw A corner - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointB))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointC))); - - // draw B corner - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointA, pointB))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointB, pointD))); - - // draw C corner - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointD))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointA, pointC))); - - // draw D corner - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointC, pointD))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointB, pointD))); - } else { - int state = Turnout.CLOSED; - if (layoutEditor.isAnimating()) { - state = to.getKnownState(); - } - if (state == Turnout.CLOSED) { - // continuing path - not crossed over - setColorForTrackBlock(g2, getLayoutBlock()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointB))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlock(), true); - g2.draw(new Line2D.Double(pointA, MathUtil.oneThirdPoint(pointA, pointC))); - - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointA, pointB))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockB(), true); - g2.draw(new Line2D.Double(pointB, MathUtil.oneThirdPoint(pointB, pointD))); - - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointD))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockC(), true); - g2.draw(new Line2D.Double(pointC, MathUtil.oneThirdPoint(pointC, pointA))); - - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointC, pointD))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockD(), true); - g2.draw(new Line2D.Double(pointD, MathUtil.oneThirdPoint(pointD, pointB))); - } else if (state == Turnout.THROWN) { - // diverting (crossed) path - setColorForTrackBlock(g2, getLayoutBlock()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, MathUtil.oneThirdPoint(pointA, pointB))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlock(), true); - g2.draw(new Line2D.Double(pointA, center)); - - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.oneThirdPoint(pointB, pointA))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockB(), true); - - g2.draw(new Line2D.Double(pointB, center)); - - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.oneThirdPoint(pointC, pointD))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockC(), true); - g2.draw(new Line2D.Double(pointC, center)); - - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - g2.draw(new Line2D.Double(pointD, MathUtil.oneThirdPoint(pointD, pointC))); - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockD(), true); - g2.draw(new Line2D.Double(pointD, center)); - } else { - // unknown or inconsistent - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, MathUtil.oneThirdPoint(pointA, pointB))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointA, MathUtil.oneThirdPoint(pointA, pointC))); - - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.oneThirdPoint(pointB, pointA))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointB, MathUtil.oneThirdPoint(pointB, pointD))); - - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.oneThirdPoint(pointC, pointD))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointC, MathUtil.oneThirdPoint(pointC, pointA))); - - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - g2.draw(new Line2D.Double(pointD, MathUtil.oneThirdPoint(pointD, pointC))); - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(pointD, MathUtil.oneThirdPoint(pointD, pointB))); - } // if (state == XXX) {} else... - } // if (to == null) {} else... - } else if ((getTurnoutType() == RH_XOVER) - || (getTurnoutType() == LH_XOVER)) { - // LH and RH crossover turnouts - if (to == null) { - // no physical turnout linked - draw A corner - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointB))); - if (getTurnoutType() == RH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointA, pointB), center)); + @Override + protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { +// if (isBlock) { +// return; //TODO: remove this! +// } + Point2D pA = getCoordsA(); + Point2D pB = getCoordsB(); + Point2D pC = getCoordsC(); + Point2D pD = getCoordsD(); + + boolean mainlineA = isMainlineA(); + boolean mainlineB = isMainlineB(); + boolean mainlineC = isMainlineC(); + boolean mainlineD = isMainlineD(); + + Color color = g2.getColor(); + + // if this isn't a block line all these will be the same color + Color colorA = color; + Color colorB = color; + Color colorC = color; + Color colorD = color; + + if (isBlock) { + LayoutBlock lb = getLayoutBlock(); + colorA = (lb == null) ? color : lb.getBlockColor(); + lb = getLayoutBlockB(); + colorB = (lb == null) ? color : lb.getBlockColor(); + lb = getLayoutBlockC(); + colorC = (lb == null) ? color : lb.getBlockColor(); + lb = getLayoutBlockD(); + colorD = (lb == null) ? color : lb.getBlockColor(); + } + + // middles + Point2D pM = getCoordsCenter(); + Point2D pABM = MathUtil.midPoint(pA, pB); + Point2D pAM = MathUtil.lerp(pA, pABM, 5.0 / 8.0); + Point2D pAMP = MathUtil.midPoint(pAM, pABM); + Point2D pBM = MathUtil.lerp(pB, pABM, 5.0 / 8.0); + Point2D pBMP = MathUtil.midPoint(pBM, pABM); + + Point2D pCDM = MathUtil.midPoint(pC, pD); + Point2D pCM = MathUtil.lerp(pC, pCDM, 5.0 / 8.0); + Point2D pCMP = MathUtil.midPoint(pCM, pCDM); + Point2D pDM = MathUtil.lerp(pD, pCDM, 5.0 / 8.0); + Point2D pDMP = MathUtil.midPoint(pDM, pCDM); + + Point2D pAF = MathUtil.midPoint(pAM, pM); + Point2D pBF = MathUtil.midPoint(pBM, pM); + Point2D pCF = MathUtil.midPoint(pCM, pM); + Point2D pDF = MathUtil.midPoint(pDM, pM); + + int state = getState(); + int type = getTurnoutType(); + if (type == DOUBLE_XOVER) { + if (!isBlock || (state != Turnout.THROWN)) { // unknown or continuing path - not crossed over + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, pABM)); + g2.draw(new Line2D.Double(pAF, pM)); } - - // draw B corner - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointA, pointB))); - if (getTurnoutType() == LH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointA, pointB), center)); + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pB, pABM)); + g2.draw(new Line2D.Double(pBF, pM)); + } + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pC, pCDM)); + g2.draw(new Line2D.Double(pCF, pM)); + } + if (isMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(pD, pCDM)); + g2.draw(new Line2D.Double(pDF, pM)); + } + } + if (!isBlock || (state != Turnout.CLOSED)) { // unknown or diverting path - crossed over + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, pAM)); + g2.draw(new Line2D.Double(pAM, pM)); + g2.draw(new Line2D.Double(pAMP, pABM)); + } + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pB, pBM)); + g2.draw(new Line2D.Double(pBM, pM)); + g2.draw(new Line2D.Double(pBMP, pABM)); + } + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pC, pCM)); + g2.draw(new Line2D.Double(pCM, pM)); + g2.draw(new Line2D.Double(pCMP, pCDM)); + } + if (isMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(pD, pDM)); + g2.draw(new Line2D.Double(pDM, pM)); + g2.draw(new Line2D.Double(pDMP, pCDM)); + } + } + } else if ((type == RH_XOVER) + || (type == LH_XOVER)) { // draw (rh & lh) cross overs + pAF = MathUtil.midPoint(pABM, pM); + pBF = MathUtil.midPoint(pABM, pM); + pCF = MathUtil.midPoint(pCDM, pM); + pDF = MathUtil.midPoint(pCDM, pM); + if (!isBlock || (state != Turnout.THROWN)) { // unknown or continuing path - not crossed over + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, pABM)); + } + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pABM, pB)); + } + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pC, pCDM)); + } + if (isMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(pCDM, pD)); } - - // draw C corner - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointD))); if (getTurnoutType() == RH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointC, pointD), center)); + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pAF, pM)); + } + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pCF, pM)); + } + } else if (getTurnoutType() == LH_XOVER) { + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pBF, pM)); + } + if (isMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(pDF, pM)); + } } - - // draw D corner - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointC, pointD))); - if (getTurnoutType() == LH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointC, pointD), center)); + } + if (!isBlock || (state != Turnout.CLOSED)) { // unknown or diverting path - crossed over + if (getTurnoutType() == RH_XOVER) { + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, pABM)); + g2.draw(new Line2D.Double(pABM, pM)); + } + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pBM, pB)); + } + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pC, pCDM)); + g2.draw(new Line2D.Double(pCDM, pM)); + } + if (isMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(pDM, pD)); + } + } else if (getTurnoutType() == LH_XOVER) { + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, pAM)); + } + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pB, pABM)); + g2.draw(new Line2D.Double(pABM, pM)); + } + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pC, pCM)); + } + if (isMain == mainlineD) { + g2.setColor(colorD); + g2.draw(new Line2D.Double(pD, pCDM)); + g2.draw(new Line2D.Double(pCDM, pM)); + } + } + } + } else if ((type == SINGLE_SLIP) + || (type == DOUBLE_SLIP)) { + log.error("slips should be being drawn by LayoutSlip sub-class"); + } else { // LH, RH, or WYE Turnouts + // draw A<===>center + if (isMain == mainlineA) { + g2.setColor(colorA); + g2.draw(new Line2D.Double(pA, pM)); + } + if (!isBlock || (state != Turnout.THROWN)) { // unknown or continuing path + // draw center<===>B + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(pM, pB)); } } else { - int state = Turnout.CLOSED; - if (layoutEditor.isAnimating()) { - state = to.getKnownState(); - } - if (state == Turnout.CLOSED) { - // continuing path - not crossed over - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointB))); - if (getTurnoutType() == RH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlock(), true); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointA, pointB)))); - } + // draw center<--=>B + if (isMain == mainlineB) { + g2.setColor(colorB); + g2.draw(new Line2D.Double(MathUtil.twoThirdsPoint(pM, pB), pB)); + } + } + if (!isBlock || (state != Turnout.CLOSED)) { // unknown or diverting path + // draw center<===>C + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(pM, pC)); + } + } else { + // draw center<--=>C + if (isMain == mainlineC) { + g2.setColor(colorC); + g2.draw(new Line2D.Double(MathUtil.twoThirdsPoint(pM, pC), pC)); + } + } + } + } // draw1 - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointA, pointB))); + /** + * {@inheritDoc} + */ + @Override + protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { + int type = getTurnoutType(); - if (getTurnoutType() == LH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockB(), true); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointA, pointB)))); - } + Point2D pA = getCoordsA(); + Point2D pB = getCoordsB(); + Point2D pC = getCoordsC(); + Point2D pD = getCoordsD(); + Point2D pM = getCoordsCenter(); - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointD))); - if (getTurnoutType() == RH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockC(), true); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointC, pointD)))); - } + Point2D vAM = MathUtil.normalize(MathUtil.subtract(pM, pA)); + Point2D vAMo = MathUtil.orthogonal(MathUtil.normalize(vAM, railDisplacement)); + + Point2D pAL = MathUtil.subtract(pA, vAMo); + Point2D pAR = MathUtil.add(pA, vAMo); + + Point2D vBM = MathUtil.normalize(MathUtil.subtract(pB, pM)); + double dirBM_DEG = MathUtil.computeAngleDEG(vBM); + Point2D vBMo = MathUtil.normalize(MathUtil.orthogonal(vBM), railDisplacement); + Point2D pBL = MathUtil.subtract(pB, vBMo); + Point2D pBR = MathUtil.add(pB, vBMo); + Point2D pMR = MathUtil.add(pM, vBMo); + + Point2D vCM = MathUtil.normalize(MathUtil.subtract(pC, pM)); + double dirCM_DEG = MathUtil.computeAngleDEG(vCM); + + Point2D vCMo = MathUtil.normalize(MathUtil.orthogonal(vCM), railDisplacement); + Point2D pCL = MathUtil.subtract(pC, vCMo); + Point2D pCR = MathUtil.add(pC, vCMo); + Point2D pML = MathUtil.subtract(pM, vBMo); + + double deltaBMC_DEG = MathUtil.absDiffAngleDEG(dirBM_DEG, dirCM_DEG); + double deltaBMC_RAD = Math.toRadians(deltaBMC_DEG); + + double hypotF = railDisplacement / Math.sin(deltaBMC_RAD / 2.0); + + Point2D vDisF = MathUtil.normalize(MathUtil.add(vAM, vCM), hypotF); + if (type == WYE_TURNOUT) { + vDisF = MathUtil.normalize(vAM, hypotF); + } + Point2D pF = MathUtil.add(pM, vDisF); + + Point2D pFR = MathUtil.add(pF, MathUtil.multiply(vBMo, 2.0)); + Point2D pFL = MathUtil.subtract(pF, MathUtil.multiply(vCMo, 2.0)); + + Point2D pFPR = MathUtil.add(pF, MathUtil.normalize(vBMo, 2.0)); + Point2D pFPL = MathUtil.subtract(pF, MathUtil.normalize(vCMo, 2.0)); + + Point2D vDisAP = MathUtil.normalize(vAM, hypotF); + Point2D pAP = MathUtil.subtract(pM, vDisAP); + Point2D pAPR = MathUtil.add(pAP, vAMo); + Point2D pAPL = MathUtil.subtract(pAP, vAMo); + + Point2D vSo = MathUtil.normalize(vAMo, 2.0); + Point2D pSL = MathUtil.add(pAPL, vSo); + Point2D pSR = MathUtil.subtract(pAPR, vSo); - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointC, pointD))); - if (getTurnoutType() == LH_XOVER) { - layoutEditor.setTrackStrokeWidth(g2, false); - setColorForTrackBlock(g2, getLayoutBlockD(), true); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointC, pointD)))); + boolean mainlineA = isMainlineA(); + boolean mainlineB = isMainlineB(); + boolean mainlineC = isMainlineC(); + boolean mainlineD = isMainlineD(); + + int state = getState(); + + switch (type) { + case RH_TURNOUT: { + if (isMain == mainlineA) { + g2.draw(new Line2D.Double(pAL, pML)); + g2.draw(new Line2D.Double(pAR, pAPR)); + } + if (isMain == mainlineB) { + g2.draw(new Line2D.Double(pML, pBL)); + g2.draw(new Line2D.Double(pF, pBR)); + if (state != Turnout.CLOSED) { // unknown or diverting path + g2.draw(new Line2D.Double(pSR, pFPR)); + } else { + g2.draw(new Line2D.Double(pAPR, pF)); } - } else if (state == Turnout.THROWN) { - // diverting (crossed) path - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointB))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointA, pointB), center)); - } else if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointA, MathUtil.oneFourthPoint(pointA, pointB))); + } + if (isMain == mainlineC) { + g2.draw(new Line2D.Double(pF, pCL)); + g2.draw(new Line2D.Double(pFR, pCR)); + GeneralPath path = new GeneralPath(); + path.moveTo(pAPR.getX(), pAPR.getY()); + path.quadTo(pMR.getX(), pMR.getY(), pFR.getX(), pFR.getY()); + path.lineTo(pCR.getX(), pCR.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pML.getX(), pML.getY(), pF.getX(), pF.getY()); + g2.draw(path); + } else { + path = new GeneralPath(); + path.moveTo(pSL.getX(), pSL.getY()); + path.quadTo(pML.getX(), pML.getY(), pFPL.getX(), pFPL.getY()); + g2.draw(path); } + } + break; + } // case RH_TURNOUT - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointB, pointA))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointA, pointB), center)); - } else if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointB, MathUtil.oneFourthPoint(pointB, pointA))); + case LH_TURNOUT: { + if (isMain == mainlineA) { + g2.draw(new Line2D.Double(pAR, pMR)); + g2.draw(new Line2D.Double(pAL, pAPL)); + } + if (isMain == mainlineB) { + g2.draw(new Line2D.Double(pMR, pBR)); + g2.draw(new Line2D.Double(pF, pBL)); + if (state != Turnout.CLOSED) { // unknown or diverting path + g2.draw(new Line2D.Double(pSL, pFPL)); + } else { + g2.draw(new Line2D.Double(pAPL, pF)); } - - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointD))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointC, pointD), center)); - } else if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointC, MathUtil.oneFourthPoint(pointC, pointD))); + } + if (isMain == mainlineC) { + g2.draw(new Line2D.Double(pF, pCR)); + GeneralPath path = new GeneralPath(); + path.moveTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pML.getX(), pML.getY(), pFL.getX(), pFL.getY()); + path.lineTo(pCL.getX(), pCL.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pAPR.getX(), pAPR.getY()); + path.quadTo(pMR.getX(), pMR.getY(), pF.getX(), pF.getY()); + g2.draw(path); + } else { + path = new GeneralPath(); + path.moveTo(pSR.getX(), pSR.getY()); + path.quadTo(pMR.getX(), pMR.getY(), pFPR.getX(), pFPR.getY()); + g2.draw(path); } + } + break; + } // case LH_TURNOUT - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointD, pointC))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(MathUtil.midPoint(pointC, pointD), center)); - } else if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointD, MathUtil.oneFourthPoint(pointD, pointC))); + case WYE_TURNOUT: { + if (isMain == mainlineA) { + g2.draw(new Line2D.Double(pAL, pAPL)); + g2.draw(new Line2D.Double(pAR, pAPR)); + } + if (isMain == mainlineB) { + g2.draw(new Line2D.Double(pF, pBL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pAPR.getX(), pAPR.getY()); + path.quadTo(pMR.getX(), pMR.getY(), pFR.getX(), pFR.getY()); + path.lineTo(pBR.getX(), pBR.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pAPR.getX(), pAPR.getY()); + path.quadTo(pMR.getX(), pMR.getY(), pF.getX(), pF.getY()); + g2.draw(path); + } else { + path = new GeneralPath(); + path.moveTo(pSR.getX(), pSR.getY()); + path.quadTo(pMR.getX(), pMR.getY(), pFPR.getX(), pFPR.getY()); + g2.draw(path); } - } else { - // unknown or inconsistent - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointA, MathUtil.midPoint(pointA, pointB))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointA, pointB)))); - } else if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointA, MathUtil.oneFourthPoint(pointA, pointB))); + } + if (isMain == mainlineC) { + pML = MathUtil.subtract(pM, vCMo); + GeneralPath path = new GeneralPath(); + path.moveTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pML.getX(), pML.getY(), pFL.getX(), pFL.getY()); + path.lineTo(pCL.getX(), pCL.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pF, pCR)); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pSL.getX(), pSL.getY()); + path.quadTo(pML.getX(), pML.getY(), pFPL.getX(), pFPL.getY()); + g2.draw(path); + } else { + path = new GeneralPath(); + path.moveTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pML.getX(), pML.getY(), pF.getX(), pF.getY()); + g2.draw(path); } - - setColorForTrackBlock(g2, getLayoutBlockB()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(pointB, pointA))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointA, pointB)))); - } else if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointB, MathUtil.oneFourthPoint(pointB, pointA))); + } + break; + } // case WYE_TURNOUT + + case DOUBLE_XOVER: { + // A, B, C, D end points (left and right) + Point2D vAB = MathUtil.normalize(MathUtil.subtract(pB, pA), railDisplacement); + double dirAB_DEG = MathUtil.computeAngleDEG(vAB); + Point2D vABo = MathUtil.orthogonal(MathUtil.normalize(vAB, railDisplacement)); + pAL = MathUtil.subtract(pA, vABo); + pAR = MathUtil.add(pA, vABo); + pBL = MathUtil.subtract(pB, vABo); + pBR = MathUtil.add(pB, vABo); + Point2D vCD = MathUtil.normalize(MathUtil.subtract(pD, pC), railDisplacement); + Point2D vCDo = MathUtil.orthogonal(MathUtil.normalize(vCD, railDisplacement)); + pCL = MathUtil.add(pC, vCDo); + pCR = MathUtil.subtract(pC, vCDo); + Point2D pDL = MathUtil.add(pD, vCDo); + Point2D pDR = MathUtil.subtract(pD, vCDo); + + // AB, CD mid points (left and right) + Point2D pABM = MathUtil.midPoint(pA, pB); + Point2D pABL = MathUtil.midPoint(pAL, pBL); + Point2D pABR = MathUtil.midPoint(pAR, pBR); + Point2D pCDM = MathUtil.midPoint(pC, pD); + Point2D pCDL = MathUtil.midPoint(pCL, pDL); + Point2D pCDR = MathUtil.midPoint(pCR, pDR); + + // A, B, C, D mid points + double halfParallelDistance = MathUtil.distance(pABM, pCDM) / 2.0; + Point2D pAM = MathUtil.subtract(pABM, MathUtil.normalize(vAB, halfParallelDistance)); + Point2D pAML = MathUtil.subtract(pAM, vABo); + Point2D pAMR = MathUtil.add(pAM, vABo); + Point2D pBM = MathUtil.add(pABM, MathUtil.normalize(vAB, halfParallelDistance)); + Point2D pBML = MathUtil.subtract(pBM, vABo); + Point2D pBMR = MathUtil.add(pBM, vABo); + Point2D pCM = MathUtil.subtract(pCDM, MathUtil.normalize(vCD, halfParallelDistance)); + Point2D pCML = MathUtil.subtract(pCM, vABo); + Point2D pCMR = MathUtil.add(pCM, vABo); + Point2D pDM = MathUtil.add(pCDM, MathUtil.normalize(vCD, halfParallelDistance)); + Point2D pDML = MathUtil.subtract(pDM, vABo); + Point2D pDMR = MathUtil.add(pDM, vABo); + + // crossing points + Point2D vACM = MathUtil.normalize(MathUtil.subtract(pCM, pAM), railDisplacement); + Point2D vACMo = MathUtil.orthogonal(vACM); + Point2D vBDM = MathUtil.normalize(MathUtil.subtract(pDM, pBM), railDisplacement); + Point2D vBDMo = MathUtil.orthogonal(vBDM); + Point2D pBDR = MathUtil.add(pM, vACM); + Point2D pBDL = MathUtil.subtract(pM, vACM); + + // crossing diamond point (no gaps) + Point2D pVR = MathUtil.add(pBDL, vBDM); + Point2D pKL = MathUtil.subtract(pBDL, vBDM); + Point2D pKR = MathUtil.add(pBDR, vBDM); + Point2D pVL = MathUtil.subtract(pBDR, vBDM); + + // crossing diamond points (with gaps) + Point2D vACM2 = MathUtil.normalize(vACM, 2.0); + Point2D vBDM2 = MathUtil.normalize(vBDM, 2.0); + // (syntax of "pKLtC" is "point LK toward C", etc.) + Point2D pKLtC = MathUtil.add(pKL, vACM2); + Point2D pKLtD = MathUtil.add(pKL, vBDM2); + Point2D pVLtA = MathUtil.subtract(pVL, vACM2); + Point2D pVLtD = MathUtil.add(pVL, vBDM2); + Point2D pKRtA = MathUtil.subtract(pKR, vACM2); + Point2D pKRtB = MathUtil.subtract(pKR, vBDM2); + Point2D pVRtB = MathUtil.subtract(pVR, vBDM2); + Point2D pVRtC = MathUtil.add(pVR, vACM2); + + // A, B, C, D frog points + vCM = MathUtil.normalize(MathUtil.subtract(pCM, pM)); + dirCM_DEG = MathUtil.computeAngleDEG(vCM); + double deltaBAC_DEG = MathUtil.absDiffAngleDEG(dirAB_DEG, dirCM_DEG); + double deltaBAC_RAD = Math.toRadians(deltaBAC_DEG); + hypotF = railDisplacement / Math.sin(deltaBAC_RAD / 2.0); + Point2D vACF = MathUtil.normalize(MathUtil.add(vACM, vAB), hypotF); + Point2D pAFL = MathUtil.add(pAM, vACF); + Point2D pCFR = MathUtil.subtract(pCM, vACF); + Point2D vBDF = MathUtil.normalize(MathUtil.add(vBDM, vCD), hypotF); + Point2D pBFL = MathUtil.add(pBM, vBDF); + Point2D pDFR = MathUtil.subtract(pDM, vBDF); + + // A, B, C, D frog points + Point2D pAFR = MathUtil.add(MathUtil.add(pAFL, vACMo), vACMo); + Point2D pBFR = MathUtil.subtract(MathUtil.subtract(pBFL, vBDMo), vBDMo); + Point2D pCFL = MathUtil.subtract(MathUtil.subtract(pCFR, vACMo), vACMo); + Point2D pDFL = MathUtil.add(MathUtil.add(pDFR, vBDMo), vBDMo); + + // end of switch rails (closed) + Point2D vABF = MathUtil.normalize(vAB, hypotF); + pAP = MathUtil.subtract(pAM, vABF); + pAPL = MathUtil.subtract(pAP, vABo); + pAPR = MathUtil.add(pAP, vABo); + Point2D pBP = MathUtil.add(pBM, vABF); + Point2D pBPL = MathUtil.subtract(pBP, vABo); + Point2D pBPR = MathUtil.add(pBP, vABo); + + Point2D vCDF = MathUtil.normalize(vCD, hypotF); + Point2D pCP = MathUtil.subtract(pCM, vCDF); + Point2D pCPL = MathUtil.add(pCP, vCDo); + Point2D pCPR = MathUtil.subtract(pCP, vCDo); + Point2D pDP = MathUtil.add(pDM, vCDF); + Point2D pDPL = MathUtil.add(pDP, vCDo); + Point2D pDPR = MathUtil.subtract(pDP, vCDo); + + // end of switch rails (open) + Point2D vS = MathUtil.normalize(vABo, 2.0); + Point2D pASL = MathUtil.add(pAPL, vS); + Point2D pASR = MathUtil.subtract(pAPR, vS); + Point2D pBSL = MathUtil.add(pBPL, vS); + Point2D pBSR = MathUtil.subtract(pBPR, vS); + Point2D pCSR = MathUtil.subtract(pCPR, vS); + Point2D pCSL = MathUtil.add(pCPL, vS); + Point2D pDSR = MathUtil.subtract(pDPR, vS); + Point2D pDSL = MathUtil.add(pDPL, vS); + + // end of switch rails (open at frogs) + Point2D pAFS = MathUtil.subtract(pAFL, vS); + Point2D pBFS = MathUtil.subtract(pBFL, vS); + Point2D pCFS = MathUtil.add(pCFR, vS); + Point2D pDFS = MathUtil.add(pDFR, vS); + vSo = MathUtil.orthogonal(vS); + Point2D pAFSR = MathUtil.add(pAFL, vSo); + Point2D pBFSR = MathUtil.subtract(pBFL, vSo); + Point2D pCFSL = MathUtil.subtract(pCFR, vSo); + Point2D pDFSL = MathUtil.add(pDFR, vSo); + + if (isMain == mainlineA) { + g2.draw(new Line2D.Double(pAL, pABL)); + g2.draw(new Line2D.Double(pVRtB, pKLtD)); + g2.draw(new Line2D.Double(pAFL, pABR)); + g2.draw(new Line2D.Double(pAFL, pKL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pAR.getX(), pAR.getY()); + path.lineTo(pAPR.getX(), pAPR.getY()); + path.quadTo(pAMR.getX(), pAMR.getY(), pAFR.getX(), pAFR.getY()); + path.lineTo(pVR.getX(), pVR.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pAML.getX(), pAML.getY(), pAFL.getX(), pAFL.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pASR, pAFSR)); + } else { // continuing path + g2.draw(new Line2D.Double(pAPR, pAFL)); + path = new GeneralPath(); + path.moveTo(pASL.getX(), pASL.getY()); + path.quadTo(pAML.getX(), pAML.getY(), pAFS.getX(), pAFS.getY()); + g2.draw(path); } - - setColorForTrackBlock(g2, getLayoutBlockC()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(pointC, pointD))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointC, pointD)))); - } else if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointC, MathUtil.oneFourthPoint(pointC, pointD))); + } + if (isMain == mainlineB) { + g2.draw(new Line2D.Double(pABL, pBL)); + g2.draw(new Line2D.Double(pKLtC, pVLtA)); + g2.draw(new Line2D.Double(pBFL, pABR)); + g2.draw(new Line2D.Double(pBFL, pKL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pBR.getX(), pBR.getY()); + path.lineTo(pBPR.getX(), pBPR.getY()); + path.quadTo(pBMR.getX(), pBMR.getY(), pBFR.getX(), pBFR.getY()); + path.lineTo(pVL.getX(), pVL.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pBPL.getX(), pBPL.getY()); + path.quadTo(pBML.getX(), pBML.getY(), pBFL.getX(), pBFL.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pBSR, pBFSR)); + } else { + g2.draw(new Line2D.Double(pBPR, pBFL)); + path = new GeneralPath(); + path.moveTo(pBSL.getX(), pBSL.getY()); + path.quadTo(pBML.getX(), pBML.getY(), pBFS.getX(), pBFS.getY()); + g2.draw(path); } - - setColorForTrackBlock(g2, getLayoutBlockD()); - layoutEditor.setTrackStrokeWidth(g2, isMainlineD()); - if (getTurnoutType() == LH_XOVER) { - g2.draw(new Line2D.Double(pointD, MathUtil.midPoint(pointC, pointD))); - //layoutEditor.setTrackStrokeWidth(g2, false); - g2.draw(new Line2D.Double(center, MathUtil.oneThirdPoint(center, MathUtil.midPoint(pointC, pointD)))); - } else if (getTurnoutType() == RH_XOVER) { - g2.draw(new Line2D.Double(pointD, MathUtil.oneFourthPoint(pointD, pointC))); + } + if (isMain == mainlineC) { + g2.draw(new Line2D.Double(pCR, pCDR)); + g2.draw(new Line2D.Double(pKRtB, pVLtD)); + g2.draw(new Line2D.Double(pCFR, pCDL)); + g2.draw(new Line2D.Double(pCFR, pKR)); + GeneralPath path = new GeneralPath(); + path.moveTo(pCL.getX(), pCL.getY()); + path.lineTo(pCPL.getX(), pCPL.getY()); + path.quadTo(pCML.getX(), pCML.getY(), pCFL.getX(), pCFL.getY()); + path.lineTo(pVL.getX(), pVL.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pCPR.getX(), pCPR.getY()); + path.quadTo(pCMR.getX(), pCMR.getY(), pCFR.getX(), pCFR.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pCSL, pCFSL)); + } else { + g2.draw(new Line2D.Double(pCPL, pCFR)); + path = new GeneralPath(); + path.moveTo(pCSR.getX(), pCSR.getY()); + path.quadTo(pCMR.getX(), pCMR.getY(), pCFS.getX(), pCFS.getY()); + g2.draw(path); } - } // if (state == XXX} {} else... - } // if (to == null) {} else... - } else { - // LH, RH, or WYE Turnouts - if (to == null) { - // no physical turnout linked - draw connected - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - g2.draw(new Line2D.Double(pointA, center)); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, center)); - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, center)); - } else { - layoutEditor.setTrackStrokeWidth(g2, isMainlineA()); - //line from throat to center - g2.draw(new Line2D.Double(pointA, center)); - int state = Turnout.CLOSED; - if (layoutEditor.isAnimating()) { - state = to.getKnownState(); - } - switch (state) { - case Turnout.CLOSED: - if (getContinuingSense() == Turnout.CLOSED) { - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - //line from continuing leg to center - g2.draw(new Line2D.Double(pointB, center)); - if (layoutEditor.getTurnoutDrawUnselectedLeg()) { - //line from diverging leg halfway to center - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - setColorForTrackBlock(g2, getLayoutBlockB(), true); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(center, pointC))); - } - } else { - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - //line from diverging leg to center - g2.draw(new Line2D.Double(pointC, center)); - if (layoutEditor.getTurnoutDrawUnselectedLeg()) { - //line from continuing leg halfway to center - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - setColorForTrackBlock(g2, getLayoutBlockC(), true); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(center, pointB))); - } - } - break; - case Turnout.THROWN: - if (getContinuingSense() == Turnout.THROWN) { - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, center)); - if (layoutEditor.getTurnoutDrawUnselectedLeg()) { - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - setColorForTrackBlock(g2, getLayoutBlockB(), true); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(center, pointC))); - } - } else { - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, center)); - if (layoutEditor.getTurnoutDrawUnselectedLeg()) { - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - setColorForTrackBlock(g2, getLayoutBlockC(), true); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(center, pointB))); - } - } - break; - default: - // inconsistent or unknown - layoutEditor.setTrackStrokeWidth(g2, isMainlineC()); - g2.draw(new Line2D.Double(pointC, MathUtil.midPoint(center, pointC))); - layoutEditor.setTrackStrokeWidth(g2, isMainlineB()); - g2.draw(new Line2D.Double(pointB, MathUtil.midPoint(center, pointB))); - } // switch (state) - } // if (to == null) {} else... - } // if (getTurnoutType() == XXX) {} else if... {} else... - } // draw + } + if (isMain == mainlineD) { + g2.draw(new Line2D.Double(pCDR, pDR)); + g2.draw(new Line2D.Double(pKRtA, pVRtC)); + g2.draw(new Line2D.Double(pDFR, pCDL)); + g2.draw(new Line2D.Double(pDFR, pKR)); + GeneralPath path = new GeneralPath(); + path.moveTo(pDL.getX(), pDL.getY()); + path.lineTo(pDPL.getX(), pDPL.getY()); + path.quadTo(pDML.getX(), pDML.getY(), pDFL.getX(), pDFL.getY()); + path.lineTo(pVR.getX(), pVR.getY()); + g2.draw(path); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pDPR.getX(), pDPR.getY()); + path.quadTo(pDMR.getX(), pDMR.getY(), pDFR.getX(), pDFR.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pDSL, pDFSL)); + } else { + g2.draw(new Line2D.Double(pDPL, pDFR)); + path = new GeneralPath(); + path.moveTo(pDSR.getX(), pDSR.getY()); + path.quadTo(pDMR.getX(), pDMR.getY(), pDFS.getX(), pDFS.getY()); + g2.draw(path); + } + } + break; + } // case DOUBLE_XOVER + + case RH_XOVER: { + // A, B, C, D end points (left and right) + Point2D vAB = MathUtil.normalize(MathUtil.subtract(pB, pA), railDisplacement); + double dirAB_DEG = MathUtil.computeAngleDEG(vAB); + Point2D vABo = MathUtil.orthogonal(MathUtil.normalize(vAB, railDisplacement)); + pAL = MathUtil.subtract(pA, vABo); + pAR = MathUtil.add(pA, vABo); + pBL = MathUtil.subtract(pB, vABo); + pBR = MathUtil.add(pB, vABo); + Point2D vCD = MathUtil.normalize(MathUtil.subtract(pD, pC), railDisplacement); + Point2D vCDo = MathUtil.orthogonal(MathUtil.normalize(vCD, railDisplacement)); + pCL = MathUtil.add(pC, vCDo); + pCR = MathUtil.subtract(pC, vCDo); + Point2D pDL = MathUtil.add(pD, vCDo); + Point2D pDR = MathUtil.subtract(pD, vCDo); + + // AB and CD mid points + Point2D pABM = MathUtil.midPoint(pA, pB); + Point2D pABL = MathUtil.subtract(pABM, vABo); + Point2D pABR = MathUtil.add(pABM, vABo); + Point2D pCDM = MathUtil.midPoint(pC, pD); + Point2D pCDL = MathUtil.subtract(pCDM, vABo); + Point2D pCDR = MathUtil.add(pCDM, vABo); + + // directions + Point2D vAC = MathUtil.normalize(MathUtil.subtract(pCDM, pABM), railDisplacement); + Point2D vACo = MathUtil.orthogonal(MathUtil.normalize(vAC, railDisplacement)); + double dirAC_DEG = MathUtil.computeAngleDEG(vAC); + double deltaBAC_DEG = MathUtil.absDiffAngleDEG(dirAB_DEG, dirAC_DEG); + double deltaBAC_RAD = Math.toRadians(deltaBAC_DEG); + + // AC mid points + Point2D pACL = MathUtil.subtract(pM, vACo); + Point2D pACR = MathUtil.add(pM, vACo); + + // frogs + hypotF = railDisplacement / Math.sin(deltaBAC_RAD / 2.0); + Point2D vF = MathUtil.normalize(MathUtil.add(vAB, vAC), hypotF); + Point2D pABF = MathUtil.add(pABM, vF); + Point2D pCDF = MathUtil.subtract(pCDM, vF); + + // frog primes + Point2D pABFP = MathUtil.add(MathUtil.add(pABF, vACo), vACo); + Point2D pCDFP = MathUtil.subtract(MathUtil.subtract(pCDF, vACo), vACo); + + // end of switch rails (closed) + Point2D vABF = MathUtil.normalize(vAB, hypotF); + pAP = MathUtil.subtract(pABM, vABF); + pAPL = MathUtil.subtract(pAP, vABo); + pAPR = MathUtil.add(pAP, vABo); + Point2D pCP = MathUtil.add(pCDM, vABF); + Point2D pCPL = MathUtil.add(pCP, vCDo); + Point2D pCPR = MathUtil.subtract(pCP, vCDo); + + // end of switch rails (open) + Point2D vS = MathUtil.normalize(vAB, 2.0); + vSo = MathUtil.orthogonal(vS); + Point2D pASL = MathUtil.add(pAPL, vSo); + Point2D pASR = MathUtil.subtract(pAPR, vSo); + Point2D pCSL = MathUtil.add(pCPL, vSo); + Point2D pCSR = MathUtil.subtract(pCPR, vSo); + + // end of switch rails (open at frogs) + Point2D pABFS = MathUtil.subtract(pABF, vSo); + Point2D pABFSP = MathUtil.subtract(pABF, vS); + Point2D pCDFS = MathUtil.add(pCDF, vSo); + Point2D pCDFSP = MathUtil.add(pCDF, vS); + + if (isMain == mainlineA) { + g2.draw(new Line2D.Double(pAL, pABL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pAR.getX(), pAR.getY()); + path.lineTo(pAPR.getX(), pAPR.getY()); + path.quadTo(pABR.getX(), pABR.getY(), pABFP.getX(), pABFP.getY()); + path.lineTo(pACR.getX(), pACR.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pABF, pACL)); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pAPL.getX(), pAPL.getY()); + path.quadTo(pABL.getX(), pABL.getY(), pABF.getX(), pABF.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pASR, pABFSP)); + } else { // continuing path + g2.draw(new Line2D.Double(pAPR, pABF)); + path = new GeneralPath(); + path.moveTo(pASL.getX(), pASL.getY()); + path.quadTo(pABL.getX(), pABL.getY(), pABFS.getX(), pABFS.getY()); + g2.draw(path); + } + } + if (isMain == mainlineB) { + g2.draw(new Line2D.Double(pABL, pBL)); + g2.draw(new Line2D.Double(pABF, pBR)); + } + if (isMain == mainlineC) { + g2.draw(new Line2D.Double(pCR, pCDR)); + GeneralPath path = new GeneralPath(); + path.moveTo(pCL.getX(), pCL.getY()); + path.lineTo(pCPL.getX(), pCPL.getY()); + path.quadTo(pCDL.getX(), pCDL.getY(), pCDFP.getX(), pCDFP.getY()); + path.lineTo(pACL.getX(), pACL.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pCDF, pACR)); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pCPR.getX(), pCPR.getY()); + path.quadTo(pCDR.getX(), pCDR.getY(), pCDF.getX(), pCDF.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pCSL, pCDFSP)); + } else { // continuing path + g2.draw(new Line2D.Double(pCPL, pCDF)); + path = new GeneralPath(); + path.moveTo(pCSR.getX(), pCSR.getY()); + path.quadTo(pCDR.getX(), pCDR.getY(), pCDFS.getX(), pCDFS.getY()); + g2.draw(path); + } + } + if (isMain == mainlineD) { + g2.draw(new Line2D.Double(pCDR, pDR)); + g2.draw(new Line2D.Double(pCDF, pDL)); + } + break; + } // case RH_XOVER + + case LH_XOVER: { + // B, A, D, C end points (left and right) + Point2D vBA = MathUtil.normalize(MathUtil.subtract(pA, pB), railDisplacement); + double dirBA_DEG = MathUtil.computeAngleDEG(vBA); + Point2D vBAo = MathUtil.orthogonal(MathUtil.normalize(vBA, railDisplacement)); + pBL = MathUtil.add(pB, vBAo); + pBR = MathUtil.subtract(pB, vBAo); + pAL = MathUtil.add(pA, vBAo); + pAR = MathUtil.subtract(pA, vBAo); + Point2D vDC = MathUtil.normalize(MathUtil.subtract(pC, pD), railDisplacement); + Point2D vDCo = MathUtil.orthogonal(MathUtil.normalize(vDC, railDisplacement)); + Point2D pDL = MathUtil.subtract(pD, vDCo); + Point2D pDR = MathUtil.add(pD, vDCo); + pCL = MathUtil.subtract(pC, vDCo); + pCR = MathUtil.add(pC, vDCo); + + // BA and DC mid points + Point2D pBAM = MathUtil.midPoint(pB, pA); + Point2D pBAL = MathUtil.add(pBAM, vBAo); + Point2D pBAR = MathUtil.subtract(pBAM, vBAo); + Point2D pDCM = MathUtil.midPoint(pD, pC); + Point2D pDCL = MathUtil.add(pDCM, vBAo); + Point2D pDCR = MathUtil.subtract(pDCM, vBAo); + + // directions + Point2D vBD = MathUtil.normalize(MathUtil.subtract(pDCM, pBAM), railDisplacement); + Point2D vBDo = MathUtil.orthogonal(MathUtil.normalize(vBD, railDisplacement)); + double dirBD_DEG = MathUtil.computeAngleDEG(vBD); + double deltaABD_DEG = MathUtil.absDiffAngleDEG(dirBA_DEG, dirBD_DEG); + double deltaABD_RAD = Math.toRadians(deltaABD_DEG); + + // BD mid points + Point2D pBDL = MathUtil.add(pM, vBDo); + Point2D pBDR = MathUtil.subtract(pM, vBDo); + + // frogs + hypotF = railDisplacement / Math.sin(deltaABD_RAD / 2.0); + Point2D vF = MathUtil.normalize(MathUtil.add(vBA, vBD), hypotF); + Point2D pBFL = MathUtil.add(pBAM, vF); + Point2D pBF = MathUtil.subtract(pBFL, vBDo); + Point2D pBFR = MathUtil.subtract(pBF, vBDo); + Point2D pDFR = MathUtil.subtract(pDCM, vF); + Point2D pDF = MathUtil.add(pDFR, vBDo); + Point2D pDFL = MathUtil.add(pDF, vBDo); + + // end of switch rails (closed) + Point2D vBAF = MathUtil.normalize(vBA, hypotF); + Point2D pBP = MathUtil.subtract(pBAM, vBAF); + Point2D pBPL = MathUtil.add(pBP, vBAo); + Point2D pBPR = MathUtil.subtract(pBP, vBAo); + Point2D pDP = MathUtil.add(pDCM, vBAF); + Point2D pDPL = MathUtil.subtract(pDP, vDCo); + Point2D pDPR = MathUtil.add(pDP, vDCo); + + // end of switch rails (open) + Point2D vS = MathUtil.normalize(vBA, 2.0); + vSo = MathUtil.orthogonal(vS); + Point2D pBSL = MathUtil.subtract(pBPL, vSo); + Point2D pBSR = MathUtil.add(pBPR, vSo); + Point2D pDSL = MathUtil.subtract(pDPL, vSo); + Point2D pDSR = MathUtil.add(pDPR, vSo); + + // end of switch rails (open at frogs) + Point2D pBAFS = MathUtil.add(pBFL, vSo); + Point2D pBAFSP = MathUtil.subtract(pBFL, vS); + Point2D pDCFS = MathUtil.subtract(pDFR, vSo); + Point2D pDCFSP = MathUtil.add(pDFR, vS); + + if (isMain == mainlineA) { + g2.draw(new Line2D.Double(pBAL, pAL)); + g2.draw(new Line2D.Double(pBFL, pAR)); + } + if (isMain == mainlineB) { + g2.draw(new Line2D.Double(pBL, pBAL)); + GeneralPath path = new GeneralPath(); + path.moveTo(pBR.getX(), pBR.getY()); + path.lineTo(pBPR.getX(), pBPR.getY()); + path.quadTo(pBAR.getX(), pBAR.getY(), pBFR.getX(), pBFR.getY()); + path.lineTo(pBDR.getX(), pBDR.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pBFL, pBDL)); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pBPL.getX(), pBPL.getY()); + path.quadTo(pBAL.getX(), pBAL.getY(), pBFL.getX(), pBFL.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pBSR, pBAFSP)); + } else { // continuing path + g2.draw(new Line2D.Double(pBPR, pBFL)); + path = new GeneralPath(); + path.moveTo(pBSL.getX(), pBSL.getY()); + path.quadTo(pBAL.getX(), pBAL.getY(), pBAFS.getX(), pBAFS.getY()); + g2.draw(path); + } + } + if (isMain == mainlineC) { + g2.draw(new Line2D.Double(pDCR, pCR)); + g2.draw(new Line2D.Double(pDFR, pCL)); + } + if (isMain == mainlineD) { + g2.draw(new Line2D.Double(pDR, pDCR)); + GeneralPath path = new GeneralPath(); + path.moveTo(pDL.getX(), pDL.getY()); + path.lineTo(pDPL.getX(), pDPL.getY()); + path.quadTo(pDCL.getX(), pDCL.getY(), pDFL.getX(), pDFL.getY()); + path.lineTo(pBDL.getX(), pBDL.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pDFR, pBDR)); + if (state != Turnout.CLOSED) { // unknown or diverting path + path = new GeneralPath(); + path.moveTo(pDPR.getX(), pDPR.getY()); + path.quadTo(pDCR.getX(), pDCR.getY(), pDFR.getX(), pDFR.getY()); + g2.draw(path); + g2.draw(new Line2D.Double(pDSL, pDCFSP)); + } else { // continuing path + g2.draw(new Line2D.Double(pDPL, pDFR)); + path = new GeneralPath(); + path.moveTo(pDSR.getX(), pDSR.getY()); + path.quadTo(pDCR.getX(), pDCR.getY(), pDCFS.getX(), pDCFS.getY()); + g2.draw(path); + } + } + break; + } // case LH_XOVER + case SINGLE_SLIP: + case DOUBLE_SLIP: { + log.error("slips should be being drawn by LayoutSlip sub-class"); + break; + } + } + } /** * {@inheritDoc} @@ -3395,7 +3934,9 @@ protected void drawUnconnected(Graphics2D g2) { } if ((getTurnoutType() == DOUBLE_XOVER) || (getTurnoutType() == RH_XOVER) - || (getTurnoutType() == LH_XOVER)) { + || (getTurnoutType() == LH_XOVER) + || (getTurnoutType() == SINGLE_SLIP) + || (getTurnoutType() == DOUBLE_SLIP)) { if (getConnectD() == null) { g2.fill(layoutEditor.trackControlCircleAt(getCoordsD())); } @@ -3408,7 +3949,7 @@ protected void drawTurnoutControls(Graphics2D g2) { protected void drawEditControls(Graphics2D g2) { Point2D pt = getCoordsA(); - if (getTurnoutType() >= DOUBLE_XOVER && getTurnoutType() <= LH_XOVER) { + if (getTurnoutType() >= DOUBLE_XOVER && getTurnoutType() <= DOUBLE_SLIP) { if (getConnectA() == null) { g2.setColor(Color.magenta); } else { @@ -3421,7 +3962,7 @@ protected void drawEditControls(Graphics2D g2) { g2.setColor(Color.green); } } - g2.draw(layoutEditor.trackControlPointRectAt(pt)); + g2.draw(layoutEditor.trackEditControlRectAt(pt)); pt = getCoordsB(); if (getConnectB() == null) { @@ -3429,7 +3970,7 @@ protected void drawEditControls(Graphics2D g2) { } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(pt)); + g2.draw(layoutEditor.trackEditControlRectAt(pt)); pt = getCoordsC(); if (getConnectC() == null) { @@ -3437,18 +3978,20 @@ protected void drawEditControls(Graphics2D g2) { } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(pt)); + g2.draw(layoutEditor.trackEditControlRectAt(pt)); if ((getTurnoutType() == DOUBLE_XOVER) || (getTurnoutType() == RH_XOVER) - || (getTurnoutType() == LH_XOVER)) { + || (getTurnoutType() == LH_XOVER) + || (getTurnoutType() == SINGLE_SLIP) + || (getTurnoutType() == DOUBLE_SLIP)) { pt = getCoordsD(); if (getConnectD() == null) { g2.setColor(Color.red); } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(pt)); + g2.draw(layoutEditor.trackEditControlRectAt(pt)); } } // drawEditControls @@ -3924,4 +4467,5 @@ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { private final static Logger log = LoggerFactory.getLogger(LayoutTurnout.class ); + } diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java index d383ff6cafa..461e4f4737e 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java @@ -2,6 +2,7 @@ import static java.lang.Float.POSITIVE_INFINITY; +import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.ActionEvent; @@ -48,16 +49,17 @@ *

                * The radius of the turntable circle is variable by the user. *

                - * Each radiating segment (RayTrack) connecting point is a fixed distance - * from the center of the turntable. The user may vary the angle of the - * radiating segment. Angles are measured from the vertical (12 o'clock) - * position in a clockwise manner. For example, 30 degrees is 1 o'clock, 60 - * degrees is 2 o'clock, 90 degrees is 3 o'clock, etc. + * Each radiating segment (RayTrack) connecting point is a fixed distance from + * the center of the turntable. The user may vary the angle of the radiating + * segment. Angles are measured from the vertical (12 o'clock) position in a + * clockwise manner. For example, 30 degrees is 1 o'clock, 60 degrees is 2 + * o'clock, 90 degrees is 3 o'clock, etc. *

                * Each radiating segment is drawn from its connection point to the turntable * circle in the direction of the turntable center. * * @author Dave Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutTurntable extends LayoutTrack { @@ -244,13 +246,14 @@ public int getRayTurnoutState(int i) { public Point2D getRayCoordsIndexed(int index) { Point2D result = MathUtil.zeroPoint2D; + double rayRadius = radius + LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); for (RayTrack rt : rayList) { if (rt.getConnectionIndex() == index) { double angle = Math.toRadians(rt.getAngle()); // calculate coordinates result = new Point2D.Double( - (center.getX() + ((1.25 * radius) * Math.sin(angle))), - (center.getY() - ((1.25 * radius) * Math.cos(angle)))); + (center.getX() + (rayRadius * Math.sin(angle))), + (center.getY() - (rayRadius * Math.cos(angle)))); break; } } @@ -262,10 +265,11 @@ public Point2D getRayCoordsOrdered(int i) { RayTrack rt = rayList.get(i); if (rt != null) { double angle = Math.toRadians(rt.getAngle()); + double rayRadius = radius + LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); // calculate coordinates result = new Point2D.Double( - (center.getX() + ((1.25 * radius) * Math.sin(angle))), - (center.getY() - ((1.25 * radius) * Math.cos(angle)))); + (center.getX() + (rayRadius * Math.sin(angle))), + (center.getY() - (rayRadius * Math.cos(angle)))); } return result; } @@ -381,6 +385,10 @@ public boolean isMainlineOrdered(int i) { return result; } + public boolean isMainline() { + return false; + } + /** * Modify coordinates methods */ @@ -416,7 +424,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean //note: optimization here: instead of creating rectangles for all the // points to check below, we create a rectangle for the test point // and test if the points below are in that rectangle instead. - Rectangle2D r = layoutEditor.trackControlCircleRectAt(hitPoint); + Rectangle2D r = layoutEditor.trackControlRectAt(hitPoint); Point2D p, minPoint = MathUtil.zeroPoint2D; double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); @@ -434,7 +442,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean for (int k = 0; k < getNumberRays(); k++) { if (!requireUnconnected || (getRayConnectOrdered(k) == null)) { - p = getCoordsCenter(); + p = getRayCoordsOrdered(k); distance = MathUtil.distance(p, hitPoint); if (distance < minDistance) { minDistance = distance; @@ -732,44 +740,91 @@ void dispose() { lastKnownIndex = -1; } } - } + } // class RayTrack /** - * draw this turntable - * - * @param g2 the graphics port to draw to + * {@inheritDoc} */ - protected void draw(Graphics2D g2) { - // draw turntable circle - default track color, side track width - float trackWidth = layoutEditor.setTrackStrokeWidth(g2, false); + @Override + protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { + float trackWidth = 2.F; float halfTrackWidth = trackWidth / 2.f; - double r = getRadius(), d = r + r; - g2.setColor(defaultTrackColor); - g2.draw(new Ellipse2D.Double(center.getX() - r, center.getY() - r, d, d)); + double radius = getRadius(), diameter = radius + radius; + double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); + + if (isBlock && isMain) { + // draw turntable circle - default track color, side track width + g2.setStroke(new BasicStroke(trackWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); + g2.setColor(defaultTrackColor); + g2.draw(new Ellipse2D.Double(center.getX() - radius, center.getY() - radius, diameter, diameter)); + } // draw ray tracks for (int j = 0; j < getNumberRays(); j++) { + boolean main = false; TrackSegment ts = getRayConnectOrdered(j); if (ts != null) { - layoutEditor.setTrackStrokeWidth(g2, ts.isMainline()); - setColorForTrackBlock(g2, ts.getLayoutBlock()); - } else { - layoutEditor.setTrackStrokeWidth(g2, false); - g2.setColor(defaultTrackColor); - } - Point2D pt1 = getRayCoordsOrdered(j); - Point2D delta = MathUtil.multiply(MathUtil.normalize(MathUtil.subtract(pt1, center)), r); - Point2D pt2 = MathUtil.add(center, delta); - g2.draw(new Line2D.Double(pt1, pt2)); - if (isTurnoutControlled() && (getPosition() == j)) { - delta = MathUtil.multiply(delta, (r - halfTrackWidth) / r); - //pt1 = MathUtil.subtract(center, MathUtil.subtract(pt2, center)); - pt1 = MathUtil.subtract(center, delta); - //g2.setColor(Color.RED); //TODO: remove this + main = ts.isMainline(); + } + if (isBlock) { + if (ts == null) { + g2.setColor(defaultTrackColor); + } else { + setColorForTrackBlock(g2, ts.getLayoutBlock()); + } + } + if (main == isMain) { + Point2D pt2 = getRayCoordsOrdered(j); + Point2D delta = MathUtil.normalize(MathUtil.subtract(pt2, center), radius); + Point2D pt1 = MathUtil.add(center, delta); g2.draw(new Line2D.Double(pt1, pt2)); + if (isTurnoutControlled() && (getPosition() == j)) { + delta = MathUtil.normalize(delta, radius - halfTrackWidth); + pt1 = MathUtil.subtract(center, delta); + g2.draw(new Line2D.Double(pt1, pt2)); + } } } - } + } // draw1 + + /** + * {@inheritDoc} + */ + @Override + protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { + float trackWidth = 2.F; + float halfTrackWidth = trackWidth / 2.f; + double radius = getRadius(), diameter = radius + radius; + + // draw ray tracks + for (int j = 0; j < getNumberRays(); j++) { + boolean main = false; + TrackSegment ts = getRayConnectOrdered(j); + if (ts != null) { + main = ts.isMainline(); + } + if (main == isMain) { + Point2D pt2 = getRayCoordsOrdered(j); + Point2D vDelta = MathUtil.normalize(MathUtil.subtract(pt2, center), radius); + Point2D vDeltaO = MathUtil.normalize(MathUtil.orthogonal(vDelta), railDisplacement); + Point2D pt1 = MathUtil.add(center, vDelta); + Point2D pt1L = MathUtil.subtract(pt1, vDeltaO); + Point2D pt1R = MathUtil.add(pt1, vDeltaO); + Point2D pt2L = MathUtil.subtract(pt2, vDeltaO); + Point2D pt2R = MathUtil.add(pt2, vDeltaO); + g2.draw(new Line2D.Double(pt1L, pt2L)); + g2.draw(new Line2D.Double(pt1R, pt2R)); + if (isTurnoutControlled() && (getPosition() == j)) { + vDelta = MathUtil.normalize(vDelta, radius - halfTrackWidth); + pt1 = MathUtil.subtract(center, vDelta); + pt1L = MathUtil.subtract(pt1, vDeltaO); + pt1R = MathUtil.add(pt1, vDeltaO); + g2.draw(new Line2D.Double(pt1L, pt2L)); + g2.draw(new Line2D.Double(pt1R, pt2R)); + } + } + } + } // draw2 /** * {@inheritDoc} @@ -819,7 +874,7 @@ protected void drawEditControls(Graphics2D g2) { } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(pt)); + g2.draw(layoutEditor.trackEditControlRectAt(pt)); } } @@ -966,6 +1021,6 @@ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { // nothing to see here, move along... } - private final static Logger log = LoggerFactory.getLogger(LayoutTurntable.class - ); + private final static Logger log = LoggerFactory.getLogger(LayoutTurntable.class); + } diff --git a/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java b/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java index 3f609f7d409..3180b4ed585 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java @@ -1,7 +1,9 @@ package jmri.jmrit.display.layoutEditor; import static java.lang.Float.POSITIVE_INFINITY; +import static java.lang.Math.PI; +import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.ActionEvent; @@ -66,6 +68,7 @@ * placed here by Set Signals at Level Crossing in Tools menu. * * @author Dave Duchamp Copyright (c) 2004-2007 + * @author George Warner Copyright (C) 2017 */ public class LevelXing extends LayoutTrack { @@ -847,6 +850,10 @@ public boolean isMainlineBD() { } } + public boolean isMainline() { + return (isMainlineAC() || isMainlineBD()); + } + /** * Modify coordinates methods */ @@ -900,7 +907,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean //note: optimization here: instead of creating rectangles for all the // points to check below, we create a rectangle for the test point // and test if the points below are in that rectangle instead. - Rectangle2D r = layoutEditor.trackControlCircleRectAt(hitPoint); + Rectangle2D r = layoutEditor.trackControlRectAt(hitPoint); Point2D p, minPoint = MathUtil.zeroPoint2D; double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); @@ -935,7 +942,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean if (distance < minDistance) { minDistance = distance; minPoint = p; - result = LEVEL_XING_A; + result = LEVEL_XING_B; } } @@ -946,7 +953,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean if (distance < minDistance) { minDistance = distance; minPoint = p; - result = LEVEL_XING_A; + result = LEVEL_XING_C; } } @@ -957,7 +964,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean if (distance < minDistance) { minDistance = distance; minPoint = p; - result = LEVEL_XING_A; + result = LEVEL_XING_D; } } if ((useRectangles && !r.contains(minPoint)) @@ -1376,32 +1383,103 @@ public void setAdditionalViewPopUpMenu(JPopupMenu popup) { * * @param g2 the graphics port to draw to */ - protected void draw(Graphics2D g2) { - if (isMainlineBD() && (!isMainlineAC())) { - drawXingAC(g2); - drawXingBD(g2); - } else { - drawXingBD(g2); - drawXingAC(g2); + protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { + if (isMain == isMainlineAC()) { + if (isBlock) { + setColorForTrackBlock(g2, getLayoutBlockAC()); + } + g2.draw(new Line2D.Double(getCoordsA(), getCoordsC())); + } + if (isMain == isMainlineBD()) { + if (isBlock) { + setColorForTrackBlock(g2, getLayoutBlockBD()); + } + g2.draw(new Line2D.Double(getCoordsB(), getCoordsD())); } - } // drawHidden(Graphics2D g2) - - private void drawXingAC(Graphics2D g2) { - // set color for an AC block - setColorForTrackBlock(g2, getLayoutBlockAC()); - // set track width for AC block - layoutEditor.setTrackStrokeWidth(g2, isMainlineAC()); - // drawHidden AC segment - g2.draw(new Line2D.Double(getCoordsA(), getCoordsC())); } - private void drawXingBD(Graphics2D g2) { - // set color - check for an BD block - setColorForTrackBlock(g2, getLayoutBlockBD()); - // set track width for BD block - layoutEditor.setTrackStrokeWidth(g2, isMainlineBD()); - // drawHidden BD segment - g2.draw(new Line2D.Double(getCoordsB(), getCoordsD())); + /** + * {@inheritDoc} + */ + @Override + protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { + g2.setStroke(new BasicStroke(1.F)); + + Point2D pA = getCoordsA(); + Point2D pB = getCoordsB(); + Point2D pC = getCoordsC(); + Point2D pD = getCoordsD(); + Point2D pM = getCoordsCenter(); + + Point2D vAC = MathUtil.normalize(MathUtil.subtract(pC, pA), railDisplacement); + double dirAC_DEG = MathUtil.computeAngleDEG(pA, pC); + Point2D vACo = MathUtil.orthogonal(vAC); + Point2D pAL = MathUtil.subtract(pA, vACo); + Point2D pAR = MathUtil.add(pA, vACo); + Point2D pCL = MathUtil.subtract(pC, vACo); + Point2D pCR = MathUtil.add(pC, vACo); + + Point2D vBD = MathUtil.normalize(MathUtil.subtract(pD, pB), railDisplacement); + double dirBD_DEG = MathUtil.computeAngleDEG(pB, pD); + Point2D vBDo = MathUtil.orthogonal(vBD); + Point2D pBL = MathUtil.subtract(pB, vBDo); + Point2D pBR = MathUtil.add(pB, vBDo); + Point2D pDL = MathUtil.subtract(pD, vBDo); + Point2D pDR = MathUtil.add(pD, vBDo); + + double deltaDEG = MathUtil.absDiffAngleDEG(dirAC_DEG, dirBD_DEG); + double deltaRAD = Math.toRadians(deltaDEG); + + double hypotK = railDisplacement / Math.cos((PI - deltaRAD) / 2.0); + double hypotV = railDisplacement / Math.cos(deltaRAD / 2.0); + + log.debug("dir AC: {}, BD: {}, diff: {}", dirAC_DEG, dirBD_DEG, deltaDEG); + + Point2D vDisK = MathUtil.normalize(MathUtil.add(vAC, vBD), hypotK); + Point2D vDisV = MathUtil.normalize(MathUtil.orthogonal(vDisK), hypotV); + Point2D pKL = MathUtil.subtract(pM, vDisK); + Point2D pKR = MathUtil.add(pM, vDisK); + Point2D pVL = MathUtil.subtract(pM, vDisV); + Point2D pVR = MathUtil.add(pM, vDisV); + + if (isMain == isMainlineAC()) { + // this is the *2.0 vector (rail gap) for the AC diamond parts + Point2D vAC2 = MathUtil.normalize(vAC, 2.0); + // KL toward C, VR toward A, VL toward C and KR toward A + Point2D pKLtC = MathUtil.add(pKL, vAC2); + Point2D pVRtA = MathUtil.subtract(pVR, vAC2); + Point2D pVLtC = MathUtil.add(pVL, vAC2); + Point2D pKRtA = MathUtil.subtract(pKR, vAC2); + + // draw right AC rail: AR====KL == VR====CR + g2.draw(new Line2D.Double(pAR, pKL)); + g2.draw(new Line2D.Double(pKLtC, pVRtA)); + g2.draw(new Line2D.Double(pVR, pCR)); + + // draw left AC rail: AL====VL == KR====CL + g2.draw(new Line2D.Double(pAL, pVL)); + g2.draw(new Line2D.Double(pVLtC, pKRtA)); + g2.draw(new Line2D.Double(pKR, pCL)); + } + if (isMain == isMainlineBD()) { + // this is the *2.0 vector (rail gap) for the BD diamond parts + Point2D vBD2 = MathUtil.normalize(vBD, 2.0); + // VR toward D, KR toward B, KL toward D and VL toward B + Point2D pVRtD = MathUtil.add(pVR, vBD2); + Point2D pKRtB = MathUtil.subtract(pKR, vBD2); + Point2D pKLtD = MathUtil.add(pKL, vBD2); + Point2D pVLtB = MathUtil.subtract(pVL, vBD2); + + // draw right BD rail: BR====VR == KR====DR + g2.draw(new Line2D.Double(pBR, pVR)); + g2.draw(new Line2D.Double(pVRtD, pKRtB)); + g2.draw(new Line2D.Double(pKR, pDR)); + + // draw left BD rail: BL====KL == VL====DL + g2.draw(new Line2D.Double(pBL, pKL)); + g2.draw(new Line2D.Double(pKLtD, pVLtB)); + g2.draw(new Line2D.Double(pVL, pDL)); + } } /** @@ -1428,35 +1506,35 @@ protected void drawUnconnected(Graphics2D g2) { protected void drawEditControls(Graphics2D g2) { g2.setColor(defaultTrackColor); - g2.draw(layoutEditor.trackControlCircleAt(getCoordsCenter())); + //TODO:uncomment this line g2.draw(layoutEditor.trackEditControlCircleAt(getCoordsCenter())); if (getConnectA() == null) { g2.setColor(Color.magenta); } else { g2.setColor(Color.blue); } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsA())); + g2.draw(layoutEditor.trackEditControlRectAt(getCoordsA())); if (getConnectB() == null) { g2.setColor(Color.red); } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsB())); + g2.draw(layoutEditor.trackEditControlRectAt(getCoordsB())); if (getConnectC() == null) { g2.setColor(Color.red); } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsC())); + g2.draw(layoutEditor.trackEditControlRectAt(getCoordsC())); if (getConnectD() == null) { g2.setColor(Color.red); } else { g2.setColor(Color.green); } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsD())); + g2.draw(layoutEditor.trackEditControlRectAt(getCoordsD())); } protected void drawTurnoutControls(Graphics2D g2) { @@ -1633,4 +1711,5 @@ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { } private final static Logger log = LoggerFactory.getLogger(LevelXing.class); + } diff --git a/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java b/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java index c01b1f771b9..e95633685a1 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java +++ b/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java @@ -70,6 +70,7 @@ * * @author Dave Duchamp Copyright (c) 2004-2007 * @author Bob Jacobsen Copyright (2) 2014 + * @author George Warner Copyright (C) 2017 */ public class PositionablePoint extends LayoutTrack { @@ -702,8 +703,8 @@ public boolean replaceTrackConnection(@Nullable TrackSegment oldTrack, @Nullable result = false; } } else { - log.error("Already connected to {}", newTrack.getName()); - result = false; + log.error("Already connected to {}", newTrack.getName()); + result = false; } return result; } // replaceTrackConnection @@ -1325,7 +1326,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean //note: optimization here: instead of creating rectangles for all the // points to check below, we create a rectangle for the test point // and test if the points below are in that rectangle instead. - Rectangle2D r = layoutEditor.trackControlCircleRectAt(hitPoint); + Rectangle2D r = layoutEditor.trackControlRectAt(hitPoint); Point2D p, minPoint = MathUtil.zeroPoint2D; double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); @@ -1413,13 +1414,26 @@ public boolean isDisconnected(int connectionType) { return result; } + public boolean isMainline() { + boolean result = false; // assume failure (pessimist!) + if (getConnect1() != null) { + result = getConnect1().isMainline(); + } + if (getType() == ANCHOR) { + if (getConnect2() != null) { + result |= getConnect2().isMainline(); + } + } + return result; + } + /** * draw this PositionablePoint * * @param g2 the graphics port to draw to */ @Override - protected void draw(Graphics2D g2) { + protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { if (getType() != ANCHOR) { Point2D pt = getCoordsCenter(); boolean mainline = false; @@ -1436,19 +1450,18 @@ protected void draw(Graphics2D g2) { } } - double trackWidth = Math.min(layoutEditor.setTrackStrokeWidth(g2, mainline), 3.0); + double trackWidth = 2.0; + double tieWidth = trackWidth * 2.0; Stroke drawingStroke = new BasicStroke((float) trackWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.F); - //Stroke drawingStroke1 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.F); - trackWidth *= 2.0; + g2.setColor(defaultTrackColor); if (!ep1.equals(ep2)) { - setColorForTrackBlock(g2, getConnect1().getLayoutBlock()); double angleRAD = (Math.PI / 2.0) - MathUtil.computeAngleRAD(ep1, ep2); Point2D p1, p2, p3, p4; if (getType() == END_BUMPER) { // draw a cross tie - p1 = new Point2D.Double(0.0, -trackWidth); - p2 = new Point2D.Double(0.0, +trackWidth); + p1 = new Point2D.Double(0.0, -tieWidth); + p2 = new Point2D.Double(0.0, +tieWidth); p1 = MathUtil.add(MathUtil.rotateRAD(p1, angleRAD), pt); p2 = MathUtil.add(MathUtil.rotateRAD(p2, angleRAD), pt); @@ -1456,10 +1469,10 @@ protected void draw(Graphics2D g2) { g2.draw(new Line2D.Double(p1, p2)); } else if (getType() == EDGE_CONNECTOR) { // draw an X - p1 = new Point2D.Double(-trackWidth, -trackWidth); - p2 = new Point2D.Double(-trackWidth, +trackWidth); - p3 = new Point2D.Double(+trackWidth, +trackWidth); - p4 = new Point2D.Double(+trackWidth, -trackWidth); + p1 = new Point2D.Double(-trackWidth - tieWidth, -tieWidth); + p2 = new Point2D.Double(-trackWidth - tieWidth, +tieWidth); + p3 = new Point2D.Double(-trackWidth + tieWidth, +tieWidth); + p4 = new Point2D.Double(-trackWidth + tieWidth, -tieWidth); p1 = MathUtil.add(MathUtil.rotateRAD(p1, angleRAD), pt); p2 = MathUtil.add(MathUtil.rotateRAD(p2, angleRAD), pt); @@ -1471,12 +1484,17 @@ protected void draw(Graphics2D g2) { g2.draw(new Line2D.Double(p2, p4)); } } - // this is to force setTrackStrokeWidth's mainline local to toggle - // so next time it's called it will "do the right thing"... - layoutEditor.setTrackStrokeWidth(g2, !mainline); } // if (getType() != ANCHOR) } // draw + /** + * {@inheritDoc} + */ + @Override + protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { + //nothing to do here... move along... + } + /** * {@inheritDoc} */ @@ -1515,7 +1533,7 @@ protected void drawEditControls(Graphics2D g2) { g2.setColor(Color.green); } } - g2.draw(layoutEditor.trackControlPointRectAt(getCoordsCenter())); + g2.draw(layoutEditor.trackEditControlRectAt(getCoordsCenter())); } // drawEditControls @Override @@ -1790,7 +1808,7 @@ public void collectContiguousTracksNamesInBlockNamed(@Nonnull String blockName, } } - /** + /** * {@inheritDoc} */ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { @@ -1799,4 +1817,5 @@ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { } private final static Logger log = LoggerFactory.getLogger(PositionablePoint.class); + } diff --git a/java/src/jmri/jmrit/display/layoutEditor/TrackNode.java b/java/src/jmri/jmrit/display/layoutEditor/TrackNode.java index a53c0dbb918..c9e8c67b087 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/TrackNode.java +++ b/java/src/jmri/jmrit/display/layoutEditor/TrackNode.java @@ -29,6 +29,7 @@ * Object and Node Type, are not returned. * * @author Dave Duchamp Copyright (C) 2009 + * @author George Warner Copyright (C) 2017 */ public class TrackNode { diff --git a/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java b/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java index 9e651fdb6f8..0b8acfd4828 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java +++ b/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java @@ -3,10 +3,8 @@ import static java.lang.Float.POSITIVE_INFINITY; import static jmri.jmrit.display.layoutEditor.LayoutTrack.TRACK; -import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; -import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.geom.Arc2D; @@ -51,6 +49,7 @@ * TrackSegments may be hidden when the panel is not in EditMode. * * @author Dave Duchamp Copyright (p) 2004-2009 + * @author George Warner Copyright (c) 2017 */ public class TrackSegment extends LayoutTrack { @@ -186,7 +185,6 @@ protected void setNewConnect2(@Nullable LayoutTrack connectTrack, int connection type2 = connectionType; } - /** * replace old track connection with new track connection * @@ -432,7 +430,7 @@ private String getConnectName(@Nullable LayoutTrack layoutTrack, int type) { * This implementation returns null because {@link #getConnect1} and * {@link #getConnect2} should be used instead. */ - // only implemented here to supress "does not override abstract method " error in compiler + // only implemented here to suppress "does not override abstract method " error in compiler public LayoutTrack getConnection(int connectionType) throws jmri.JmriException { // nothing to see here, move along return null; @@ -444,7 +442,7 @@ public LayoutTrack getConnection(int connectionType) throws jmri.JmriException { * This implementation does nothing because {@link #setNewConnect1} and * {@link #setNewConnect2} should be used instead. */ - // only implemented here to supress "does not override abstract method " error in compiler + // only implemented here to suppress "does not override abstract method " error in compiler public void setConnection(int connectionType, @Nullable LayoutTrack o, int type) throws jmri.JmriException { // nothing to see here, move along } @@ -629,7 +627,7 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean //note: optimization here: instead of creating rectangles for all the // points to check below, we create a rectangle for the test point // and test if the points below are in that rectangle instead. - Rectangle2D r = layoutEditor.trackControlCircleRectAt(hitPoint); + Rectangle2D r = layoutEditor.trackControlRectAt(hitPoint); Point2D p, minPoint = MathUtil.zeroPoint2D; double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); @@ -645,14 +643,13 @@ protected int findHitPointType(Point2D hitPoint, boolean useRectangles, boolean } } else if (isBezier()) { // hit testing for the control points - // note: control points will override center circle for (int index = 0; index < bezierControlPoints.size(); index++) { p = bezierControlPoints.get(index); distance = MathUtil.distance(p, hitPoint); if (distance < minDistance) { minDistance = distance; minPoint = p; - result = TRACK_CIRCLE_CENTRE; + result = BEZIER_CONTROL_POINT_OFFSET_MIN + index; } } } @@ -818,7 +815,8 @@ public void actionPerformed(ActionEvent e) { @Override public void actionPerformed(ActionEvent e) { splitTrackSegment(); - }; + } + ; }); JMenu lineType = new JMenu(Bundle.getMessage("ChangeTo")); @@ -895,9 +893,9 @@ public void actionPerformed(ActionEvent e) { } // showPopup /** - * split this TrackSegment + * split track segment into two track segments with an anchor between */ - private void splitTrackSegment() { + public void splitTrackSegment() { // create a new anchor Point2D p = getCentreSeg(); PositionablePoint newAnchor = layoutEditor.addAnchor(p); @@ -905,7 +903,7 @@ private void splitTrackSegment() { layoutEditor.setLink(newAnchor, POS_POINT, this, TRACK); //get unique name for a new track segment - String name = layoutEditor.getFinder().uniqueName("T", 0); + String name = layoutEditor.getFinder().uniqueName("T", 1); //create it between the new anchor and my connect2(/type2) TrackSegment newTrackSegment = new TrackSegment(name, @@ -1058,14 +1056,14 @@ void changeType(int choice) { Point2D ep1 = layoutEditor.getCoords(getConnect1(), getType1()); Point2D ep2 = layoutEditor.getCoords(getConnect2(), getType2()); - // compute offset one third the distance from ep1 to ep2 + // compute orthogonal offset0 with length one third the distance from ep1 to ep2 Point2D offset = MathUtil.subtract(ep2, ep1); - offset = MathUtil.multiply(MathUtil.normalize(offset), MathUtil.length(offset) / 3); + offset = MathUtil.normalize(offset, MathUtil.length(offset) / 3.0); + offset = MathUtil.orthogonal(offset); - // swap x & y so the offset is orthogonal to orginal line - offset = new Point2D.Double(offset.getY(), offset.getX()); + // add orthogonal offset0 to 1/3rd and 2/3rd points Point2D pt1 = MathUtil.add(MathUtil.oneThirdPoint(ep1, ep2), offset); - Point2D pt2 = MathUtil.subtract(MathUtil.oneThirdPoint(ep2, ep1), offset); + Point2D pt2 = MathUtil.subtract(MathUtil.twoThirdsPoint(ep1, ep2), offset); bezierControlPoints.add(pt1); bezierControlPoints.add(pt2); @@ -1159,7 +1157,7 @@ public boolean hideConstructionLines() { /** * The following are used only as a temporary store after a circle or arc * has been calculated. This prevents the need to recalculate the values - * each time a re-drawHidden is required. + * each time a re-draw is required. */ private Point2D pt1; private Point2D pt2; @@ -1182,7 +1180,6 @@ public void setTmpPt2(Point2D Pt2) { changed = true; } - //private int startadj; private double cX; public double getCX() { @@ -1223,14 +1220,14 @@ public void setCH(double CH) { cH = CH; } - private double startadj; + private double startAdj; - public double getStartadj() { - return startadj; + public double getStartAdj() { + return startAdj; } - public void setStartadj(double Startadj) { - startadj = Startadj; + public void setStartAdj(double startAdj) { + this.startAdj = startAdj; } // this is the center of the track segment (it is "on" the track segment) @@ -1376,41 +1373,41 @@ public void setChordLength(double chord) { * Called when the user changes the angle dynamically in edit mode * by dragging the centre of the cirle. */ - //NOTE: AFAICT this isn't called from anywhere protected void reCalculateTrackSegmentAngle(double x, double y) { + if (!isBezier()) { + double pt2x; + double pt2y; + double pt1x; + double pt1y; + + if (isFlip()) { + pt1x = getTmpPt2().getX(); + pt1y = getTmpPt2().getY(); + pt2x = getTmpPt1().getX(); + pt2y = getTmpPt1().getY(); + } else { + pt1x = getTmpPt1().getX(); + pt1y = getTmpPt1().getY(); + pt2x = getTmpPt2().getX(); + pt2y = getTmpPt2().getY(); + } + //Point 1 to new point distance + double a; + double o; + double la; + // Compute arc's chord + a = pt2x - x; + o = pt2y - y; + la = Math.hypot(a, o); - double pt2x; - double pt2y; - double pt1x; - double pt1y; + double lb; + a = pt1x - x; + o = pt1y - y; + lb = Math.hypot(a, o); - if (isFlip()) { - pt1x = getTmpPt2().getX(); - pt1y = getTmpPt2().getY(); - pt2x = getTmpPt1().getX(); - pt2y = getTmpPt1().getY(); - } else { - pt1x = getTmpPt1().getX(); - pt1y = getTmpPt1().getY(); - pt2x = getTmpPt2().getX(); - pt2y = getTmpPt2().getY(); + double newangle = Math.toDegrees(Math.acos((-getChordLength() * getChordLength() + la * la + lb * lb) / (2 * la * lb))); + setAngle(newangle); } - //Point 1 to new point distance - double a; - double o; - double la; - // Compute arc's chord - a = pt2x - x; - o = pt2y - y; - la = Math.hypot(a, o); - - double lb; - a = pt1x - x; - o = pt1y - y; - lb = Math.hypot(a, o); - - double newangle = Math.toDegrees(Math.acos((-getChordLength() * getChordLength() + la * la + lb * lb) / (2 * la * lb))); - setAngle(newangle); } /* @@ -1454,7 +1451,7 @@ protected void calculateTrackSegmentAngle() { double radius = (chord / 2) / Math.sin(halfAngleRAD); // Circle double startRad = Math.atan2(a, o) - halfAngleRAD; - setStartadj(Math.toDegrees(startRad)); + setStartAdj(Math.toDegrees(startRad)); if (isCircle()) { // Circle - Compute center setCentreX(pt2x - Math.cos(startRad) * radius); @@ -1473,7 +1470,7 @@ protected void calculateTrackSegmentAngle() { setCentreSeg(MathUtil.add(getCentre(), offset)); } else { // Ellipse - Round start angle to the closest multiple of 90 - setStartadj(Math.round(getStartadj() / 90.0D) * 90.0D); + setStartAdj(Math.round(getStartAdj() / 90.0D) * 90.0D); // Ellipse - Compute rectangle required by Arc2D.Double setCW(Math.abs(a) * 2.0D); setCH(Math.abs(o) * 2.0D); @@ -1494,107 +1491,105 @@ protected void calculateTrackSegmentAngle() { * {@inheritDoc} */ @Override - protected void draw(Graphics2D g2) { - // hidden, dashed & solid track segments are drawn interleaved - // so save and restore the previous stroke before & after drawing - Stroke oldStroke = g2.getStroke(); // save previous stroke - setColorForTrackBlock(g2, getLayoutBlock()); - - if (isHidden()) { - if (layoutEditor.isEditable()) { - drawHidden(g2); + protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { + if (isMain == mainline) { + if (isBlock) { + setColorForTrackBlock(g2, getLayoutBlock()); + } + if (isArc()) { + calculateTrackSegmentAngle(); + g2.draw(new Arc2D.Double(getCX(), getCY(), getCW(), getCH(), getStartAdj(), getTmpAngle(), Arc2D.OPEN)); + trackRedrawn(); + } else if (isBezier()) { + Point2D pt1 = layoutEditor.getCoords(getConnect1(), getType1()); + Point2D pt2 = layoutEditor.getCoords(getConnect2(), getType2()); + + int cnt = bezierControlPoints.size(); + Point2D[] points = new Point2D[cnt + 2]; + points[0] = pt1; + for (int idx = 0; idx < cnt; idx++) { + points[idx + 1] = bezierControlPoints.get(idx); + } + points[cnt + 1] = pt2; + + MathUtil.drawBezier(g2, points); + } else { + Point2D end1 = layoutEditor.getCoords(getConnect1(), getType1()); + Point2D end2 = layoutEditor.getCoords(getConnect2(), getType2()); + + g2.draw(new Line2D.Double(end1, end2)); } - } else if (isDashed()) { - drawDashed(g2); - } else if (!isHidden()) { - drawSolid(g2); } - g2.setStroke(oldStroke); // restore previous stroke } /** * {@inheritDoc} */ @Override - protected void drawUnconnected(Graphics2D g2) { - // TrackSegments are always connected - // nothing to see here... move along... - } - - private void drawHidden(Graphics2D g2) { - g2.setStroke(new BasicStroke(1.0F, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND)); - g2.draw(new Line2D.Double(layoutEditor.getCoords(getConnect1(), getType1()), - layoutEditor.getCoords(getConnect2(), getType2()))); - } // drawHidden + protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { + if (isMain == mainline) { + if (isArc()) { + calculateTrackSegmentAngle(); + Rectangle2D cRectangle2D = new Rectangle2D.Double( + getCX(), getCY(), getCW(), getCH()); + Rectangle2D cLeftRectangle2D = MathUtil.inset(cRectangle2D, -railDisplacement); + double startAdj = getStartAdj(), tmpAngle = getTmpAngle(); + g2.draw(new Arc2D.Double( + cLeftRectangle2D.getX(), + cLeftRectangle2D.getY(), + cLeftRectangle2D.getWidth(), + cLeftRectangle2D.getHeight(), + startAdj, tmpAngle, Arc2D.OPEN)); + Rectangle2D cLRightRectangle2D = MathUtil.inset(cRectangle2D, +railDisplacement); + g2.draw(new Arc2D.Double( + cLRightRectangle2D.getX(), + cLRightRectangle2D.getY(), + cLRightRectangle2D.getWidth(), + cLRightRectangle2D.getHeight(), + startAdj, tmpAngle, Arc2D.OPEN)); + trackRedrawn(); + } else if (isBezier()) { + Point2D pt1 = layoutEditor.getCoords(getConnect1(), getType1()); + Point2D pt2 = layoutEditor.getCoords(getConnect2(), getType2()); + + int cnt = bezierControlPoints.size(); + Point2D[] points = new Point2D[cnt + 2]; + points[0] = pt1; + for (int idx = 0; idx < cnt; idx++) { + points[idx + 1] = bezierControlPoints.get(idx); + } + points[cnt + 1] = pt2; - private void drawDashed(Graphics2D g2) { - float trackWidth = layoutEditor.setTrackStrokeWidth(g2, mainline); - if (isArc()) { - calculateTrackSegmentAngle(); - Stroke drawingStroke = new BasicStroke(trackWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{9}, 0); - g2.setStroke(drawingStroke); - g2.draw(new Arc2D.Double(getCX(), getCY(), getCW(), getCH(), getStartadj(), getTmpAngle(), Arc2D.OPEN)); - } else if (isBezier()) { - Stroke drawingStroke = new BasicStroke(trackWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{9}, 0); - g2.setStroke(drawingStroke); + MathUtil.drawBezier(g2, points, -railDisplacement); + MathUtil.drawBezier(g2, points, +railDisplacement); + } else { + Point2D end1 = layoutEditor.getCoords(getConnect1(), getType1()); + Point2D end2 = layoutEditor.getCoords(getConnect2(), getType2()); - Point2D pt1 = layoutEditor.getCoords(getConnect1(), getType1()); - Point2D pt2 = layoutEditor.getCoords(getConnect2(), getType2()); + Point2D delta = MathUtil.subtract(end2, end1); + Point2D vector = MathUtil.normalize(delta, railDisplacement); + vector = MathUtil.orthogonal(vector); - int cnt = bezierControlPoints.size(); - Point2D[] points = new Point2D[cnt + 2]; - points[0] = pt1; - for (int idx = 0; idx < cnt; idx++) { - points[idx + 1] = bezierControlPoints.get(idx); - } - points[cnt + 1] = pt2; + Point2D ep1L = MathUtil.add(end1, vector); + Point2D ep2L = MathUtil.add(end2, vector); + g2.draw(new Line2D.Double(ep1L, ep2L)); - MathUtil.drawBezier(g2, points); - } else { - Point2D end1 = layoutEditor.getCoords(getConnect1(), getType1()); - Point2D end2 = layoutEditor.getCoords(getConnect2(), getType2()); - - double delX = end1.getX() - end2.getX(); - double delY = end1.getY() - end2.getY(); - double cLength = Math.hypot(delX, delY); - - // note: The preferred dimension of a dash (solid + blank space) is - // 5 * the track width - about 60% solid and 40% blank. - int nDashes = (int) (cLength / ((trackWidth) * 5.0)); - if (nDashes < 3) { - nDashes = 3; - } - double delXDash = -delX / ((nDashes) - 0.5); - double delYDash = -delY / ((nDashes) - 0.5); - double begX = end1.getX(); - double begY = end1.getY(); - for (int k = 0; k < nDashes; k++) { - g2.draw(new Line2D.Double(new Point2D.Double(begX, begY), - new Point2D.Double(begX + (delXDash * 0.5), begY + (delYDash * 0.5)))); - begX += delXDash; - begY += delYDash; + Point2D ep1R = MathUtil.subtract(end1, vector); + Point2D ep2R = MathUtil.subtract(end2, vector); + g2.draw(new Line2D.Double(ep1R, ep2R)); } } - } // drawDashed - - private void drawSolid(Graphics2D g2) { - if (isArc()) { - calculateTrackSegmentAngle(); - g2.draw(new Arc2D.Double(getCX(), getCY(), getCW(), getCH(), getStartadj(), getTmpAngle(), Arc2D.OPEN)); - } else if (isBezier()) { - Point2D pt0 = layoutEditor.getCoords(getConnect1(), getType1()); - Point2D pt3 = layoutEditor.getCoords(getConnect2(), getType2()); + } - Point2D pt1 = bezierControlPoints.get(0); - Point2D pt2 = bezierControlPoints.get(1); - MathUtil.drawBezier(g2, pt0, pt1, pt2, pt3); - } else { - Point2D end1 = layoutEditor.getCoords(getConnect1(), getType1()); - Point2D end2 = layoutEditor.getCoords(getConnect2(), getType2()); - g2.draw(new Line2D.Double(end1, end2)); - } - trackRedrawn(); - } // drawSolid + /** + * {@inheritDoc} + */ + @Override + protected void drawUnconnected(Graphics2D g2 + ) { + // TrackSegments are always connected + // nothing to see here... move along... + } protected void drawEditControls(Graphics2D g2) { g2.setColor(Color.black); @@ -1608,20 +1603,20 @@ protected void drawEditControls(Graphics2D g2) { g2.draw(new Line2D.Double(circleCenterPoint, ep2)); // Draw a circle and square at the circles centre, that // allows the user to change the angle by dragging the mouse. - g2.draw(layoutEditor.trackControlCircleAt(circleCenterPoint)); - g2.draw(layoutEditor.trackControlCircleRectAt(circleCenterPoint)); + g2.draw(layoutEditor.trackEditControlCircleAt(circleCenterPoint)); + g2.draw(layoutEditor.trackEditControlRectAt(circleCenterPoint)); } else if (isBezier()) { //draw construction lines and control circles Point2D lastPt = ep1; for (Point2D bcp : bezierControlPoints) { g2.draw(new Line2D.Double(lastPt, bcp)); lastPt = bcp; - g2.draw(layoutEditor.trackControlPointRectAt(bcp)); + g2.draw(layoutEditor.trackEditControlRectAt(bcp)); } g2.draw(new Line2D.Double(lastPt, ep2)); } } - g2.draw(layoutEditor.trackControlCircleAt(getCentreSeg())); + g2.draw(layoutEditor.trackEditControlCircleAt(getCentreSeg())); } // drawEditControls protected void drawTurnoutControls(Graphics2D g2) { @@ -1882,6 +1877,7 @@ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { setLayoutBlock(layoutBlock); } - private final static Logger log = LoggerFactory.getLogger(TrackSegment.class); + private final static Logger log = LoggerFactory.getLogger(TrackSegment.class + ); } diff --git a/java/src/jmri/jmrit/display/layoutEditor/TransitCreationTool.java b/java/src/jmri/jmrit/display/layoutEditor/TransitCreationTool.java index c9b1c0d2a3e..c308d0af29b 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/TransitCreationTool.java +++ b/java/src/jmri/jmrit/display/layoutEditor/TransitCreationTool.java @@ -33,6 +33,7 @@ *

                * * @author Kevin Dickerson Copyright (C) 2011 + * @author George Warner Copyright (C) 2017 */ public class TransitCreationTool { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutBlockManagerXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutBlockManagerXml.java index a30393ac184..d3e95f24da5 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutBlockManagerXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutBlockManagerXml.java @@ -18,6 +18,7 @@ * Provides the functionality for configuring a LayoutBlockManager * * @author Dave Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutBlockManagerXml extends jmri.managers.configurexml.AbstractNamedBeanManagerConfigXML { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutEditorXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutEditorXml.java index 2012e396524..fdc0e4ec64e 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutEditorXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutEditorXml.java @@ -15,6 +15,7 @@ import jmri.jmrit.display.layoutEditor.LayoutEditor; import jmri.jmrit.display.layoutEditor.LayoutSlip; import jmri.jmrit.display.layoutEditor.LayoutTrack; +import jmri.jmrit.display.layoutEditor.LayoutTrackDrawingOptions; import jmri.jmrit.display.layoutEditor.LayoutTurnout; import jmri.jmrit.display.layoutEditor.LayoutTurntable; import jmri.jmrit.display.layoutEditor.LevelXing; @@ -31,6 +32,7 @@ * Based in part on PanelEditorXml.java * * @author Dave Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutEditorXml extends AbstractXmlAdapter { @@ -106,6 +108,17 @@ public Element store(Object o) { panel.setAttribute("openDispatcher", p.getOpenDispatcherOnLoad() ? "yes" : "no"); panel.setAttribute("useDirectTurnoutControl", p.getDirectTurnoutControl() ? "yes" : "no"); + // store layout track drawing options + try { + LayoutTrackDrawingOptions ltdo = p.getLayoutTrackDrawingOptions(); + Element e = jmri.configurexml.ConfigXmlManager.elementFromObject(ltdo); + if (e != null) { + panel.addContent(e); + } + } catch (Exception e) { + log.error("Error storing contents element: " + e); + } + // note: moving zoom attribute into per-window user preference //panel.setAttribute("zoom", Double.toString(p.getZoom())); int num; @@ -503,12 +516,13 @@ public boolean load(Element shared, Element perNode) { if (log.isDebugEnabled()) { String id = ""; try { - id = item.getAttribute("ident").getValue(); + id = item.getAttribute("name").getValue(); log.debug("Load " + id + " for [" + panel.getName() + "] via " + adapterName); + } catch (NullPointerException e) { + log.debug("Load layout object for [" + panel.getName() + "] via " + adapterName); } catch (RuntimeException e) { throw e; } catch (Exception e) { - log.debug("Load layout object for [" + panel.getName() + "] via " + adapterName); } } try { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutSlipXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutSlipXml.java index 1d4f45cc351..4fff843e3ca 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutSlipXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutSlipXml.java @@ -16,6 +16,7 @@ * LayoutEditor. * * @author David Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutSlipXml extends AbstractXmlAdapter { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTrackDrawingOptionsXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTrackDrawingOptionsXml.java new file mode 100644 index 00000000000..5623cf582cd --- /dev/null +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTrackDrawingOptionsXml.java @@ -0,0 +1,146 @@ +package jmri.jmrit.display.layoutEditor.configurexml; + +import java.awt.Color; +import javax.annotation.CheckReturnValue; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import jmri.configurexml.AbstractXmlAdapter; +import jmri.jmrit.display.layoutEditor.LayoutEditor; +import jmri.jmrit.display.layoutEditor.LayoutTrackDrawingOptions; +import jmri.util.ColorUtil; +import org.jdom2.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This module handles saving and loading LayoutTrackDrawingOptions + * for a LayoutEditor. + * + * @author George Warner Copyright (c) 2017 + */ +public class LayoutTrackDrawingOptionsXml extends AbstractXmlAdapter { + + public LayoutTrackDrawingOptionsXml() { + } + + /** + * Default implementation for storing LayoutTrackDrawingOptions contents + * + * @param o Object to store, of type LayoutTrackDrawingOptions + * @return Element containing the complete info + */ + @Override + public Element store(Object o) { + + LayoutTrackDrawingOptions p = (LayoutTrackDrawingOptions) o; + + Element element = new Element("layoutTrackDrawingOptions"); + + // include attributes + element.setAttribute("name", p.getName()); + + // add elements + element.addContent(new Element("mainBallastColor").addContent(ColorUtil.colorToHexString(p.getMainBallastColor()))); + element.addContent(new Element("mainBallastWidth").addContent("" + p.getMainBallastWidth())); + element.addContent(new Element("mainBlockLineWidth").addContent("" + p.getMainBlockLineWidth())); + element.addContent(new Element("mainRailColor").addContent(ColorUtil.colorToHexString(p.getMainRailColor()))); + element.addContent(new Element("mainRailCount").addContent("" + p.getMainRailCount())); + element.addContent(new Element("mainRailGap").addContent("" + p.getMainRailGap())); + element.addContent(new Element("mainRailWidth").addContent("" + p.getMainRailWidth())); + element.addContent(new Element("mainTieColor").addContent(ColorUtil.colorToHexString(p.getMainTieColor()))); + element.addContent(new Element("mainTieGap").addContent("" + p.getMainTieGap())); + element.addContent(new Element("mainTieLength").addContent("" + p.getMainTieLength())); + element.addContent(new Element("mainTieWidth").addContent("" + p.getMainTieWidth())); + element.addContent(new Element("sideBallastColor").addContent(ColorUtil.colorToHexString(p.getSideBallastColor()))); + element.addContent(new Element("sideBallastWidth").addContent("" + p.getSideBallastWidth())); + element.addContent(new Element("sideBlockLineWidth").addContent("" + p.getSideBlockLineWidth())); + element.addContent(new Element("sideRailColor").addContent(ColorUtil.colorToHexString(p.getSideRailColor()))); + element.addContent(new Element("sideRailCount").addContent("" + p.getSideRailCount())); + element.addContent(new Element("sideRailGap").addContent("" + p.getSideRailGap())); + element.addContent(new Element("sideRailWidth").addContent("" + p.getSideRailWidth())); + element.addContent(new Element("sideTieColor").addContent(ColorUtil.colorToHexString(p.getSideTieColor()))); + element.addContent(new Element("sideTieGap").addContent("" + p.getSideTieGap())); + element.addContent(new Element("sideTieLength").addContent("" + p.getSideTieLength())); + element.addContent(new Element("sideTieWidth").addContent("" + p.getSideTieWidth())); + + element.setAttribute("class", getClass().getName()); + return element; + } + + @Override + public boolean load(Element shared, Element perNode) { + log.error("Invalid method called"); + return false; + } + + /** + * Load, starting with the layoutTrackDrawingOptions element, then all the + * other data + * + * @param element Top level Element to unpack. + * @param o LayoutEditor as an Object + */ + @Override + public void load(Element element, Object o) { + // create the objects + LayoutEditor p = (LayoutEditor) o; + + // get the current LayoutTrackDrawingOptions + LayoutTrackDrawingOptions ltdo = p.getLayoutTrackDrawingOptions(); + + // set its name + String name = element.getAttribute("name").getValue(); + ltdo.setName(name); + + // get remaining option elements + ltdo.setMainBallastColor(getElementColor(element, "mainBallastColor", ltdo.getMainBallastColor())); + ltdo.setMainBallastWidth(getElementInt(element, "mainBallastWidth", ltdo.getMainBallastWidth())); + ltdo.setMainBlockLineWidth(getElementInt(element, "mainBlockLineWidth", ltdo.getMainBlockLineWidth())); + ltdo.setMainRailColor(getElementColor(element, "mainRailColor", ltdo.getMainRailColor())); + ltdo.setMainRailCount(getElementInt(element, "mainRailCount", ltdo.getMainRailCount())); + ltdo.setMainRailGap(getElementInt(element, "mainRailGap", ltdo.getMainRailGap())); + ltdo.setMainRailWidth(getElementInt(element, "mainRailWidth", ltdo.getMainRailWidth())); + ltdo.setMainTieColor(getElementColor(element, "mainTieColor", ltdo.getMainTieColor())); + ltdo.setMainTieGap(getElementInt(element, "mainTieGap", ltdo.getMainTieGap())); + ltdo.setMainTieLength(getElementInt(element, "mainTieLength", ltdo.getMainTieLength())); + ltdo.setMainTieWidth(getElementInt(element, "mainTieWidth", ltdo.getMainTieWidth())); + ltdo.setSideBallastColor(getElementColor(element, "sideBallastColor", ltdo.getSideBallastColor())); + ltdo.setSideBallastWidth(getElementInt(element, "sideBallastWidth", ltdo.getSideBallastWidth())); + ltdo.setSideBlockLineWidth(getElementInt(element, "sideBlockLineWidth", ltdo.getSideBlockLineWidth())); + ltdo.setSideRailColor(getElementColor(element, "sideRailColor", ltdo.getSideBallastColor())); + ltdo.setSideRailCount(getElementInt(element, "sideRailCount", ltdo.getSideRailCount())); + ltdo.setSideRailGap(getElementInt(element, "sideRailGap", ltdo.getSideRailGap())); + ltdo.setSideRailWidth(getElementInt(element, "sideRailWidth", ltdo.getSideRailWidth())); + ltdo.setSideTieColor(getElementColor(element, "sideTieColor", ltdo.getSideTieColor())); + ltdo.setSideTieGap(getElementInt(element, "sideTieGap", ltdo.getSideTieGap())); + ltdo.setSideTieLength(getElementInt(element, "sideTieLength", ltdo.getSideTieLength())); + ltdo.setSideTieWidth(getElementInt(element, "sideTieWidth", ltdo.getSideTieWidth())); + + p.setLayoutTrackDrawingOptions(ltdo); + } // load + + @CheckReturnValue + private Color getElementColor(@Nonnull Element el, @Nonnull String child, @Nullable Color defVal) { + Element c = el.getChild(child); + if (c != null) { + String val = c.getText(); + if ((val != null) && !val.isEmpty()) { + defVal = Color.decode(val); + } + } + return defVal; + } + + int getElementInt(Element el, String child, int defVal) { + Element c = el.getChild(child); + if (c != null) { + String val = c.getText(); + if ((val != null) && !val.isEmpty()) { + defVal = Integer.parseInt(val); + } + } + return defVal; + } + + private final static Logger log = LoggerFactory.getLogger(LayoutTrackDrawingOptionsXml.class); +} diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurnoutXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurnoutXml.java index b158bae9f2b..f64051caba9 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurnoutXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurnoutXml.java @@ -17,6 +17,7 @@ * LayoutEditor. * * @author David Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutTurnoutXml extends AbstractXmlAdapter { @@ -63,7 +64,7 @@ public Element store(Object o) { element.setAttribute("yd", "" + coords.getY()); element.setAttribute("ver", "" + p.getVersion()); element.setAttribute("class", getClass().getName()); - + if (!p.getTurnoutName().isEmpty()) { element.setAttribute("turnoutname", p.getTurnoutName()); } @@ -256,7 +257,7 @@ public void load(Element element, Object o) { if (a != null) { l.connectDName = a.getValue(); } - + a = element.getAttribute("signala1name"); if (a != null) { l.setSignalA1Name(a.getValue()); diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurntableXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurntableXml.java index 001461c1e68..ed1f91e21dd 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurntableXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LayoutTurntableXml.java @@ -18,6 +18,7 @@ * LayoutEditor. * * @author David Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LayoutTurntableXml extends AbstractXmlAdapter { @@ -107,7 +108,7 @@ public void load(Element element, Object o) { } catch (NullPointerException e) { // considered normal if the attribute is not present } - // load ray tracks + // load ray tracks List rayTrackList = element.getChildren("raytrack"); if (rayTrackList.size() > 0) { for (int i = 0; i < rayTrackList.size(); i++) { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LevelXingXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LevelXingXml.java index 18b449b73a2..2af3c0e3f3e 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/LevelXingXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/LevelXingXml.java @@ -16,6 +16,7 @@ * LayoutEditor. * * @author David Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class LevelXingXml extends AbstractXmlAdapter { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/PositionablePointXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/PositionablePointXml.java index c17fc3507ff..8661d5ba818 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/PositionablePointXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/PositionablePointXml.java @@ -16,6 +16,7 @@ * LayoutEditor. * * @author David Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class PositionablePointXml extends AbstractXmlAdapter { diff --git a/java/src/jmri/jmrit/display/layoutEditor/configurexml/TrackSegmentXml.java b/java/src/jmri/jmrit/display/layoutEditor/configurexml/TrackSegmentXml.java index c6b61a728a9..5869667a432 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/configurexml/TrackSegmentXml.java +++ b/java/src/jmri/jmrit/display/layoutEditor/configurexml/TrackSegmentXml.java @@ -17,6 +17,7 @@ * LayoutEditor. * * @author David Duchamp Copyright (c) 2007 + * @author George Warner Copyright (C) 2017 */ public class TrackSegmentXml extends AbstractXmlAdapter { diff --git a/java/src/jmri/jmrit/display/palette/BackgroundItemPanel.java b/java/src/jmri/jmrit/display/palette/BackgroundItemPanel.java index bb0ab82556a..fdf380dd4df 100644 --- a/java/src/jmri/jmrit/display/palette/BackgroundItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/BackgroundItemPanel.java @@ -5,6 +5,7 @@ import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JColorChooser; @@ -16,15 +17,16 @@ import jmri.jmrit.catalog.NamedIcon; import jmri.jmrit.display.Editor; import jmri.util.JmriJFrame; +import jmri.util.swing.DrawSquares; +import jmri.util.swing.ImagePanel; /** - * JPanels for the various item types that come from tool Tables - e.g. Sensors, - * Turnouts, etc. + * JPanels for the Panel Backgrounds. */ public class BackgroundItemPanel extends IconItemPanel { /** - * Constructor for plain icons and backgrounds + * Constructor for plain icons and backgrounds. */ public BackgroundItemPanel(JmriJFrame parentFrame, String type, Editor editor) { super(parentFrame, type, editor); @@ -48,7 +50,7 @@ protected JPanel instructions(boolean isBackGround) { if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); JPanel panel = super.instructions(isBackGround); JPanel blurb = (JPanel) panel.getComponent(0); - blurb.add(new JLabel(Bundle.getMessage("ToColorBackground", "ButtonBackgroundColor"))); + blurb.add(new JLabel(Bundle.getMessage("ToColorBackground", Bundle.getMessage("ButtonBackgroundColor")))); blurb.add(javax.swing.Box.createVerticalStrut(ItemPalette.STRUT_SIZE)); return panel; } @@ -69,6 +71,11 @@ public void actionPerformed(ActionEvent a) { return bottomPanel; } + @Override + protected JPanel makeBgButtonPanel(ImagePanel preview1, ImagePanel preview2, BufferedImage[] imgArray) { + return null; // no button to set Preview Bg on BackgroundItemPanel + } + class ColorDialog extends JDialog implements ChangeListener { JColorChooser _chooser; @@ -113,6 +120,9 @@ protected JPanel makeDoneButtonPanel() { @Override public void actionPerformed(ActionEvent a) { _editor.setBackgroundColor(_chooser.getColor()); + _currentBackground = _chooser.getColor(); + _backgrounds[0] = DrawSquares.getImage(500, 150, 15, _currentBackground, _currentBackground); + _iconPanel.setImage(_backgrounds[0]); dialog.dispose(); } @@ -149,5 +159,7 @@ public void stateChanged(ChangeEvent e) { _preview.getParent().setBackground(_chooser.getColor()); } } + private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(BackgroundItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/ClockItemPanel.java b/java/src/jmri/jmrit/display/palette/ClockItemPanel.java index 13f35ca1649..8e9d548dd69 100644 --- a/java/src/jmri/jmrit/display/palette/ClockItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/ClockItemPanel.java @@ -3,6 +3,7 @@ import java.awt.Color; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; @@ -16,18 +17,20 @@ import jmri.jmrit.catalog.NamedIcon; import jmri.jmrit.display.AnalogClock2Display; import jmri.jmrit.display.Editor; +import jmri.util.swing.ImagePanel; import jmri.util.JmriJFrame; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * ItemPanel for for plain icons and backgrounds + * ItemPanel for Clocks. */ public class ClockItemPanel extends IconItemPanel { public ClockItemPanel(JmriJFrame parentFrame, String type, Editor editor) { super(parentFrame, type, editor); setToolTipText(Bundle.getMessage("ToolTipDragIcon")); + } protected JPanel instructions() { @@ -43,12 +46,15 @@ protected JPanel instructions() { @Override protected void addIconsToPanel(HashMap iconMap) { - _iconPanel = new JPanel(); + _iconPanel = new ImagePanel(); + updateBackgrounds(); // create array of backgrounds + Iterator> it = iconMap.entrySet().iterator(); while (it.hasNext()) { Entry entry = it.next(); - NamedIcon icon = new NamedIcon(entry.getValue()); // make copy for possible reduction + NamedIcon icon = new NamedIcon(entry.getValue()); // make copy for possible reduction JPanel panel = new JPanel(); + panel.setOpaque(false); String borderName = ItemPalette.convertText(entry.getKey()); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), borderName)); @@ -73,6 +79,7 @@ protected void addIconsToPanel(HashMap iconMap) { @Override public void initButtonPanel() { + add(makeBgButtonPanel(_iconPanel, null, _backgrounds)); } public class ClockDragJLabel extends DragJLabel { @@ -87,9 +94,7 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti return null; } String url = ((NamedIcon) getIcon()).getURL(); - if (log.isDebugEnabled()) { - log.debug("DragJLabel.getTransferData url= " + url); - } + log.debug("DragJLabel.getTransferData url= {}", url); if (flavor.isMimeTypeEqual(Editor.POSITIONABLE_FLAVOR)) { AnalogClock2Display c; String link = _linkName.getText().trim(); @@ -107,11 +112,12 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti sb.append(" icon \""); sb.append(url); sb.append("\""); - return sb.toString(); + return sb.toString(); } return null; } } private final static Logger log = LoggerFactory.getLogger(ClockItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/DecoratorPanel.java b/java/src/jmri/jmrit/display/palette/DecoratorPanel.java index b0c049b88d1..b46387baf29 100644 --- a/java/src/jmri/jmrit/display/palette/DecoratorPanel.java +++ b/java/src/jmri/jmrit/display/palette/DecoratorPanel.java @@ -2,6 +2,7 @@ import java.awt.BorderLayout; import java.awt.Color; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -9,8 +10,10 @@ import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; +import java.awt.image.BufferedImage; import java.util.Hashtable; import java.util.Iterator; +import javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; @@ -35,9 +38,11 @@ import jmri.jmrit.display.PositionablePopupUtil; import jmri.jmrit.display.SensorIcon; import jmri.jmrit.display.palette.TextItemPanel.DragDecoratorLabel; +import jmri.util.swing.DrawSquares; +import jmri.util.swing.ImagePanel; /** - * Panel for positionables with text and/or colored margins and borders + * Panel for positionables with text and/or colored margins and borders. * * @author PeteCressman Copyright (C) 2009, 2015 */ @@ -92,13 +97,21 @@ public class DecoratorPanel extends JPanel implements ChangeListener, ItemListen AJSpinner _heightSpin; JColorChooser _chooser; - JPanel _previewPanel; + ImagePanel _previewPanel; JPanel _samplePanel; private PositionablePopupUtil _util; private Hashtable _sample = null; private int _selectedButton; ButtonGroup _buttonGroup = new ButtonGroup(); + protected DrawSquares _squaresPanel; // checkered background + static Color _grayColor = new Color(235, 235, 235); + static Color _darkGrayColor = new Color(150, 150, 150); + private Color[] colorChoice = new Color[] {Color.white, _grayColor, _darkGrayColor}; // panel bg color picked up directly + protected Color _currentBackground; + protected BufferedImage[] _backgrounds; // array of Image backgrounds + private int previewBgSet = 0; // setting for preview background color, starts as 0 = use Panel bg + Editor _editor; java.awt.Window _dialog; @@ -106,21 +119,28 @@ public DecoratorPanel(Editor editor, javax.swing.JDialog dialog) { _editor = editor; _dialog = dialog; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - Color bkgrnd = _editor.getTargetPanel().getBackground(); - _chooser = new JColorChooser(bkgrnd); + _currentBackground = _editor.getTargetPanel().getBackground(); // start using Panel background color + _chooser = new JColorChooser(_currentBackground); _sample = new Hashtable<>(); - _previewPanel = new JPanel(); + _previewPanel = new ImagePanel(); _previewPanel.setLayout(new BorderLayout()); - _previewPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - _previewPanel.add(Box.createVerticalStrut(STRUT), BorderLayout.NORTH); - _previewPanel.add(Box.createVerticalStrut(STRUT), BorderLayout.SOUTH); - _previewPanel.setBackground(bkgrnd); - + _previewPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + _previewPanel.add(Box.createVerticalStrut(STRUT), BorderLayout.PAGE_START); + _previewPanel.add(Box.createVerticalStrut(STRUT), BorderLayout.PAGE_END); + + // create array of backgrounds, _currentBackground already set and used + _backgrounds = new BufferedImage[5]; + _backgrounds[0] = DrawSquares.getImage(500, 150, 15, _currentBackground, _currentBackground); + for (int i = 1; i <= 3; i++) { + _backgrounds[i] = DrawSquares.getImage(500, 150, 15, colorChoice[i - 1], colorChoice[i - 1]); // choice 0 is not in colorChoice[] + } + _backgrounds[4] = DrawSquares.getImage(500, 150, 15, Color.white, _grayColor); + _samplePanel = new JPanel(); -// _samplePanel.setLayout(new BoxLayout(_samplePanel, BoxLayout.X_AXIS)); _samplePanel.add(Box.createHorizontalStrut(STRUT)); - _samplePanel.setBackground(bkgrnd); + _samplePanel.setOpaque(false); } static class AJComboBox extends JComboBox { @@ -168,7 +188,7 @@ private JPanel makeSpinPanel(String caption, JSpinner spin) { return panel; } - /* Called by Palettte's TextItemPanel i.e. make a new panel item to drag */ + /* Called by Palette's TextItemPanel i.e. make a new panel item to drag */ protected void initDecoratorPanel(DragDecoratorLabel sample) { sample.setDisplayLevel(Editor.LABELS); sample.setBackground(_editor.getTargetPanel().getBackground()); @@ -181,14 +201,14 @@ protected void initDecoratorPanel(DragDecoratorLabel sample) { _chooser.getSelectionModel().addChangeListener(this); _chooser.setPreviewPanel(new JPanel()); this.add(_chooser); - _previewPanel.add(_samplePanel, java.awt.BorderLayout.CENTER); + _previewPanel.add(_samplePanel, BorderLayout.CENTER); this.add(_previewPanel); updateSamples(); } /* Called by Editor's TextAttrDialog - i.e. update a panel item from menu */ public void initDecoratorPanel(Positionable pos) { - Positionable item = pos.deepClone(); // copy of PositionableLabel being edited + Positionable item = pos.deepClone(); // copy of PositionableLabel being edited _util = item.getPopupUtility(); if (pos instanceof SensorIcon && !((SensorIcon)pos).isIcon()) { @@ -265,7 +285,7 @@ public void initDecoratorPanel(Positionable pos) { _chooser.getSelectionModel().addChangeListener(this); _chooser.setPreviewPanel(new JPanel()); this.add(_chooser); - _previewPanel.add(_samplePanel, java.awt.BorderLayout.CENTER); + _previewPanel.add(_samplePanel, BorderLayout.CENTER); this.add(_previewPanel); updateSamples(); } @@ -435,8 +455,10 @@ ActionListener init(AJRadioButton b) { return this; } }.init(button)); - panel.add(p); + // add a SetBackground combo + p.add(makeBgButtonPanel(_previewPanel, null, _backgrounds)); + panel.add(p); return panel; } @@ -464,8 +486,8 @@ ActionListener init(AJRadioButton b) { return button; } - private void updateSamples() { - if (_previewPanel==null) { + protected void updateSamples() { + if (_previewPanel == null) { return; } @@ -516,6 +538,50 @@ private void updateSamples() { } } + /** + * Create panel element containing [Set background:] drop down list. + * Special version for Decorator, no access to shared variable previewBgSet. + * @see jmri.jmrit.catalog.PreviewDialog#setupPanel() + * @see ItemPanel + * + * @param preview1 ImagePanel containing icon set + * @param preview2 not used, matches method in ItemPanel + * @param imgArray array of colored background images + * @return a JPanel with label and drop down + */ + private JPanel makeBgButtonPanel(@Nonnull ImagePanel preview1, ImagePanel preview2, BufferedImage[] imgArray) { + JComboBox bgColorBox = new JComboBox<>(); + bgColorBox.addItem(Bundle.getMessage("PanelBgColor")); // PanelColor key is specific for CPE, too long for combo + bgColorBox.addItem(Bundle.getMessage("White")); + bgColorBox.addItem(Bundle.getMessage("LightGray")); + bgColorBox.addItem(Bundle.getMessage("DarkGray")); + bgColorBox.addItem(Bundle.getMessage("Checkers")); + bgColorBox.setSelectedIndex(previewBgSet); // starts as 0 = panel bg color, cannot read shared choice + bgColorBox.addActionListener((ActionEvent e) -> { + if (imgArray != null) { + if (previewBgSet != bgColorBox.getSelectedIndex()) { + previewBgSet = bgColorBox.getSelectedIndex(); // store user choice + // load background image + log.debug("Palette Decorator setImage called {}", previewBgSet); + preview1.setImage(imgArray[previewBgSet]); + } + // preview.setOpaque(false); // needed? + preview1.revalidate(); // force redraw + } else { + log.debug("imgArray is empty"); + } + }); + JPanel backgroundPanel = new JPanel(); + backgroundPanel.setLayout(new BoxLayout(backgroundPanel, BoxLayout.Y_AXIS)); + JPanel pp = new JPanel(); + pp.setLayout(new FlowLayout(FlowLayout.CENTER)); + pp.add(new JLabel(Bundle.getMessage("setBackground"))); + pp.add(bgColorBox); + backgroundPanel.add(pp); + backgroundPanel.setMaximumSize(backgroundPanel.getPreferredSize()); + return backgroundPanel; + } + @Override public void stateChanged(ChangeEvent e) { Object obj = e.getSource(); @@ -648,7 +714,6 @@ private void changeColor() { log.warn("Unexpected _selectedButton {} in changeColor", _selectedButton); break; } - } @Override @@ -709,4 +774,5 @@ public void itemStateChanged(ItemEvent e) { // initialize logging private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(DecoratorPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/DetectionPanel.java b/java/src/jmri/jmrit/display/palette/DetectionPanel.java index 6ac60406039..b0277154b06 100644 --- a/java/src/jmri/jmrit/display/palette/DetectionPanel.java +++ b/java/src/jmri/jmrit/display/palette/DetectionPanel.java @@ -25,11 +25,11 @@ import jmri.jmrit.picker.PickPanel; /** - * Panel for Occupancy and Error detection, + * Panel for Occupancy and Error detection. */ public class DetectionPanel extends JPanel { - private JTextField _occDetectorName = new JTextField(); // can be either a Sensor or OBlock name + private JTextField _occDetectorName = new JTextField(); // can be either a Sensor or OBlock name private JFrame _pickFrame; private JButton _openPicklistButton; private JPanel _trainIdPanel; @@ -41,6 +41,7 @@ public class DetectionPanel extends JPanel { private JPanel _checkBoxPanel; /** + * Add _blockPathPanel to this ItemPanel. */ public DetectionPanel(ItemPanel parent) { super(); @@ -296,4 +297,5 @@ private void makePathList(OBlock block) { _blockPathPanel.add(_checkBoxPanel, 1); _blockPathPanel.setVisible(true); } + } diff --git a/java/src/jmri/jmrit/display/palette/DropJLabel.java b/java/src/jmri/jmrit/display/palette/DropJLabel.java index f4a4725c2aa..60a87275c7f 100644 --- a/java/src/jmri/jmrit/display/palette/DropJLabel.java +++ b/java/src/jmri/jmrit/display/palette/DropJLabel.java @@ -104,8 +104,7 @@ private void accept(DropTargetDropEvent e, NamedIcon newIcon) { DropTarget target = (DropTarget) e.getSource(); DropJLabel label = (DropJLabel) target.getComponent(); if (log.isDebugEnabled()) { - log.debug("accept drop for " + label.getName() - + ", " + newIcon.getURL()); + log.debug("accept drop for {}, {}", label.getName(),newIcon.getURL()); } if (newIcon == null || newIcon.getIconWidth() < 1 || newIcon.getIconHeight() < 1) { label.setText(Bundle.getMessage("invisibleIcon")); @@ -125,10 +124,11 @@ private void accept(DropTargetDropEvent e, NamedIcon newIcon) { } e.dropComplete(true); if (log.isDebugEnabled()) { - log.debug("DropJLabel.drop COMPLETED for " + label.getName() - + ", " + (newIcon != null ? newIcon.getURL() : " newIcon==null ")); + log.debug("DropJLabel.drop COMPLETED for {}, {}", + label.getName(), (newIcon != null ? newIcon.getURL() : " newIcon==null ")); } } private final static Logger log = LoggerFactory.getLogger(DropJLabel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/FamilyItemPanel.java b/java/src/jmri/jmrit/display/palette/FamilyItemPanel.java index a25cd1b2a00..cc9e805f2f7 100644 --- a/java/src/jmri/jmrit/display/palette/FamilyItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/FamilyItemPanel.java @@ -1,5 +1,6 @@ package jmri.jmrit.display.palette; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridBagConstraints; @@ -7,6 +8,7 @@ import java.awt.datatransfer.DataFlavor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; @@ -17,47 +19,52 @@ import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import jmri.jmrit.catalog.NamedIcon; import jmri.jmrit.display.Editor; +import jmri.util.swing.ImagePanel; import jmri.util.JmriJFrame; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * ItemPanel for items having sets of icons (families) + * ItemPanel general implementation for placing of CPE items having sets of icons (families). * -* @author Pete Cressman Copyright (c) 2010, 2011 + * @author Pete Cressman Copyright (c) 2010, 2011 + * @author Egbert Broerse 2017 */ public abstract class FamilyItemPanel extends ItemPanel { protected String _family; protected JPanel _iconFamilyPanel; - protected JPanel _iconPanel; // panel contained in _iconFamilyPanel - all icons in family - protected JPanel _dragIconPanel; // contained in _iconFamilyPanel - to drag to control panel - protected boolean _supressDragging; + protected JPanel familyPanel; + protected ImagePanel _dragIconPanel; // a panel on _iconFamilyPanel - to drag to control panel, hidden upon [Show Icons] + protected ImagePanel _iconPanel; // a panel on _iconFamilyPanel - all icons in family, shown upon [Show Icons] + protected boolean _suppressDragging; protected int _buttonPosition = 0; - JPanel _bottom1Panel; // Typically _showIconsButton and _editIconsButton - JPanel _bottom2Panel; // createIconFamilyButton - when all families have been deleted + JPanel _bottom1Panel; // typically displays the _showIconsButton and _editIconsButton + JPanel _bottom2Panel; // createIconFamilyButton - when all families have been deleted JButton _showIconsButton; JButton _editIconsButton; JButton _updateButton; protected HashMap _currentIconMap; IconDialog _dialog; ButtonGroup _familyButtonGroup; + protected JPanel bgBoxPanel; // panel with a combo box to set a contrasting background behind the icon preview static boolean _suppressNamePrompts = false; /** * Constructor types with multiple families and multiple icon families. * - * @param parentFrame parentFrame - * @param type type - * @param family family - * @param editor editor + * @param parentFrame enclosing parentFrame + * @param type bean type + * @param family icon family + * @param editor panel editor */ public FamilyItemPanel(JmriJFrame parentFrame, String type, String family, Editor editor) { super(parentFrame, type, editor); @@ -66,6 +73,7 @@ public FamilyItemPanel(JmriJFrame parentFrame, String type, String family, Edito /** * Init for creation. + * Also called by enclosing TabbedPanel on change of displayed tab Pane. */ @Override public void init() { @@ -73,15 +81,17 @@ public void init() { if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); Thread.yield(); _update = false; - _supressDragging = false; + _suppressDragging = false; makeBottomPanel(null); super.init(); } + // updateBgCombo(); // TODO (see proposed method in ItemPanel class + log.debug("tab redisplayed. BgSet = {}", previewBgSet); } /** - * Init for update of existing track block _bottom3Panel has "Update Panel" - * button put into _bottom1Panel. + * Init for update of existing track block. + * _bottom3Panel has an [Update Panel] button put onto _bottom1Panel. * * @param doneAction doneAction * @param iconMap iconMap @@ -89,23 +99,23 @@ public void init() { public void init(ActionListener doneAction, HashMap iconMap) { if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); _update = true; - _supressDragging = true; // do dragging when updating + _suppressDragging = true; // no dragging when updating _currentIconMap = iconMap; if (iconMap != null) { - checkCurrentMap(iconMap); // is map in families?, does user want to add it? etc + checkCurrentMap(iconMap); // is map in families?, does user want to add it? etc. } makeBottomPanel(doneAction); -// setSize(getPreferredSize()); + // setSize(getPreferredSize()); } /** - * Init for conversion of plain track to indicator track. + * Init for conversion of plain track to IndicatorTrack. * * @param doneAction doneAction */ public void init(ActionListener doneAction) { _update = false; - _supressDragging = true; // do dragging in circuitBuilder + _suppressDragging = true; // no dragging in circuitBuilder _bottom1Panel = new JPanel(); addShowButtonToBottom(); addUpdateButtonToBottom(doneAction); @@ -118,29 +128,33 @@ public void init(ActionListener doneAction) { * _bottom1Panel and _bottom2Panel alternate visibility in bottomPanel * depending on whether icon families exist. They are made first because * they are referenced in initIconFamiliesPanel(). _bottom2Panel is for the - * exceptional case where there are no families at all. Subclasses will - * insert other panels - * @param doneAction doneAction + * exceptional case where there are no families at all. + *

                + * Subclasses will insert other panels. + * + * @param doneAction the calling action */ protected void makeBottomPanel(ActionListener doneAction) { _bottom2Panel = makeCreateNewFamilyPanel(); + updateBackgrounds(); // create array of backgrounds makeItemButtonPanel(); + initIconFamiliesPanel(); + add(_iconFamilyPanel); if (doneAction != null) { addUpdateButtonToBottom(doneAction); + addBgComboToBottom(); } - initIconFamiliesPanel(); - add(_iconFamilyPanel); JPanel bottomPanel = new JPanel(new FlowLayout()); bottomPanel.add(_bottom1Panel); bottomPanel.add(_bottom2Panel); //_bottom2Panel.setVisible(false); // to prevent showing it on Reporter tab? add(bottomPanel); - if (log.isDebugEnabled()) { - log.debug("init done for family " + _family); - } + log.debug("init done for family {}", _family); } - // add update button to _bottom1Panel + /** + * Add [Update] button to _bottom1Panel. + */ protected void addUpdateButtonToBottom(ActionListener doneAction) { _updateButton = new JButton(Bundle.getMessage("updateButton")); // custom update label _updateButton.addActionListener(doneAction); @@ -164,9 +178,21 @@ public void actionPerformed(ActionEvent a) { _bottom1Panel.add(_showIconsButton); } + @SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="makeBgButtonPanel can return null") + private void addBgComboToBottom() { + if (_iconPanel == null || _backgrounds == null) { + log.debug("null panels for combo"); + return; + } + bgBoxPanel = makeBgButtonPanel(_iconPanel, null, _backgrounds); + // to enable returning null for some types, skip Reporter. Don't add here for SignalMast (takes care of its own combo) + if (bgBoxPanel != null) { + _bottom1Panel.add(bgBoxPanel); + } + } + private void makeItemButtonPanel() { - _bottom1Panel = new JPanel(); - _bottom1Panel.setLayout(new FlowLayout()); + _bottom1Panel = new JPanel(new FlowLayout()); addShowButtonToBottom(); _editIconsButton = new JButton(Bundle.getMessage("ButtonEditIcons")); _editIconsButton.addActionListener(new ActionListener() { @@ -199,27 +225,29 @@ public void actionPerformed(ActionEvent a) { }); deleteButton.setToolTipText(Bundle.getMessage("ToolTipDeleteFamily")); _bottom1Panel.add(deleteButton); + } else { + addBgComboToBottom(); // add combo } } /** - * iconMap is existing map of the icon. Check whether map is one of the - * families. If so, return. If not, does user want to add it to families? If - * so, add. If not, save for return when updated. + * Check whether map is one of the families. + * If so, return. If not, does user want to add it to families? + * If so, add. If not, save for return when updated. + * + * @param iconMap existing map of the icon */ private void checkCurrentMap(HashMap iconMap) { - if (log.isDebugEnabled()) { - log.debug("checkCurrentMap: for type \"" + _itemType + "\", family \"" + _family + "\""); - } + log.debug("checkCurrentMap: for type \"{}\", family \"{}\"", _itemType, _family); String family = findFamilyOfMap(iconMap, ItemPalette.getFamilyMaps(_itemType)); if (family != null) { // icons same as a known family, maybe with another name _family = family; return; } else { // no match with Palette families if (ItemPalette.getIconMap(_itemType, _family) != null) { -// JOptionPane.showMessageDialog(_paletteFrame, -// Bundle.getMessage("DuplicateFamilyName", _family, _itemType), -// Bundle.getMessage("WarningTitle"), JOptionPane.WARNING_MESSAGE); + // JOptionPane.showMessageDialog(_paletteFrame, + // Bundle.getMessage("DuplicateFamilyName", _family, _itemType), + // Bundle.getMessage("WarningTitle"), JOptionPane.WARNING_MESSAGE); // make sure name does not duplicate a known name _family = null; } @@ -231,7 +259,7 @@ private void checkCurrentMap(HashMap iconMap) { if (_family == null || _family.trim().length() == 0) { // bail out _family = null; -// _suppressNamePrompts = true; + // _suppressNamePrompts = true; return; } } @@ -256,7 +284,7 @@ private String findFamilyOfMap(HashMap iconMap, HashMap> entry = it.next(); if (log.isDebugEnabled()) { - log.debug("FamilyKey= " + entry.getKey()); + log.debug("FamilyKey = {}", entry.getKey()); } if (mapsAreEqual(entry.getValue(), iconMap)) { return entry.getKey(); @@ -274,8 +302,7 @@ protected boolean mapsAreEqual(HashMap map1, HashMap ent = iter.next(); NamedIcon icon = map2.get(ent.getKey()); if (log.isDebugEnabled()) { - log.debug("key= " + ent.getKey() - + ", url1= " + icon.getURL() + ", url2= " + ent.getValue().getURL()); + log.debug("key = {}, url1= {}, url2= {}", ent.getKey(), icon.getURL(), ent.getValue().getURL()); } if (icon == null) { return false; @@ -289,11 +316,17 @@ protected boolean mapsAreEqual(HashMap map1, HashMap> families = ItemPalette.getFamilyMaps(_itemType); if (families != null && families.size() > 0) { - _iconFamilyPanel = new JPanel(); - _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); + if (_iconFamilyPanel == null) { + _iconFamilyPanel = new JPanel(); + _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); + } JPanel familyPanel = makeFamilyButtons(families.keySet().iterator(), (_currentIconMap == null)); if (_currentIconMap == null) { _currentIconMap = families.get(_family); @@ -303,7 +336,7 @@ protected void initIconFamiliesPanel() { if (_currentIconMap == null) { log.error("currentIconMap is null in initIconFamiliesPanel"); } else { - addIconsToPanel(_currentIconMap); // need to have family iconMap identified before calling + addIconsToPanel(_currentIconMap); // need to have family iconMap identified before calling makeDndIconPanel(_currentIconMap, "BeanStateUnknown"); } } else { @@ -312,11 +345,14 @@ protected void initIconFamiliesPanel() { } protected void updateFamiliesPanel() { - if (log.isDebugEnabled()) { - log.debug("updateFamiliesPanel for " + _itemType); - } + log.debug("updateFamiliesPanel for {}", _itemType); if (_iconFamilyPanel != null) { - removeIconFamiliesPanel(); + if (_iconPanel != null) { + _iconPanel.removeAll(); + } + if (_dragIconPanel != null) { + _dragIconPanel.removeAll(); + } } initIconFamiliesPanel(); add(_iconFamilyPanel, _buttonPosition); @@ -327,13 +363,13 @@ protected void updateFamiliesPanel() { } /** - * Set actions of radioButtons to change family. + * Create and set actions of radioButtons to change family on pane. */ protected JPanel makeFamilyButtons(Iterator it, boolean setDefault) { String thisType = null; - JPanel familyPanel = new JPanel(); + JPanel familyPanel = new JPanel(); // this is only a local object familyPanel.setLayout(new BoxLayout(familyPanel, BoxLayout.Y_AXIS)); - // I18N use NamedBeanBundle property for basic beans like "Turnout" I18N + // uses NamedBeanBundle property for basic beans like "Turnout" I18N if ("Sensor".equals(_itemType)) { thisType = "BeanNameSensor"; } else if ("Turnout".equals(_itemType)) { @@ -358,6 +394,7 @@ protected JPanel makeFamilyButtons(Iterator it, boolean setDefault) { String txt = Bundle.getMessage("IconFamiliesLabel", Bundle.getMessage(thisType)); JPanel p = new JPanel(new FlowLayout()); p.add(new JLabel(txt)); + p.setOpaque(false); familyPanel.add(p); _familyButtonGroup = new ButtonGroup(); JPanel buttonPanel = new JPanel(new FlowLayout()); @@ -378,9 +415,7 @@ public void actionPerformed(ActionEvent e) { ActionListener init(String f) { fam = f; - if (log.isDebugEnabled()) { - log.debug("ActionListener.init : for type \"" + _itemType + "\", family \"" + fam + "\""); - } + log.debug("ActionListener.init() for type \"{}\", family \"{}\"", _itemType, fam); return this; } }.init(family)); @@ -391,14 +426,13 @@ ActionListener init(String f) { count = 0; familyPanel.add(buttonPanel); buttonPanel = new JPanel(new FlowLayout()); - buttonPanel.setLayout(new FlowLayout()); //new BoxLayout(p, BoxLayout.Y_AXIS) } buttonPanel.add(button); _familyButtonGroup.add(button); } familyPanel.add(buttonPanel); if (setDefault && !family.equals(_family)) { - _family = family; // let last family be the selected one + _family = family; // let last family be the selected one if (button != null) { button.setSelected(true); } else { @@ -409,14 +443,22 @@ ActionListener init(String f) { return familyPanel; } + /** + * Position secundary Preview component on _iconFamilyPanel (visible after [Show Icons]). + */ protected void addFamilyPanels(JPanel familyPanel) { if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); - _iconPanel = new JPanel(new FlowLayout()); - _iconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - _iconFamilyPanel.add(_iconPanel); + if (_iconPanel == null) { // don't overwrite existing _iconPanel + _iconPanel = new ImagePanel(); + _iconFamilyPanel.add(_iconPanel); + _iconPanel.setLayout(new FlowLayout()); + _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + log.debug("_iconPanel created"); + } _iconPanel.setVisible(false); - if (!_supressDragging) { + + if (!_suppressDragging) { makeDragIconPanel(0); } _iconFamilyPanel.add(familyPanel); @@ -428,19 +470,41 @@ protected void addFamilyPanels(JPanel familyPanel) { } } - /* - * position component position in _iconFamilyPanel + /** + * Position initial Preview component on _iconFamilyPanel. If already present, keep and clear it. */ + @SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="makeBgButtonPanel can return null") protected void makeDragIconPanel(int position) { - if (_dragIconPanel != null) { - _iconFamilyPanel.remove(_dragIconPanel); - } - _dragIconPanel = new JPanel(); - _dragIconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _dragIconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - _dragIconPanel.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); - _iconFamilyPanel.add(_dragIconPanel, position); + if (_dragIconPanel == null) { + _dragIconPanel = new ImagePanel(); + _dragIconPanel.setOpaque(true); // to show background color/squares + if (_backgrounds != null) { + _dragIconPanel.setImage(_backgrounds[previewBgSet]); // pick up shared setting + if (_iconPanel != null) { + _iconPanel.setImage(_backgrounds[previewBgSet]); // pick up shared setting + } + } else { + log.debug("FamilyItemPanel - no value for previewBgSet"); + } + _dragIconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + _dragIconPanel.setLayout(new FlowLayout()); + _dragIconPanel.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); + _iconFamilyPanel.add(_dragIconPanel, position); // place icons over background + } else { + _dragIconPanel.removeAll(); + } _dragIconPanel.setVisible(true); + + // add a SetBackground combo + // TODO add updating of panel upon display via previewBgSet + if (_bottom1Panel != null && bgBoxPanel == null && !"SignalMast".equals(_itemType)) { + bgBoxPanel = makeBgButtonPanel(_dragIconPanel, _iconPanel, _backgrounds); + // to enable returning null for some types, skip Reporter. Don't add here for SignalMast (takes care of its own combo) + if (bgBoxPanel != null) { + _bottom1Panel.add(bgBoxPanel); + } + } } protected void familiesMissing() { @@ -460,10 +524,14 @@ protected void familiesMissing() { protected void addIconsToPanel(HashMap iconMap) { if (iconMap == null) { - if (log.isDebugEnabled()) - log.debug("iconMap is null for type " + _itemType + " family " + _family); + log.debug("iconMap is null for type {} family {}", _itemType, _family); + return; + } + if (_iconPanel == null) { // bug for SignalMast icons (is of class ImagePanel) + log.debug("_iconPanel is null for type {}", _itemType); return; } + _iconPanel.setOpaque(false); GridBagLayout gridbag = new GridBagLayout(); _iconPanel.setLayout(gridbag); @@ -482,10 +550,10 @@ protected void addIconsToPanel(HashMap iconMap) { Iterator> it = iconMap.entrySet().iterator(); while (it.hasNext()) { Entry entry = it.next(); - NamedIcon icon = new NamedIcon(entry.getValue()); // make copy for possible reduction + NamedIcon icon = new NamedIcon(entry.getValue()); // make copy for possible reduction icon.reduceTo(100, 100, 0.2); JPanel panel = new JPanel(new FlowLayout()); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); // I18N use existing NamedBeanBundle keys String borderName = getIconBorderName(entry.getKey()); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), @@ -493,7 +561,7 @@ protected void addIconsToPanel(HashMap iconMap) { JLabel image = new JLabel(icon); if (icon.getIconWidth() < 1 || icon.getIconHeight() < 1) { image.setText(Bundle.getMessage("invisibleIcon")); - image.setForeground(Color.lightGray); + image.setOpaque(false); } image.setToolTipText(icon.getName()); panel.add(image); @@ -507,10 +575,10 @@ protected void addIconsToPanel(HashMap iconMap) { if (cnt < numCol - 1) { // last row JPanel p = new JPanel(new FlowLayout()); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); - p.setBackground(_editor.getTargetPanel().getBackground()); + p.setOpaque(false); p.add(Box.createHorizontalStrut(100)); gridbag.setConstraints(p, c); - //if (log.isDebugEnabled()) log.debug("addIconsToPanel: gridx= "+c.gridx+" gridy= "+c.gridy); + log.debug("addIconsToPanel: gridx = {} gridy = {}", c.gridx, c.gridy); _iconPanel.add(p); c.gridx = 1; } @@ -530,7 +598,7 @@ protected JLabel getDragger(DataFlavor flavor, HashMap map, N } protected void makeDndIconPanel(HashMap iconMap, String displayKey) { - if (_supressDragging) { + if (_suppressDragging) { return; } if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); @@ -546,14 +614,15 @@ protected void makeDndIconPanel(HashMap iconMap, String displ panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), borderName)); panel.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); JLabel label; try { label = getDragger(new DataFlavor(Editor.POSITIONABLE_FLAVOR), iconMap, icon); if (label != null) { label.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); -// label.setIcon(icon); + // label.setIcon(icon); label.setName(borderName); + label.setOpaque(false); panel.add(label); } } catch (java.lang.ClassNotFoundException cnfe) { @@ -572,11 +641,12 @@ protected void makeDndIconPanel(HashMap iconMap, String displ protected void hideIcons() { if (_iconPanel == null) { + log.debug("hideIcons() _iconPanel = null"); return; } if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); _iconPanel.setVisible(false); - if (!_supressDragging) { + if (!_suppressDragging) { _dragIconPanel.setVisible(true); _dragIconPanel.invalidate(); } @@ -588,8 +658,8 @@ protected void hideIcons() { protected void showIcons() { if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); _iconPanel.setVisible(true); - _iconPanel.invalidate(); - if (!_supressDragging) { + _iconPanel.invalidate(); // force redraw + if (!_suppressDragging) { _dragIconPanel.setVisible(false); } _showIconsButton.setText(Bundle.getMessage("HideIcons")); @@ -598,7 +668,7 @@ protected void showIcons() { } /** - * Action item for delete family + * Action item for deletion of an icon family. */ protected void deleteFamilySet() { ItemPalette.removeIconMap(_itemType, _family); @@ -609,7 +679,7 @@ protected void deleteFamilySet() { /** * Replacement panel for _bottom1Panel when no icon families exist for - * _itemType + * _itemType. */ private JPanel makeCreateNewFamilyPanel() { JPanel panel = new JPanel(); @@ -683,30 +753,33 @@ protected void removeIconFamiliesPanel() { } /** - * Action of family radio button MultisensorItemPanel - * IndicatorTOItem must overrides - * @param family family + * Action of family radio button. + * MultiSensorItemPanel and IndicatorTOItemPanel must override. + * + * @param family icon family name */ protected void setFamily(String family) { _family = family; - if (log.isDebugEnabled()) { - log.debug("setFamily: for type \"" + _itemType + "\", family \"" + family + "\""); - } - _iconFamilyPanel.remove(_iconPanel); - _iconPanel = new JPanel(); - _iconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - _iconFamilyPanel.add(_iconPanel, 0); + log.debug("setFamily: for type \"{}\", family \"{}\"", _itemType, family); + if (_iconPanel == null) { + _iconPanel = new ImagePanel(); + _iconPanel.setOpaque(false); // see through + _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + _iconFamilyPanel.add(_iconPanel, 0); + } else { + _iconPanel.removeAll(); // just clear contents + } HashMap map = ItemPalette.getIconMap(_itemType, _family); if (map != null) { _currentIconMap = map; } - if (!_supressDragging) { + if (!_suppressDragging) { makeDragIconPanel(0); makeDndIconPanel(_currentIconMap, "BeanStateUnknown"); } addIconsToPanel(_currentIconMap); - _iconFamilyPanel.invalidate(); + _iconFamilyPanel.revalidate(); // force redraw hideIcons(); Enumeration en = _familyButtonGroup.getElements(); while (en.hasMoreElements()) { @@ -722,7 +795,7 @@ protected void setFamily(String family) { protected void setEditor(Editor ed) { super.setEditor(ed); if (_initialized) { - boolean visible = _iconPanel.isVisible(); + boolean visible = (_iconPanel != null && _iconPanel.isVisible()); // check for invalid _initialized state makeDragIconPanel(0); makeDndIconPanel(_currentIconMap, "BeanStateUnknown"); if (_family != null) { @@ -739,7 +812,7 @@ protected void setEditor(Editor ed) { /** * Create icon set to panel icon display class. * - * @return updating map + * @return updated icon map */ public HashMap getIconMap() { if (_currentIconMap == null) { diff --git a/java/src/jmri/jmrit/display/palette/IconDialog.java b/java/src/jmri/jmrit/display/palette/IconDialog.java index f44785fff5d..3945dd9cb96 100644 --- a/java/src/jmri/jmrit/display/palette/IconDialog.java +++ b/java/src/jmri/jmrit/display/palette/IconDialog.java @@ -39,12 +39,12 @@ public class IconDialog extends ItemDialog { /** * Constructor for existing family to change icons, add/delete icons, or to - * delete the family + * delete the family. */ public IconDialog(String type, String family, FamilyItemPanel parent, HashMap iconMap) { super(type, Bundle.getMessage("ShowIconsTitle", family)); if (log.isDebugEnabled()) { - log.debug("IconDialog ctor: for " + type + " Family " + family); + log.debug("IconDialog ctor: for {}, family = {}", type, family); } _family = family; _parent = parent; @@ -91,13 +91,13 @@ protected void makeAddIconButtonPanel(JPanel buttonPanel, String addTip, String } /** - * Action for both create new family and change existing family + * Action for both create new family and change existing family. */ protected boolean doDoneAction() { _parent.reset(); // checkIconSizes(); _parent._currentIconMap = _iconMap; - if (!_parent.isUpdate()) { // don't touch palette's maps. just modify individual device icons + if (!_parent.isUpdate()) { // don't touch palette's maps. just modify individual device icons ItemPalette.removeIconMap(_type, _family); if (!ItemPalette.addFamily(_parent._paletteFrame, _type, _family, _iconMap)) { return false; @@ -136,7 +136,7 @@ public void actionPerformed(ActionEvent a) { protected JPanel makeIconPanel(HashMap iconMap) { if (iconMap == null) { - log.error("iconMap is null for type " + _type + " family " + _family); + log.error("iconMap is null for type {}, family {}", _type, _family); return null; } JPanel iconPanel = new JPanel(); @@ -160,7 +160,7 @@ protected JPanel makeIconPanel(HashMap iconMap) { c.gridy = 0; if (log.isDebugEnabled()) { - log.debug("makeIconPanel: for " + iconMap.size() + " icons. gridwidth= " + gridwidth); + log.debug("makeIconPanel: for {} icons. gridwidth = {}", iconMap.size(), gridwidth); } int panelWidth = 0; Iterator> it = iconMap.entrySet().iterator(); diff --git a/java/src/jmri/jmrit/display/palette/IconItemPanel.java b/java/src/jmri/jmrit/display/palette/IconItemPanel.java index 3c52f9c9922..10f72764a54 100644 --- a/java/src/jmri/jmrit/display/palette/IconItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/IconItemPanel.java @@ -15,6 +15,7 @@ import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; @@ -23,6 +24,7 @@ import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -35,26 +37,28 @@ import jmri.jmrit.display.LinkingLabel; import jmri.jmrit.display.PositionableLabel; import jmri.util.JmriJFrame; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * ItemPanel for for plain icons and backgrounds. + * ItemPanel for plain Icons and Backgrounds. * Does NOT use IconDialog class to add, replace or delete icons. */ public class IconItemPanel extends ItemPanel implements MouseListener { HashMap _iconMap; HashMap _tmpIconMap; - JPanel _iconPanel; + ImagePanel _iconPanel; JButton _catalogButton; CatalogPanel _catalog; JLabel _selectedIcon; JButton deleteIconButton; - protected int _level = Editor.ICONS; // sub classes can override (e.g. Background) + protected int _level = Editor.ICONS; // sub classes can override (e.g. Background) /** - * Constructor for plain icons and backgrounds + * Constructor for plain icons and backgrounds. + * * @param type type * @param parentFrame parentFrame * @param editor editor @@ -118,7 +122,7 @@ protected void initIconFamiliesPanel() { HashMap> families = ItemPalette.getFamilyMaps(_itemType); if (families != null && families.size() > 0) { if (families.size() != 1) { - log.warn("ItemType \"" + _itemType + "\" has " + families.size() + " families."); + log.warn("ItemType \"{}\" has {}", _itemType, families.size()); } Iterator iter = families.keySet().iterator(); while (iter.hasNext()) { @@ -127,8 +131,8 @@ protected void initIconFamiliesPanel() { addIconsToPanel(_iconMap); } } else { - // make create message todo!!! - log.error("Item type \"" + _itemType + "\" has " + (families == null ? "null" : families.size()) + " families."); + // make create message + log.error("Item type \"{}\" has {} families.", _itemType, (families == null ? "null" : families.size())); } } @@ -138,24 +142,31 @@ protected void initIconFamiliesPanel() { * @param iconMap set of icons to add to panel */ protected void addIconsToPanel(HashMap iconMap) { - Color bkgrdColor = _editor.getTargetPanel().getBackground(); - _iconPanel = new JPanel(); - _iconPanel.setBackground(bkgrdColor); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), Bundle.getMessage("PreviewBorderTitle"))); + updateBackgrounds(); // create array of backgrounds + + if (_iconPanel == null) { // create a new one + _iconPanel = new ImagePanel(); + _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + } else { // clear existing to keep connection to combo + _iconPanel.removeAll(); + } + _iconPanel.setImage(_backgrounds[previewBgSet]); // pick up shared setting + JPanel iPanel = new JPanel(); - iPanel.setBackground(bkgrdColor); + iPanel.setOpaque(false); Iterator> it = iconMap.entrySet().iterator(); while (it.hasNext()) { Entry entry = it.next(); - NamedIcon icon = new NamedIcon(entry.getValue()); // make copy for possible reduction + NamedIcon icon = new NamedIcon(entry.getValue()); // make copy for possible reduction JPanel panel = new JPanel(); - panel.setBackground(bkgrdColor); + panel.setOpaque(false); String borderName = ItemPalette.convertText(entry.getKey()); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), borderName)); try { JLabel label = new IconDragJLabel(new DataFlavor(Editor.POSITIONABLE_FLAVOR), _level); - label.setBackground(bkgrdColor); + label.setOpaque(false); label.setName(borderName); label.setToolTipText(icon.getName()); panel.add(label); @@ -182,13 +193,13 @@ protected void addIconsToPanel(HashMap iconMap) { protected void setEditor(Editor ed) { super.setEditor(ed); if (_initialized) { - removeIconFamiliesPanel(); + removeIconFamiliesPanel(); // clean up by replacing addIconsToPanel(_iconMap); } } /* - * For plain icons and backgrounds, families panel is the icon panel of just one family. + * For plain icons and backgrounds, families panel is the icon panel of just one family. */ protected void removeIconFamiliesPanel() { if (_iconPanel != null) { @@ -198,9 +209,7 @@ protected void removeIconFamiliesPanel() { } protected void updateFamiliesPanel() { - if (log.isDebugEnabled()) { - log.debug("updateFamiliesPanel for " + _itemType); - } + log.debug("updateFamiliesPanel for {}", _itemType); removeIconFamiliesPanel(); initIconFamiliesPanel(); validate(); @@ -211,7 +220,7 @@ protected void updateFamiliesPanel() { */ public void initButtonPanel() { JPanel bottomPanel = new JPanel(); - bottomPanel.setLayout(new FlowLayout()); //new BoxLayout(p, BoxLayout.Y_AXIS) + bottomPanel.setLayout(new FlowLayout()); _catalogButton = new JButton(Bundle.getMessage("ButtonShowCatalog")); _catalogButton.addActionListener(new ActionListener() { @@ -252,6 +261,9 @@ public void actionPerformed(ActionEvent a) { bottomPanel.add(deleteIconButton); deleteIconButton.setEnabled(false); + if (makeBgButtonPanel(_iconPanel, null, _backgrounds) != null) { + bottomPanel.add(makeBgButtonPanel(_iconPanel, null, _backgrounds)); // to enable returning null for Backgrounds + } add(bottomPanel); } @@ -265,7 +277,7 @@ void hideCatalog() { */ protected void addNewIcon() { if (log.isDebugEnabled()) { - log.debug("addNewIcon Action: iconMap.size()= " + _iconMap.size()); + log.debug("addNewIcon Action: iconMap.size()= {}", _iconMap.size()); } String name = JOptionPane.showInputDialog(this, Bundle.getMessage("NoIconName"), null); @@ -397,7 +409,7 @@ public IconDragJLabel(DataFlavor flavor, int zLevel) { level = zLevel; new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, this); - //if (log.isDebugEnabled()) log.debug("DropJLabel ctor"); + log.debug("DropJLabel ctor"); } @Override @@ -411,9 +423,7 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti return null; } String url = ((NamedIcon) getIcon()).getURL(); - if (log.isDebugEnabled()) { - log.debug("DragJLabel.getTransferData url= " + url); - } + log.debug("DragJLabel.getTransferData url= {}", url); if (flavor.isMimeTypeEqual(Editor.POSITIONABLE_FLAVOR)) { String link = _linkName.getText().trim(); PositionableLabel l; @@ -463,26 +473,18 @@ public void drop(DropTargetDropEvent e) { accept(e, newIcon); } else if (e.isDataFlavorSupported(DataFlavor.stringFlavor)) { String text = (String) tr.getTransferData(DataFlavor.stringFlavor); - if (log.isDebugEnabled()) { - log.debug("drop for stringFlavor " + text); - } + log.debug("drop for stringFlavor {}", text); NamedIcon newIcon = new NamedIcon(text, text); accept(e, newIcon); } else { - if (log.isDebugEnabled()) { - log.debug("DropJLabel.drop REJECTED!"); - } + log.debug("DropJLabel.drop REJECTED!"); e.rejectDrop(); } } catch (IOException ioe) { - if (log.isDebugEnabled()) { - log.debug("DropPanel.drop REJECTED!"); - } + log.debug("DropPanel.drop REJECTED!"); e.rejectDrop(); } catch (UnsupportedFlavorException ufe) { - if (log.isDebugEnabled()) { - log.debug("DropJLabel.drop REJECTED!"); - } + log.debug("DropJLabel.drop REJECTED!"); e.rejectDrop(); } } @@ -492,8 +494,7 @@ private void accept(DropTargetDropEvent e, NamedIcon newIcon) { DropTarget target = (DropTarget) e.getSource(); IconDragJLabel label = (IconDragJLabel) target.getComponent(); if (log.isDebugEnabled()) { - log.debug("accept drop for " + label.getName() - + ", " + newIcon.getURL()); + log.debug("accept drop for {}, {}", label.getName(), newIcon.getURL()); } if (newIcon == null || newIcon.getIconWidth() < 1 || newIcon.getIconHeight() < 1) { label.setText(Bundle.getMessage("invisibleIcon")); @@ -510,8 +511,8 @@ private void accept(DropTargetDropEvent e, NamedIcon newIcon) { addIconsToPanel(_iconMap); e.dropComplete(true); if (log.isDebugEnabled()) { - log.debug("DropJLabel.drop COMPLETED for " + label.getName() - + ", " + (newIcon != null ? newIcon.getURL() : " newIcon==null ")); + log.debug("DropJLabel.drop COMPLETED for {}, {}", label.getName(), + (newIcon != null ? newIcon.getURL() : " newIcon==null ")); } } } diff --git a/java/src/jmri/jmrit/display/palette/IndicatorItemPanel.java b/java/src/jmri/jmrit/display/palette/IndicatorItemPanel.java index ee1283d2393..5fd8cc3664a 100644 --- a/java/src/jmri/jmrit/display/palette/IndicatorItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/IndicatorItemPanel.java @@ -21,21 +21,21 @@ import org.slf4j.LoggerFactory; /** - * ItemPanel for for Indicating track blocks + * ItemPanel for for Indicating track blocks. */ public class IndicatorItemPanel extends FamilyItemPanel { private DetectionPanel _detectPanel; /** - * Constructor for plain icons and backgrounds + * Constructor for plain icons and backgrounds. */ public IndicatorItemPanel(JmriJFrame parentFrame, String type, String family, Editor editor) { super(parentFrame, type, family, editor); } /** - * Init for creation insert panels for detection and train id + * Init for creation of insert panels for detection and train id. */ @Override public void init() { @@ -51,8 +51,8 @@ public void init() { } /** - * Init for update of existing track block _bottom3Panel has "Update Panel" - * button put into _bottom1Panel + * Init for update of existing track block. + * _bottom3Panel has "Update Panel" button put onto _bottom1Panel. */ @Override public void init(ActionListener doneAction, HashMap iconMap) { @@ -62,7 +62,7 @@ public void init(ActionListener doneAction, HashMap iconMap) } /** - * Init for conversion of plain track to indicator track + * Init for conversion of plain track to indicator track. */ @Override public void init(ActionListener doneAction) { @@ -180,4 +180,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(IndicatorItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/IndicatorTOIconDialog.java b/java/src/jmri/jmrit/display/palette/IndicatorTOIconDialog.java index 3335af1b478..5f847c145e8 100644 --- a/java/src/jmri/jmrit/display/palette/IndicatorTOIconDialog.java +++ b/java/src/jmri/jmrit/display/palette/IndicatorTOIconDialog.java @@ -25,7 +25,7 @@ public class IndicatorTOIconDialog extends IconDialog { /** * Constructor for existing family to change icons, add/delete icons, or to - * delete the family + * delete the family. */ public IndicatorTOIconDialog(String type, String family, IndicatorTOItemPanel parent, String key, HashMap iconMap) { @@ -33,14 +33,11 @@ public IndicatorTOIconDialog(String type, String family, IndicatorTOItemPanel pa _family = family; _key = key; sizeLocate(); - if (log.isDebugEnabled()) { - log.debug("IndicatorTOIconDialog ctor done. type= \"" - + type + "\", family= \"" + family + "\", key= \"" + key + "\""); - } + log.debug("IndicatorTOIconDialog ctor done. type= \"{}\" family =\"{}\", key= \"{}\"", type, family, key); } /** - * Add/Delete icon family for types that may have more than 1 family + * Add/Delete icon family for types that may have more than 1 family. */ @Override protected void makeAddIconButtonPanel(JPanel buttonPanel, String addTip, String deleteTip) { @@ -71,13 +68,11 @@ public void actionPerformed(ActionEvent a) { } /** - * Action item for add new status set in makeAddIconButtonPanel + * Action item for add new status set in makeAddIconButtonPanel. */ private void addFamilySet() { - if (log.isDebugEnabled()) { - log.debug("addFamilySet: type= \"" - + _type + "\", family= \"" + _family + "\" key= " + _key); - } + log.debug("addFamilySet: type= \"{}\", family= \"{}\" key= {}", + _type, _family, _key); setVisible(false); IndicatorTOItemPanel parent = (IndicatorTOItemPanel) _parent; if (parent._iconGroupsMap.size() < IndicatorTOItemPanel.STATUS_KEYS.length) { @@ -106,12 +101,12 @@ private void addFamilySet() { /** * NOT add a new family. Create a status family when previous status was - * deleted + * deleted. */ private void createNewStatusSet() { if (log.isDebugEnabled()) { - log.debug("createNewFamily: type= \"" - + _type + "\", family= \"" + _family + "\" key= " + _key); + log.debug("createNewFamily: type= \"{}\", family \"{}\" key = \"{}\"", + _type, _family, _key); } //check text HashMap iconMap = ItemPanel.makeNewIconMap("Turnout"); @@ -121,7 +116,7 @@ private void createNewStatusSet() { } /** - * Action item for add delete status set in makeAddIconButtonPanel + * Action item for add delete status set in makeAddIconButtonPanel. */ private void deleteFamilySet() { ItemPalette.removeLevel4IconMap(_type, _parent._family, _key); @@ -130,7 +125,7 @@ private void deleteFamilySet() { } /** - * Action item for makeDoneButtonPanel + * Action item for makeDoneButtonPanel. */ @Override protected boolean doDoneAction() { @@ -145,8 +140,8 @@ protected boolean doDoneAction() { private boolean addFamilySet(String family, HashMap iconMap, String subFamily) { if (log.isDebugEnabled()) { - log.debug("addFamily _type= \"" + _type + "\", family= \"" + family + "\"" - + ", key= \"" + _key + "\", _iconMap.size= " + iconMap.size()); + log.debug("addFamily _type= \"{}\", family= \"{}\", key=\"{}\", _iconMap.size= {}", + _type, family, _key, iconMap.size()); } IndicatorTOItemPanel parent = (IndicatorTOItemPanel) _parent; parent.updateIconGroupsMap(subFamily, iconMap); @@ -156,4 +151,5 @@ private boolean addFamilySet(String family, HashMap iconMap, } private final static Logger log = LoggerFactory.getLogger(IndicatorTOIconDialog.class); + } diff --git a/java/src/jmri/jmrit/display/palette/IndicatorTOItemPanel.java b/java/src/jmri/jmrit/display/palette/IndicatorTOItemPanel.java index f644921596f..999aa9999aa 100644 --- a/java/src/jmri/jmrit/display/palette/IndicatorTOItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/IndicatorTOItemPanel.java @@ -8,6 +8,7 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -26,12 +27,12 @@ import jmri.jmrit.display.IndicatorTurnoutIcon; import jmri.jmrit.picker.PickListModel; import jmri.util.JmriJFrame; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * JPanels for the various item types that come from tool Tables - e.g. Sensors, - * Turnouts, etc. + * JPanel for IndicatorTurnout items. */ public class IndicatorTOItemPanel extends TableItemPanel { @@ -41,7 +42,6 @@ public class IndicatorTOItemPanel extends TableItemPanel { private DetectionPanel _detectPanel; private JPanel _tablePanel; protected HashMap> _iconGroupsMap; -// private HashMap> _updateGroupsMap; public IndicatorTOItemPanel(JmriJFrame parentFrame, String type, String family, PickListModel model, Editor editor) { super(parentFrame, type, family, model, editor); @@ -50,7 +50,7 @@ public IndicatorTOItemPanel(JmriJFrame parentFrame, String type, String family, /** * Init for creation _bottom1Panel and _bottom2Panel alternate visibility in * bottomPanel depending on whether icon families exist. They are made first - * because they are referenced in initIconFamiliesPanel() + * because they are referenced in initIconFamiliesPanel(). */ @Override public void init() { @@ -65,7 +65,7 @@ public void init() { } /** - * Init for conversion of plain track to indicator track + * Init for conversion of plain track to indicator track. */ @Override public void init(ActionListener doneAction) { @@ -75,14 +75,15 @@ public void init(ActionListener doneAction) { } /** - * Init for update of existing indicator turnout _bottom3Panel has "Update - * Panel" button put into _bottom1Panel + * Init for update of existing indicator turnout. + * _bottom3Panel has "Update Panel" button put onto _bottom1Panel. + * * @param doneAction doneAction * @param iconMaps iconMaps */ public void initUpdate(ActionListener doneAction, HashMap> iconMaps) { _iconGroupsMap = iconMaps; - checkCurrentMaps(iconMaps); // is map in families?, does user want to add it? etc + checkCurrentMaps(iconMaps); // is map in families?, does user want to add it? etc. super.init(doneAction, null); _bottom1Panel.remove(_editIconsButton); _detectPanel = new DetectionPanel(this); @@ -93,7 +94,7 @@ public void initUpdate(ActionListener doneAction, HashMap> iconMaps) { @@ -104,9 +105,7 @@ private void checkCurrentMaps(HashMap> iconMa while (it.hasNext()) { Entry>> entry = it.next(); family = entry.getKey(); - if (log.isDebugEnabled()) { - log.debug("FamilyKey= " + family); - } + log.debug("FamilyKey = {}", family); Iterator>> iter = entry.getValue().entrySet().iterator(); while (iter.hasNext()) { Entry> ent = iter.next(); @@ -151,7 +150,7 @@ private void checkCurrentMaps(HashMap> iconMa } /* - * Get a handle in order to change visibility + * Get a handle in order to change visibility. */ @Override protected JPanel initTablePanel(PickListModel model, Editor editor) { @@ -171,9 +170,12 @@ public void dispose() { */ @Override protected void initIconFamiliesPanel() { - _iconFamilyPanel = new JPanel(); - _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); - + if (_iconFamilyPanel == null) { // keep existing panels + _iconFamilyPanel = new ImagePanel(); + _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); + } else { + _iconFamilyPanel.removeAll(); // TODO use a function in _iconFamilyPanel + } HashMap>> families = ItemPalette.getLevel4FamilyMaps(_itemType); if (families != null && families.size() > 0) { @@ -183,26 +185,25 @@ protected void initIconFamiliesPanel() { if (_iconGroupsMap == null) { _iconGroupsMap = families.get(_family); } - // make _iconPanel & _dragIconPanel before calls to add icons + // make _iconPanel + _dragIconPanel before calls to add icons addFamilyPanels(familyPanel); + if (_iconGroupsMap == null) { log.error("_iconGroupsMap is null in initIconFamiliesPanel"); _family = null; } else { - addIcons2Panel(_iconGroupsMap); // need to have family iconMap identified before calling + addIcons2Panel(_iconGroupsMap); // need to have family iconMap identified before calling makeDndIconPanel(_iconGroupsMap.get("ClearTrack"), "TurnoutStateClosed"); } } else { familiesMissing(); - //createNewFamily(); - } - if (log.isDebugEnabled()) { - log.debug("initIconFamiliesPanel done"); } + updateBackgrounds(); // create array of backgrounds + log.debug("initIconFamiliesPanel done"); } private void resetFamiliesPanel() { - remove(_iconFamilyPanel); + //_iconFamilyPanel.removeAll(); _tablePanel.setVisible(true); initIconFamiliesPanel(); int n = _iconFamilyPanel.getComponentCount(); @@ -215,7 +216,7 @@ private void resetFamiliesPanel() { } /** - * Make matrix of icons - each row has a button to change icons + * Make matrix of icons - each row has a button to change icons. */ private void addIcons2Panel(HashMap> map) { GridBagLayout gridbag = new GridBagLayout(); @@ -239,7 +240,7 @@ private void addIcons2Panel(HashMap> map) { String stateName = entry.getKey(); JPanel panel = new JPanel(); panel.add(new JLabel(ItemPalette.convertText(stateName))); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); gridbag.setConstraints(panel, c); _iconPanel.add(panel); c.gridx++; @@ -252,7 +253,7 @@ private void addIcons2Panel(HashMap> map) { NamedIcon icon = new NamedIcon(ent.getValue()); // make copy for possible reduction icon.reduceTo(100, 100, 0.2); panel = new JPanel(); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), borderName)); //if (log.isDebugEnabled()) log.debug("addIcons2Panel: "+borderName+" icon at (" @@ -272,7 +273,7 @@ private void addIcons2Panel(HashMap> map) { c.gridx++; } panel = new JPanel(); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); JButton button = new JButton(Bundle.getMessage("ButtonEditIcons")); button.addActionListener(new ActionListener() { String key; @@ -383,7 +384,7 @@ protected void showIcons() { } /** - * Action item for delete family + * Action item for delete family. */ @Override protected void deleteFamilySet() { @@ -404,7 +405,7 @@ private void createNewFamily() { } /** - * _iconGroupsMap holds edit changes when done is pressed + * _iconGroupsMap holds edit changes when done is pressed. */ protected void updateIconGroupsMap(String key, HashMap iconMap) { _iconGroupsMap.put(key, iconMap); @@ -413,19 +414,22 @@ protected void updateIconGroupsMap(String key, HashMap iconMa @Override protected void setFamily(String family) { _family = family; - if (log.isDebugEnabled()) { - log.debug("setFamily: for type \"" + _itemType + "\", family \"" + family + "\""); + log.debug("setFamily: for type \"{}\", family \"{}\"", _itemType, family); + if (_iconPanel == null) { + _iconPanel = new ImagePanel(); + _iconPanel.setOpaque(true); + _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + _iconFamilyPanel.add(_iconPanel, 0); + } else { + _iconPanel.removeAll(); } - _iconFamilyPanel.remove(_iconPanel); - _iconPanel = new JPanel(); - _iconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - _iconFamilyPanel.add(_iconPanel, 0); - if (!_supressDragging) { - _iconFamilyPanel.remove(_dragIconPanel); - makeDragIconPanel(1); -// _dragIconPanel = new JPanel(); -// _iconFamilyPanel.add(_dragIconPanel, 0); + if (!_suppressDragging) { + if (_dragIconPanel == null) { + makeDragIconPanel(1); + } else { + _dragIconPanel.removeAll(); + } } _iconGroupsMap = ItemPalette.getLevel4Family(_itemType, _family); addIcons2Panel(_iconGroupsMap); @@ -436,7 +440,7 @@ protected void setFamily(String family) { @Override protected void updateFamiliesPanel() { if (log.isDebugEnabled()) { - log.debug("updateFamiliesPanel for " + _itemType); + log.debug("updateFamiliesPanel for {}", _itemType); } if (_iconFamilyPanel != null) { removeIconFamiliesPanel(); @@ -451,7 +455,7 @@ protected void updateFamiliesPanel() { private void openStatusEditDialog(String key) { if (log.isDebugEnabled()) { - log.debug("openStatusEditDialog for family \"" + _family + "\" and \"" + key + "\""); + log.debug("openStatusEditDialog for family \"{}\" and \"{}\"", _family, key); } _currentIconMap = _iconGroupsMap.get(key); _dialog = new IndicatorTOIconDialog(_itemType, _family, this, key, _currentIconMap); @@ -572,4 +576,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(IndicatorTOItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/ItemPalette.java b/java/src/jmri/jmrit/display/palette/ItemPalette.java index bd660656a28..b100a9b0285 100644 --- a/java/src/jmri/jmrit/display/palette/ItemPalette.java +++ b/java/src/jmri/jmrit/display/palette/ItemPalette.java @@ -38,12 +38,13 @@ import org.slf4j.LoggerFactory; /** - * Container for adding items to control panels. Loads and stores icons used in - * control editor panels. For background colors to work on a particular editor + * Container for adding items to Control Panels. Loads and stores icons used in + * Control Panel Editor panels. For background colors to work on a particular editor * instance, select the 'Item Palette' item under 'Add Items' menu to configure - * ItemPalette for that editor. Otherwise any item can be dragged and - * dropped to any editor. The icons are displayed on the background - * of the last editor to call the ItemPalette instance. + * ItemPalette for that editor. Otherwise any item can be dragged and + * dropped to any editor. The icons are displayed on the background + * of the last editor to call the ItemPalette instance. The user can set it + * to another color or a white/gray squares pattern using the "View on:" combo. * * @author Pete Cressman Copyright (c) 2010 */ @@ -130,7 +131,7 @@ static CatalogTreeNode store3levelMap(String type, HashMap>>(); _indicatorTOMaps @@ -139,7 +140,7 @@ static public void loadIcons(Editor ed) { if (!loadSavedIcons(ed)) { loadDefaultIcons(ed); } -// System.out.println("Palette icons loaded in "+ (System.currentTimeMillis()-t)+ " milliseconds."); + // System.out.println("Palette icons loaded in " + (System.currentTimeMillis()-t) + " milliseconds."); } } @@ -159,21 +160,19 @@ static boolean loadSavedIcons(Editor ed) { HashMap>> familyTOMap = loadIndicatorFamilyMap(node, ed); if (log.isDebugEnabled()) { - log.debug("Add " + familyTOMap.size() - + " indicatorTO families to item type " + typeName + " to _indicatorTOMaps."); + log.debug("Add {} indicatorTO families to item type {} for _indicatorTOMaps.", + familyTOMap.size(), typeName ); } _indicatorTOMaps.put(typeName, familyTOMap); } else { HashMap> familyMap = loadFamilyMap(node, ed); _iconMaps.put(typeName, familyMap); - if (log.isDebugEnabled()) { - log.debug("Add item type " + typeName + " to _iconMaps."); - } + log.debug("Add item type {} to _iconMaps.", typeName); } } if (log.isDebugEnabled()) { - log.debug("Icon Map has " + _iconMaps.size() + " members"); + log.debug("Icon Map has {} members", _iconMaps.size()); } return true; } @@ -213,7 +212,7 @@ static HashMap> loadFamilyMap(CatalogTreeNode if (icon == null) { icon = ed.loadFailed(iconName, path); if (icon == null) { - log.info(iconName + " removed for url= " + path); + log.info("{} removed for url = {}", iconName, path); } else { InstanceManager.getDefault(ImageIndexEditor.class).indexChanged(true); } @@ -221,7 +220,7 @@ static HashMap> loadFamilyMap(CatalogTreeNode if (icon != null) { iconMap.put(iconName, icon); if (log.isDebugEnabled()) { - log.debug("Add " + iconName + " icon to family " + familyName); + log.debug("Add {} icon to family \"{}\"", iconName, familyName); } } Thread.yield(); @@ -268,15 +267,15 @@ static void loadFamilies(String typeName, List families, Editor ed) { = loadDefaultIndicatorTOMap(families, ed); _indicatorTOMaps.put(typeName, familyTOMap); if (log.isDebugEnabled()) { - log.debug("Add " + familyTOMap.size() - + " indicatorTO families to item type " + typeName + " to _indicatorTOMaps."); + log.debug("Add {} indicatorTO families to item type {} to _indicatorTOMaps.", + familyTOMap.size(), typeName); } } else { HashMap> familyMap = loadDefaultFamilyMap(families, ed); _iconMaps.put(typeName, familyMap); if (log.isDebugEnabled()) { - log.debug("Add " + familyMap.size() - + " families to item type " + typeName + " to _iconMaps."); + log.debug("Add {} families to item type \"{}\" to _iconMaps.", + familyMap.size(), typeName); } } } @@ -313,13 +312,13 @@ static HashMap> loadDefaultFamilyMap(List> loadDefaultFamilyMap(List> loadDefaultFamilyMap(List> familyMap = loadDefaultFamilyMap(types, ed); familyTOMap.put(familyName, familyMap); if (log.isDebugEnabled()) { - log.debug("Add " + familyMap.size() - + " IndicatorTO sub-families to item type " + familyName + " to IndicatorTO families."); + log.debug("Add {} IndicatorTO sub-families to item type {} to IndicatorTO families.", + familyMap.size(), familyName); } } return familyTOMap; @@ -368,11 +367,11 @@ static public ItemPalette getDefault(String title, @Nonnull Editor ed) { if (name == null || name.equals("")) { name = Bundle.getMessage("untitled"); } - instance.setTitle(Bundle.getMessage("MenuItemItemPalette") + "-" + name); + instance.setTitle(Bundle.getMessage("MenuItemItemPalette") + " - " + name); // Either of these positioning calls puts the instance on the primary monitor. ??? java.awt.Point pt = ed.getLocation(); instance.setLocation(pt.x, pt.y); -// instance.setLocationRelativeTo(ed); + // instance.setLocationRelativeTo(ed); instance.pack(); instance.setVisible(true); return instance; @@ -405,7 +404,7 @@ public void windowClosing(java.awt.event.WindowEvent e) { pack(); } - /* + /** * Add the tabs on the the Control Panel Editor. */ static void buildTabPane(ItemPalette palette, Editor editor) { @@ -466,7 +465,7 @@ static void buildTabPane(ItemPalette palette, Editor editor) { _tabIndex.put("Text", iconPanel); iconPanel = new RPSItemPanel(palette, "RPSReporter", null, editor); -// itemPanel.init(); // show panel on start + // itemPanel.init(); // show panel on start _tabPane.add(new JScrollPane(iconPanel), Bundle.getMessage("RPSreporter")); // stored in jmri.jmrit.display.DisplayBundle _tabIndex.put("RPSReporter", iconPanel); @@ -488,17 +487,18 @@ static void buildTabPane(ItemPalette palette, Editor editor) { _tabIndex.put("Portal", itemPanel); _tabPane.addChangeListener(palette); -// _tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); + // _tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } @Override public void stateChanged(ChangeEvent e) { if (!jmri.util.ThreadingUtil.isGUIThread()) log.error("Not on GUI thread", new Exception("traceback")); -// long t = System.currentTimeMillis(); + // long t = System.currentTimeMillis(); JTabbedPane tp = (JTabbedPane) e.getSource(); JScrollPane sp = (JScrollPane) tp.getSelectedComponent(); ItemPanel p = (ItemPanel) sp.getViewport().getView(); p.init(); + log.debug("different tab displayed"); if (_currentItemPanel != null) { _currentItemPanel.closeDialogs(); } @@ -554,7 +554,7 @@ public void closePanels(java.awt.event.WindowEvent e) { } /** - * Look for duplicate name of family in the iterated set + * Look for duplicate name of family in the iterated set. */ private static boolean familyNameOK(java.awt.Frame frame, String type, String family, Iterator it) { if (family == null || family.length() == 0) { @@ -576,7 +576,8 @@ private static boolean familyNameOK(java.awt.Frame frame, String type, String fa } /** - * Adding a new Family of icons to the device type + * Add a new Family of icons to the device type. + * * @param frame frame * @param type type * @param family family @@ -587,7 +588,7 @@ static protected boolean addFamily(java.awt.Frame frame, String type, String fam if (ItemPalette.getFamilyMaps(type) == null) { HashMap> typeMap = new HashMap>(); _iconMaps.put(type, typeMap); -// typeMap.put(family, iconMap); + // typeMap.put(family, iconMap); } Iterator iter = ItemPalette.getFamilyMaps(type).keySet().iterator(); if (familyNameOK(frame, type, family, iter)) { @@ -603,7 +604,8 @@ static protected boolean addFamily(java.awt.Frame frame, String type, String fam } /** - * Getting all the Families of icons for a given device type + * Get all the Families of icons for a given device type. + * * @param type type * @return map of families */ @@ -612,13 +614,14 @@ static protected HashMap> getFamilyMaps(Strin } /** - * Removing a Family of icons from the device type + * Remove a Family of icons from the device type. + * * @param type type * @param family family */ static protected void removeIconMap(String type, String family) { if (log.isDebugEnabled()) { - log.debug("removeIconMap for family \"" + family + " \" in type \"" + type + "\""); + log.debug("removeIconMap for family \"{}\" in type \"{}\"", family, type); } _iconMaps.get(type).remove(family); InstanceManager.getDefault(ImageIndexEditor.class).indexChanged(true); @@ -627,24 +630,24 @@ static protected void removeIconMap(String type, String family) { if (families != null && families.size() > 0) { Iterator it = families.keySet().iterator(); while (it.hasNext()) { - log.debug("removeIconMap remaining Keys: family \"" + it.next() + " \" in type \"" + type + "\""); + log.debug("removeIconMap remaining Keys: family \"{}\" in type \"{}\"", it.next(), type); } } } } /* - * Getting a clone of the Family of icons for a given device type and family + * Get a clone of the Family of icons for a given device type and family. */ static protected HashMap getIconMap(String type, String family) { HashMap> itemMap = _iconMaps.get(type); if (itemMap == null) { - log.error("getIconMap failed. item type \"" + type + "\" not found."); + log.error("getIconMap failed. item type \"{}\" not found.", type); return null; } HashMap iconMap = itemMap.get(family); if (iconMap == null) { - log.error("getIconMap failed. family \"" + family + "\" not found in item type \"" + type + "\"."); + log.error("getIconMap failed. family \"{}\" not found in item type \"{}\"", family, type); return null; } return cloneMap(iconMap); @@ -694,8 +697,8 @@ static protected void addLevel4FamilyMap(String type, String family, // Currently only needed for IndicatorTO type static protected void removeLevel4IconMap(String type, String family, String key) { if (log.isDebugEnabled()) { - log.debug("removelvl4IconMap for indicator family \"" + family + " \" in type \"" + type - + "\" with key = \"" + key + "\""); + log.debug("removelvl4IconMap for indicator family \"{}\" in type \"{}\" with key \"{}\"", + family, type, key); } if (key != null) { _indicatorTOMaps.get(type).get(family).remove(key); @@ -749,10 +752,11 @@ static protected JPanel makeBannerPanel(String labelText, Component field) { c.gridx = 1; c.anchor = java.awt.GridBagConstraints.CENTER; c.weightx = 1.0; - c.fill = java.awt.GridBagConstraints.HORIZONTAL; // text field will expand + c.fill = java.awt.GridBagConstraints.HORIZONTAL; // text field will expand panel.add(field, c); return panel; } private final static Logger log = LoggerFactory.getLogger(ItemPalette.class); + } diff --git a/java/src/jmri/jmrit/display/palette/ItemPanel.java b/java/src/jmri/jmrit/display/palette/ItemPanel.java index f2f9430c0e9..f723d6ae2d1 100644 --- a/java/src/jmri/jmrit/display/palette/ItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/ItemPanel.java @@ -1,14 +1,22 @@ package jmri.jmrit.display.palette; +import java.awt.Color; import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.util.HashMap; +import javax.annotation.Nonnull; import javax.swing.BoxLayout; +import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import jmri.jmrit.catalog.NamedIcon; import jmri.jmrit.display.Editor; import jmri.jmrit.display.controlPanelEditor.PortalIcon; +import jmri.util.swing.DrawSquares; +import jmri.util.swing.ImagePanel; import jmri.util.JmriJFrame; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,7 +25,7 @@ * JPanels for the various item types that come from tool Tables - e.g. Sensors, * Turnouts, etc. * -* Devices such as these have sets of icons to display their various states. + * Devices such as these have sets of icons to display their various states. * such sets are called a "family" in the code. These devices then may have sets * of families to provide the user with a choice of the icon set to use for a * particular device. @@ -25,7 +33,7 @@ * The subclass FamilyItemPanel.java and its subclasses * handles these devices. * -* Other devices, e.g. backgrounds or memory, may use only one or no icon to + * Other devices, e.g. backgrounds or memory, may use only one or no icon to * display. The subclass IconItemPanel.java and its subclasses handles these * devices. */ @@ -34,12 +42,20 @@ public abstract class ItemPanel extends JPanel { protected JmriJFrame _paletteFrame; protected String _itemType; protected Editor _editor; - protected boolean _initialized = false; // Has init() been run - protected boolean _update = false; // Editing existing icon, do not allow icon dragging. Set in init() + protected boolean _initialized = false; // has init() been run + protected boolean _update = false; // editing existing icon, do not allow icon dragging. Set in init() JTextField _linkName = new JTextField(30); + static Color _grayColor = new Color(235, 235, 235); + static Color _darkGrayColor = new Color(150, 150, 150); + protected Color[] colorChoice = new Color[] {Color.white, _grayColor, _darkGrayColor}; // panel bg color picked up directly + protected Color _currentBackground = _grayColor; + protected BufferedImage[] _backgrounds; // array of Image backgrounds, shared to save on RAM + protected int previewBgSet = 0; // shared setting for preview background color, starts as 0 = use Panel bg + //protected JComboBox bgColorBox; // TODO use a shared JComboBox + listeners in ImagePanels to respond to state changes /** * Constructor for all table types. + * * @param parentFrame ItemPalette instance * @param type identifier of the ItemPanel type * @param editor Editor that last called for the ItemPalette @@ -54,7 +70,8 @@ public ItemPanel(JmriJFrame parentFrame, String type, Editor editor) { /** * Initializes panel for selecting a new Control Panel item or for updating * an existing item. Adds table if item is a bean. i.e. customizes for the - * item type + * item type. + * Called by enclosing TabbedPanel on change of displayed tab Pane. */ public void init() { _initialized = true; @@ -66,15 +83,86 @@ protected void setEditor(Editor ed) { protected void initLinkPanel() { JPanel panel = new JPanel(); - panel.setLayout(new FlowLayout()); //new BoxLayout(p, BoxLayout.Y_AXIS) + panel.setLayout(new FlowLayout()); panel.add(new JLabel(Bundle.getMessage("LinkName"))); panel.add(_linkName); _linkName.setToolTipText(Bundle.getMessage("ToolTipLink")); panel.setToolTipText(Bundle.getMessage("ToolTipLink")); - add(panel); } + /** + * Create panel element containing [Set background:] drop down list. + * @see jmri.jmrit.catalog.PreviewDialog#setupPanel() + * @see DecoratorPanel + * + * @param preview1 preview pane1 to set background image on + * @param preview2 (optional) second preview pane1 to set background image on + * @param imgArray the image array to choose from + * @return JPanel with label and drop down with actions + */ + protected JPanel makeBgButtonPanel(@Nonnull ImagePanel preview1, ImagePanel preview2, BufferedImage[] imgArray) { + JComboBox bgColorBox = new JComboBox<>(); + bgColorBox.addItem(Bundle.getMessage("PanelBgColor")); // PanelColor key is specific for CPE, but too long for combo + bgColorBox.addItem(Bundle.getMessage("White")); + bgColorBox.addItem(Bundle.getMessage("LightGray")); + bgColorBox.addItem(Bundle.getMessage("DarkGray")); + bgColorBox.addItem(Bundle.getMessage("Checkers")); + bgColorBox.setSelectedIndex(previewBgSet); // Global field, starts as 0 = panel bg color + bgColorBox.addActionListener((ActionEvent e) -> { + if (imgArray != null) { + if (previewBgSet != bgColorBox.getSelectedIndex()) { + previewBgSet = bgColorBox.getSelectedIndex(); // store user choice in field + // load background image + log.debug("Palette setImage called {}", previewBgSet); + preview1.setImage(imgArray[previewBgSet]); + preview1.setOpaque(false); // needed? + preview1.revalidate(); // force redraw + if (preview2 != null) { + preview2.setImage(imgArray[previewBgSet]); + preview2.setOpaque(false); // needed? + preview2.revalidate(); // force redraw + } + } + } else { + log.debug("imgArray is empty"); + } + }); + + JPanel backgroundPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + backgroundPanel.add(new JLabel(Bundle.getMessage("setBackground"))); + backgroundPanel.add(bgColorBox); + backgroundPanel.setMaximumSize(backgroundPanel.getPreferredSize()); + return backgroundPanel; + } + + /** + * TODO: Synchronise View On: ComboBox choice across tabs + */ +// protected void updateBgCombo() { +// if (bgColorBox != null) { +// bgColorBox.setSelectedIndex(previewBgSet); +// } +// log.debug("BgCombo updated"); +// } + + /** + * Create array of backgrounds. + */ + protected void updateBackgrounds() { + if (_backgrounds == null) { // reduces load but will not redraw for new size + _backgrounds = new BufferedImage[5]; + for (int i = 1; i <= 3; i++) { + _backgrounds[i] = DrawSquares.getImage(500, 150, 15, colorChoice[i - 1], colorChoice[i - 1]); + // [i-1] because choice 0 is not in colorChoice[] + } + _backgrounds[4] = DrawSquares.getImage(500, 150, 15, Color.white, _grayColor); + } + // always update background from Panel Editor + _currentBackground = _editor.getTargetPanel().getBackground(); // start using Panel background color + _backgrounds[0] = DrawSquares.getImage(500, 150, 15, _currentBackground, _currentBackground); + } + protected void closeDialogs() { } @@ -135,7 +223,7 @@ static private String[] getNames(String type) { } else if (type.equals("Portal")) { return PORTAL; } else { - log.error("Item type \"" + type + "\" cannot create icon sets!"); + log.error("Item type \"{}\" cannot create icon sets!", type); return null; } } @@ -163,4 +251,5 @@ static protected void checkIconMap(String type, HashMap map) } private final static Logger log = LoggerFactory.getLogger(ItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/MemoryItemPanel.java b/java/src/jmri/jmrit/display/palette/MemoryItemPanel.java index e01fa03ae13..cb1bc5ac2f9 100644 --- a/java/src/jmri/jmrit/display/palette/MemoryItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/MemoryItemPanel.java @@ -1,10 +1,16 @@ package jmri.jmrit.display.palette; +import java.awt.Color; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.IOException; import javax.swing.Box; import javax.swing.BoxLayout; +import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -24,6 +30,7 @@ import jmri.jmrit.display.MemoryInputIcon; import jmri.jmrit.display.MemorySpinnerIcon; import jmri.jmrit.picker.PickListModel; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +51,7 @@ public void init() { add(initTablePanel(_model, _editor)); initIconFamiliesPanel(); add(_iconFamilyPanel); + add(makeBgButtonPanel(_dragIconPanel, _iconPanel, _backgrounds)); _initialized = true; } } @@ -81,13 +89,15 @@ protected JPanel instructions() { protected void initIconFamiliesPanel() { _iconFamilyPanel = new JPanel(); _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); + _iconFamilyPanel.setOpaque(true); if (!_update) { _iconFamilyPanel.add(instructions()); } + updateBackgrounds(); // create array of backgrounds + makeDragIconPanel(1); makeDndIconPanel(null, null); - -// _iconFamilyPanel.add(_dragIconPanel); + log.debug("initIconFamiliesPanel done"); } @Override @@ -96,7 +106,7 @@ protected void makeDndIconPanel(java.util.HashMap iconMap, St return; } JPanel panel = new JPanel(); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); panel.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints c = new java.awt.GridBagConstraints(); c.gridwidth = 1; @@ -107,11 +117,10 @@ protected void makeDndIconPanel(java.util.HashMap iconMap, St c.weightx = 1.0; JLabel label = new JLabel(Bundle.getMessage("ReadWriteMemory")); - label.setBackground(_editor.getTargetPanel().getBackground()); + label.setOpaque(false); panel.add(label, c); c.gridy = 1; _writeMem = new MemoryInputIcon(5, _editor); -// JPanel p0 = makeDragIcon(_writeMem, Type.READWRITE); panel.add(makeDragIcon(_writeMem, Type.READWRITE), c); _spinner = new JSpinner(new SpinnerNumberModel(0, 0, 100, 1)); @@ -126,14 +135,14 @@ protected void makeDndIconPanel(java.util.HashMap iconMap, St c.gridy = 3; c.anchor = java.awt.GridBagConstraints.NORTH; label = new JLabel(Bundle.getMessage("NumColsLabel")); - label.setBackground(_editor.getTargetPanel().getBackground()); + label.setOpaque(false); panel.add(label, c); c.gridx = 1; c.gridy = 0; c.anchor = java.awt.GridBagConstraints.CENTER; label = new JLabel(Bundle.getMessage("ReadMemory")); - label.setBackground(_editor.getTargetPanel().getBackground()); + label.setOpaque(false); panel.add(label, c); c.gridy = 1; _readMem = new MemoryIcon(NamedIcon.getIconByName("resources/icons/misc/X-red.gif"), _editor); @@ -142,7 +151,7 @@ protected void makeDndIconPanel(java.util.HashMap iconMap, St c.gridx = 2; c.gridy = 0; label = new JLabel(Bundle.getMessage("SpinnerMemory")); - label.setBackground(_editor.getTargetPanel().getBackground()); + label.setOpaque(false); panel.add(label, c); c.gridy = 1; _spinMem = new MemorySpinnerIcon(_editor); @@ -152,7 +161,7 @@ protected void makeDndIconPanel(java.util.HashMap iconMap, St c.gridy = 2; c.gridwidth = 4; label = new JLabel(Bundle.getMessage("ComboMemory")); - label.setBackground(_editor.getTargetPanel().getBackground()); + label.setOpaque(false); panel.add(label, c); c.gridy = 3; _comboMem = new MemoryComboIcon(_editor, null); @@ -164,11 +173,11 @@ protected void makeDndIconPanel(java.util.HashMap iconMap, St private JPanel makeDragIcon(JComponent mem, Type type) { JPanel panel = new JPanel(); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); JPanel comp; try { comp = getDragger(new DataFlavor(Editor.POSITIONABLE_FLAVOR), type, mem); - comp.setBackground(_editor.getTargetPanel().getBackground()); + comp.setOpaque(false); comp.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); } catch (java.lang.ClassNotFoundException cnfe) { cnfe.printStackTrace(); @@ -179,21 +188,20 @@ private JPanel makeDragIcon(JComponent mem, Type type) { } /* - * Set column width for InputMemoryIcon + * Set column width for InputMemoryIcon. */ @Override public void stateChanged(ChangeEvent e) { if (log.isDebugEnabled()) { - log.debug("stateChanged: class= " + _spinner.getValue().getClass().getName() - + ", value= " + _spinner.getValue()); + log.debug("stateChanged: class= {}, value= {}", _spinner.getValue().getClass().getName(), + _spinner.getValue()); } - Integer nCols = (Integer) _spinner.getValue(); _writeMem.setNumColumns(nCols.intValue()); } /** - * ListSelectionListener action from table + * ListSelectionListener action from table. */ @Override public void valueChanged(ListSelectionEvent e) { @@ -201,9 +209,7 @@ public void valueChanged(ListSelectionEvent e) { return; } int row = _table.getSelectedRow(); - if (log.isDebugEnabled()) { - log.debug("Table valueChanged: row= " + row); - } + log.debug("Table valueChanged: row= {}", row); if (row >= 0) { if (_updateButton != null) { _updateButton.setEnabled(true); @@ -219,7 +225,7 @@ public void valueChanged(ListSelectionEvent e) { _updateButton.setEnabled(false); _updateButton.setToolTipText(Bundle.getMessage("ToolTipPickFromTable")); } - _iconFamilyPanel.remove(_dragIconPanel); + _dragIconPanel.removeAll(); makeDragIconPanel(1); makeDndIconPanel(null, null); } @@ -230,7 +236,7 @@ public void valueChanged(ListSelectionEvent e) { protected void setEditor(Editor ed) { _editor = ed; if (_initialized) { - _iconFamilyPanel.remove(_dragIconPanel); + _dragIconPanel.removeAll(); makeDragIconPanel(1); makeDndIconPanel(null, null); } @@ -325,4 +331,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(MemoryItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/MultiSensorIconDialog.java b/java/src/jmri/jmrit/display/palette/MultiSensorIconDialog.java index b66817ff211..5b2a1434b4e 100644 --- a/java/src/jmri/jmrit/display/palette/MultiSensorIconDialog.java +++ b/java/src/jmri/jmrit/display/palette/MultiSensorIconDialog.java @@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory; /** - * Icons may be added or deleted from a family + * Icons may be added or deleted from a family. * * @author Pete Cressman Copyright (c) 2010 */ @@ -22,7 +22,7 @@ public class MultiSensorIconDialog extends IconDialog { /** * Constructor for existing family to change icons, add/delete icons, or to - * delete the family + * delete the family. */ public MultiSensorIconDialog(String type, String family, FamilyItemPanel parent, HashMap iconMap) { @@ -34,7 +34,7 @@ protected String getIconName() { } /** - * add/delete icon. For Multisensor, it adds another sensor position. + * Add/delete icon. For Multisensor, it adds another sensor position. */ @Override protected void makeAddIconButtonPanel(JPanel buttonPanel, String addTip, String deleteTip) { @@ -47,7 +47,7 @@ public void actionPerformed(ActionEvent a) { if (addNewIcon(getIconName())) { InstanceManager.getDefault(ImageIndexEditor.class).indexChanged(true); JPanel p = (JPanel) (getContentPane().getComponent(0)); - p.remove(_iconPanel); + p.remove(_iconPanel); // OK to replace on a Dialog _iconPanel = makeIconPanel(_iconMap); p.add(_iconPanel, 1); pack(); @@ -64,7 +64,7 @@ public void actionPerformed(ActionEvent a) { if (deleteIcon()) { InstanceManager.getDefault(ImageIndexEditor.class).indexChanged(true); JPanel p = (JPanel) (getContentPane().getComponent(0)); - p.remove(_iconPanel); + p.remove(_iconPanel); // OK to replace on a Dialog _iconPanel = makeIconPanel(_iconMap); p.add(_iconPanel, 1); pack(); @@ -86,7 +86,7 @@ protected boolean doDoneAction() { } /** - * Action item for makeAddIconButtonPanel + * Action item for makeAddIconButtonPanel. */ protected boolean addNewIcon(String name) { if (log.isDebugEnabled()) { @@ -109,7 +109,7 @@ protected boolean addNewIcon(String name) { } /** - * Action item for makeAddIconButtonPanel + * Action item for makeAddIconButtonPanel. */ protected boolean deleteIcon() { if (log.isDebugEnabled()) { @@ -124,4 +124,5 @@ protected boolean deleteIcon() { } private final static Logger log = LoggerFactory.getLogger(MultiSensorIconDialog.class); + } diff --git a/java/src/jmri/jmrit/display/palette/MultiSensorItemPanel.java b/java/src/jmri/jmrit/display/palette/MultiSensorItemPanel.java index fcc323f4f15..0144b20db31 100644 --- a/java/src/jmri/jmrit/display/palette/MultiSensorItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/MultiSensorItemPanel.java @@ -1,10 +1,12 @@ package jmri.jmrit.display.palette; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -27,6 +29,7 @@ import jmri.jmrit.display.MultiSensorIcon; import jmri.jmrit.picker.PickListModel; import jmri.util.JmriJFrame; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -95,10 +98,10 @@ public void actionPerformed(ActionEvent a) { public void clearSelections() { _selectionModel.clearSelection(); int size = 6; -// if (_family!=null) { -// HashMap map = ItemPalette.getIconMap(_itemType, _family); -// size = map.size(); -// } + // if (_family!=null) { + // HashMap map = ItemPalette.getIconMap(_itemType, _family); + // size = map.size(); + // } if (_currentIconMap != null) { size = _currentIconMap.size(); } @@ -113,8 +116,11 @@ protected void makeDndIconPanel(HashMap iconMap, String displ @Override protected void initIconFamiliesPanel() { super.initIconFamiliesPanel(); - makeMultiSensorPanel(); - _iconFamilyPanel.add(_multiSensorPanel); + if (_multiSensorPanel == null) { + makeMultiSensorPanel(); + _iconFamilyPanel.add(_multiSensorPanel); // Panel containing up-dn, le-ri radio buttons + } + updateBackgrounds(); // create array of backgrounds } private void makeMultiSensorPanel() { @@ -148,11 +154,10 @@ public void actionPerformed(ActionEvent e) { @Override protected void setFamily(String family) { super.setFamily(family); - if (_multiSensorPanel != null) { - _iconFamilyPanel.remove(_multiSensorPanel); + if (_multiSensorPanel == null) { + makeMultiSensorPanel(); + _iconFamilyPanel.add(_multiSensorPanel); } - makeMultiSensorPanel(); - _iconFamilyPanel.add(_multiSensorPanel); _iconFamilyPanel.repaint(); updateFamiliesPanel(); setSelections(); @@ -232,8 +237,7 @@ protected class MultiSensorSelectionModel extends DefaultListSelectionModel { protected ArrayList getSelections() { if (log.isDebugEnabled()) { - log.debug("getSelections: size= " + _selections.size() - + ", _nextPosition= " + _nextPosition); + log.debug("getSelections: size = {}, _nextPosition = {}", _selections.size(), _nextPosition); } return _selections; } @@ -270,23 +274,17 @@ protected void setPositionRange(int size) { public boolean isSelectedIndex(int index) { for (int i = 0; i < _positions.length; i++) { if (_positions[i] == index) { - if (log.isDebugEnabled()) { - log.debug("isSelectedIndex(" + index + ") returned true"); - } + log.debug("isSelectedIndex({}) returned true", index); return true; } } - if (log.isDebugEnabled()) { - log.debug("isSelectedIndex(" + index + ") returned false"); - } + log.debug("isSelectedIndex({}) returned false", index); return false; } @Override public void clearSelection() { - if (log.isDebugEnabled()) { - log.debug("clearSelection()"); - } + log.debug("clearSelection()"); for (int i = 0; i < _positions.length; i++) { if (_positions[i] >= 0) { _tableModel.setValueAt(null, _positions[i], PickListModel.POSITION_COL); @@ -301,10 +299,8 @@ public void clearSelection() { @Override public void addSelectionInterval(int index0, int index1) { - if (log.isDebugEnabled()) { - log.debug("addSelectionInterval(" + index0 + ", " + index1 + ") - stubbed"); - } -// super.addSelectionInterval(index0, index1); + log.debug("addSelectionInterval({}), {}) - stubbed", index0, index1); + // super.addSelectionInterval(index0, index1); } @Override @@ -316,7 +312,7 @@ public void setSelectionInterval(int row, int index1) { return; } if (log.isDebugEnabled()) { - log.debug("setSelectionInterval(" + row + ", " + index1 + ")"); + log.debug("setSelectionInterval({}, {})", row, index1); } NamedBean bean = _tableModel.getBeanAt(row); String position = (String) _tableModel.getValueAt(row, PickListModel.POSITION_COL); @@ -412,4 +408,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(MultiSensorItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle.properties index c7cfa834149..52d4328792c 100644 --- a/java/src/jmri/jmrit/display/palette/PaletteBundle.properties +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle.properties @@ -28,7 +28,7 @@ fromArrow = Entry Arrow OccupancySensor = Occupancy Circuit ErrorSensor = Error Sensor -IconSetName = Icon Set Name: +IconSetName = Icon Set Name: {0} #IconName = Icon Name: #editText = Edit Text LinkName = Panel or URL Name @@ -41,7 +41,7 @@ HideIcons = Hide Icons ButtonEditIcons = Edit Icons ButtonShowCatalog = Icon Catalog HideCatalog = Hide Catalog -ButtonBackgroundColor = Background Color +ButtonBackgroundColor=Set Panel Background Color... updateButton = Update Panel addNewFamily = Add New Icon Set addIcon = Add Icon diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle_cs.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle_cs.properties new file mode 100644 index 00000000000..a54d11bfd9d --- /dev/null +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle_cs.properties @@ -0,0 +1,172 @@ +# PaletteBundle_cs.properties +# +# Czech properties for the jmrit.display.palette package +# Translation: Petr Sidlo + +# Tab labels +# most from NamedBeanBundle +# remaining Tab labels: +RPSReporter = RPSReporter +Icon = Ikona +Background = Pozad\u00ed +Text = Text +IndicatorTrack = Indik\u00e1tor koleje +IndicatorTO = Indik\u00e1tor v\u00fdhybky +ClearTrack = Volno +OccupiedTrack = Obsazeno +PositionTrack = Poloha vlaku +AllocatedTrack = P\u0159id\u011bleno +DontUseTrack = Mimo provoz +ErrorTrack = Chyba nap\u00e1jen\u00ed + +BlockSegment = Segment bloku +LeftEndSegment = Lev\u00fd konec segmentu +RightEndSegment = Prav\u00fd konec segmentu + +block = Viditeln\u00e9 +path = \u00dapravy cestu +hidden = Skryt\u00e9 +toArrow = V\u00fdstupn\u00ed \u0161ipka +fromArrow = Vstupn\u00ed \u0161ipka + +OccupancySensor = Obvod obsazen\u00ed +ErrorSensor = Sn\u00edma\u010d chyby + +IconSetName = N\u00e1zev sady ikon: +IconName = N\u00e1zev ikony: +editText = Upravit text +LinkName = N\u00e1zev panelu nebo URL +ToolTipLink = Zadejte odkaz na JMRI panel nebo http URL (voliteln\u00e9) + +# Button labels +CreateNewItem = P\u0159idat novou polo\u017eku tabulky... +ShowIcons = Zobrazit ikony +HideIcons = Skr\u00fdt ikony +ButtonEditIcons = Upravit ikony +ButtonShowCatalog= Katalog ikon +HideCatalog= Skr\u00fdt katalog +ButtonBackgroundColor=Barva pozad\u00ed... +updateButton = Aktualizovat panel +addNewFamily = P\u0159idat novou sadu ikon +addIcon = P\u0159idat ikonu +deleteIcon = Smazat ikonu +createNewFamily = Nov\u00e1 sada ikon +deleteFamily = Smazat sadu ikon +ClearSelection = Vy\u010distit v\u00fdb\u011br tabulky +leverPosition = Poloha p\u00e1ky +LeftRight = Kliknout Lev\u00e1/Prav\u00e1 +UpDown = Kliknout Horn\u00ed/Doln\u00ed +ReadMemory = Pam\u011b\u0165 zobrazen\u00ed +ReadWriteMemory = Pam\u011b\u0165 vstupn\u00ed scht\u00e1nky +SpinnerMemory = Pam\u011b\u0165 \u010d\u00edseln\u00edku +ComboMemory = Pam\u011b\u0165 rozbalovac\u00edho seznamu +OpenPicklist = Otev\u0159\u00edt v\u00fdb\u011brov\u00fd seznam sn\u00edma\u010d\u016f +addMissingStatus = P\u0159idat chyb\u011bj\u00edc\u00ed stav +deleteStatus = Vymazat stav +setDefaultIcons = Nastavit v\u00fdchoz\u00ed ikonu + +#title +createNewIconSet = Vytvo\u0159it novou sadu ikon pro {0} + +dragToPanel = P\u0159et\u00e1hnout na panel +AddToTableTitle = P\u0159idat novou polo\u017eku do tabulky +ShowIconsTitle = Upraviz ikonu pro {0} +IconFamiliesLabel = Sady ikon pro {0}: +infoTitle = Informace +invisibleIcon = Neviditeln\u00e1 ikona +circuitPaths = Obvodov\u00e9 cesty + +ColorChooser = V\u00fdb\u011br barvy pozad\u00ed +PanelColor = Barva ovl\u00e1dac\u00edho panelu + +first = Prvn\u00ed +second = Druh\u00fd +third = T\u0159et\u00ed +fourth = \u010ctvrt\u00fd +fifth = P\u00e1t\u00fd +sixth = \u0160est\u00fd +seventh = Sedm\u00fd +eighth = Osm\u00fd +nineth = Dev\u00e1t\u00fd +tenth = Des\u00e1t\u00fd + +scale = M\u011b\u0159\u00edtko {0}:1 + +FamilyName = Sada ikon "{0}". +EnterFamilyName = Zadejte n\u00e1zev pro tuto sadu ikon. +NoFamilyName = Sada ikon nem\u00e1 n\u00e1zev. Pokud ji chcete pojmenovat tak zadejte n\u00e1zev. +DuplicateFamilyName = N\u00e1zev skupiny "{0}" je stejn\u00fd jako jin\u00e1 skupina ikon pro {1}. Pros\u00edm zm\u011b\u0148te n\u00e1zev. +DuplicatePosition = Sn\u00edma\u010d {0} je ji\u017e nastaven na pozici {1}. +NeedPosition = Tento v\u00edcen\u00e1sobn\u00fd sn\u00edma\u010d pot\u0159ebuje {0} poloh. Vyberte v\u00edce \u0159\u00e1dk\u016f z tabulky. +NeedIcon = Tento v\u00edcen\u00e1sobn\u00fd sn\u00edma\u010d m\u00e1 pouze {0} poloh. Vyma\u017ete v\u00fdb\u011br pro zm\u011bnu po\u0159ad\u00ed poloh./nPro dal\u0161\u00ed polohy p\u0159idejte jinou ikonu. +AllFamiliesDeleted = V\u0161echny sady ikon pro typ {0} byly smaz\u00e1ny.\nChcete obnovit v\u00fdchoz\u00ed sadu? +FamilyNotFound = Sada ikon "{1}" nebyla nalazena v typu "{0}". +RedX = \u010cerven\u00e9 X +NoIconName = Pros\u00edm zadejte n\u00e1zev pro ikonu: +UnkownFamilyName = Sada ikon "{0}" nen\u00ed zn\u00e1m\u00e1 v palet\u011b. Chcete ji p\u0159idat do sady ikon?\nZvolte "Ne" a \u017e\u00e1dn\u00e9 dal\u0161\u00ed zpr\u00e1vy nebudou zas\u00edl\u00e1ny. +DuplicateIconName = Jin\u00e1 ikona m\u00e1 n\u00e1zev {0}. +InvalidOccDetector = {0} toto nen\u00ed platn\u00fd sn\u00edma\u010d nebo sn\u00edma\u010d bloku obsazen\u00ed pro indik\u00e1tor koleje +InvalidErrSensor = {0} Toto nen\u00ed platn\u00fd n\u00e1zev chybov\u00e9ho sn\u00edma\u010de +ShowTrainName = P\u0159i obsazen\u00ed zobrazit n\u00e1zev vlaku +AllStatus = Sada ikon obsahuje v\u0161echny mo\u017en\u00e9 stavy koleje +PickStatus = N\u00e1sleduj\u00edc\u00ed ikony stav\u016f chyb\u00ed. Vyberte co chcete p\u0159idat. +SelectPathIcons = Vyberte cestu(y), kter\u00e9 obsahuj\u00ed tuto ikonu. + +# Instructions +AddToPanel = P\u0159id\u00e1n\u00ed ikony do ovl\u00e1dac\u00edcho panelu: +PickRowReporter = Pro p\u0159id\u00e1n\u00ed Reporteru, vyberte jeho \u0159\u00e1dek z tabulky +DragReporter = a potom p\u0159et\u00e1hn\u011bte panel zobrazen\u00ed do va\u0161eho ovl\u00e1dac\u00edho panelu. +DragIconPanel = -- p\u0159et\u00e1hn\u011bte ikonu z panelu zobrazen\u00ed n\u00ed\u017ee uvedenou do va\u0161eho ovl\u00e1dac\u00edho panelu +DragIconCatalog = -- nebo stiskn\u011bte [{0}] a p\u0159et\u00e1hn\u011bte ikonu z katalogu do va\u0161eho ovl\u00e1dac\u00edho panelu +ToAddDeleteModify = Pro zm\u011bnu ikony na panelu zobrazen\u00ed n\u00ed\u017ee uvedenou, p\u0159et\u00e1hn\u011bte ikonu z katalogu na ikonu. +ToChangeName = Pro zm\u011bnu n\u00e1zvu ikony n\u00ed\u017ee uveden\u00e9 ud\u011blejte dvojklik na n\u00e1zev. +ToDeleteIcon = Pro vymaz\u00e1n\u00ed ikony, klikn\u011bte na n\u00e1zev a potom stiskn\u011bte aktivovan\u00e9 tla\u010d\u00edtko [{0}]. +ToLinkToURL = Pro kliknut\u00ed na tento odkaz {0} na jin\u00fd JMRI panel nebo URL, +enterPanel = -- pro JMRI panel, zadejte "frame:" v poli na tla\u010d\u00edtku. +enterURL = -- pro URL, zadejte odkaz (nap\u0159. "http://etc") v poli na tla\u010d\u00edtku. +ToColorBackground = Pro v\u00fdb\u011br barvy pozad\u00ed: Stiskn\u011bte [{0}] +AddClockToPanel = P\u0159et\u00e1hn\u011bte ikonu n\u00ed\u017ee uvedenou pro p\u0159id\u00e1n\u00ed {0} do va\u0161eho ovl\u00e1dac\u00edho panelu. +nullMemoryIcon = se zobraz\u00ed ikona pam\u011bti zobrazen\u00ed kdy\u017e pam\u011b\u0165 je pr\u00e1zdn\u00e1. +emptyMemoryIcon = Kdy\u017e je pam\u011b\u0165 pr\u00e1zdn\u00fd \u0159et\u011bzec nap\u0159. "", potom je ikona zobrazen\u00ed pam\u011bti pr\u00e1zdn\u00e1. +emptyMemoryFix = Pokud je pr\u00e1zdn\u00e9, zadejte hodnotu do ostatn\u00edch ikon pam\u011bti pro zobrazen\u00ed a p\u0159et\u00e1hn\u011bte ji. +comboMemory2 = Pou\u017eijte m\u00edstn\u00ed nab\u00eddku [{0}] pro p\u0159id\u00e1n\u00ed nebo vymaz\u00e1n\u00ed polo\u017eek. +comboMemory1 = V\u00fdb\u011brov\u00fd seznam ikony pam\u011bti nastav\u00ed pam\u011bt v\u00fdb\u011brem polo\u017eky z v\u00fdb\u011brov\u00e9ho seznamu. +addTextAndAttrs = Zadejte text a vyberte atributy pro \u0161t\u00edtek v panelu N\u00e1hled. Potom + +# tooltips +ToolTipAddToTable = Stisknut\u00edm tla\u010d\u00edtka p\u0159id\u00e1te novou polo\u017eku do v\u00fd\u0161e uveden\u00e9 tabulky +ToolTipShowIcons = Stikn\u011bte pro zobrazen\u00ed ikon pro aktu\u00e1ln\u00ed sadu ikon +ToolTipEditIcons = Stiskn\u011bte pro zm\u011bnu ikon pro aktu\u00e1ln\u00ed sadu ikon nebo pro p\u0159id\u00e1n\u00ed a vymaz\u00e1n\u00ed sady ikon +ToolTipDragTableRow = P\u0159et\u00e1hn\u011bte \u0159\u00e1dek z tabulky abyste p\u0159idali \u0161t\u00edtek polo\u017eky do panelu +ToolTipDragSelection = P\u0159et\u00e1hnete v\u00fdb\u011br sensor\u016f z tabulky abyste p\u0159idali v\u00edcen\u00e1sobn\u00fd sn\u00edma\u010d do panelu +ToolTipDragIcon = P\u0159et\u00e1hn\u011bte ikonu z tohoto panelu abyste ji p\u0159idali do ovl\u00e1dac\u00edho panelu +ToolTipDragCatalog = P\u0159et\u00e1hn\u011bte ikonu p\u0159\u00edmo z panelu katalogu abyste ji p\u0159idali do ovl\u00e1dac\u00edho panelu +ToolTipEnterText = Zadejte text \u0161t\u00edtku a stiskn\u011bte kl\u00e1vesu Enter +ToolTipDragText = P\u0159et\u00e1hn\u011bte \u0161t\u00edtek z panelu N\u00e1hled abyste ho p\u0159idali do ovl\u00e1dac\u00edho panelu +ToolTipSetIconSensor = Vyberte \u0159\u00e1dek sn\u00edma\u010de v tabulce v po\u0159ad\u00ed v jak\u00e9m se maj\u00ed sn\u00edma\u010de aktivovat ve v\u00edcen\u00e1sobn\u00e9m sn\u00edma\u010di. +ToolTipAddFamily = Vytvo\u0159te p\u0159\u00eddavnou sadu ikon pro toto za\u0159\u00edzen\u00ed +ToolTipDeleteFamily = Vymazat tuto sadu ikon +ToolTipClearSelection = Zru\u0161it v\u00fdb\u011br \u0159\u00e1dk\u016f tabulky +ToolTipAddIcon = P\u0159idat dal\u0161\u00ed ikonu do va\u0161eho panelu ikon. Zadejte jej\u00ed n\u00e1zev. +ToolTipDeleteIcon = Vymazat ikonu z va\u0161eho panelu ikon. Vyberte ikonu kter\u00e1 m\u00e1 b\u00fdt vymaz\u00e1na. +ToolTipAddPosition = P\u0159idat dal\u0161\u00ed pozici sn\u00edma\u010de v t\u00e9to sad\u011b ikon +ToolTipDeletePosition = Vymazat posledn\u00ed pozici sn\u00edma\u010de z t\u00e9to sady ikon +ToolTipEditColor = Vybrat barvu pozad\u00ed pro panel +ToolTipCatalog = Otev\u0159ete katalog ikon a p\u0159et\u00e1hn\u011bte z n\u011bj ikony do panelu +ToolTipOccupancySensor = Zadejte n\u00e1zev sn\u00edma\u010de nebo bloku obsazen\u00ed kter\u00fd detekuje obsazenost t\u00e9to polo\u017eky koleje +ToolTipErrorSensor = Zadejte n\u00e1zev sn\u00edma\u010de kter\u00fd detekuje chybov\u00e9 podm\u00ednky pro tuto polo\u017eku koleje +ToolTipPickLists = V\u00fdb\u011brov\u00fd seznam zobrazuje tabulku s v\u00fdb\u011brem sn\u00edma\u010d\u016f nebo blok\u016f obsazen\u00ed pro detekci +ToolTipPickFromTable = Vyberte polo\u017eku z tabulky a sadu ikon pro aktualizaci panelu +ToolTipPickRowToShowIcon = Vyberte \u0159\u00e1dek z tabulky pro zobrazen\u00ed ikon pro danou polo\u017eku +ToolTipShowTrainName = Kolejov\u00fd \u00fasek by m\u011bl zobrazovat n\u00e1zev povolen\u00e9ho vlaku kdy\u017e obsazuje \u00fasek +ToolTipMissingStatus = Zp\u011bt p\u0159idat d\u0159\u00edve smazan\u00fd stav koleje +ToolTipDeleteStatus = Vymazat stav koleje kterou nepou\u017e\u00edv\u00e1te +ToolTipSelectPathIcons = Zkontrolujte cesty kterou tato ikona pot\u0159ebuje pro zobrazen\u00ed cesty. +ToolTipSetDefaultIcons = Zm\u011bnit v\u00fdchoz\u00ed ikony br\u00e1ny na vybranou skupinu ikon. + +# Decorator strings +PreviewBorderTitle = N\u00e1hled +sample = Uk\u00e1zka +fixedWidth = Pevn\u00e1 \u0161\u00ed\u0159ka +fixedHeight = Pevn\u00e1 v\u00fd\u0161ka +transparentBack = Pr\u016fhledn\u00e9 pozad\u00ed diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle_da.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle_da.properties index dd8b5252138..61e89554d07 100644 --- a/java/src/jmri/jmrit/display/palette/PaletteBundle_da.properties +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle_da.properties @@ -28,8 +28,7 @@ fromArrow = Entry Arrow OccupancySensor = Occupancy Circuit ErrorSensor = Fejl Sensor - -IconSetName = Ikon S\u00e6t Navn: +IconSetName=Ikon S\u00e6t Navn: {0} #IconName = Ikon Navn: #editText = Rediger Text LinkName = Panel ellr URL Navn @@ -42,7 +41,7 @@ HideIcons = Skjul Ikoner ButtonEditIcons = Rediger Ikoner ButtonShowCatalog = Ikon Katalog HideCatalog = Skjul Katalog -ButtonBackgroundColor = Baggrunds Farve +ButtonBackgroundColor=Baggrunds Farve... updateButton = Opdater Panel addNewFamily = Tilf\u00f8j Nyt Ikon S\u00e6t addIcon = Tilf\u00f8j Ikon diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle_de.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle_de.properties index 9a36eb9a47a..1ec00fe2a85 100644 --- a/java/src/jmri/jmrit/display/palette/PaletteBundle_de.properties +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle_de.properties @@ -28,8 +28,7 @@ fromArrow=Eintrittpfeil OccupancySensor=Besetztmelderkreis ErrorSensor=Fehlerdetektor - -IconSetName=Sinnbilderpaketname: +IconSetName=Sinnbilderpaketname: {0} #IconName=Sinnbildname: #editText=Bearbeite Text: LinkName=Name des Gleisstellbildes oder URL @@ -43,7 +42,7 @@ HideIcons=Verbirge Sinnbilder ButtonEditIcons=Sinnbilder bearbeiten ButtonShowCatalog=Sinnbilderkatalog HideCatalog=Verbirge Katalog -ButtonBackgroundColor=Hintergrundfarbe +ButtonBackgroundColor=W\u00e4hle Hintergrundfarbe... updateButton=Tafel aktualisieren addNewFamily=F\u00fcge neues Paket hinzu addIcon=F\u00fcge Sinnbild hinzu diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle_fr.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle_fr.properties index 1b3be89f743..eefddbed8b4 100644 --- a/java/src/jmri/jmrit/display/palette/PaletteBundle_fr.properties +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle_fr.properties @@ -34,8 +34,7 @@ fromArrow = Fl\u00eache d'Entr\u00e9e OccupancySensor = Circuit d'occupation ErrorSensor = Erreur Capteur - -IconSetName = D\u00e9finir Nom de l'Ic\u00f4ne: +IconSetName=D\u00e9finir Nom de l'Ic\u00f4ne: {0} #IconName = Nom Ic\u00f4ne : #editText = Modifier le Texte LinkName = Panneau ou le Nom de l'URL @@ -48,7 +47,7 @@ HideIcons = Masquer les Ic\u00f4nes ButtonEditIcons = \u00c9diter des Ic\u00f4nes ButtonShowCatalog = Catalogue d'Ic\u00f4nes HideCatalog = Cacher Catalogue -ButtonBackgroundColor = Couleur de fond +ButtonBackgroundColor=Couleur de fond... updateButton = M \u00e0 J Panneau addNewFamily = Ajouter un nouveau jeu d'Ic\u00f4ne addIcon = Ajouter Ic\u00f4ne diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle_it.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle_it.properties index f8404089d8b..be7541b72b9 100644 --- a/java/src/jmri/jmrit/display/palette/PaletteBundle_it.properties +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle_it.properties @@ -26,8 +26,7 @@ fromArrow = Freccia Ingresso OccupancySensor = Sensore Blocco Occupato ErrorSensor = Errore Sensore - -IconSetName = Nome Set Icone: +IconSetName=Nome Set Icone: {0} #IconName = Nome Icona: #editText = Modifica Testo LinkName = Pannelo o Nome URL diff --git a/java/src/jmri/jmrit/display/palette/PaletteBundle_nl.properties b/java/src/jmri/jmrit/display/palette/PaletteBundle_nl.properties index 42f9be48768..ebbde20c023 100644 --- a/java/src/jmri/jmrit/display/palette/PaletteBundle_nl.properties +++ b/java/src/jmri/jmrit/display/palette/PaletteBundle_nl.properties @@ -27,8 +27,7 @@ fromArrow = Inrijpijl OccupancySensor = Spoorstroomloop ErrorSensor = Foutterugmelder - -IconSetName = Naam Symbolenset: +IconSetName=Naam Symbolenset: {0} #IconName = Icon Name: #editText = Edit Text LinkName = Paneel of URL @@ -41,7 +40,7 @@ HideIcons = Verberg Symbolen ButtonEditIcons = Bewerk Symbolen ButtonShowCatalog = Symbolencatalogus HideCatalog = Verberg Catalogus -ButtonBackgroundColor = Achtergrondkleur +ButtonBackgroundColor=Kies Achtergrondkleur... updateButton = Werk Paneel bij addNewFamily = Voeg nieuwe Symbolenset toe addIcon = Voeg Symbool toe diff --git a/java/src/jmri/jmrit/display/palette/PortalItemPanel.java b/java/src/jmri/jmrit/display/palette/PortalItemPanel.java index c8fa2cb74d6..5029dba35aa 100644 --- a/java/src/jmri/jmrit/display/palette/PortalItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/PortalItemPanel.java @@ -21,7 +21,7 @@ public /*abstract*/ class PortalItemPanel extends FamilyItemPanel { /** - * Constructor types with multiple families and multiple icon families + * Constructor types with multiple families and multiple icon families. */ public PortalItemPanel(JmriJFrame parentFrame, String type, String family, Editor editor) { super(parentFrame, type, family, editor); @@ -31,13 +31,13 @@ public PortalItemPanel(JmriJFrame parentFrame, String type, String family, Edito * Init for creation _bottom1Panel and _bottom2Panel alternate visibility in * bottomPanel depending on whether icon families exist. They are made first * because they are referenced in initIconFamiliesPanel(). Subclasses will - * insert other panels + * insert other panels. */ @Override public void init() { if (!_initialized) { super.init(); - _supressDragging = true; + _suppressDragging = true; add(makeChangeDefaultIconsPanel()); } } @@ -65,4 +65,5 @@ private void setDefaults() { @Override protected void makeDndIconPanel(HashMap iconMap, String displayKey) { } + } diff --git a/java/src/jmri/jmrit/display/palette/RPSItemPanel.java b/java/src/jmri/jmrit/display/palette/RPSItemPanel.java index 1946474e6df..7298e68627a 100644 --- a/java/src/jmri/jmrit/display/palette/RPSItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/RPSItemPanel.java @@ -18,7 +18,7 @@ public class RPSItemPanel extends FamilyItemPanel { /** - * Constructor for plain icons and backgrounds + * Constructor for plain icons and backgrounds. */ public RPSItemPanel(JmriJFrame parentFrame, String type, String family, Editor editor) { super(parentFrame, type, family, editor); @@ -38,7 +38,7 @@ protected void makeDndIconPanel(HashMap iconMap, String displ super.makeDndIconPanel(iconMap, "active"); } - /** + /* * **************************************************** */ @Override @@ -86,4 +86,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(RPSItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/ReporterItemPanel.java b/java/src/jmri/jmrit/display/palette/ReporterItemPanel.java index 6be7918143d..4c1dc99bc63 100644 --- a/java/src/jmri/jmrit/display/palette/ReporterItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/ReporterItemPanel.java @@ -4,11 +4,16 @@ import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionListener; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.HashMap; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; +import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -20,6 +25,7 @@ import jmri.jmrit.display.ReporterIcon; import jmri.jmrit.picker.PickListModel; import jmri.util.JmriJFrame; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,19 +56,36 @@ protected JPanel instructions() { return panel; } + /** + * ReporterItemPanel displays no _iconFamilyPanel. + */ @Override protected void initIconFamiliesPanel() { - _iconFamilyPanel = new JPanel(); - _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); - if (!_update) { - _iconFamilyPanel.add(instructions()); + boolean initialize = false; + if (_iconFamilyPanel == null) { + log.debug("new _iconFamilyPanel created"); + initialize = true; + _iconFamilyPanel = new JPanel(); + _iconFamilyPanel.setOpaque(true); + _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); + if (!_update) { + _iconFamilyPanel.add(instructions()); + } } - _iconPanel = new JPanel(); - _iconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); -// _iconFamilyPanel.add(_iconPanel); makeDragIconPanel(1); makeDndIconPanel(null, null); + if (_iconPanel == null) { // keep an existing panel + _iconPanel = new ImagePanel(); // never shown, so don't bother to configure, but element must exist + //_iconPanel.setOpaque(false); + //_iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + // Bundle.getMessage("PreviewBorderTitle"))); + //_iconFamilyPanel.add(_iconPanel); // On Reporter, no icon family to choose + } + if (_backgrounds != null) { + _dragIconPanel.setImage(_backgrounds[previewBgSet]); // pick up shared setting + } else { + log.debug("ReporterItemPanel - no value for previewBgSet"); + } } @Override @@ -70,8 +93,16 @@ protected void makeBottomPanel(ActionListener doneAction) { if (doneAction != null) { addUpdateButtonToBottom(doneAction); } + updateBackgrounds(); // create array of backgrounds + initIconFamiliesPanel(); add(_iconFamilyPanel); + // add a SetBackground combo + // TODO add indirect updating of panel upon display via previewBgSet + if (bgBoxPanel == null) { + bgBoxPanel = makeBgButtonPanel(_dragIconPanel, null, _backgrounds); + add(bgBoxPanel); + } } @Override @@ -81,16 +112,16 @@ protected void makeDndIconPanel(HashMap iconMap, String displ } _reporter = new ReporterIcon(_editor); JPanel panel = new JPanel(); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); JPanel comp; try { comp = getDragger(new DataFlavor(Editor.POSITIONABLE_FLAVOR)); - comp.setBackground(_editor.getTargetPanel().getBackground()); - comp.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); } catch (java.lang.ClassNotFoundException cnfe) { cnfe.printStackTrace(); comp = new JPanel(); } + comp.setOpaque(false); + comp.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); panel.add(comp); panel.revalidate(); int width = Math.max(100, panel.getPreferredSize().width); @@ -106,7 +137,7 @@ protected JPanel makeItemButtonPanel() { } /** - * ListSelectionListener action from table + * ListSelectionListener action from table. */ @Override public void valueChanged(ListSelectionEvent e) { @@ -114,9 +145,7 @@ public void valueChanged(ListSelectionEvent e) { return; } int row = _table.getSelectedRow(); - if (log.isDebugEnabled()) { - log.debug("Table valueChanged: row= " + row); - } + log.debug("Table valueChanged: row = {}", row); if (row >= 0) { if (_updateButton != null) { _updateButton.setEnabled(true); @@ -144,9 +173,10 @@ protected void setEditor(Editor ed) { _family = null; super.setEditor(ed); if (_initialized) { - remove(_iconFamilyPanel); + _dragIconPanel.removeAll(); + _iconPanel.removeAll(); initIconFamiliesPanel(); - add(_iconFamilyPanel, 1); + //add(_iconFamilyPanel, 1); validate(); } } @@ -172,7 +202,6 @@ protected boolean okToDrag() { return true; } - @Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (!isDataFlavorSupported(flavor)) { @@ -200,4 +229,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(ReporterItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/SignalHeadItemPanel.java b/java/src/jmri/jmrit/display/palette/SignalHeadItemPanel.java index eaa9989d1c1..8b28c651ac9 100644 --- a/java/src/jmri/jmrit/display/palette/SignalHeadItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/SignalHeadItemPanel.java @@ -26,10 +26,11 @@ import jmri.jmrit.display.SignalHeadIcon; import jmri.jmrit.picker.PickListModel; import jmri.util.JmriJFrame; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SignalHeadItemPanel extends TableItemPanel {//implements ListSelectionListener { +public class SignalHeadItemPanel extends TableItemPanel { //implements ListSelectionListener { public SignalHeadItemPanel(JmriJFrame parentFrame, String type, String family, PickListModel model, Editor editor) { super(parentFrame, type, family, model, editor); @@ -69,14 +70,18 @@ protected void makeDndIconPanel(HashMap iconMap, String displ @Override protected void showIcons() { - _iconFamilyPanel.remove(_iconPanel); - _iconPanel = new JPanel(); - _iconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - _iconFamilyPanel.add(_iconPanel, 0); + if (_iconPanel == null) { // create a new one + _iconPanel = new ImagePanel(); + _iconPanel.setOpaque(false); + _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + _iconFamilyPanel.add(_iconPanel, 0); + } else { + _iconPanel.removeAll(); // clear old icons + } addIconsToPanel(_currentIconMap); _iconPanel.setVisible(true); - if (!_update) { + if (!_update && _dragIconPanel != null) { // prevent NPE _dragIconPanel.setVisible(false); } _showIconsButton.setText(Bundle.getMessage("HideIcons")); @@ -87,7 +92,7 @@ protected void addIconsToPanel(HashMap allIconsMap) { HashMap iconMap = getFilteredIconMap(allIconsMap); if (iconMap == null) { iconMap = ItemPalette.getIconMap(_itemType, _family); - if (iconMap == null) { + if (iconMap == null) { // none found _updateButton.setEnabled(false); _updateButton.setToolTipText(Bundle.getMessage("ToolTipPickFromTable")); } @@ -97,7 +102,7 @@ protected void addIconsToPanel(HashMap allIconsMap) { } /** - * ListSelectionListener action + * ListSelectionListener action. */ @Override public void valueChanged(ListSelectionEvent e) { @@ -106,7 +111,7 @@ public void valueChanged(ListSelectionEvent e) { } int row = _table.getSelectedRow(); if (log.isDebugEnabled()) { - log.debug("Table valueChanged: row= " + row); + log.debug("Table valueChanged: row= {}", row); } if (row >= 0) { _updateButton.setEnabled(true); @@ -121,7 +126,6 @@ public void valueChanged(ListSelectionEvent e) { if (_iconPanel.isVisible()) { showIcons(); } - // hideIcons(); } protected HashMap getFilteredIconMap(HashMap allIconsMap) { @@ -228,4 +232,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(SignalHeadItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/SignalMastItemPanel.java b/java/src/jmri/jmrit/display/palette/SignalMastItemPanel.java index 12d208c8e7b..e5dec6f7d72 100644 --- a/java/src/jmri/jmrit/display/palette/SignalMastItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/SignalMastItemPanel.java @@ -6,6 +6,7 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; @@ -14,6 +15,7 @@ import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -29,9 +31,16 @@ import jmri.jmrit.display.SignalMastIcon; import jmri.jmrit.picker.PickListModel; import jmri.util.JmriJFrame; +import jmri.util.swing.ImagePanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * TableItemPanel extension for placing of SignalMast items with a fixed set of icons. + * + * @author Pete Cressman Copyright (c) 2010, 2011 + * @author Egbert Broerse 2017 + */ public class SignalMastItemPanel extends TableItemPanel implements ListSelectionListener { SignalMast _mast; @@ -47,9 +56,8 @@ public void init() { _table.getSelectionModel().addListSelectionListener(this); _showIconsButton.setEnabled(false); _showIconsButton.setToolTipText(Bundle.getMessage("ToolTipPickRowToShowIcon")); -// makeDragIconPanel(); initIconFamiliesPanel(); - add(_iconFamilyPanel, 1); + add(_iconFamilyPanel, 1); } } @@ -69,31 +77,43 @@ protected JPanel instructions() { @Override protected void initIconFamiliesPanel() { - _iconFamilyPanel = new JPanel(); - _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); - if (!_update) { + boolean initialize = false; + if (_iconFamilyPanel == null) { + log.debug("new _iconFamilyPanel created"); + initialize = true; + _iconFamilyPanel = new JPanel(); + _iconFamilyPanel.setLayout(new BoxLayout(_iconFamilyPanel, BoxLayout.Y_AXIS)); + _iconFamilyPanel.setOpaque(true); _iconFamilyPanel.add(instructions()); } if (_table != null) { int row = _table.getSelectedRow(); - getIconMap(row); // sets _currentIconMap & _mast, if they exist. + getIconMap(row); // sets _currentIconMap + _mast, if they exist. } makeDragIconPanel(1); makeDndIconPanel(null, null); - _iconPanel = new JPanel(); - _iconPanel.setBackground(_editor.getTargetPanel().getBackground()); - _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1),Bundle.getMessage("PreviewBorderTitle"))); - addIconsToPanel(_currentIconMap); - _iconFamilyPanel.add(_dragIconPanel); - JPanel panel = new JPanel(); - if (_mast != null) { - panel.add(new JLabel(Bundle.getMessage("IconSetName") + " " - + _mast.getSignalSystem().getSystemName())); + if (_iconPanel == null) { // keep an existing panel + _iconPanel = new ImagePanel(); + _iconPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), + Bundle.getMessage("PreviewBorderTitle"))); + } + if (_backgrounds != null) { + _iconPanel.setImage(_backgrounds[previewBgSet]); // pick up shared setting } else { - panel.add(new JLabel(Bundle.getMessage("PickRowMast"))); + log.debug("SignalMastItemPanel - no value for previewBgSet"); + } + addIconsToPanel(_currentIconMap); + + if (initialize) { + JPanel panel = new JPanel(); + if (_mast != null) { + panel.add(new JLabel(Bundle.getMessage("IconSetName", _mast.getSignalSystem().getSystemName()))); + } else { + panel.add(new JLabel(Bundle.getMessage("PickRowMast"))); + } + _iconFamilyPanel.add(panel); + _iconFamilyPanel.add(_iconPanel); } - _iconFamilyPanel.add(panel); - _iconFamilyPanel.add(_iconPanel); _iconPanel.setVisible(false); hideIcons(); } @@ -107,14 +127,14 @@ protected void makeDndIconPanel(HashMap iconMap, String displ NamedIcon icon = getDragIcon(); JPanel panel = new JPanel(); - panel.setBackground(_editor.getTargetPanel().getBackground()); + panel.setOpaque(false); String borderName = ItemPalette.convertText("dragToPanel"); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), borderName)); JLabel label; try { label = getDragger(new DataFlavor(Editor.POSITIONABLE_FLAVOR), icon); - label.setBackground(_editor.getTargetPanel().getBackground()); + label.setOpaque(false); label.setToolTipText(Bundle.getMessage("ToolTipDragIcon")); } catch (java.lang.ClassNotFoundException cnfe) { cnfe.printStackTrace(); @@ -149,7 +169,9 @@ public void actionPerformed(ActionEvent a) { if (doneAction != null) { addUpdateButtonToBottom(doneAction); } - initIconFamiliesPanel(); + initIconFamiliesPanel(); // (if null: creates and) adds a new _iconFamilyPanel for the new mast map + updateBackgrounds(); // create array of backgrounds + _bottom1Panel.add(makeBgButtonPanel(_dragIconPanel, _iconPanel, _backgrounds)); add(_bottom1Panel); } @@ -162,9 +184,7 @@ private void getIconMap(int row) { NamedBean bean = _model.getBeanAt(row); if (bean == null) { - if (log.isDebugEnabled()) { - log.debug("getIconMap: NamedBean is null at row " + row); - } + log.debug("getIconMap: NamedBean is null at row {}", row); _mast = null; _currentIconMap = null; _family = null; @@ -174,7 +194,7 @@ private void getIconMap(int row) { try { _mast = InstanceManager.getDefault(jmri.SignalMastManager.class).provideSignalMast(bean.getDisplayName()); } catch (IllegalArgumentException ex) { - log.error("getIconMap: No SignalMast called " + bean.getDisplayName()); + log.error("getIconMap: No SignalMast called {}", bean.getDisplayName()); _currentIconMap = null; return; } @@ -194,8 +214,7 @@ private void getIconMap(int row) { } } if (log.isDebugEnabled()) { - log.debug("getIconMap: for " + _family - + " size= " + _currentIconMap.size()); + log.debug("getIconMap for {} size= {}", _family, _currentIconMap.size()); } } @@ -218,12 +237,12 @@ protected void setEditor(Editor ed) { _editor = ed; if (_initialized) { makeDragIconPanel(0); - makeDndIconPanel(_currentIconMap, ""); // empty key OK, this uses getDragIcon() + makeDndIconPanel(_currentIconMap, ""); // empty key OK, this uses getDragIcon() } } /** - * ListSelectionListener action + * ListSelectionListener action. */ @Override public void valueChanged(ListSelectionEvent e) { @@ -231,10 +250,9 @@ public void valueChanged(ListSelectionEvent e) { return; } int row = _table.getSelectedRow(); - if (log.isDebugEnabled()) { - log.debug("Table valueChanged: row= " + row); - } - remove(_iconFamilyPanel); + log.debug("Table valueChanged: row= {}", row); + // update the family icons + _iconPanel.removeAll(); if (row >= 0) { if (_updateButton != null) { _updateButton.setEnabled(true); @@ -251,8 +269,7 @@ public void valueChanged(ListSelectionEvent e) { _showIconsButton.setEnabled(false); _showIconsButton.setToolTipText(Bundle.getMessage("ToolTipPickRowToShowIcon")); } - initIconFamiliesPanel(); - add(_iconFamilyPanel, 1); + initIconFamiliesPanel(); // (if null: creates and) adds a new _iconFamilyPanel for the new mast map validate(); } @@ -297,11 +314,12 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti sb.append(" icons for \""); sb.append(bean.getDisplayName()); sb.append("\""); - return sb.toString(); + return sb.toString(); } return null; } } private final static Logger log = LoggerFactory.getLogger(SignalMastItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/TableItemPanel.java b/java/src/jmri/jmrit/display/palette/TableItemPanel.java index 03c536a3b9a..a0010f4e314 100644 --- a/java/src/jmri/jmrit/display/palette/TableItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/TableItemPanel.java @@ -5,6 +5,7 @@ import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; @@ -28,15 +29,16 @@ import jmri.jmrit.display.SensorIcon; import jmri.jmrit.display.TurnoutIcon; import jmri.jmrit.picker.PickListModel; +import jmri.util.swing.ImagePanel; import jmri.util.JmriJFrame; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * ItemPanel for the various item types that come from tool Tables - e.g. - * Sensors, Turnouts, etc. + * FamilyItemPanel extension for placing of CPE item types that come from tool Tables + * - e.g. Turnouts, Sensors, Lights, Signal Heads, etc. * -* @author Pete Cressman Copyright (c) 2010, 2011 + * @author Pete Cressman Copyright (c) 2010, 2011 */ public class TableItemPanel extends FamilyItemPanel implements ListSelectionListener { @@ -53,13 +55,13 @@ public class TableItemPanel extends FamilyItemPanel implements ListSelectionList /** * Constructor for all table types. When item is a bean, the itemType is the - * name key for the item in jmri.NamedBeanBundle.properties - * @param parentFrame parentFrame - * @param type type - * @param family family - * @param model model - * @param editor editor - * + * name key for the item in jmri.NamedBeanBundle.properties. + * + * @param parentFrame the enclosing parentFrame + * @param type item type + * @param family icon family + * @param model list model + * @param editor associated Panel editor */ public TableItemPanel(JmriJFrame parentFrame, String type, String family, PickListModel model, Editor editor) { super(parentFrame, type, family, editor); @@ -67,20 +69,20 @@ public TableItemPanel(JmriJFrame parentFrame, String type, String family, PickLi } /** - * Init for creation insert table + * Init for creation insert table. */ @Override public void init() { if (!_initialized) { super.init(); - add(initTablePanel(_model, _editor), 0); // top of Panel + add(initTablePanel(_model, _editor), 0); // top of Panel _buttonPosition = 1; } } /** * Init for update of existing indicator turnout _bottom3Panel has "Update - * Panel" button put into _bottom1Panel + * Panel" button put into _bottom1Panel. */ @Override public void init(ActionListener doneAction, HashMap iconMap) { @@ -90,7 +92,7 @@ public void init(ActionListener doneAction, HashMap iconMap) } /** - * top Panel + * Top Panel. */ protected JPanel initTablePanel(PickListModel model, Editor editor) { _table = model.makePickTable(); @@ -174,7 +176,7 @@ protected void addToTable() { if (bean != null) { int setRow = _model.getIndexOf(bean); if (log.isDebugEnabled()) { - log.debug("addToTable: row= " + setRow + ", bean= " + bean.getDisplayName()); + log.debug("addToTable: row = {}, bean = {}", setRow, bean.getDisplayName()); } _table.setRowSelectionInterval(setRow, setRow); _scrollPane.getVerticalScrollBar().setValue(setRow * ROW_HEIGHT); @@ -192,9 +194,10 @@ protected void addToTable() { /** * Used by Panel Editor to make the final installation of the icon(s) into * the user's Panel. - *

                - * Note! the selection is cleared. When two successive calls are made, the + *

                + * Note: the selection is cleared. When two successive calls are made, the * 2nd will always return null, regardless of the 1st return. + * * @return bean selected in the table */ public NamedBean getTableSelection() { @@ -204,11 +207,11 @@ public NamedBean getTableSelection() { NamedBean b = _model.getBeanAt(row); _table.clearSelection(); if (log.isDebugEnabled()) { - log.debug("getTableSelection: row= " + row + ", bean= " + (b==null?b:b.getDisplayName())); + log.debug("getTableSelection: row = {}, bean = {}", row, (b == null ? "null" : b.getDisplayName())); } return b; } else if (log.isDebugEnabled()) { - log.debug("getTableSelection: row= " + row); + log.debug("getTableSelection: row = {}", row); } return null; } @@ -216,7 +219,7 @@ public NamedBean getTableSelection() { public void setSelection(NamedBean bean) { int row = _model.getIndexOf(bean); row = _table.convertRowIndexToView(row); - log.debug("setSelection: NamedBean= " + bean + ", row= " + row); + log.debug("setSelection: NamedBean = {}, row = {}", bean, row); if (row >= 0) { _table.addRowSelectionInterval(row, row); _scrollPane.getVerticalScrollBar().setValue(row * ROW_HEIGHT); @@ -226,7 +229,7 @@ public void setSelection(NamedBean bean) { } /** - * ListSelectionListener action + * ListSelectionListener action. */ @Override public void valueChanged(ListSelectionEvent e) { @@ -234,9 +237,7 @@ public void valueChanged(ListSelectionEvent e) { return; } int row = _table.getSelectedRow(); - if (log.isDebugEnabled()) { - log.debug("Table valueChanged: row= " + row); - } + log.debug("Table valueChanged: row = {}", row); if (row >= 0) { _updateButton.setEnabled(true); _updateButton.setToolTipText(null); @@ -253,9 +254,7 @@ protected NamedBean getDeviceNamedBean() { return null; } int row = _table.getSelectedRow(); - if (log.isDebugEnabled()) { - log.debug("getDeviceNamedBean: from table \"" + _itemType + "\" at row " + row); - } + log.debug("getDeviceNamedBean: from table \"{}\" at row {}", _itemType, row); if (row < 0) { return null; } @@ -343,4 +342,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(TableItemPanel.class); + } diff --git a/java/src/jmri/jmrit/display/palette/TextItemPanel.java b/java/src/jmri/jmrit/display/palette/TextItemPanel.java index 36feb9d9301..6f05f064e17 100644 --- a/java/src/jmri/jmrit/display/palette/TextItemPanel.java +++ b/java/src/jmri/jmrit/display/palette/TextItemPanel.java @@ -24,11 +24,10 @@ import org.slf4j.LoggerFactory; /** - * ItemPanel for text labels + * ItemPanel for text labels. */ public class TextItemPanel extends ItemPanel /*implements ActionListener */ { - // JTextField _text; DecoratorPanel _decorator; public TextItemPanel(ItemPalette parentFrame, String type, Editor editor) { @@ -61,12 +60,14 @@ public void init() { private void makeDecoratorPanel() { if (_decorator != null) { - remove(_decorator); + _decorator.removeAll(); + _decorator.updateSamples(); + } else { + DragDecoratorLabel sample = new DragDecoratorLabel(Bundle.getMessage("sample"), _editor); + _decorator = new DecoratorPanel(_editor, null); + _decorator.initDecoratorPanel(sample); + add(_decorator, 1); } - DragDecoratorLabel sample = new DragDecoratorLabel(Bundle.getMessage("sample"), _editor); - _decorator = new DecoratorPanel(_editor, null); - _decorator.initDecoratorPanel(sample); - add(_decorator, 1); } @Override @@ -78,7 +79,7 @@ protected void setEditor(Editor ed) { } /** - * Export a Positionable item from panel + * Export a Positionable item from panel. */ class DragDecoratorLabel extends PositionableLabel implements DragGestureListener, DragSourceListener, Transferable { @@ -171,4 +172,5 @@ public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorExcepti } private final static Logger log = LoggerFactory.getLogger(TextItemPanel.class); + } diff --git a/java/src/jmri/jmrit/signalling/AddEntryExitPairAction.java b/java/src/jmri/jmrit/entryexit/AddEntryExitPairAction.java similarity index 96% rename from java/src/jmri/jmrit/signalling/AddEntryExitPairAction.java rename to java/src/jmri/jmrit/entryexit/AddEntryExitPairAction.java index 0975bca7acb..43226093495 100644 --- a/java/src/jmri/jmrit/signalling/AddEntryExitPairAction.java +++ b/java/src/jmri/jmrit/entryexit/AddEntryExitPairAction.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; diff --git a/java/src/jmri/jmrit/signalling/AddEntryExitPairFrame.java b/java/src/jmri/jmrit/entryexit/AddEntryExitPairFrame.java similarity index 93% rename from java/src/jmri/jmrit/signalling/AddEntryExitPairFrame.java rename to java/src/jmri/jmrit/entryexit/AddEntryExitPairFrame.java index c325582ec52..05bd7c17e22 100644 --- a/java/src/jmri/jmrit/signalling/AddEntryExitPairFrame.java +++ b/java/src/jmri/jmrit/entryexit/AddEntryExitPairFrame.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -52,7 +52,7 @@ public void actionPerformed(ActionEvent event) { }); setJMenuBar(menuBar); - addHelpMenu("package.jmri.jmrit.signalling.EntryExitFrame", true); // NOI18N + addHelpMenu("package.jmri.jmrit.entryexit.EntryExitFrame", true); // NOI18N // pack for display pack(); } diff --git a/java/src/jmri/jmrit/signalling/AddEntryExitPairPanel.java b/java/src/jmri/jmrit/entryexit/AddEntryExitPairPanel.java similarity index 99% rename from java/src/jmri/jmrit/signalling/AddEntryExitPairPanel.java rename to java/src/jmri/jmrit/entryexit/AddEntryExitPairPanel.java index aa576080152..5c773e6b0e6 100644 --- a/java/src/jmri/jmrit/signalling/AddEntryExitPairPanel.java +++ b/java/src/jmri/jmrit/entryexit/AddEntryExitPairPanel.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.Color; import java.awt.Container; @@ -53,7 +53,7 @@ public class AddEntryExitPairPanel extends jmri.util.swing.JmriPanel { List panels; - EntryExitPairs nxPairs = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + EntryExitPairs nxPairs = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class); // signalling.EntryExitBundle via Bundle method diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle.java b/java/src/jmri/jmrit/entryexit/Bundle.java similarity index 93% rename from java/src/jmri/jmrit/signalling/entryexit/Bundle.java rename to java/src/jmri/jmrit/entryexit/Bundle.java index 9e2bf1b9361..1839bef70d4 100644 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle.java +++ b/java/src/jmri/jmrit/entryexit/Bundle.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Locale; @@ -21,10 +21,10 @@ * @author Bob Jacobsen Copyright (C) 2012 * @since 3.3.1 */ -public class Bundle extends jmri.jmrit.signalling.Bundle { +public class Bundle extends jmri.jmrit.Bundle { @Nullable - private static final String name = "jmri.jmrit.signalling.entryexit.Bundle"; // NOI18N + private static final String name = "jmri.jmrit.entryexit.EntryExitBundle"; // NOI18N // // below here is boilerplate to be copied exactly diff --git a/java/src/jmri/jmrit/signalling/entryexit/DestinationPoints.java b/java/src/jmri/jmrit/entryexit/DestinationPoints.java similarity index 99% rename from java/src/jmri/jmrit/signalling/entryexit/DestinationPoints.java rename to java/src/jmri/jmrit/entryexit/DestinationPoints.java index af91e3b6a46..84b9fa7c1e9 100644 --- a/java/src/jmri/jmrit/signalling/entryexit/DestinationPoints.java +++ b/java/src/jmri/jmrit/entryexit/DestinationPoints.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.awt.BorderLayout; @@ -26,7 +26,6 @@ import jmri.jmrit.display.layoutEditor.LayoutBlockConnectivityTools; import jmri.jmrit.display.layoutEditor.LayoutSlip; import jmri.jmrit.display.layoutEditor.LayoutTurnout; -import jmri.jmrit.signalling.EntryExitPairs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +45,7 @@ public String getBeanType() { LayoutBlock destination; boolean disposed = false; - transient EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + transient EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class); transient jmri.SignalMastLogic sml; diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle.properties new file mode 100644 index 00000000000..9d54d27c432 --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle.properties @@ -0,0 +1,63 @@ +# EntryExitBundle.properties +# +# Default properties for the jmri.jmrit.entryexit + +WindowTitleStackRoutes = Stacked Routes + +MenuEntryExit = Entry Exit +MenuItemClearRoute = Clear Route +MenuItemCancelRoute = Cancel Route +MenuItemLockManualRoute = Lock Manual Route + +BeanNameDestination = NX Destination Point +StackRouteAsk = Would you like to Stack the Route? +RouteNotClear = Route Not Clear +Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. + +Stack = Stack +ClearDown = Clear Down +Exit = Exit +InterlockPrompt = What would you like to do with this interlock? +Interlock = Interlock + +EnableLayoutBlockRouting = Layout Block Routing is not enabled.\n Do you want to enable it? +LayoutBlockRoutingEnabled = Layout Block Routing has been enabled.\n Please close and reopen this window for the changes to take effect. + +SelectPanel = Select Panel + +FromLocation = Entry Point +ToLocation = Exit Point +AddPair = Add Pair +AddEntryExitPoints = Add Entry Exit Points +AutoGenerate = Auto Generate Entry-Exit Pairs +AutoGenEntryExitTitle = Auto Generate Entry Exit Pairs +AutoGenEntryExitMessage = Do you want to automatically generate \nthe Entry Exit Pairs and Logic, based \nupon the track plan in the layout editor? + +SettingDuration = Duration of setting Colour (ms) +ValueBeNumber = Duration of setting colour should be a number! +RouteSetColour = Initial colour of path while route is Setup +OptionsTitle = Entry Exit Options +Reselection = Route Reselection Option +ReselectionTip = Set the action for when the NX buttons are reselected + +EndBumperPoint = Destination location is at an End Bumper; it is not possible to do "Both Way NX" at this location + +SetTurnoutsOnly = Set Turnouts Only +SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts +FullInterlock = Full Interlock +NXType = NX Type +DiscoverEntryExitPairs = Discover Entry Exit Pairs +DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... +AutoGenComplete = Generation of Entry Exit Pairs Completed + +BothWayTurnoutOnly = Both Way Operation can not be used if a Signal is present at both Entry and Exit points + +ColumnFrom = Entry +ColumnTo = Exit +ColumnBoth = Both Way +DispatcherInt = Integrate with Dispatcher + +PromptUser = Prompt User +ClearRoute = Clear Route +CancelRoute = Cancel Route +StackRoute = Stack Route diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle_ca.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle_ca.properties new file mode 100644 index 00000000000..19026154370 --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle_ca.properties @@ -0,0 +1,64 @@ +# EntryExitBundle_ca.properties +# +# Catalan properties for the jmri.jmrit.entryexit +# Catalan Translation: Joan de Castro (joan276dca@yahoo.es) 18/08/2016 + +WindowTitleStackRoutes = Itineraris blocats + +MenuEntryExit = Entrada Sortida +MenuItemClearRoute = Neteja itinerari +MenuItemCancelRoute = Cancel\u00b7la Itinerari +MenuItemLockManualRoute = Bloqueja Itinerari Manual + +BeanNameDestination = Punt de destinaci\u00f3 NX +StackRouteAsk = Would you like to Stack the Route? +RouteNotClear = Route Not Clear +Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. + +Stack = Stack +ClearDown = Clear Down +Exit = Exit +InterlockPrompt = What would you like to do with this interlock? +Interlock = Interlock + +EnableLayoutBlockRouting = Blocs d'itinerari desactivats a la maqueta\n Els vols activar? +LayoutBlockRoutingEnabled = Blocs d'itinerari activats a la maqueta.\n Siusplau, tanca i torna a obrir aquesta finestra per a activar els canvis. + +SelectPanel = Selecciona Panell + +FromLocation = Punt d'entrada +ToLocation = Punt de sortida +AddPair = Afegir parell +AddEntryExitPoints = Add Entry Exit Points +AutoGenerate = Auto-generaci\u00f3 Parelles d'Entrada-Sortida +AutoGenEntryExitTitle = Auto-generaci\u00f3 Parelles d'Entrada-Sortida +AutoGenEntryExitMessage = Vols generar autom\u00e0ticament \nEls parells d'entrada sortida i la l\u00f2gica, basada \nen el pla de vies de la maqueta? + +SettingDuration = Durada d'ajust de color (ms) +ValueBeNumber = La durada de la configuraci\u00f3 del color ha de ser un nombre! +RouteSetColour = Color inicial de la ruta durant un itinerari V\u00e0lid +OptionsTitle = Opcions d'Entrada Sortida +Reselection = Opcions de selecci\u00f3 d'Itinerari +ReselectionTip = Set the action for when the NX buttons are reselected + +EndBumperPoint = Ubicaci\u00f3 de destinaci\u00f3 es troba en una topera, no \u00e9s possible fer els "dos sentits" de la marxa + +SetTurnoutsOnly = Set Turnouts Only +SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts +FullInterlock = Full Interlock +NXType = NX Type +DiscoverEntryExitPairs = Discover Entry Exit Pairs +DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... +AutoGenComplete = Generation of Entry Exit Pairs Completed + +BothWayTurnoutOnly = No es poden usar dues direccions si hi ha un Senyal a l'entrada i a la sortida + +ColumnFrom = Entrada +ColumnTo = Sortida +ColumnBoth = Ambdues direccions +DispatcherInt = Integra amb Dispatcher + +PromptUser = Prompt User +ClearRoute = Clear Route +CancelRoute = Cancel Route +StackRoute = Stack Route diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle_da.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle_da.properties new file mode 100644 index 00000000000..efee4268030 --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle_da.properties @@ -0,0 +1,64 @@ +# EntryExitBundle_da.properties +# +# Danish properties for the jmri.jmrit.entryexit +# Translation by Sonny Hansen + +WindowTitleStackRoutes = Stacked Routes + +MenuEntryExit = Entry Exit +MenuItemClearRoute = Clear Route +MenuItemCancelRoute = Cancel Route +MenuItemLockManualRoute = Lock Manual Route + +BeanNameDestination = NX Destination Point +StackRouteAsk = Would you like to Stack the Route? +RouteNotClear = Route Not Clear +Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. + +Stack = Stack +ClearDown = Clear Down +Exit = Exit +InterlockPrompt = What would you like to do with this interlock? +Interlock = Interlock + +EnableLayoutBlockRouting = Layout Block Routing is not enabled.\n Do you want to enable it? +LayoutBlockRoutingEnabled = Layout Block Routing has been enabled.\n Please close and reopen this window for the changes to take effect. + +SelectPanel = V\u00e6lg Panel + +FromLocation = Entry Point +ToLocation = Exit Point +AddPair = Add Pair +AddEntryExitPoints = Add Entry Exit Points +AutoGenerate = Auto Generate Entry-Exit Pairs +AutoGenEntryExitTitle = Auto Generate Entry Exit Pairs +AutoGenEntryExitMessage = Do you want to automatically generate \nthe Entry Exit Pairs and Logic, based \nupon the track plan in the layout editor? + +SettingDuration = Duration of setting Colour (ms) +ValueBeNumber = Duration of setting colour should be a number! +RouteSetColour = Initial colour of path while route is Setup +OptionsTitle = Entry Exit Options +Reselection = Route Reselection Option +ReselectionTip = Set the action for when the NX buttons are reselected + +EndBumperPoint = Destination location is at an End Bumper; it is not possible to do "Both Way NX" at this location + +SetTurnoutsOnly = Set Turnouts Only +SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts +FullInterlock = Full Interlock +NXType = NX Type +DiscoverEntryExitPairs = Discover Entry Exit Pairs +DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... +AutoGenComplete = Generation of Entry Exit Pairs Completed + +BothWayTurnoutOnly = Both Way Operation can not be used if a Signal is present at both Entry and Exit points + +ColumnFrom = Entry +ColumnTo = Exit +ColumnBoth = Both Way +DispatcherInt = Integrate with Dispatcher + +PromptUser = Prompt User +ClearRoute = Clear Route +CancelRoute = Cancel Route +StackRoute = Stack Route diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle_de.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle_de.properties new file mode 100644 index 00000000000..38530028906 --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle_de.properties @@ -0,0 +1,64 @@ +# EntryExitBundle_de.properties +# +# German properties for the jmri.jmrit.entryexit +# Translation by Egbert Broerse + +WindowTitleStackRoutes=Aufgestapelte Fahrstra\u00dfe + +MenuEntryExit = Entry Exit +MenuItemClearRoute=Gebe Fahrstra\u00dfe frei +MenuItemCancelRoute=Annuliere Fahrstra\u00dfe +MenuItemLockManualRoute=Verriegle handm\u00e4\u00dfige Fahrstra\u00dfe + +BeanNameDestination=NX Zielpunkt +StackRouteAsk = Willst du die Fahrstra\u00dfe aufstapeln? +RouteNotClear = Fahrstra\u00dfe nicht Frei +Error1 = Keine Auswahl in der Liste.\nMache auswahl und klicke {0} oder lass aufgestapelt. + +Stack = Aufstapeln +ClearDown = Ab hier freigeben +Exit = Verlasse +InterlockPrompt = Was soll mit dieser Verrieglung geschehen? +Interlock = Fahrstra\u00dfenverrieglung + +EnableLayoutBlockRouting = Anlageblockrouting ist nicht aktiviert\nJetzt einschalten? +LayoutBlockRoutingEnabled = Anlageblockrouting ist aktiviert.\n Bitte dieses Fenster schlie\u00dfen und wieder \u00f6ffnen um die \u00c4nderungen durch zu f\u00fchren. + +SelectPanel = W\u00e4hle Tafel + +FromLocation = Eintrittspunkt +ToLocation = Ausgangspunkt +AddPair = F\u00fcge Paar hinzu +AddEntryExitPoints = F\u00fcge Eintritts-/Ausgangspunkte hinzu +AutoGenerate = Eintritts-/Ausgangspunkte automatisch erstellen +AutoGenEntryExitTitle = Autom. Eintritts-/Ausgangspunkte +AutoGenEntryExitMessage = Willst du die Eintritts-/Ausgangspunkte und Logik automatisch erstellen, basiert auf\ndein Gleisplan in Anlagaeditor? + +SettingDuration = Dauer der Farbe\u00fcbergang (ms) +ValueBeNumber = Dauer der Farbe\u00fcbergang soll ein Zahl sein! +RouteSetColour = Initieller Farbe eines Pfades w\u00e4hrend Routeneingabe +OptionsTitle = Eintritts-/Ausgangsoptionen +Reselection = Routenwiederauswahl Option +ReselectionTip = Definiere was geschehen soll wenn die NX Kn\u00f6pfe wieder ausgew\u00e4hlt werden. + +EndBumperPoint = Zielpunkt ist an einem Prellblock; an dieser Stelle kan man keine "Zweiweg NX" erstellen. + +SetTurnoutsOnly = Nur Weichen stellen +SetTurnoutsAndSignalMasts = Weichen und Signalmasten stellen +FullInterlock = Fahrsta\u00dfenverrieglung +NXType = NX Typ +DiscoverEntryExitPairs = Suche Eintritts-/Ausgangspunkte +DiscoveringEntryExitPairs = Eintritts-/Ausgangspunkte suchen... +AutoGenComplete = Autom. Eintritts-/Ausgangspunkte fertig + +BothWayTurnoutOnly = Zweiweg NX nicht m\u00f6glich wenn sowohl am Abfahrt- als am Zielpunkt ein Signal steht. + +ColumnFrom = Eingang +ColumnTo = Ausfahrt +ColumnBoth = Zweiweg +DispatcherInt = Zusammenarbeit mit Leitstelle + +PromptUser = Frage mich +ClearRoute = Strecke freigeben +CancelRoute = Strecke abbrechen +StackRoute = Strecke aufstapeln diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle_fr.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle_fr.properties new file mode 100644 index 00000000000..8dff7ebaa1f --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle_fr.properties @@ -0,0 +1,64 @@ +# EntryExitBundle_fr.properties +# +# French properties for the jmri.jmrit.entryexit +# Updated by BLOREC Herv\u00e9 2016-06-07 + +WindowTitleStackRoutes = Itin\u00e9raire Superpos\u00e9s + +MenuEntryExit = Entr\u00e9e Sortie +MenuItemClearRoute = Nettoyer Itin\u00e9raire +MenuItemCancelRoute = Cancel Route +MenuItemLockManualRoute = Verrouillage Manuel de l'Itin\u00e9raire + +BeanNameDestination = Point de Destination NX +StackRouteAsk = Would you like to Stack the Route? +RouteNotClear = Route Not Clear +Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. + +Stack = Stack +ClearDown = Clear Down +Exit = Exit +InterlockPrompt = What would you like to do with this interlock? +Interlock = Interlock + +EnableLayoutBlockRouting = Le Dispositif de routage de Canton du R\u00e9seau n'est pas activ\u00e9.\nVoulez-vous l'activer? +LayoutBlockRoutingEnabled = Le dispositif de routage de Canton du R\u00e9seau a \u00e9t\u00e9 activ\u00e9.\nVeuillez fermer et r\u00e9ouvrir cette fen\u00eatre pour que les modifications prennent effet. + +SelectPanel = S\u00e9lectionnez le Panneau + +FromLocation = Point d'Entr\u00e9e +ToLocation = Point de Sortie +AddPair = Ajoutez une Paire +AddEntryExitPoints = Add Entry Exit Points +AutoGenerate = G\u00e9n\u00e9ration Automatique des Paires Entr\u00e9e Sortie +AutoGenEntryExitTitle = G\u00e9n\u00e9ration Automatique des Paires Entr\u00e9e Sortie +AutoGenEntryExitMessage = Voulez-vous g\u00e9n\u00e9rerautomatiquement \nles Paires d'Entr\u00e9e Sortie et la Logique bas\u00e9e \nsur le plan de voiedans l'\u00e9diteur de r\u00e9seau? + +SettingDuration = Dur\u00e9e de la mise en couleur (ms) +ValueBeNumber = La dur\u00e9e de la mise en couleur doit \u00eatre un nombre! +RouteSetColour = Couleur initiale du chemin tandis que l'itin\u00e9raire est install\u00e9 +OptionsTitle = Options Entr\u00e9e Sortie +Reselection = Option Nouvelle s\u00e9lection Itin\u00e9raire +ReselectionTip = Set the action for when the NX buttons are reselected + +EndBumperPoint = L'empacement de destination est un Heurtoir, il n'est pas possible de faire les "Deux Chemins NX" \u00e0 cet endroit + +SetTurnoutsOnly = Set Turnouts Only +SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts +FullInterlock = Full Interlock +NXType = NX Type +DiscoverEntryExitPairs = Discover Entry Exit Pairs +DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... +AutoGenComplete = Generation of Entry Exit Pairs Completed + +BothWayTurnoutOnly = Les Op\u00e9ration Bidirectionnelles ne peuvent pas \u00eatre utilis\u00e9es si un Signal est pr\u00e9sent \u00e0 la fois aux points d'Entr\u00e9e et de Sortie + +ColumnFrom = Entr\u00e9e +ColumnTo = Sortie +ColumnBoth = Les Deux Sens +DispatcherInt = Int\u00e9grer avec le Dispatcheur + +PromptUser = Prompt User +ClearRoute = Clear Route +CancelRoute = Cancel Route +StackRoute = Stack Route diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle_it.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle_it.properties new file mode 100644 index 00000000000..2ccbb604889 --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle_it.properties @@ -0,0 +1,64 @@ +# EntryExitBundle_it.properties +# +# Italian properties for the jmri.jmrit.entryexit +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) + +WindowTitleStackRoutes = Itinerari Impilati + +MenuEntryExit = Ingresso-Uscita +MenuItemClearRoute = Pulisci Itinerario +MenuItemCancelRoute = Annulla Itinerario +MenuItemLockManualRoute = Blocca itinerario manuale + +BeanNameDestination = NX Destination Point +StackRouteAsk = Would you like to Stack the Route? +RouteNotClear = Route Not Clear +Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. + +Stack = Stack +ClearDown = Clear Down +Exit = Exit +InterlockPrompt = What would you like to do with this interlock? +Interlock = Interlock + +EnableLayoutBlockRouting = Instradamento Blocchi sul tracciato non \u00e8 abilitato\n Vuoi abilitarlo? +LayoutBlockRoutingEnabled = Instradamento Blocchi sul tracciato \u00e8 stato abilitato.\n Per convalidare la modifica : Chiudi e riapri questa finestra. + +SelectPanel = Seleziona Pannello + +FromLocation = Punto di Entrata +ToLocation = Punto di Uscita +AddPair = Aggiungi Coppia +AddEntryExitPoints = Add Entry Exit Points +AutoGenerate = Autogenerazione Coppie Entrata-Uscita +AutoGenEntryExitTitle = Autogenerazione Coppie Entrata-Uscita +AutoGenEntryExitMessage = Desideri generare automaticamente \nle coppie di Entrata-Uscita e la Logica, basandosi \nsul tracciato eseguito nell'Editor Tracciati? + +SettingDuration = Durata settaggio Colore (ms) +ValueBeNumber = Durata settaggio Colore deve essere un numero! +RouteSetColour = Colore iniziale del percorso durante Itinerario Valido +OptionsTitle = Opzioni Ingresso-uscita +Reselection = Opzioni Riselezione percorso +ReselectionTip = Set the action for when the NX buttons are reselected + +EndBumperPoint = La posizione Destinazione \u00cb un Respingente, non \u00cb possibile il percorso nei "due senso di marcia NX" + +SetTurnoutsOnly = Set Turnouts Only +SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts +FullInterlock = Full Interlock +NXType = NX Type +DiscoverEntryExitPairs = Discover Entry Exit Pairs +DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... +AutoGenComplete = Generation of Entry Exit Pairs Completed + +BothWayTurnoutOnly = Percorso nei due sensi di marcia non utilizzabile se c'\u00e0 un Segnale sia all'Entrata che all'Uscita + +ColumnFrom = Entrata +ColumnTo = Uscita +ColumnBoth = Entrambe le direzioni +DispatcherInt = Integra con Dispatcher + +PromptUser = Prompt User +ClearRoute = Clear Route +CancelRoute = Cancel Route +StackRoute = Stack Route diff --git a/java/src/jmri/jmrit/entryexit/EntryExitBundle_nl.properties b/java/src/jmri/jmrit/entryexit/EntryExitBundle_nl.properties new file mode 100644 index 00000000000..09cc4921b9e --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/EntryExitBundle_nl.properties @@ -0,0 +1,64 @@ +# EntryExitBundle_nl.properties +# +# Dutch properties for the jmri.jmrit.entryexit +# Translation by Egbert Broerse 2016-09 + +WindowTitleStackRoutes = Rijwegen in Wachtrij + +MenuEntryExit = Entry Exit +MenuItemClearRoute = Geef Rijweg vrij +MenuItemCancelRoute = Annuleer Rijweg +MenuItemLockManualRoute = Reserveer handmatige Rijweg + +BeanNameDestination = NX Eindpunt +StackRouteAsk = Rijweg in de wachtrij zetten? +RouteNotClear = Rijweg niet vrij +Error1 = Er was geen selectie in de lijst.\nMaak een keuze en klik op {0} of laat in Wachtrij staan. + +Stack = In Wachtrij +ClearDown = Vanaf hier vrijgeven +Exit = Verlaat +InterlockPrompt = Wat moet er met de Rijwegbeveiliging gebeuren? +Interlock = Rijwegbeveiliging + +EnableLayoutBlockRouting = Spoorplanbloktoewijzing is uitgeschakeld.\nNu activeren? +LayoutBlockRoutingEnabled = Spoorplanbloktoewijzing geactiveerd.\nSluit dit venster en open het opnieuw om alle wijzigingen door te voeren. + +SelectPanel = Kies een paneel + +FromLocation = Inrijpunt +ToLocation = Uitrijpunt +AddPair = Voeg Seinpaar toe +AddEntryExitPoints = Voeg In-/Uitrijpunt toe +AutoGenerate = In-/Uitrijpunten automatisch aanmaken +AutoGenEntryExitTitle = Autom. In-/Uitrijpunten +AutoGenEntryExitMessage = Wil je In-/Uitrijpunten en Logica automatisch aanmaken op basis van\nhet schema in de Spoorplan Editor? + +SettingDuration = Duur van kleurverloop (ms) +ValueBeNumber = Duur van kleurverloop invoeren als geheel getal! +RouteSetColour = Initieel Padkleur tijdens Routeselectie +OptionsTitle = Opties voor In-/Uitrijpunten +Reselection = Optie Route Opnieuw Kiezen +ReselectionTip = Stel actie in om uit te voeren als de NX knoppen opnieuw aangekruisd worden. + +EndBumperPoint = Doel is een stootblok; op deze plek kan men geen "2-Richting NX" aanmaken. + +SetTurnoutsOnly = Alleen Wissels bedienen +SetTurnoutsAndSignalMasts = Wissels en Seinmasten bedienen +FullInterlock = Rijwegbeveiliging +NXType = NX-type +DiscoverEntryExitPairs = Ontdek In-/Uitrijpunten +DiscoveringEntryExitPairs = Zoek In-/Uitrijpunten... +AutoGenComplete = Autom. In-/Uitrijpunten voltooid + +BothWayTurnoutOnly = 2-Richting NX is niet mogelijk indien zowel bij het In- als het Uitrijpunt een Seinmast staat. + +ColumnFrom = Inrit +ColumnTo = Uitrit +ColumnBoth = 2-Richting +DispatcherInt = Integreer met Verkeersleiding + +PromptUser = Vraag mij +ClearRoute = Geef Route vrij +CancelRoute = Annuleer Route +StackRoute = Stapel Route diff --git a/java/src/jmri/jmrit/signalling/EntryExitPairs.java b/java/src/jmri/jmrit/entryexit/EntryExitPairs.java similarity index 99% rename from java/src/jmri/jmrit/signalling/EntryExitPairs.java rename to java/src/jmri/jmrit/entryexit/EntryExitPairs.java index a586f6558de..4563cdb37d5 100644 --- a/java/src/jmri/jmrit/signalling/EntryExitPairs.java +++ b/java/src/jmri/jmrit/entryexit/EntryExitPairs.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.Color; import java.awt.event.MouseAdapter; @@ -26,10 +26,6 @@ import jmri.jmrit.display.layoutEditor.LayoutBlockConnectivityTools; import jmri.jmrit.display.layoutEditor.LayoutBlockManager; import jmri.jmrit.display.layoutEditor.LayoutEditor; -import jmri.jmrit.signalling.entryexit.DestinationPoints; -import jmri.jmrit.signalling.entryexit.PointDetails; -import jmri.jmrit.signalling.entryexit.Source; -import jmri.jmrit.signalling.entryexit.StackNXPanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/java/src/jmri/jmrit/signalling/entryexit/ManuallySetRoute.java b/java/src/jmri/jmrit/entryexit/ManuallySetRoute.java similarity index 95% rename from java/src/jmri/jmrit/signalling/entryexit/ManuallySetRoute.java rename to java/src/jmri/jmrit/entryexit/ManuallySetRoute.java index 16fdc9a0831..153c841b309 100644 --- a/java/src/jmri/jmrit/signalling/entryexit/ManuallySetRoute.java +++ b/java/src/jmri/jmrit/entryexit/ManuallySetRoute.java @@ -1,10 +1,9 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import jmri.Block; import jmri.NamedBean; import jmri.jmrit.display.layoutEditor.LayoutBlock; import jmri.jmrit.display.layoutEditor.LayoutBlockManager; -import jmri.jmrit.signalling.EntryExitPairs; public class ManuallySetRoute { @@ -14,7 +13,7 @@ public class ManuallySetRoute { public ManuallySetRoute(PointDetails pd) { sourcePoint = pd; LayoutBlock facing = lbm.getFacingBlockByNamedBean(pd.getSensor(), pd.getPanel()); - EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class); for (LayoutBlock pro : lbm.getProtectingBlocksByNamedBean(pd.getSensor(), pd.getPanel())) { if (findDestPoint(pro, facing)) { PointDetails dest = manager.providePoint(destLoc, pd.getPanel()); diff --git a/java/src/jmri/jmrit/signalling/entryexit/PointDetails.java b/java/src/jmri/jmrit/entryexit/PointDetails.java similarity index 99% rename from java/src/jmri/jmrit/signalling/entryexit/PointDetails.java rename to java/src/jmri/jmrit/entryexit/PointDetails.java index 0ff067870e7..ea1ac0ea86d 100644 --- a/java/src/jmri/jmrit/signalling/entryexit/PointDetails.java +++ b/java/src/jmri/jmrit/entryexit/PointDetails.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; @@ -17,7 +17,6 @@ import jmri.jmrit.display.layoutEditor.LayoutTurnout; import jmri.jmrit.display.layoutEditor.LevelXing; import jmri.jmrit.display.layoutEditor.PositionablePoint; -import jmri.jmrit.signalling.EntryExitPairs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -162,7 +161,7 @@ private void nxButtonStateChange(PropertyChangeEvent e) { setButtonState(EntryExitPairs.NXBUTTONINACTIVE); } } - jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class).setMultiPointRoute(this, panel); + jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class).setMultiPointRoute(this, panel); } void setSignalMast(SignalMast mast) { diff --git a/java/src/jmri/jmrit/signalling/entryexit/Source.java b/java/src/jmri/jmrit/entryexit/Source.java similarity index 98% rename from java/src/jmri/jmrit/signalling/entryexit/Source.java rename to java/src/jmri/jmrit/entryexit/Source.java index 044d73b8c04..ad7a2381489 100644 --- a/java/src/jmri/jmrit/signalling/entryexit/Source.java +++ b/java/src/jmri/jmrit/entryexit/Source.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -11,7 +11,6 @@ import jmri.SignalMast; import jmri.jmrit.display.layoutEditor.LayoutBlock; import jmri.jmrit.display.layoutEditor.LayoutEditor; -import jmri.jmrit.signalling.EntryExitPairs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,7 +29,7 @@ public class Source { //String ref = "Empty"; transient PointDetails pd = null; - EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class); //Using Object here rather than sourceSensor, working on the basis that it might //one day be possible to have a signal icon selectable on a panel and diff --git a/java/src/jmri/jmrit/signalling/entryexit/StackNXPanel.java b/java/src/jmri/jmrit/entryexit/StackNXPanel.java similarity index 95% rename from java/src/jmri/jmrit/signalling/entryexit/StackNXPanel.java rename to java/src/jmri/jmrit/entryexit/StackNXPanel.java index 4f426b82c57..33dec316842 100644 --- a/java/src/jmri/jmrit/signalling/entryexit/StackNXPanel.java +++ b/java/src/jmri/jmrit/entryexit/StackNXPanel.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.awt.BorderLayout; import java.awt.event.ActionEvent; @@ -11,11 +11,10 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; -import jmri.jmrit.signalling.EntryExitPairs; public class StackNXPanel extends JPanel { - transient EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + transient EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class); private JPanel entryExitPanel; diff --git a/java/src/jmri/jmrit/signalling/configurexml/EntryExitPairsXml.java b/java/src/jmri/jmrit/entryexit/configurexml/EntryExitPairsXml.java similarity index 99% rename from java/src/jmri/jmrit/signalling/configurexml/EntryExitPairsXml.java rename to java/src/jmri/jmrit/entryexit/configurexml/EntryExitPairsXml.java index cd6a288e714..11ef7bf910f 100644 --- a/java/src/jmri/jmrit/signalling/configurexml/EntryExitPairsXml.java +++ b/java/src/jmri/jmrit/entryexit/configurexml/EntryExitPairsXml.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.configurexml; +package jmri.jmrit.entryexit.configurexml; import java.awt.Color; import java.util.ArrayList; @@ -14,7 +14,7 @@ import jmri.SignalMastManager; import jmri.configurexml.AbstractXmlAdapter; import jmri.jmrit.display.layoutEditor.LayoutEditor; -import jmri.jmrit.signalling.EntryExitPairs; +import jmri.jmrit.entryexit.EntryExitPairs; import jmri.util.ColorUtil; import org.jdom2.Element; import org.slf4j.Logger; @@ -299,7 +299,7 @@ public static String colorToString(Color color) { * @param string String describing a color * @return integer representing a screen color * @deprecated since 4.9.4; use {@link jmri.util.ColorUtil#stringToColor(String)} instead - * + * */ @Deprecated public static Color stringToColor(String string) { diff --git a/java/src/jmri/jmrit/entryexit/package-info.java b/java/src/jmri/jmrit/entryexit/package-info.java new file mode 100644 index 00000000000..6259a0f92cb --- /dev/null +++ b/java/src/jmri/jmrit/entryexit/package-info.java @@ -0,0 +1,11 @@ +/** + * Implements Entry/Exit ( NX ) dispatching using Layout Editor panels. + * + *

                Related Documentation

                + * + * Entry/Exit (NX) Description + */ + +//@annotations for the entire package go here + +package jmri.jmrit.entryexit; \ No newline at end of file diff --git a/java/src/jmri/jmrit/logix/WarrantPreferences.java b/java/src/jmri/jmrit/logix/WarrantPreferences.java index 77dd952a32e..3fc16473e06 100644 --- a/java/src/jmri/jmrit/logix/WarrantPreferences.java +++ b/java/src/jmri/jmrit/logix/WarrantPreferences.java @@ -298,7 +298,7 @@ private boolean loadSpeedMap(Element child) { try { speed = Float.valueOf(list.get(i).getText()); } catch (NumberFormatException nfe) { - log.error("Speed names has invalid content for {} = ", name, list.get(i).getText()); + log.error("Speed names has invalid content for {} = {}", name, list.get(i).getText()); } log.debug("Add {}, {} to AspectSpeed Table", name, speed); map.put(name, speed); @@ -666,7 +666,7 @@ public void setTimeIncrement(int increment) { public float getThrottleIncrement() { return _throttleIncr; } - + /** * Set the throttle increment. * diff --git a/java/src/jmri/jmrit/mailreport/ReportContext.java b/java/src/jmri/jmrit/mailreport/ReportContext.java index 537107cab0e..f9e4a103656 100644 --- a/java/src/jmri/jmrit/mailreport/ReportContext.java +++ b/java/src/jmri/jmrit/mailreport/ReportContext.java @@ -49,28 +49,41 @@ public String getReport(boolean reportNetworkInfo) { addString("JMRI Version: " + jmri.Version.name() + " "); addString("JMRI configuration file name: " - + System.getProperty("org.jmri.apps.Apps.configFilename") + " "); - if (jmri.util.JmriJFrame.getFrameList().get(0) != null) { + + System.getProperty("org.jmri.apps.Apps.configFilename") + " (from org.jmri.apps.Apps.configFilename system property)"); + if (!jmri.util.JmriJFrame.getFrameList().isEmpty() && jmri.util.JmriJFrame.getFrameList().get(0) != null) { addString("JMRI main window name: " + jmri.util.JmriJFrame.getFrameList().get(0).getTitle() + " "); + } else { + addString("No main window present"); } addString("JMRI Application: " + jmri.Application.getApplicationName() + " "); - ConnectionConfig[] connList = InstanceManager.getDefault(ConnectionConfigManager.class).getConnections(); - if (connList != null) { - for (int x = 0; x < connList.length; x++) { - ConnectionConfig conn = connList[x]; - addString("Connection " + x + ": " + conn.getManufacturer() + " connected via " + conn.name() + " on " + conn.getInfo() + " Disabled " + conn.getDisabled() + " "); + ConnectionConfigManager cm = InstanceManager.getNullableDefault(ConnectionConfigManager.class); + if (cm != null) { + ConnectionConfig[] connList = cm.getConnections(); + if (connList != null) { + for (int x = 0; x < connList.length; x++) { + ConnectionConfig conn = connList[x]; + addString("Connection " + x + ": " + conn.getManufacturer() + " connected via " + conn.name() + " on " + conn.getInfo() + " Disabled " + conn.getDisabled() + " "); + } } + } else { + addString("No connections present"); } - + addString("Available Communication Ports:"); addCommunicationPortInfo(); Profile profile = ProfileManager.getDefault().getActiveProfile(); - addString("Active profile: " + profile.getName() + " "); - addString("Profile location: " + profile.getPath().getPath() + " "); - addString("Profile ID: " + profile.getId() + " "); + if (profile != null) { + addString("Active profile: " + profile.getName() + " "); + addString("Profile location: " + profile.getPath().getPath() + " "); + addString("Profile ID: " + profile.getId() + " "); + } else { + addString("No profile present"); + } + + addString("JMRI Node ID: "+ jmri.util.node.NodeIdentity.identity() ); String prefs = FileUtil.getUserFilesPath(); addString("Preferences directory: " + prefs + " "); @@ -86,7 +99,7 @@ public String getReport(boolean reportNetworkInfo) { //String operations = jmri.jmrit.operations.setup.OperationsSetupXml.getFileLocation(); //addString("Operations files location: "+operations+" "); - jmri.jmrit.audio.AudioFactory af = jmri.InstanceManager.getDefault(jmri.AudioManager.class).getActiveAudioFactory(); + jmri.jmrit.audio.AudioFactory af = jmri.InstanceManager.getNullableDefault(jmri.AudioManager.class).getActiveAudioFactory(); String audio = af != null ? af.toString() : "[not initialised]"; addString("Audio factory type: " + audio + " "); diff --git a/java/src/jmri/jmrit/operations/OperationsFrame.java b/java/src/jmri/jmrit/operations/OperationsFrame.java index ca2b3649dee..1e1ff103f9c 100644 --- a/java/src/jmri/jmrit/operations/OperationsFrame.java +++ b/java/src/jmri/jmrit/operations/OperationsFrame.java @@ -1,7 +1,7 @@ //OperationsFrame.java package jmri.jmrit.operations; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.awt.Container; import java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.JButton; @@ -27,7 +27,6 @@ * * @author Dan Boudreau Copyright (C) 2008, 2012 */ -@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "cast is consistent OperationsPanel") public class OperationsFrame extends JmriJFrame implements AncestorListener { public static final String NEW_LINE = "\n"; // NOI18N @@ -70,31 +69,31 @@ public void initMinimumSize(Dimension dimension) { } protected void addItem(JComponent c, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItem(c, x, y); + this.getContentPane().addItem(c, x, y); } protected void addItemLeft(JComponent c, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItemLeft(c, x, y); + this.getContentPane().addItemLeft(c, x, y); } protected void addItemWidth(JComponent c, int width, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItemWidth(c, width, x, y); + this.getContentPane().addItemWidth(c, width, x, y); } protected void addItem(JPanel p, JComponent c, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItem(p, c, x, y); + this.getContentPane().addItem(p, c, x, y); } protected void addItemLeft(JPanel p, JComponent c, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItemLeft(p, c, x, y); + this.getContentPane().addItemLeft(p, c, x, y); } protected void addItemTop(JPanel p, JComponent c, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItemTop(p, c, x, y); + this.getContentPane().addItemTop(p, c, x, y); } protected void addItemWidth(JPanel p, JComponent c, int width, int x, int y) { - ((OperationsPanel) this.getContentPane()).addItemWidth(p, c, width, x, y); + this.getContentPane().addItemWidth(p, c, width, x, y); } /** @@ -104,7 +103,7 @@ protected void addItemWidth(JPanel p, JComponent c, int width, int x, int y) { * @return the number of checkboxes, minimum is 5 (6 checkboxes) */ protected int getNumberOfCheckboxesPerLine() { - return ((OperationsPanel) this.getContentPane()).getNumberOfCheckboxesPerLine(this.getPreferredSize()); + return this.getContentPane().getNumberOfCheckboxesPerLine(this.getPreferredSize()); } protected void addButtonAction(JButton b) { @@ -112,7 +111,7 @@ protected void addButtonAction(JButton b) { } protected void buttonActionPerformed(ActionEvent ae) { - ((OperationsPanel) this.getContentPane()).buttonActionPerformed(ae); + this.getContentPane().buttonActionPerformed(ae); } protected void addRadioButtonAction(JRadioButton b) { @@ -120,7 +119,7 @@ protected void addRadioButtonAction(JRadioButton b) { } protected void radioButtonActionPerformed(ActionEvent ae) { - ((OperationsPanel) this.getContentPane()).radioButtonActionPerformed(ae); + this.getContentPane().radioButtonActionPerformed(ae); } protected void addCheckBoxAction(JCheckBox b) { @@ -128,7 +127,7 @@ protected void addCheckBoxAction(JCheckBox b) { } protected void checkBoxActionPerformed(ActionEvent ae) { - ((OperationsPanel) this.getContentPane()).checkBoxActionPerformed(ae); + this.getContentPane().checkBoxActionPerformed(ae); } protected void addSpinnerChangeListerner(JSpinner s) { @@ -136,7 +135,7 @@ protected void addSpinnerChangeListerner(JSpinner s) { } protected void spinnerChangeEvent(ChangeEvent ae) { - ((OperationsPanel) this.getContentPane()).spinnerChangeEvent(ae); + this.getContentPane().spinnerChangeEvent(ae); } protected void addComboBoxAction(JComboBox b) { @@ -144,11 +143,11 @@ protected void addComboBoxAction(JComboBox b) { } protected void comboBoxActionPerformed(ActionEvent ae) { - ((OperationsPanel) this.getContentPane()).comboBoxActionPerformed(ae); + this.getContentPane().comboBoxActionPerformed(ae); } protected void selectNextItemComboBox(JComboBox b) { - ((OperationsPanel) this.getContentPane()).selectNextItemComboBox(b); + this.getContentPane().selectNextItemComboBox(b); } /** @@ -159,7 +158,7 @@ protected void selectNextItemComboBox(JComboBox b) { * @param textArea the textArea to adjust */ protected void adjustTextAreaColumnWidth(JScrollPane scrollPane, JTextArea textArea) { - ((OperationsPanel) this.getContentPane()).adjustTextAreaColumnWidth(scrollPane, textArea, this.getPreferredSize()); + this.getContentPane().adjustTextAreaColumnWidth(scrollPane, textArea, this.getPreferredSize()); } /** @@ -170,30 +169,30 @@ protected void adjustTextAreaColumnWidth(JScrollPane scrollPane, JTextArea textA * @return true */ public boolean loadTableDetails(JTable table) { - return ((OperationsPanel) this.getContentPane()).loadTableDetails(table); + return this.getContentPane().loadTableDetails(table); } protected void clearTableSort(JTable table) { - ((OperationsPanel) this.getContentPane()).clearTableSort(table); + this.getContentPane().clearTableSort(table); } protected synchronized void createShutDownTask() { - ((OperationsPanel) this.getContentPane()).createShutDownTask(); + this.getContentPane().createShutDownTask(); } @Override public void dispose() { - ((OperationsPanel) this.getContentPane()).dispose(); + this.getContentPane().dispose(); super.dispose(); } @Override protected void storeValues() { - ((OperationsPanel) this.getContentPane()).storeValues(); + this.getContentPane().storeValues(); } protected String lineWrap(String s) { - return ((OperationsPanel) this.getContentPane()).lineWrap(s, this.getPreferredSize()); + return this.getContentPane().lineWrap(s, this.getPreferredSize()); } // Kludge fix for horizontal scrollbar encroaching buttons at bottom of a scrollable window. @@ -214,17 +213,53 @@ protected void addHorizontalScrollBarKludgeFix(JScrollPane pane, JPanel panel) { @Override public void ancestorAdded(AncestorEvent event) { - ((OperationsPanel) this.getContentPane()).ancestorAdded(event); + this.getContentPane().ancestorAdded(event); } @Override public void ancestorRemoved(AncestorEvent event) { - ((OperationsPanel) this.getContentPane()).ancestorRemoved(event); + this.getContentPane().ancestorRemoved(event); } @Override public void ancestorMoved(AncestorEvent event) { - ((OperationsPanel) this.getContentPane()).ancestorMoved(event); + this.getContentPane().ancestorMoved(event); + } + + /** + * {@inheritDoc} + *

                + * This implementation only accepts the content pane if it is an + * {@link OperationsPanel}. + * + * @throws java.lang.IllegalArgumentException if the content pane is not an + * OperationsPanel + */ + @Override + public void setContentPane(Container contentPane) { + if (contentPane instanceof OperationsPanel) { + super.setContentPane(contentPane); + } else { + throw new IllegalArgumentException("OperationsFrames can only use an OperationsPanel as the contentPane"); + } + } + + /** + * {@inheritDoc} + *

                + * This implementation only returns the content pane if it is an + * {@link OperationsPanel}. + * + * @throws java.lang.IllegalArgumentException if the content pane is not an + * OperationsPanel + */ + @Override + public OperationsPanel getContentPane() { + Container c = super.getContentPane(); + if (c instanceof OperationsPanel) { + return (OperationsPanel) c; + } + throw new IllegalArgumentException("OperationsFrames can only use an OperationsPanel as the contentPane"); } // private final static Logger log = LoggerFactory.getLogger(OperationsFrame.class); diff --git a/java/src/jmri/jmrit/operations/OperationsPanel.java b/java/src/jmri/jmrit/operations/OperationsPanel.java index 35b415ccdb6..00804b44ed5 100644 --- a/java/src/jmri/jmrit/operations/OperationsPanel.java +++ b/java/src/jmri/jmrit/operations/OperationsPanel.java @@ -1,6 +1,6 @@ package jmri.jmrit.operations; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.awt.Container; import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.GridBagConstraints; @@ -255,7 +255,7 @@ public boolean loadTableDetails(JTable table) { TableRowSorter sorter = new TableRowSorter<>(table.getModel()); table.setRowSorter(sorter); // only sort on columns that are String or Integer - for (int i =0; i < table.getColumnCount(); i++) { + for (int i = 0; i < table.getColumnCount(); i++) { if (table.getColumnClass(i) == String.class || table.getColumnClass(i) == Integer.class) { continue; // allow sorting } @@ -267,7 +267,7 @@ public boolean loadTableDetails(JTable table) { // have to shut off autoResizeMode to get horizontal scroll to work (JavaSwing p 541) table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // give each cell a bit of space between the vertical lines and text - table.setIntercellSpacing(new Dimension(3,1)); + table.setIntercellSpacing(new Dimension(3, 1)); // table must have a name table.setName(getWindowFrameRef() + ":table"); // NOI18N Optional manager = InstanceManager.getOptionalDefault(JTablePersistenceManager.class); @@ -367,7 +367,7 @@ public void ancestorAdded(AncestorEvent event) { @Override public void ancestorRemoved(AncestorEvent event) { -// log.debug("Ancestor Removed"); +// log.debug("Ancestor Removed"); // do nothing } @@ -381,10 +381,10 @@ public void ancestorMoved(AncestorEvent event) { } } - @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "Checks for instance") protected String getWindowFrameRef() { - if (this.getTopLevelAncestor() instanceof JmriJFrame) { - return ((JmriJFrame) this.getTopLevelAncestor()).getWindowFrameRef(); + Container c = this.getTopLevelAncestor(); + if (c instanceof JmriJFrame) { + return ((JmriJFrame) c).getWindowFrameRef(); } return null; } diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/Car.java b/java/src/jmri/jmrit/operations/rollingstock/cars/Car.java index 3a42783f81d..d1692e1274e 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/Car.java +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/Car.java @@ -77,15 +77,15 @@ public Car(String road, String number) { public Car copy() { Car car = new Car(); - car.setBuilt(_built); - car.setColor(_color); - car.setLength(_length); - car.setLoadName(_loadName); - car.setReturnWhenEmptyLoadName(_rweLoadName); - car.setNumber(_number); - car.setOwner(_owner); - car.setRoadName(_road); - car.setTypeName(_type); + car.setBuilt(getBuilt()); + car.setColor(getColor()); + car.setLength(getLength()); + car.setLoadName(getLoadName()); + car.setReturnWhenEmptyLoadName(getReturnWhenEmptyLoadName()); + car.setNumber(getNumber()); + car.setOwner(getOwner()); + car.setRoadName(getRoadName()); + car.setTypeName(getTypeName()); car.loaded = true; return car; } @@ -177,7 +177,7 @@ public String getReturnWhenEmptyLoadName() { * @return The car's load priority. */ public String getLoadPriority() { - return (carLoads.getPriority(_type, _loadName)); + return (carLoads.getPriority(getTypeName(), getLoadName())); } /** @@ -186,7 +186,7 @@ public String getLoadPriority() { * @return type empty or type load */ public String getLoadType() { - return (carLoads.getLoadType(_type, _loadName)); + return (carLoads.getLoadType(getTypeName(), getLoadName())); } public String getPickupComment() { diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/CarAttributeEditFrame.java b/java/src/jmri/jmrit/operations/rollingstock/cars/CarAttributeEditFrame.java index 3a24bf7f2e4..9e8ef650d18 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/CarAttributeEditFrame.java +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/CarAttributeEditFrame.java @@ -372,8 +372,7 @@ private void updateCarQuanity() { int number = 0; String item = (String) comboBox.getSelectedItem(); log.debug("Selected item {}", item); - for (RollingStock rs : carManager.getList()) { - Car car = (Car) rs; + for (Car car : carManager.getList()) { if (_comboboxName.equals(CarEditFrame.ROAD)) { if (car.getRoadName().equals(item)) { diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/CarEditFrame.java b/java/src/jmri/jmrit/operations/rollingstock/cars/CarEditFrame.java index dd4d9dc2e32..1085c22120c 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/CarEditFrame.java +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/CarEditFrame.java @@ -92,7 +92,7 @@ public class CarEditFrame extends OperationsFrame implements java.beans.Property JComboBox trackLocationBox = new JComboBox<>(); JComboBox loadComboBox = InstanceManager.getDefault(CarLoads.class).getComboBox(null); JComboBox kernelComboBox = carManager.getKernelComboBox(); - JComboBox rfidComboBox = new JComboBox(); + JComboBox rfidComboBox = new JComboBox<>(); // panels JPanel pBlocking = new JPanel(); @@ -693,8 +693,7 @@ private void saveCar(boolean isSave) { new Object[]{_car.getTypeName()}), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // go through the entire list and change the passenger setting // for all cars of this type - for (RollingStock rs : carManager.getList()) { - Car c = (Car) rs; + for (Car c : carManager.getList()) { if (c.getTypeName().equals(_car.getTypeName())) { c.setPassenger(passengerCheckBox.isSelected()); } @@ -719,8 +718,7 @@ private void saveCar(boolean isSave) { .getMessage("carModifyAllType"), new Object[]{_car.getTypeName()}), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // go through the entire list and change the passenger setting // for all cars of this type - for (RollingStock rs : carManager.getList()) { - Car c = (Car) rs; + for (Car c : carManager.getList()) { if (c.isPassenger() && c.getTypeName().equals(_car.getTypeName())) { c.setBlocking(blocking); } @@ -735,8 +733,7 @@ private void saveCar(boolean isSave) { new Object[]{_car.getTypeName()}), MessageFormat.format(Bundle.getMessage("carModifyAllType"), new Object[]{_car.getTypeName()}), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // go through the entire list and change the caboose setting for all cars of this type - for (RollingStock rs : carManager.getList()) { - Car c = (Car) rs; + for (Car c : carManager.getList()) { if (c.getTypeName().equals(_car.getTypeName())) { c.setCaboose(cabooseCheckBox.isSelected()); } @@ -751,8 +748,7 @@ private void saveCar(boolean isSave) { new Object[]{_car.getTypeName()}), MessageFormat.format(Bundle.getMessage("carModifyAllType"), new Object[]{_car.getTypeName()}), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // go through the entire list and change the utility for all cars of this type - for (RollingStock rs : carManager.getList()) { - Car c = (Car) rs; + for (Car c : carManager.getList()) { if (c.getTypeName().equals(_car.getTypeName())) { c.setUtility(utilityCheckBox.isSelected()); } @@ -767,8 +763,7 @@ private void saveCar(boolean isSave) { new Object[]{_car.getTypeName()}), MessageFormat.format(Bundle.getMessage("carModifyAllType"), new Object[]{_car.getTypeName()}), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { // go through the entire list and change the hazardous setting for all cars of this type - for (RollingStock rs : carManager.getList()) { - Car c = (Car) rs; + for (Car c : carManager.getList()) { if (c.getTypeName().equals(_car.getTypeName())) { c.setHazardous(hazardousCheckBox.isSelected()); } diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/CarLoadEditFrame.java b/java/src/jmri/jmrit/operations/rollingstock/cars/CarLoadEditFrame.java index 7086e89b21a..dcf78cb0019 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/CarLoadEditFrame.java +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/CarLoadEditFrame.java @@ -18,7 +18,6 @@ import jmri.jmrit.operations.OperationsXml; import jmri.jmrit.operations.locations.LocationManager; import jmri.jmrit.operations.locations.schedules.ScheduleManager; -import jmri.jmrit.operations.rollingstock.RollingStock; import jmri.jmrit.operations.setup.Control; import jmri.jmrit.operations.setup.Setup; import jmri.jmrit.operations.trains.TrainManager; @@ -315,8 +314,7 @@ private void updateCarQuanity() { } int number = 0; String item = (String) loadComboBox.getSelectedItem(); - for (RollingStock rs : InstanceManager.getDefault(CarManager.class).getList()) { - Car car = (Car) rs; + for (Car car : InstanceManager.getDefault(CarManager.class).getList()) { if (car.getLoadName().equals(item)) { number++; } diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/CarManager.java b/java/src/jmri/jmrit/operations/rollingstock/cars/CarManager.java index d6626491e91..6d1b9226e3b 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/CarManager.java +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/CarManager.java @@ -192,7 +192,7 @@ public void updateKernelComboBox(JComboBox box) { */ public List getKernelNameList() { String[] names = new String[_kernelHashTable.size()]; - List out = new ArrayList(); + List out = new ArrayList<>(); Enumeration en = _kernelHashTable.keys(); int i = 0; while (en.hasMoreElements()) { @@ -411,7 +411,7 @@ public List getByTrainDestinationList(Train train) { List byLocation = getByList(byFinal, BY_LOCATION); List byDestination = getByList(byLocation, BY_DESTINATION); // now place cabooses, cars with FRED, and passenger cars at the rear of the train - List out = new ArrayList(); + List out = new ArrayList<>(); int lastCarsIndex = 0; // incremented each time a car is added to the end of the list for (Car rs : byDestination) { Car car = rs; @@ -496,7 +496,7 @@ public List getByTrainDestinationList(Train train) { * @return List of caboose road names. */ public List getCabooseRoadNames() { - List names = new ArrayList(); + List names = new ArrayList<>(); Enumeration en = _hashTable.keys(); while (en.hasMoreElements()) { Car car = getById(en.nextElement()); @@ -514,7 +514,7 @@ public List getCabooseRoadNames() { * @return List of road names of cars with FREDs */ public List getFredRoadNames() { - List names = new ArrayList(); + List names = new ArrayList<>(); Enumeration en = _hashTable.keys(); while (en.hasMoreElements()) { Car car = getById(en.nextElement()); @@ -535,8 +535,7 @@ public List getFredRoadNames() { */ public void replaceLoad(String type, String oldLoadName, String newLoadName) { List cars = getList(); - for (Car rs : cars) { - Car car = rs; + for (Car car : cars) { if (car.getTypeName().equals(type) && car.getLoadName().equals(oldLoadName)) { if (newLoadName != null) { car.setLoadName(newLoadName); @@ -544,11 +543,18 @@ public void replaceLoad(String type, String oldLoadName, String newLoadName) { car.setLoadName(InstanceManager.getDefault(CarLoads.class).getDefaultEmptyName()); } } + if (car.getTypeName().equals(type) && car.getReturnWhenEmptyLoadName().equals(oldLoadName)) { + if (newLoadName != null) { + car.setReturnWhenEmptyLoadName(newLoadName); + } else { + car.setReturnWhenEmptyLoadName(InstanceManager.getDefault(CarLoads.class).getDefaultEmptyName()); + } + } } } public List getCarsLocationUnknown() { - List mias = new ArrayList(); + List mias = new ArrayList<>(); List cars = getByIdList(); for (Car rs : cars) { Car car = rs; diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/CarsTableModel.java b/java/src/jmri/jmrit/operations/rollingstock/cars/CarsTableModel.java index f4349d5525e..affbac0e260 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/CarsTableModel.java +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/CarsTableModel.java @@ -386,7 +386,7 @@ void initTable(JTable table, CarsTableFrame frame) { } // Cars frame table column widths, starts with Select column and ends with Edit - private int[] tableColumnWidths = + private final int[] tableColumnWidths = {60, 60, 60, 65, 35, 75, 75, 75, 65, 190, 190, 140, 190, 190, 190, 65, 50, 50, 50, 50, 100, 50, 100, 100, 65, 70}; @@ -469,7 +469,7 @@ public String getColumnName(int col) { case FINAL_DESTINATION_COLUMN: return Bundle.getMessage("FinalDestination"); case RWE_COLUMN: - return Bundle.getMessage("ReturnWhenEmpty"); + return Bundle.getMessage("RWELocation"); case RWE_LOAD_COLUMN: return Bundle.getMessage("RWELoad"); case TRAIN_COLUMN: diff --git a/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties b/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties index ab6d5e040c5..fe0a2e3cc21 100644 --- a/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties +++ b/java/src/jmri/jmrit/operations/rollingstock/cars/JmritOperationsCarsBundle.properties @@ -20,6 +20,7 @@ WeightTons = Tons #LocationAndTrack = Location and Track FD = FD ReturnWhenEmpty = Return When Empty +RWELocation = RWE Location RWELoad = RWE Load Wait = Wait Last = Last diff --git a/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java b/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java index 75a83ca280c..a639b3b0f76 100644 --- a/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java +++ b/java/src/jmri/jmrit/operations/trains/TrainsTableFrame.java @@ -370,34 +370,42 @@ public void buttonActionPerformed(java.awt.event.ActionEvent ae) { } if (ae.getSource() == runFileButton) { // Processes the CSV Manifest files using an external custom program. - if (!InstanceManager.getDefault(TrainCustomManifest.class).excelFileExists()) { - log.warn("Manifest creator file not found!, directory name: " + InstanceManager.getDefault(TrainCustomManifest.class).getDirectoryName() - + ", file name: " + InstanceManager.getDefault(TrainCustomManifest.class).getFileName()); // NOI18N - JOptionPane.showMessageDialog(this, MessageFormat.format( - Bundle.getMessage("LoadDirectoryNameFileName"), new Object[]{ - InstanceManager.getDefault(TrainCustomManifest.class).getDirectoryName(), InstanceManager.getDefault(TrainCustomManifest.class).getFileName()}), Bundle - .getMessage("ManifestCreatorNotFound"), JOptionPane.ERROR_MESSAGE); + TrainCustomManifest tcm = InstanceManager.getDefault(TrainCustomManifest.class); + if (!tcm.excelFileExists()) { + log.warn("Manifest creator file not found!, directory name: {}, file name: {}", + tcm.getDirectoryName(), tcm.getFileName()); + JOptionPane.showMessageDialog(this, + MessageFormat.format(Bundle.getMessage("LoadDirectoryNameFileName"), + new Object[]{ + tcm.getDirectoryName(), + tcm.getFileName() + }), + Bundle.getMessage("ManifestCreatorNotFound"), + JOptionPane.ERROR_MESSAGE); return; } List trains = getSortByList(); for (Train train : trains) { if (train.isBuildEnabled()) { if (!train.isBuilt() && trainManager.isBuildMessagesEnabled()) { - JOptionPane.showMessageDialog(this, MessageFormat.format(Bundle - .getMessage("NeedToBuildBeforeRunFile"), new Object[]{ - train.getName()}), - Bundle.getMessage("ErrorTitle"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, + MessageFormat.format(Bundle.getMessage("NeedToBuildBeforeRunFile"), + new Object[]{ + train.getName() + }), + Bundle.getMessage("ErrorTitle"), + JOptionPane.ERROR_MESSAGE); } else if (train.isBuilt()) { // Make sure our csv manifest file exists for this Train. File csvFile = train.createCSVManifestFile(); // Add it to our collection to be processed. - InstanceManager.getDefault(TrainCustomManifest.class).addCVSFile(csvFile); + tcm.addCVSFile(csvFile); } } } // Now run the user specified custom Manifest processor program - InstanceManager.getDefault(TrainCustomManifest.class).process(); + tcm.process(); } if (ae.getSource() == switchListsButton) { if (tslef != null) { diff --git a/java/src/jmri/jmrit/picker/PickListModel.java b/java/src/jmri/jmrit/picker/PickListModel.java index bee0bb1a6e9..27dccdac8ef 100644 --- a/java/src/jmri/jmrit/picker/PickListModel.java +++ b/java/src/jmri/jmrit/picker/PickListModel.java @@ -15,9 +15,9 @@ import javax.swing.table.TableColumnModel; import javax.swing.table.TableRowSorter; import jmri.*; +import jmri.jmrit.beantable.BeanTableDataModel; +import jmri.jmrit.entryexit.*; import jmri.jmrit.logix.*; -import jmri.jmrit.signalling.*; -import jmri.jmrit.signalling.entryexit.*; import jmri.util.*; import jmri.util.swing.XTableColumnModel; import org.slf4j.Logger; @@ -47,7 +47,7 @@ * * @author Pete Cressman Copyright (C) 2009, 2010 */ -public abstract class PickListModel extends jmri.jmrit.beantable.BeanTableDataModel implements PropertyChangeListener { +public abstract class PickListModel extends BeanTableDataModel implements PropertyChangeListener { protected ArrayList _pickList; protected String _name; @@ -313,7 +313,7 @@ public void changeSelection(int row, int col, boolean toggle, boolean extend) { _table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); _table.setPreferredScrollableViewportSize(new java.awt.Dimension(250, _table.getRowHeight() * 7)); _table.setDragEnabled(true); - _table.setTransferHandler(new jmri.util.DnDTableExportHandler()); + _table.setTransferHandler(new DnDTableExportHandler()); _table.getTableHeader().setReorderingAllowed(true); _table.setColumnModel(new XTableColumnModel()); @@ -582,7 +582,7 @@ public void setValueAt(Object type, int r, int c) { static class SignalHeadPickModel extends PickListModel { - SignalHeadManager manager = InstanceManager.getDefault(jmri.SignalHeadManager.class); + SignalHeadManager manager = InstanceManager.getDefault(SignalHeadManager.class); SignalHeadPickModel() { _name = rb.getString("TitleSignalTable"); @@ -590,7 +590,7 @@ static class SignalHeadPickModel extends PickListModel { @Override public Manager getManager() { - manager = InstanceManager.getDefault(jmri.SignalHeadManager.class); + manager = InstanceManager.getDefault(SignalHeadManager.class); return manager; } @@ -616,7 +616,7 @@ public boolean canAddBean() { static class SignalMastPickModel extends PickListModel { - SignalMastManager manager = InstanceManager.getDefault(jmri.SignalMastManager.class); + SignalMastManager manager = InstanceManager.getDefault(SignalMastManager.class); SignalMastPickModel() { _name = rb.getString("TitleSignalMastTable"); @@ -624,7 +624,7 @@ static class SignalMastPickModel extends PickListModel { @Override public Manager getManager() { - manager = InstanceManager.getDefault(jmri.SignalMastManager.class); + manager = InstanceManager.getDefault(SignalMastManager.class); return manager; } @@ -680,7 +680,7 @@ public boolean canAddBean() { static class BlockPickModel extends PickListModel { - BlockManager manager = InstanceManager.getDefault(jmri.BlockManager.class); + BlockManager manager = InstanceManager.getDefault(BlockManager.class); BlockPickModel() { _name = rb.getString("TitleBlockTable"); @@ -688,7 +688,7 @@ static class BlockPickModel extends PickListModel { @Override public Manager getManager() { - manager = InstanceManager.getDefault(jmri.BlockManager.class); + manager = InstanceManager.getDefault(BlockManager.class); return manager; } @@ -710,7 +710,7 @@ public boolean canAddBean() { static class ReporterPickModel extends PickListModel { - ReporterManager manager = InstanceManager.getDefault(jmri.ReporterManager.class); + ReporterManager manager = InstanceManager.getDefault(ReporterManager.class); ReporterPickModel() { _name = rb.getString("TitleReporterTable"); @@ -718,7 +718,7 @@ static class ReporterPickModel extends PickListModel { @Override public Manager getManager() { - manager = InstanceManager.getDefault(jmri.ReporterManager.class); + manager = InstanceManager.getDefault(ReporterManager.class); return manager; } @@ -770,7 +770,7 @@ public boolean canAddBean() { static class OBlockPickModel extends PickListModel { - OBlockManager manager = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class); + OBlockManager manager = InstanceManager.getDefault(OBlockManager.class); OBlockPickModel() { _name = rb.getString("TitleBlockTable"); @@ -778,7 +778,7 @@ static class OBlockPickModel extends PickListModel { @Override public Manager getManager() { - manager = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class); + manager = InstanceManager.getDefault(OBlockManager.class); return manager; } @@ -830,7 +830,7 @@ public boolean canAddBean() { static class EntryExitPickModel extends PickListModel { - EntryExitPairs manager = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + EntryExitPairs manager = InstanceManager.getDefault(EntryExitPairs.class); EntryExitPickModel() { _name = rb.getString("TitleEntryExitTable"); @@ -838,7 +838,7 @@ static class EntryExitPickModel extends PickListModel { @Override public Manager getManager() { - manager = jmri.InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class); + manager = InstanceManager.getDefault(EntryExitPairs.class); return manager; } @@ -878,7 +878,7 @@ static class LogixPickModel extends PickListModel { @Override public Manager getManager() { - manager = InstanceManager.getDefault(jmri.LogixManager.class); + manager = InstanceManager.getDefault(LogixManager.class); return manager; } diff --git a/java/src/jmri/jmrit/progsupport/ProgOpsModePane.java b/java/src/jmri/jmrit/progsupport/ProgOpsModePane.java index 3d0b0498d86..b1eab7b8d7a 100644 --- a/java/src/jmri/jmrit/progsupport/ProgOpsModePane.java +++ b/java/src/jmri/jmrit/progsupport/ProgOpsModePane.java @@ -7,6 +7,7 @@ import java.util.List; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; +import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; @@ -19,7 +20,6 @@ import jmri.Programmer; import jmri.ProgrammingMode; import jmri.implementation.AccessoryOpsModeProgrammerFacade; -import jmri.managers.DefaultProgrammerManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,23 +48,27 @@ public class ProgOpsModePane extends ProgModeSelector implements PropertyChangeL ButtonGroup addrGroup = new ButtonGroup(); JRadioButton shortAddrButton = new JRadioButton(Bundle.getMessage("ShortAddress")); JRadioButton longAddrButton = new JRadioButton(Bundle.getMessage("LongAddress")); + JCheckBox offsetAddrCheckBox = new JCheckBox(Bundle.getMessage("DccAccessoryAddressOffSet")); + JLabel addressLabel = new JLabel(Bundle.getMessage("AddressLabel")); boolean oldLongAddr = false; boolean opsAccyMode = false; boolean oldOpsAccyMode = false; boolean opsSigMode = false; boolean oldOpsSigMode = false; - AddressedProgrammer programmer = null; - AccessoryOpsModeProgrammerFacade facadeProgrammer = null; + boolean oldoffsetAddrCheckBox = false; + transient volatile AddressedProgrammer programmer = null; + transient volatile AccessoryOpsModeProgrammerFacade facadeProgrammer = null; /** * Get the selected programmer */ @Override public Programmer getProgrammer() { - log.debug("getProgrammer mLongAddrCheck.isSelected()={}, oldLongAddr={}, mAddrField.getValue()={}, oldAddrValue={}, opsAccyMode={}, oldOpsAccyMode={}, opsSigMode={}, oldOpsSigMode={})", - longAddrButton.isSelected(), oldLongAddr, mAddrField.getValue(), oldAddrValue, opsAccyMode, oldOpsAccyMode, opsSigMode, oldOpsSigMode); - if ((longAddrButton.isSelected() == oldLongAddr) + log.debug("getProgrammer mLongAddrCheck.isSelected()={}, oldLongAddr={}, mAddrField.getValue()={}, oldAddrValue={}, opsAccyMode={}, oldOpsAccyMode={}, opsSigMode={}, oldOpsSigMode={}, oldoffsetAddrCheckBox={})", + longAddrButton.isSelected(), oldLongAddr, mAddrField.getValue(), oldAddrValue, opsAccyMode, oldOpsAccyMode, opsSigMode, oldOpsSigMode, oldoffsetAddrCheckBox); + if (longAddrButton.isSelected() == oldLongAddr && mAddrField.getValue().equals(oldAddrValue) + && offsetAddrCheckBox.isSelected() == oldoffsetAddrCheckBox && opsAccyMode == oldOpsAccyMode && opsSigMode == oldOpsSigMode) { log.debug("getProgrammer hasn't changed"); @@ -82,6 +86,7 @@ public Programmer getProgrammer() { oldAddrValue = (Integer) mAddrField.getValue(); oldOpsAccyMode = opsAccyMode; oldOpsSigMode = opsSigMode; + oldoffsetAddrCheckBox = offsetAddrCheckBox.isSelected(); setAddrParams(); if (pm != null) { @@ -107,11 +112,12 @@ public Programmer getProgrammer() { if (opsAccyMode) { log.debug(" getting AccessoryOpsModeProgrammerFacade"); facadeProgrammer = new AccessoryOpsModeProgrammerFacade(programmer, - longAddrButton.isSelected() ? "accessory" : "decoder"); + longAddrButton.isSelected() ? "accessory" : "decoder", 200, programmer); return facadeProgrammer; } else if (opsSigMode) { - log.debug(" getting AccessoryOpsModeProgrammerFacade signal mode"); - facadeProgrammer = new AccessoryOpsModeProgrammerFacade(programmer, "signal"); + String addrType = offsetAddrCheckBox.isSelected() ? "signal" : "altsignal"; + log.debug(" getting AccessoryOpsModeProgrammerFacade {}", addrType); + facadeProgrammer = new AccessoryOpsModeProgrammerFacade(programmer, addrType, 200, programmer); return facadeProgrammer; } return programmer; @@ -180,9 +186,11 @@ public void actionPerformed(java.awt.event.ActionEvent e) { add(new JLabel(" ")); add(shortAddrButton); add(longAddrButton); + add(offsetAddrCheckBox); + offsetAddrCheckBox.setToolTipText(Bundle.getMessage("DccOffsetTooltip")); JPanel panel = new JPanel(); panel.setLayout(new java.awt.FlowLayout()); - panel.add(new JLabel(Bundle.getMessage("AddressLabel"))); + panel.add(addressLabel); panel.add(mAddrField); mAddrField.setToolTipText(Bundle.getMessage("ToolTipEnterDecoderAddress")); add(panel); @@ -211,7 +219,17 @@ public void actionPerformed(java.awt.event.ActionEvent e) { } }); + offsetAddrCheckBox.addActionListener(new java.awt.event.ActionListener() { + @Override + public void actionPerformed(java.awt.event.ActionEvent e) { + // new programmer selection + programmerSelected(); // in case it has valid address now + } + }); + shortAddrButton.setSelected(true); + offsetAddrCheckBox.setSelected(false); + offsetAddrCheckBox.setVisible(false); // and execute the setup for 1st time programmerSelected(); @@ -235,7 +253,7 @@ void programmerSelected() { // configure buttons int index = 0; - List modes = new ArrayList(); + List modes = new ArrayList<>(); if (getProgrammer() != null) { modes.addAll(programmer.getSupportedModes()); } else { @@ -390,6 +408,8 @@ void setAddrParams() { shortAddrButton.setVisible(true); longAddrButton.setText(Bundle.getMessage("AccessoryAddress")); longAddrButton.setToolTipText(Bundle.getMessage("ToolTipAccessoryAddress")); + offsetAddrCheckBox.setVisible(false); + addressLabel.setText(Bundle.getMessage("AddressLabel")); if (longAddrButton.isSelected()) { lowAddrLimit = 1; highAddrLimit = 2044; @@ -399,9 +419,9 @@ void setAddrParams() { } } else if (opsSigMode) { shortAddrButton.setVisible(false); - longAddrButton.setSelected(true); - longAddrButton.setText(Bundle.getMessage("SignalAddress")); - longAddrButton.setToolTipText(Bundle.getMessage("ToolTipSignalAddress")); + longAddrButton.setVisible(false); + offsetAddrCheckBox.setVisible(true); + addressLabel.setText(Bundle.getMessage("SignalAddressLabel")); lowAddrLimit = 1; highAddrLimit = 2044; } else { @@ -410,6 +430,8 @@ void setAddrParams() { shortAddrButton.setVisible(true); longAddrButton.setText(Bundle.getMessage("LongAddress")); longAddrButton.setToolTipText(Bundle.getMessage("ToolTipLongAddress")); + offsetAddrCheckBox.setVisible(false); + addressLabel.setText(Bundle.getMessage("AddressLabel")); if (longAddrButton.isSelected()) { lowAddrLimit = 0; highAddrLimit = 10239; diff --git a/java/src/jmri/jmrit/progsupport/ProgSupportBundle.properties b/java/src/jmri/jmrit/progsupport/ProgSupportBundle.properties index 0fb73024973..d7313c58e9c 100644 --- a/java/src/jmri/jmrit/progsupport/ProgSupportBundle.properties +++ b/java/src/jmri/jmrit/progsupport/ProgSupportBundle.properties @@ -20,7 +20,7 @@ ToolTipLongAddress = The long (two byte) decoder address (range 0-10239) ToolTipDecoderAddress = The 9-bit decoder or board address (range 1-511) ToolTipAccessoryAddress = The 11-bit accessory or output address (range 1-2044) ToolTipSignalAddress = The 11-bit signal address (range 1-2044) - +DccOffsetTooltip = When checked, uses an alternative DCC addressing scheme. TitleSetProgrammingMode = Set programming mode TitleProgramOnMain = Program On Main @@ -29,6 +29,8 @@ LongAddress = Long address DecoderAddress = Decoder address AccessoryAddress = Accessory address SignalAddress = Signal address +DccAccessoryAddressOffSet = Offset Address AddressLabel = Address: OpsModeLabel = Mode: +SignalAddressLabel = Signal address: diff --git a/java/src/jmri/jmrit/sendpacket/Bundle.java b/java/src/jmri/jmrit/sendpacket/Bundle.java index f635dc7bd3f..f7eee558206 100644 --- a/java/src/jmri/jmrit/sendpacket/Bundle.java +++ b/java/src/jmri/jmrit/sendpacket/Bundle.java @@ -21,7 +21,7 @@ * @author Bob Jacobsen Copyright (C) 2012 * @since 3.3.1 */ -public class Bundle extends jmri.jmrix.Bundle { // Note: uses specific jmrix labels +public class Bundle extends jmri.jmrit.Bundle { // Note: uses specific jmrix labels @Nullable private static final String name = null; // No local resources diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle.properties b/java/src/jmri/jmrit/signalling/SignallingBundle.properties index 978fe0bb99b..5a9b0e66c4c 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle.properties @@ -1,7 +1,6 @@ -# Merged properties for the jmri.jmrit.signalling package - -# Properties for jmri.jmrit.signalling GUI elements -# Original file: SignallingBundle.properties +# SignallingBundle.properties +# +# Default properties for the jmri.jmrit.signalling SignallingPairs = Signaling Mast Pairs UpdateLogicButton = Update Signal Logic @@ -41,59 +40,11 @@ ColumnPermissive = Permissive ColumnAspect = Aspect ButtonDiscover = Discover -ButtonAdd = Add Logic - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle.properties - -SelectPanel = Select Panel - -FromLocation = Entry Point -ToLocation = Exit Point -AddPair = Add Pair -AddEntryExitPoints = Add Entry Exit Points -AutoGenerate = Auto Generate Entry-Exit Pairs -AutoGenEntryExitTitle = Auto Generate Entry Exit Pairs -AutoGenEntryExitMessage = Do you want to automatically generate \nthe Entry Exit Pairs and Logic, based \nupon the track plan in the layout editor? - -SettingDuration = Duration of setting Colour (ms) -ValueBeNumber = Duration of setting colour should be a number! -RouteSetColour = Initial colour of path while route is Setup -OptionsTitle = Entry Exit Options -Reselection = Route Reselection Option -ReselectionTip = Set the action for when the NX buttons are reselected - -EndBumperPoint = Destination location is at an End Bumper; it is not possible to do "Both Way NX" at this location - -SetTurnoutsOnly = Set Turnouts Only -SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts -FullInterlock = Full Interlock -NXType = NX Type -DiscoverEntryExitPairs = Discover Entry Exit Pairs -DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... -AutoGenComplete = Generation of Entry Exit Pairs Completed LabelSelectChecked = Select {0}
                to be checked: LabelAutogenerated = These {0} are
                auto generated
                and can't be
                changed: SourceMast = Source Mast DestMast = Destination Mast -BothWayTurnoutOnly = Both Way Operation can not be used if a Signal is present at both Entry and Exit points - -ColumnFrom = Entry -ColumnTo = Exit -ColumnBoth = Both Way -DispatcherInt = Integrate with Dispatcher -WindowTitleStackRoutes = Stacked Routes - -PromptUser = Prompt User -ClearRoute = Clear Route -CancelRoute = Cancel Route -StackRoute = Stack Route - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: SignallingGuiTools.properties LeaveButton = Leave RemoveButton = Remove diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle_ca.properties b/java/src/jmri/jmrit/signalling/SignallingBundle_ca.properties index fd9d619d1b6..262ae015189 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle_ca.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle_ca.properties @@ -1,18 +1,12 @@ -# Merged properties for the jmri.jmrit.signalling package - +# SignallingBundle_ca.properties +# +# Catalan properties for the jmri.jmrit.signalling # Translation: Joan de Castro (joan276dca@yahoo.es) 18/08/2016 -# Properties for jmri.jmrit.signalling GUI elements -# Original file: SignallingBundle_ca.properties -# New entries are comments (#+) and contain the English text - -#SignallingPairs = Parells de Senyals SignallingPairs = Parells de senyalitzaci\u00f3 - - UpdateLogicButton = Actualitza la l\u00f2gica de senyals UpdateButtonToolTip = Canvia la l\u00f2gica d'aquest M\u00e0stil de Senyals i surt del mode d'edici\u00f3 -#+ ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode +ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode AddLogic = Afegeix l\u00f2gica de senyals UseLayoutEditorPaths = Usa els detalls d'itineraris de l'editor de maquetes UseTurnoutDetails = Usa detalls de desviament de l'editor de maquetes @@ -20,7 +14,7 @@ UseBlockDetails = Usa detalls de bloc de l'editor de maquetes AllowAutomaticSignalMast = Permet que la l\u00f2gica gestioni senyals conflictius LockTurnouts = Bloqueja agulles quan la l\u00f2gica de senyals \u00e9s activa PathSpeed = Velocitat de l'itinerari -#+ NoneSet = None Set +NoneSet = None Set ErrorUnReachableDestination = El pal de senyals de destinaci\u00f3 no es pot trobar des del pal de senyals d'origen WarningUnabletoValidate = No ha estat possible validar el cam\u00ed entre els dos pals de senyals @@ -30,12 +24,12 @@ LayoutBlockRoutingEnabled = Blocs d'itinerari activats a la maqueta.\n Siusplau, LayoutBlockRoutingEnabledShort = Blocs d'itinerari activats a la maqueta. SignalMastCriteriaOwn = L'estat del senyal ha de ser "{0}" aquesta l\u00f2gica \u00e9s aplicable tant a l'origen, com a la destinaci\u00f3.\nAix\u00f2 pot comportar que la l\u00f2gica no treballi correctament.\nEst\u00e0s segur que ho vols usar? SignalMastCriteriaOwnTitle = Error en el pal de senyals -#+ ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. -#+ WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? -#+ DiscoverMastsTitle = Discover Signal Mast Pairs -#+ DiscoveringMasts = Discovering Signal Masts -#+ GenComplete = Generation of Signalling Pairs Completed -#+ GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. +ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. +WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? +DiscoverMastsTitle = Discover Signal Mast Pairs +DiscoveringMasts = Discovering Signal Masts +GenComplete = Generation of Signalling Pairs Completed +GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. UnOccupied = Lliure Occupied = Ocupat @@ -47,59 +41,11 @@ ColumnPermissive = Permissiu ColumnAspect = Aspecte ButtonDiscover = Descobrir -ButtonAdd = Afegir l\u00f2gica - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle_ca.properties - -SelectPanel = Selecciona Panell - -FromLocation = Punt d'entrada -ToLocation = Punt de sortida -AddPair = Afegir parell -#+ AddEntryExitPoints = Add Entry Exit Points -AutoGenerate = Auto-generaci\u00f3 Parelles d'Entrada-Sortida -AutoGenEntryExitTitle = Auto-generaci\u00f3 Parelles d'Entrada-Sortida -AutoGenEntryExitMessage = Vols generar autom\u00e0ticament \nEls parells d'entrada sortida i la l\u00f2gica, basada \nen el pla de vies de la maqueta? -SettingDuration = Durada d'ajust de color (ms) -ValueBeNumber = La durada de la configuraci\u00f3 del color ha de ser un nombre! -RouteSetColour = Color inicial de la ruta durant un itinerari V\u00e0lid -OptionsTitle = Opcions d'Entrada Sortida -Reselection = Opcions de selecci\u00f3 d'Itinerari -#+ ReselectionTip = Set the action for when the NX buttons are reselected - -EndBumperPoint = Ubicaci\u00f3 de destinaci\u00f3 es troba en una topera, no \u00e9s possible fer els "dos sentits" de la marxa - -#+ SetTurnoutsOnly = Set Turnouts Only -#+ SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts -#+ FullInterlock = Full Interlock -#+ NXType = NX Type -#+ DiscoverEntryExitPairs = Discover Entry Exit Pairs -#+ DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... -#+ AutoGenComplete = Generation of Entry Exit Pairs Completed - -#+ LabelSelectChecked = Select {0}
                to be checked: -#+ LabelAutogenerated=These {0} are
                auto generated
                and can't be
                changed: +LabelSelectChecked = Select {0}
                to be checked: +LabelAutogenerated=These {0} are
                auto generated
                and can't be
                changed: SourceMast = M\u00e0stil de Senyals d'origen DestMast = M\u00e0stil de Senyals de dest\u00ed -BothWayTurnoutOnly = No es poden usar dues direccions si hi ha un Senyal a l'entrada i a la sortida - -ColumnFrom = Entrada -ColumnTo = Sortida -ColumnBoth = Ambdues direccions -DispatcherInt = Integra amb Dispatcher -WindowTitleStackRoutes = Itinerari Usat - -#+ PromptUser = Prompt User -#+ ClearRoute = Clear Route -#+ CancelRoute = Cancel Route -#+ StackRoute = Stack Route - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: SignallingGuiTools_ca.properties LeaveButton = Deixa RemoveButton = Elimina diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle_da.properties b/java/src/jmri/jmrit/signalling/SignallingBundle_da.properties index 8425ae70828..1603ab08ea1 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle_da.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle_da.properties @@ -1,108 +1,57 @@ -# Merged properties for the jmri.jmrit.signalling package - -# Properties for jmri.jmrit.signalling GUI elements -# Original file: SignallingBundle_da.properties -# New or untranslated entries are comments (#+) and contain the English text - -#+ SignallingPairs = Signaling Mast Pairs -#+ UpdateLogicButton = Update Signal Logic -#+ UpdateButtonToolTip = Change this Signal Mast Logic -#+ ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode -#+ AddLogic = Add Signal Logic -#+ UseLayoutEditorPaths = Use Layout Editor Paths -#+ UseTurnoutDetails = Use Turnout details from Layout Editor -#+ UseBlockDetails = Use Block details from Layout Editor -#+ AllowAutomaticSignalMast = Allow the Logic to Automatically Determine Conflicting Signal Masts -#+ LockTurnouts = Lock Turnouts when Signal Mast Logic is active -#+ PathSpeed = Path Speed -#+ NoneSet = None Set - -#+ ErrorUnReachableDestination = The Destination Mast is not directly reachable from the Source Mast -#+ WarningUnabletoValidate = It has not been possible to validate the path between the two Signal Masts - -#+ EnableLayoutBlockRouting = Layout Block Routing is not enabled.\n Do you want to enable it? -#+ LayoutBlockRoutingEnabled = Layout Block Routing has been enabled.\n Please close and reopen this window for the changes to take effect. -#+ LayoutBlockRoutingEnabledShort = Layout Block routing has been enabled. -#+ SignalMastCriteriaOwn = Signal Mast state to be checked against "{0}" is either this logics source or destination mast\nThis may result in this logic not working correctly.\nAre you sure you want to use it? -#+ SignalMastCriteriaOwnTitle = Signal Mast Error -#+ ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. -#+ WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? -#+ DiscoverMastsTitle = Discover Signal Mast Pairs -#+ DiscoveringMasts = Discovering Signal Masts -#+ GenComplete = Generation of Signalling Pairs Completed -#+ GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. - -#+ UnOccupied = UnOccupied -#+ Occupied = Occupied -#+ AnyState = Any State - -#+ ColumnState = State -#+ ColumnSpeed = Speed -#+ ColumnPermissive = Permissive -#+ ColumnAspect = Aspect - -#+ ButtonDiscover = Discover -#+ ButtonAdd = Add Logic - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle_da.properties - +# SignallingBundle_da.properties +# +# Danish properties for the jmri.jmrit.signalling # Translation by Sonny Hansen -SelectPanel = V\u00e6lg Panel - -#+ FromLocation = Entry Point -#+ ToLocation = Exit Point -#+ AddPair = Add Pair -#+ AddEntryExitPoints = Add Entry Exit Points -#+ AutoGenerate = Auto Generate Entry-Exit Pairs -#+ AutoGenEntryExitTitle = Auto Generate Entry Exit Pairs -#+ AutoGenEntryExitMessage = Do you want to automatically generate \nthe Entry Exit Pairs and Logic, based \nupon the track plan in the layout editor? - -#+ SettingDuration = Duration of setting Colour (ms) -#+ ValueBeNumber = Duration of setting colour should be a number! -#+ RouteSetColour = Initial colour of path while route is Setup -#+ OptionsTitle = Entry Exit Options -#+ Reselection = Route Reselection Option -#+ ReselectionTip = Set the action for when the NX buttons are reselected - -#+ EndBumperPoint = Destination location is at an End Bumper; it is not possible to do "Both Way NX" at this location - -#+ SetTurnoutsOnly = Set Turnouts Only -#+ SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts -#+ FullInterlock = Full Interlock -#+ NXType = NX Type -#+ DiscoverEntryExitPairs = Discover Entry Exit Pairs -#+ DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... -#+ AutoGenComplete = Generation of Entry Exit Pairs Completed - -#+ LabelSelectChecked = Select {0}
                to be checked: -#+ LabelAutogenerated=These {0} are
                auto generated
                and can't be
                changed: -#+ SourceMast = Source Mast -#+ DestMast = Destination Mast -#+ BothWayTurnoutOnly = Both Way Operation can not be used if a Signal is present at both Entry and Exit points - -#+ ColumnFrom = Entry -#+ ColumnTo = Exit -#+ ColumnBoth = Both Way -#+ DispatcherInt = Integrate with Dispatcher -#+ WindowTitleStackRoutes = Stacked Routes - -#+ PromptUser = Prompt User -#+ ClearRoute = Clear Route -#+ CancelRoute = Cancel Route -#+ StackRoute = Stack Route - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: SignallingGuiTools_da.properties - -#+ LeaveButton = Leave -#+ RemoveButton = Remove -#+ UpdateLogicTitle = Update Logic -#+ RemoveLogicTitle = Remove Logic -#+ SwapLogic = Signal Masts {0} and {1}\nhave been swapped.\nDo you want to update all the logics to reflect this? -#+ RemoveLogic = SignalMast {0} has been removed.\nDo you want to remove the logic associated with it? -#+ RemoveAlreadyAssignedLogic = SignalMast {0} is already assigned within logics.\nDo you want to remove the logic associated with it? -#+ UpdateLogic = SignalMast {0} has been replaced with {1}.\nDo you want to update all the logics to reflect this? +SignallingPairs = Signaling Mast Pairs +UpdateLogicButton = Update Signal Logic +UpdateButtonToolTip = Change this Signal Mast Logic +ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode +AddLogic = Add Signal Logic +UseLayoutEditorPaths = Use Layout Editor Paths +UseTurnoutDetails = Use Turnout details from Layout Editor +UseBlockDetails = Use Block details from Layout Editor +AllowAutomaticSignalMast = Allow the Logic to Automatically Determine Conflicting Signal Masts +LockTurnouts = Lock Turnouts when Signal Mast Logic is active +PathSpeed = Path Speed +NoneSet = None Set + +ErrorUnReachableDestination = The Destination Mast is not directly reachable from the Source Mast +WarningUnabletoValidate = It has not been possible to validate the path between the two Signal Masts + +EnableLayoutBlockRouting = Layout Block Routing is not enabled.\n Do you want to enable it? +LayoutBlockRoutingEnabled = Layout Block Routing has been enabled.\n Please close and reopen this window for the changes to take effect. +LayoutBlockRoutingEnabledShort = Layout Block routing has been enabled. +SignalMastCriteriaOwn = Signal Mast state to be checked against "{0}" is either this logics source or destination mast\nThis may result in this logic not working correctly.\nAre you sure you want to use it? +SignalMastCriteriaOwnTitle = Signal Mast Error +ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. +WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? +DiscoverMastsTitle = Discover Signal Mast Pairs +DiscoveringMasts = Discovering Signal Masts +GenComplete = Generation of Signalling Pairs Completed +GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. + +UnOccupied = UnOccupied +Occupied = Occupied +AnyState = Any State + +ColumnState = State +ColumnSpeed = Speed +ColumnPermissive = Permissive +ColumnAspect = Aspect + +ButtonDiscover = Discover + +LabelSelectChecked = Select {0}
                to be checked: +LabelAutogenerated=These {0} are
                auto generated
                and can't be
                changed: +SourceMast = Source Mast +DestMast = Destination Mast + +LeaveButton = Leave +RemoveButton = Remove +UpdateLogicTitle = Update Logic +RemoveLogicTitle = Remove Logic +SwapLogic = Signal Masts {0} and {1}\nhave been swapped.\nDo you want to update all the logics to reflect this? +RemoveLogic = SignalMast {0} has been removed.\nDo you want to remove the logic associated with it? +RemoveAlreadyAssignedLogic = SignalMast {0} is already assigned within logics.\nDo you want to remove the logic associated with it? +UpdateLogic = SignalMast {0} has been replaced with {1}.\nDo you want to update all the logics to reflect this? diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle_de.properties b/java/src/jmri/jmrit/signalling/SignallingBundle_de.properties index 6eaeaf27d01..a7dee5a9bdd 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle_de.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle_de.properties @@ -1,9 +1,6 @@ -# Merged properties for the jmri.jmrit.signalling package - -# Properties for jmri.jmrit.signalling GUI elements -# Original file: SignallingBundle_de.properties -# New entries are comments (#+) and contain the English text - +# SignallingBundle_de.properties +# +# German properties for the jmri.jmrit.signalling # Translation by Egbert Broerse SignallingPairs=Signalmastlogikpaare @@ -44,59 +41,11 @@ ColumnPermissive = Permissiv ColumnAspect = Signalbegriff ButtonDiscover = Entdecke -ButtonAdd = F\u00fcge Logik zu - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle_de.properties - -SelectPanel = W\u00e4hle Tafel - -FromLocation = Eintrittspunkt -ToLocation = Ausgangspunkt -AddPair = F\u00fcge Paar hinzu -AddEntryExitPoints = F\u00fcge Eintritts-/Ausgangspunkte hinzu -AutoGenerate = Eintritts-/Ausgangspunkte automatisch erstellen -AutoGenEntryExitTitle = Autom. Eintritts-/Ausgangspunkte -AutoGenEntryExitMessage = Willst du die Eintritts-/Ausgangspunkte und Logik automatisch erstellen, basiert auf\ndein Gleisplan in Anlagaeditor? - -SettingDuration = Dauer der Farbe\u00fcbergang (ms) -ValueBeNumber = Dauer der Farbe\u00fcbergang soll ein Zahl sein! -RouteSetColour = Initieller Farbe eines Pfades w\u00e4hrend Routeneingabe -OptionsTitle = Eintritts-/Ausgangsoptionen -Reselection = Routenwiederauswahl Option -ReselectionTip = Definiere was geschehen soll wenn die NX Kn\u00f6pfe wieder ausgew\u00e4hlt werden. - -EndBumperPoint = Zielpunkt ist an einem Prellblock; an dieser Stelle kan man keine "Zweiweg NX" erstellen. - -SetTurnoutsOnly = Nur Weichen stellen -SetTurnoutsAndSignalMasts = Weichen und Signalmasten stellen -FullInterlock = Fahrsta\u00dfenverrieglung -NXType = NX Typ -DiscoverEntryExitPairs = Suche Eintritts-/Ausgangspunkte -DiscoveringEntryExitPairs = Eintritts-/Ausgangspunkte suchen... -AutoGenComplete = Autom. Eintritts-/Ausgangspunkte fertig LabelSelectChecked = Selektiere
                {0}
                zur Kontrolle: LabelAutogenerated = Diese
                {0}
                wurden automatisch
                erstellt und kann
                man nicht \u00e4ndern: SourceMast = Abfahrtmast DestMast = Zielmast -BothWayTurnoutOnly = Zweiweg NX nicht m\u00f6glich wenn sowohl am Abfahrt- als am Zielpunkt ein Signal steht. - -ColumnFrom = Eingang -ColumnTo = Ausfahrt -ColumnBoth = Zweiweg -DispatcherInt = Zusammenarbeit mit Leitstelle -WindowTitleStackRoutes = Aufgestapelte Routenstrecken - -PromptUser = Frage mich -ClearRoute = Strecke freigeben -CancelRoute = Strecke abbrechen -StackRoute = Strecke aufstapeln - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: SignallingGuiTools_de.properties LeaveButton = Stehen lassen RemoveButton = L\u00f6sche @@ -106,4 +55,3 @@ SwapLogic = Die Signalmasten {0} und {1} wurden ausgetauscht.\nAlle Logik welche RemoveLogic = Signalmast {0} wurde gel\u00f6scht.\nAlle Logik welche damit zusammenh\u00e4ngt auch l\u00f6schen? RemoveAlreadyAssignedLogic = Signalmast {0} ist schon mit Logik versehen.\nAlle heutige Logik wegnehmen um neue ein zu geben? UpdateLogic = Signalmast {0} wurde ersetzt von Mast {1}.\nAlle Logik welche damit zusammenh\u00e4ngt daran anpassen? - diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle_fr.properties b/java/src/jmri/jmrit/signalling/SignallingBundle_fr.properties index 0e4b8bdb081..4700b01c779 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle_fr.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle_fr.properties @@ -1,27 +1,12 @@ # SignallingBundle_fr.properties # -# Revision $Revision$ -# -# Default properties for the jmri.jmrit.signalling GUI elements - -# This file is part of JMRI. -#JMRI is free software; you can redistribute it and/or modify it under -# the terms of version 2 of the GNU General Public License as published -# by the Free Software Foundation. See the "COPYING" file for a copy -# of this license. -# -# JMRI is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# for more details. -# +# French properties for the jmri.jmrit.signalling # Updated by BLOREC Herv\u00e9 2016-06-07 SignallingPairs = Paires de Signalisation -SourceMast = M\u00e0t Origine -DestMast = M\u00e0t Destination -UpdateLogic = Mise à jour Logique Signal +UpdateLogicButton = Mise à jour Logique Signal UpdateButtonToolTip = Changer cette Logique de M\u00e0t et quitter le mode \u009dition +ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode AddLogic = Ajouter une Logique Signal UseLayoutEditorPaths = utiliser les Chemins de l'\u00c9diteur de R\u00e9seau UseTurnoutDetails = Utiliser les d\u00e9tails des Aiguillages depuis l'\u00c9diteur de R\u00e9seau @@ -39,13 +24,12 @@ LayoutBlockRoutingEnabled = Le dispositif de routage de Canton du R\u00e9seau a LayoutBlockRoutingEnabledShort = Le dispositif de Routage des Cantons du R\u00e9seau a \u00e9t\u00e9 activ\u00e9. SignalMastCriteriaOwn = L'\u00e9tat du M\u00e2t de Signalisation devant \u00eatre v\u00e9rifi\u00e9 par rapport "{0}" est soit cette source de logiques ou M\u00e2t de destination.\nCeci peut entrainer un fonctionnement incorrect de cette logique.\n\u00eates-vous s\u00fbr de vouloir voulez l'utiliser? SignalMastCriteriaOwnTitle = Erreur M\u00e2t de Signalisationl - -#+ ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. -#+ WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? -#+ DiscoverMastsTitle = Discover Signal Mast Pairs -#+ DiscoveringMasts = Discovering Signal Masts -#+ GenComplete = Generation of Signalling Pairs Completed -#+ GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. +ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. +WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? +DiscoverMastsTitle = Discover Signal Mast Pairs +DiscoveringMasts = Discovering Signal Masts +GenComplete = Generation of Signalling Pairs Completed +GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. UnOccupied = Inoccup\u00e9 Occupied= Occup\u00e9 @@ -57,63 +41,17 @@ ColumnPermissive = Permissive ColumnAspect = Aspect ButtonDiscover = Trouver -ButtonAdd = Ajt Logique - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle_fr.properties - -SelectPanel = S\u00e9lectionnez le Panneau - -FromLocation = Point d'Entr\u00e9e -ToLocation = Point de Sortie -AddPair = Ajoutez une Paire -#+ AddEntryExitPoints = Add Entry Exit Points -AutoGenerate = G\u00e9n\u00e9ration Automatique des Paires Entr\u00e9e Sortie -AutoGenEntryExitTitle = G\u00e9n\u00e9ration Automatique des Paires Entr\u00e9e Sortie -AutoGenEntryExitMessage = Voulez-vous g\u00e9n\u00e9rerautomatiquement \nles Paires d'Entr\u00e9e Sortie et la Logique bas\u00e9e \nsur le plan de voiedans l'\u00e9diteur de r\u00e9seau? -SettingDuration = Dur\u00e9e de la mise en couleur (ms) -ValueBeNumber = La dur\u00e9e de la mise en couleur doit \u00eatre un nombre! -RouteSetColour = Couleur initiale du chemin tandis que l'itin\u00e9raire est install\u00e9 -OptionsTitle = Options Entr\u00e9e Sortie -Reselection = Option Nouvelle s\u00e9lection Itin\u00e9raire -#+ ReselectionTip = Set the action for when the NX buttons are reselected - -EndBumperPoint = L'empacement de destination est un Heurtoir, il n'est pas possible de faire les "Deux Chemins NX" \u00e0 cet endroit - -#+ SetTurnoutsOnly = Set Turnouts Only -#+ SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts -#+ FullInterlock = Full Interlock -#+ NXType = NX Type -#+ DiscoverEntryExitPairs = Discover Entry Exit Pairs -#+ DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... -#+ AutoGenComplete = Generation of Entry Exit Pairs Completed - -#+ LabelSelectChecked = Select {0}
                to be checked: -#+ LabelAutogenerated = These {0} are
                auto generated
                and can't be
                changed: -BothWayTurnoutOnly = Les Op\u00e9ration Bidirectionnelles ne peuvent pas \u00eatre utilis\u00e9es si un Signal est pr\u00e9sent \u00e0 la fois aux points d'Entr\u00e9e et de Sortie - -ColumnFrom = Entr\u00e9e -ColumnTo = Sortie -ColumnBoth = Les Deux Sens -DispatcherInt = Int\u00e9grer avec le Dispatcheur -WindowTitleStackRoutes = Itin\u00e9raires Superpos\u00e9s - -#+ PromptUser = Prompt User -#+ ClearRoute = Clear Route -#+ CancelRoute = Cancel Route -#+ StackRoute = Stack Route - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: None +LabelSelectChecked = Select {0}
                to be checked: +LabelAutogenerated = These {0} are
                auto generated
                and can't be
                changed: +SourceMast = M\u00e0t Origine +DestMast = M\u00e0t Destination -#+ LeaveButton = Leave -#+ RemoveButton = Remove -#+ UpdateLogicTitle = Update Logic -#+ RemoveLogicTitle = Remove Logic -#+ SwapLogic = Signal Masts {0} and {1}\nhave been swapped.\nDo you want to update all the logics to reflect this? -#+ RemoveLogic = SignalMast {0} has been removed.\nDo you want to remove the logic associated with it? -#+ RemoveAlreadyAssignedLogic = SignalMast {0} is already assigned within logics.\nDo you want to remove the logic associated with it? -#+ UpdateLogic = SignalMast {0} has been replaced with {1}.\nDo you want to update all the logics to reflect this? +LeaveButton = Quitter +RemoveButton = Annuler +UpdateLogicTitle = Mise \u00e0 Jour Logique +RemoveLogicTitle = Annuler Logique +SwapLogic = Le M\u00e2t de Signalisation {0} et {1}\n ont \u00e9t\u00e9 perrmut\u00e9s \ndVoulez-vous mettre \u00e0 jour toutes les logiques pour refl\u00e9ter ceci? +RemoveLogic = Le M\u00e2t de Signalisation {0} a \u00e9t\u00e9 enlev\u00e9,\n voulez-vous enlever la logique associ\u00e9e? +RemoveAlreadyAssignedLogic = Le M\u00e2t de Signalisation {0} est d\u00e9j\u00e0 affect\u00e9 avec les logiques \n voulez-vous enlever la logique associ\u00e9e? +UpdateLogic = Le M\u00e2t de Signalisation {0} a \u00e9t\u00e9 remplac\u00e9 par {1}\n Voulez-vous mettre \u00e0 jour toutes les logiques pour refl\u00e9ter ceci? diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle_it.properties b/java/src/jmri/jmrit/signalling/SignallingBundle_it.properties index e91b35c756f..9ebb283a6f3 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle_it.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle_it.properties @@ -1,15 +1,12 @@ -# Merged properties for the jmri.jmrit.signalling package - -# Properties for jmri.jmrit.signalling GUI elements -# Original file: SignallingBundle_it.properties -# New entries are comments (#+) and contain the English text - +# SignallingBundle_it.properties +# +# Italian properties for the jmri.jmrit.signalling # Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) SignallingPairs = Coppie di Segnalazione UpdateLogicButton = Aggiorna Logica Segnale UpdateButtonToolTip = Cambia questo Percorso esci da Modifica -#+ ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode +ApplyButtonToolTip = Change this Signal Mast Logic and leave Edit mode AddLogic = Aggiungi Logica Segnale UseLayoutEditorPaths = Usa Percorsi dall'Editor Tracciato UseTurnoutDetails = Usa dettagli Scambi dall'Editor Tracciato @@ -17,7 +14,7 @@ UseBlockDetails = Usa dettagli Blocco dall'Editor Tracciato AllowAutomaticSignalMast = Permetti alla Logica di determinare automaticamente Conflitti tra segnali LockTurnouts = Blocca Scambi quando la logica del segnale \u00e8 attiva PathSpeed = Velocit\u00e0 Percorso -#+ NoneSet = None Set +NoneSet = None Set ErrorUnReachableDestination = Lo Stante del Segnale Destinazione non \u00e8 raggiungibile direttamente dal dal Segnale Sorgente WarningUnabletoValidate = Non \u00e8 stato possibile convalidare il percorso tra i due Segnali @@ -27,12 +24,12 @@ LayoutBlockRoutingEnabled = Instradamento Blocchi sul tracciato \u00e8 stato ab LayoutBlockRoutingEnabledShort = Instradamento Blocchi sul tracciato \u00e8 stato abilitato. SignalMastCriteriaOwn = Lo stato del segnale deve essere "{0}", questa logica \u00e8 sia Sorgente che Destinazione.\nQuesto pu\u00f2 avere come risultato una logica che non funziona correttamente.nSei sicuro di volerla usare lo stesso? SignalMastCriteriaOwnTitle = Errore Segnale -#+ ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. -#+ WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? -#+ DiscoverMastsTitle = Discover Signal Mast Pairs -#+ DiscoveringMasts = Discovering Signal Masts -#+ GenComplete = Generation of Signalling Pairs Completed -#+ GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. +ErrorSignalMastIdentical = Destination Signal Mast should differ from Source Mast.\nSelect and configure a different Destination Mast. +WarningExistingPair = The Destination Mast was already defined with this Source Mast.\nDo you want to overwrite its former definition? +DiscoverMastsTitle = Discover Signal Mast Pairs +DiscoveringMasts = Discovering Signal Masts +GenComplete = Generation of Signalling Pairs Completed +GenSkipped = Cannot search for Pairs as there are\nno Layout Editor panels available. UnOccupied = Libero Occupied = Occupato @@ -44,59 +41,11 @@ ColumnPermissive = Facoltativo ColumnAspect = Aspetto ButtonDiscover = Scoprire -ButtonAdd = Aggiungi Logica - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle_it.properties - -SelectPanel = Seleziona Pannello - -FromLocation = Punto di Entrata -ToLocation = Punto di Uscita -AddPair = Aggiungi Coppia -#+ AddEntryExitPoints = Add Entry Exit Points -AutoGenerate = Autogenerazione Coppie Entrata-Uscita -AutoGenEntryExitTitle = Autogenerazione Coppie Entrata-Uscita -AutoGenEntryExitMessage = Desideri generare automaticamente \nle coppie di Entrata-Uscita e la Logica, basandosi \nsul tracciato eseguito nell'Editor Tracciati? - -SettingDuration = Durata settaggio Colore (ms) -ValueBeNumber = Durata settaggio Colore deve essere un numero! -RouteSetColour = Colore iniziale del percorso durante Itinerario Valido -OptionsTitle = Opzioni Ingresso-uscita -Reselection = Opzioni Riselezione percorso -#+ ReselectionTip = Set the action for when the NX buttons are reselected -EndBumperPoint = La posizione Destinazione \u00cb un Respingente, non \u00cb possibile il percorso nei "due senso di marcia NX" - -#+ SetTurnoutsOnly = Set Turnouts Only -#+ SetTurnoutsAndSignalMasts = Set Turnouts and Signal Masts -#+ FullInterlock = Full Interlock -#+ NXType = NX Type -#+ DiscoverEntryExitPairs = Discover Entry Exit Pairs -#+ DiscoveringEntryExitPairs = Discovering Entry Exit Pairs... -#+ AutoGenComplete = Generation of Entry Exit Pairs Completed - -#+ LabelSelectChecked = Select {0}
                to be checked: -#+ LabelAutogenerated = These {0} are
                auto generated
                and can't be
                changed: +LabelSelectChecked = Select {0}
                to be checked: +LabelAutogenerated = These {0} are
                auto generated
                and can't be
                changed: SourceMast = Stante Sorgente DestMast = Stante Destinazione -BothWayTurnoutOnly = Percorso nei due sensi di marcia non utilizzabile se c'\u00e0 un Segnale sia all'Entrata che all'Uscita - -ColumnFrom = Entrata -ColumnTo = Uscita -ColumnBoth = Entrambe le direzioni -DispatcherInt = Integra con Dispatcher -WindowTitleStackRoutes = Itinerari impilati - -#+ PromptUser = Prompt User -#+ ClearRoute = Clear Route -#+ CancelRoute = Cancel Route -#+ StackRoute = Stack Route - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: SignallingGuiTools_it.properties LeaveButton = Lascia RemoveButton = Rimuovi diff --git a/java/src/jmri/jmrit/signalling/SignallingBundle_nl.properties b/java/src/jmri/jmrit/signalling/SignallingBundle_nl.properties index 0b6b79eb591..2e3fd4c48e0 100644 --- a/java/src/jmri/jmrit/signalling/SignallingBundle_nl.properties +++ b/java/src/jmri/jmrit/signalling/SignallingBundle_nl.properties @@ -1,9 +1,6 @@ -# Merged properties for the jmri.jmrit.signalling package - -# Properties for jmri.jmrit.signalling GUI elements -# Original file: SignallingBundle_nl.properties -# New entries are comments (#+) and contain the English text - +# SignallingBundle_nl.properties +# +# Dutch properties for the jmri.jmrit.signalling # Translation by Egbert Broerse 2016-09 SignallingPairs = Seinmastlogicaparen @@ -44,59 +41,11 @@ ColumnPermissive = Permissief ColumnAspect = Seinbetekenis ButtonDiscover = Ontdek -ButtonAdd = Voeg Logica toe - -# Properties for jmri.jmrit.signalling NX elements -# Original file: EntryExitBundle_nl.properties - -SelectPanel = Kies een paneel - -FromLocation = Inrijpunt -ToLocation = Uitrijpunt -AddPair = Voeg Seinpaar toe -AddEntryExitPoints = Voeg In-/Uitrijpunt toe -AutoGenerate = In-/Uitrijpunten automatisch aanmaken -AutoGenEntryExitTitle = Autom. In-/Uitrijpunten -AutoGenEntryExitMessage = Wil je In-/Uitrijpunten en Logica automatisch aanmaken op basis van\nhet schema in de Spoorplan Editor? - -SettingDuration = Duur van kleurverloop (ms) -ValueBeNumber = Duur van kleurverloop invoeren als geheel getal! -RouteSetColour = Initieel Padkleur tijdens Routeselectie -OptionsTitle = Opties voor In-/Uitrijpunten -Reselection = Optie Route Opnieuw Kiezen -ReselectionTip = Stel actie in om uit te voeren als de NX knoppen opnieuw aangekruisd worden. - -EndBumperPoint = Doel is een stootblok; op deze plek kan men geen "2-Richting NX" aanmaken. - -SetTurnoutsOnly = Alleen Wissels bedienen -SetTurnoutsAndSignalMasts = Wissels en Seinmasten bedienen -FullInterlock = Rijwegbeveiliging -NXType = NX-type -DiscoverEntryExitPairs = Ontdek In-/Uitrijpunten -DiscoveringEntryExitPairs = Zoek In-/Uitrijpunten... -AutoGenComplete = Autom. In-/Uitrijpunten voltooid LabelSelectChecked = Selecteer
                {0}
                voor controle: LabelAutogenerated = Deze {0}
                worden
                automatisch
                aangemaakt en
                zijn niet aan te
                passen: SourceMast = Vertrekmast DestMast = Doelmast -BothWayTurnoutOnly = 2-Richting NX is niet mogelijk indien zowel bij het In- als het Uitrijpunt een Seinmast staat. - -ColumnFrom = Inrit -ColumnTo = Uitrit -ColumnBoth = 2-Richting -DispatcherInt = Integreer met Verkeersleiding -WindowTitleStackRoutes = Gestapelde paden - -PromptUser = Vraag mij -ClearRoute = Geef Route vrij -CancelRoute = Annuleer Route -StackRoute = Stapel Route - -# colors use jmrit.Bundle - -# Properties for jmri.jmrit.signalling GUI Tools elements -# Original file: SignallingGuiTools_nl.properties LeaveButton = Laat staan RemoveButton = Verwijder diff --git a/java/src/jmri/jmrit/signalling/SignallingGuiTools.java b/java/src/jmri/jmrit/signalling/SignallingGuiTools.java index 237bb537825..ab3e1ba5f2f 100644 --- a/java/src/jmri/jmrit/signalling/SignallingGuiTools.java +++ b/java/src/jmri/jmrit/signalling/SignallingGuiTools.java @@ -104,7 +104,7 @@ static public void removeAlreadyAssignedSignalMastLogic(JmriJFrame frame, Signal Object[] options = {Bundle.getMessage("RemoveButton"), // NOI18N Bundle.getMessage("LeaveButton")}; // NOI18N int n = JOptionPane.showOptionDialog(frame, - java.text.MessageFormat.format(Bundle.getMessage("RemoveAlreadyLogic"), // NOI18N + java.text.MessageFormat.format(Bundle.getMessage("RemoveAlreadyAssignedLogic"), // NOI18N new Object[]{mast.getDisplayName()}), Bundle.getMessage("RemoveLogicTitle"), // NOI18N JOptionPane.YES_NO_CANCEL_OPTION, diff --git a/java/src/jmri/jmrit/signalling/SignallingGuiTools_fr.properties b/java/src/jmri/jmrit/signalling/SignallingGuiTools_fr.properties deleted file mode 100644 index 6cbc57a6ea8..00000000000 --- a/java/src/jmri/jmrit/signalling/SignallingGuiTools_fr.properties +++ /dev/null @@ -1,9 +0,0 @@ -UpdateButton = Mise \u00e0 Jour -LeaveButton = Quitter -RemoveButton = Annuler -UpdateLogicTitle = Mise \u00e0 Jour Logique -RemoveLogicTitle = Annuler Logique -SwapLogic = Le M\u00e2t de Signalisation {0} et {1}\n ont \u00e9t\u00e9 perrmut\u00e9s \ndVoulez-vous mettre \u00e0 jour toutes les logiques pour refl\u00e9ter ceci? -RemoveLogic = Le M\u00e2t de Signalisation {0} a \u00e9t\u00e9 enlev\u00e9,\n voulez-vous enlever la logique associ\u00e9e? -RemoveAlreadyAssignedLogic = Le M\u00e2t de Signalisation {0} est d\u00e9j\u00e0 affect\u00e9 avec les logiques \n voulez-vous enlever la logique associ\u00e9e? -UpdateLogic = Le M\u00e2t de Signalisation {0} a \u00e9t\u00e9 remplac\u00e9 par {1}\n Voulez-vous mettre \u00e0 jour toutes les logiques pour refl\u00e9ter ceci? diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle.properties deleted file mode 100644 index dc10c76b95b..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle.properties +++ /dev/null @@ -1,20 +0,0 @@ -# Bundle.properties -# -# Default properties for the jmri.jmrit.signalling.entryexit GUI elements -WindowTitleStackRoutes = Stacked Routes - -MenuEntryExit = Entry Exit -MenuItemClearRoute = Clear Route -MenuItemCancelRoute = Cancel Route -MenuItemLockManualRoute = Lock Manual Route - -BeanNameDestination = NX Destination Point -StackRouteAsk = Would you like to Stack the Route? -RouteNotClear = Route Not Clear -Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. - -Stack = Stack -ClearDown = Clear Down -Exit = Exit -InterlockPrompt = What would you like to do with this interlock? -Interlock = Interlock diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle_ca.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle_ca.properties deleted file mode 100644 index f94f2d4810e..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle_ca.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Catalan Translation: Joan de Castro (joan276dca@yahoo.es) 18/08/2016 - -WindowTitleStackRoutes = Itineraris blocats - -MenuEntryExit = Entrada Sortida -MenuItemClearRoute = Neteja itinerari -MenuItemCancelRoute = Cancel\u00b7la Itinerari -MenuItemLockManualRoute = Bloqueja Itinerari Manual - -BeanNameDestination = Punt de destinaci\u00f3 NX -#+ StackRouteAsk = Would you like to Stack the Route? -#+ RouteNotClear = Route Not Clear -#+ Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. - -#+ Stack = Stack -#+ ClearDown = Clear Down -#+ Exit = Exit -#+ InterlockPrompt = What would you like to do with this interlock? -#+ Interlock = Interlock diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle_da.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle_da.properties deleted file mode 100644 index f3d06f1827d..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle_da.properties +++ /dev/null @@ -1,17 +0,0 @@ -#+ WindowTitleStackRoutes = Stacked Routes - -#+ MenuEntryExit = Entry Exit -#+ MenuItemClearRoute = Clear Route -#+ MenuItemCancelRoute = Cancel Route -#+ MenuItemLockManualRoute = Lock Manual Route - -#+ BeanNameDestination = NX Destination Point -#+ StackRouteAsk = Would you like to Stack the Route? -#+ RouteNotClear = Route Not Clear -#+ Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. - -#+ Stack = Stack -#+ ClearDown = Clear Down -#+ Exit = Exit -#+ InterlockPrompt = What would you like to do with this interlock? -#+ Interlock = Interlock diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle_de.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle_de.properties deleted file mode 100644 index 3b3de53c6ae..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle_de.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Bundle_de.properties -# -# German properties for the jmri.jmrit.signalling.entryexit GUI elements -WindowTitleStackRoutes=Aufgestapelte Fahrstra\u00dfe - -MenuItemClearRoute=Gebe Fahrstra\u00dfe frei -MenuItemCancelRoute=Annuliere Fahrstra\u00dfe -MenuItemLockManualRoute=Verriegle handm\u00e4\u00dfige Fahrstra\u00dfe - -BeanNameDestination=NX Zielpunkt -StackRouteAsk = Willst du die Fahrstra\u00dfe aufstapeln? -RouteNotClear = Fahrstra\u00dfe nicht Frei -Error1 = Keine Auswahl in der Liste.\nMache auswahl und klicke {0} oder lass aufgestapelt. - -Stack = Aufstapeln -ClearDown = Ab hier freigeben -Exit = Verlasse -InterlockPrompt = Was soll mit dieser Verrieglung geschehen? -Interlock = Fahrstra\u00dfenverrieglung diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle_fr.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle_fr.properties deleted file mode 100644 index e2306442c86..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle_fr.properties +++ /dev/null @@ -1,8 +0,0 @@ -WindowTitleStackRoutes = Itin\u00e9raire Superpos\u00e9s - -ButtonCancel = Annuler -MenuEntryExit = Entr\u00e9e Sortie -MenuItemClearRoute = Nettoyer Itin\u00e9raire -MenuItemLockManualRoute = Verrouillage Manuel de l'Itin\u00e9raire - -BeanNameDestination = Point de Destination NX diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle_it.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle_it.properties deleted file mode 100644 index 989aa39fd7d..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle_it.properties +++ /dev/null @@ -1,17 +0,0 @@ -WindowTitleStackRoutes = Itinerari Impilati - -MenuEntryExit = Ingresso-Uscita -MenuItemClearRoute = Pulisci Itinerario -MenuItemCancelRoute = Annulla Itinerario -MenuItemLockManualRoute = Blocca itinerario manuale - -#+ BeanNameDestination = NX Destination Point -#+ StackRouteAsk = Would you like to Stack the Route? -#+ RouteNotClear = Route Not Clear -#+ Error1 = No item was selected in the list.\nPlease do so and click {0} or leave Route Stacked. - -#+ Stack = Stack -#+ ClearDown = Clear Down -#+ Exit = Exit -#+ InterlockPrompt = What would you like to do with this interlock? -#+ Interlock = Interlock diff --git a/java/src/jmri/jmrit/signalling/entryexit/Bundle_nl.properties b/java/src/jmri/jmrit/signalling/entryexit/Bundle_nl.properties deleted file mode 100644 index 4ff383a602d..00000000000 --- a/java/src/jmri/jmrit/signalling/entryexit/Bundle_nl.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Bundle_nl.properties -# -# Dutch properties for the jmri.jmrit.signalling.entryexit GUI elements -WindowTitleStackRoutes = Rijwegen in Wachtrij - -MenuItemClearRoute = Geef Rijweg vrij -MenuItemCancelRoute = Annuleer Rijweg -MenuItemLockManualRoute = Reserveer handmatige Rijweg - -BeanNameDestination = NX Eindpunt -StackRouteAsk = Rijweg in de wachtrij zetten? -RouteNotClear = Rijweg niet vrij -Error1 = Er was geen selectie in de lijst.\nMaak een keuze en klik op {0} of laat in Wachtrij staan. - -Stack = In Wachtrij -ClearDown = Vanaf hier vrijgeven -Exit = Verlaat -InterlockPrompt = Wat moet er met de Rijwegbeveiliging gebeuren? -Interlock = Rijwegbeveiliging diff --git a/java/src/jmri/jmrit/simpleprog/SimpleProgFrame.java b/java/src/jmri/jmrit/simpleprog/SimpleProgFrame.java index 29f121199c8..64dae52e5f0 100644 --- a/java/src/jmri/jmrit/simpleprog/SimpleProgFrame.java +++ b/java/src/jmri/jmrit/simpleprog/SimpleProgFrame.java @@ -26,7 +26,7 @@ public class SimpleProgFrame extends jmri.util.JmriJFrame implements jmri.ProgLi javax.swing.JToggleButton readButton = new javax.swing.JToggleButton(); javax.swing.JToggleButton writeButton = new javax.swing.JToggleButton(); // use JSpinner for CV number input - SpinnerNumberModel model = new SpinnerNumberModel(0, 0, 1024, 1); // 1024 is highest CV number documented by NMRA as per 2017 + SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 1024, 1); // 1024 is highest CV number documented by NMRA as per 2017 JSpinner addrField = new JSpinner(model); javax.swing.JTextField valField = new javax.swing.JTextField(4); diff --git a/java/src/jmri/jmrit/symbolicprog/CvValue.java b/java/src/jmri/jmrit/symbolicprog/CvValue.java index 64a0828aa1e..2c351889554 100644 --- a/java/src/jmri/jmrit/symbolicprog/CvValue.java +++ b/java/src/jmri/jmrit/symbolicprog/CvValue.java @@ -384,7 +384,7 @@ public void confirm(JLabel status) { Bundle.getMessage("StateExceptionDuringConfirm"), new Object[]{e.toString()})); } - log.warn("Exception during CV read: " + e); // NOI18N + log.warn("Exception during CV confirm: " + e); // NOI18N setBusy(false); } } else { diff --git a/java/src/jmri/jmrit/symbolicprog/tabbedframe/PaneProgFrame.java b/java/src/jmri/jmrit/symbolicprog/tabbedframe/PaneProgFrame.java index 30ef7f63f6b..dc80d9600c3 100644 --- a/java/src/jmri/jmrit/symbolicprog/tabbedframe/PaneProgFrame.java +++ b/java/src/jmri/jmrit/symbolicprog/tabbedframe/PaneProgFrame.java @@ -500,11 +500,12 @@ public PaneProgFrame(DecoderFile pDecoderFile, @Nonnull RosterEntry pRosterEntry Programmer pf = mProgrammer; if (getDoConfirmRead()) { pf = new jmri.implementation.VerifyWriteProgrammerFacade(pf); + log.debug("adding VerifyWriteProgrammerFacade, new programmer is {}", pf); } // add any facades defined in the decoder file pf = jmri.implementation.ProgrammerFacadeSelector - .loadFacadeElements(programming, pf, getCanCacheDefault()); - log.debug("new programmer {}", pf); + .loadFacadeElements(programming, pf, getCanCacheDefault(), pProg); + log.debug("added any other FacadeElements, new programmer is {}", pf); mProgrammer = pf; cvModel.setProgrammer(pf); resetModel.setProgrammer(pf); diff --git a/java/src/jmri/jmrix/AbstractConnectionConfig.java b/java/src/jmri/jmrix/AbstractConnectionConfig.java index ff91333a9d4..44d6df9dac5 100644 --- a/java/src/jmri/jmrix/AbstractConnectionConfig.java +++ b/java/src/jmri/jmrix/AbstractConnectionConfig.java @@ -128,6 +128,15 @@ public String getItem() { protected ArrayList additionalItems = new ArrayList<>(0); + /** + * Load the Swing widgets needed to configure this connection into a + * specified JPanel. Used during the configuration process to fill out the + * preferences window with content specific to this Connection type. The + * JPanel contents need to handle their own gets/sets to the underlying + * Connection content. + * + * @param details The specific Swing object to be configured and filled. + */ @Override abstract public void loadDetails(final JPanel details); @@ -194,10 +203,7 @@ protected int addStandardDetails(PortAdapter adapter, boolean incAdvanced, int i abstract public void setDisabled(boolean disable); /** - * Register the ConnectionConfig with the running JMRI process. It is - * strongly recommended that overriding implementations call - * super.register() since this implementation performs all required - * registration tasks. + * {@inheritDoc} */ @Override public void register() { diff --git a/java/src/jmri/jmrix/AbstractMRNodeTrafficController.java b/java/src/jmri/jmrix/AbstractMRNodeTrafficController.java index b808b2b718b..490ce5fbed7 100644 --- a/java/src/jmri/jmrix/AbstractMRNodeTrafficController.java +++ b/java/src/jmri/jmrix/AbstractMRNodeTrafficController.java @@ -140,7 +140,7 @@ public synchronized void deleteNode(int nodeAddress) { // Delete the node from the node list numNodes--; if (index < numNodes) { - // did not delete the last node, shift + // did not delete the last node, shift for (int j = index; j < numNodes; j++) { nodeArray[j] = nodeArray[j + 1]; } diff --git a/java/src/jmri/jmrix/AbstractPortController.java b/java/src/jmri/jmrix/AbstractPortController.java index 02baea3bcb1..c3172745ba5 100644 --- a/java/src/jmri/jmrix/AbstractPortController.java +++ b/java/src/jmri/jmrix/AbstractPortController.java @@ -4,6 +4,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.util.HashMap; +import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.OverridingMethodsMustInvokeSuper; import org.slf4j.Logger; @@ -144,10 +145,10 @@ public String getOption4Name() { */ @Override public String[] getOptions() { - String[] arr = options.keySet().toArray(new String[0]); - java.util.Arrays.sort(arr); - return arr; - + Set keySet = options.keySet(); + String[] result = keySet.toArray(new String[keySet.size()]); + java.util.Arrays.sort(result); + return result; } /** @@ -253,7 +254,7 @@ boolean isDirty() { @Override public String getManufacturer() { - return this.manufacturerName; + return manufacturerName; } @Override diff --git a/java/src/jmri/jmrix/AbstractSerialPortController.java b/java/src/jmri/jmrix/AbstractSerialPortController.java index 1f6c50364e1..8a5dda8c844 100644 --- a/java/src/jmri/jmrix/AbstractSerialPortController.java +++ b/java/src/jmri/jmrix/AbstractSerialPortController.java @@ -29,10 +29,13 @@ protected AbstractSerialPortController(SystemConnectionMemo connectionMemo) { /** * Standard error handling for port-busy case. - * @param p the exception being handled, if additional information from it is desired + * + * @param p the exception being handled, if additional information + * from it is desired * @param portName name of the port being accessed - * @param log where to log a status message - * @return Localized message, in case separate presentation to user is desired + * @param log where to log a status message + * @return Localized message, in case separate presentation to user is + * desired */ @Override public String handlePortBusy(PortInUseException p, String portName, Logger log) { @@ -67,7 +70,7 @@ public void connect() throws java.io.IOException { */ @Override public void setPort(String port) { - log.debug("Setting port to "+port); + log.debug("Setting port to " + port); mPort = port; } protected String mPort = null; @@ -95,34 +98,40 @@ public String getCurrentPortName() { } /** - * Set the control leads and flow control. - * This handles any necessary ordering. + * Set the control leads and flow control. This handles any necessary + * ordering. + * * @param serialPort Port to be updated - * @param flow flow control mode from (@link purejavacomm.SerialPort} - * @param rts Set RTS active if true - * @param dtr set DTR active if true + * @param flow flow control mode from (@link purejavacomm.SerialPort} + * @param rts Set RTS active if true + * @param dtr set DTR active if true */ protected void configureLeadsAndFlowControl(SerialPort serialPort, int flow, boolean rts, boolean dtr) { serialPort.setRTS(rts); serialPort.setDTR(dtr); try { - if (flow!=purejavacomm.SerialPort.FLOWCONTROL_NONE) serialPort.setFlowControlMode(flow); + if (flow != purejavacomm.SerialPort.FLOWCONTROL_NONE) { + serialPort.setFlowControlMode(flow); + } } catch (purejavacomm.UnsupportedCommOperationException e) { log.warn("Could not set flow control, ignoring"); } - if (flow!=purejavacomm.SerialPort.FLOWCONTROL_RTSCTS_OUT) serialPort.setRTS(rts); // not connected in some serial ports and adapters - serialPort.setDTR(dtr); + if (flow != purejavacomm.SerialPort.FLOWCONTROL_RTSCTS_OUT) { + serialPort.setRTS(rts); // not connected in some serial ports and adapters + } + serialPort.setDTR(dtr); } - /** + /** * Sets the flow control, while also setting RTS and DTR to active. + * * @param serialPort Port to be updated - * @param flow flow control mode from (@link purejavacomm.SerialPort} + * @param flow flow control mode from (@link purejavacomm.SerialPort} */ protected void configureLeadsAndFlowControl(SerialPort serialPort, int flow) { configureLeadsAndFlowControl(serialPort, flow, true, true); } - + /** * {@inheritDoc} */ @@ -146,7 +155,7 @@ public String getCurrentBaudRate() { /** * Get an array of valid baud rates as integers. This allows subclasses to * change the arrays of speeds. - * + *

                * This method need not be reimplemented unless the subclass is using * currentBaudNumber, which requires it. */ @@ -158,7 +167,7 @@ public int[] validBaudNumber() { /** * Convert a baud rate String to a int number,e.g. "9,600" to 9600. - * + *

                * Uses the validBaudNumber and validBaudRates methods to do this. * * @param currentBaudRate a rate from validBaudRates @@ -209,7 +218,7 @@ public Vector getPortNames() { // find the names of suitable ports while (portIDs.hasMoreElements()) { CommPortIdentifier id = portIDs.nextElement(); - // filter out line printers + // filter out line printers if (id.getPortType() != CommPortIdentifier.PORT_PARALLEL) // accumulate the names in a vector { portNameVector.addElement(id.getName()); @@ -245,14 +254,14 @@ public void recover() { /*Each serial port adapter should handle this and it should be abstract. However this is in place until all the other code has been refactored */ - protected void closeConnection() { - System.out.println("crap Called"); + log.warn("abstract closeConnection() called; should be overriden"); } - /*Each port adapter shoudl handle this and it should be abstract. + /*Each port adapter should handle this and it should be abstract. However this is in place until all the other code has been refactored */ protected void resetupConnection() { + log.warn("abstract resetupConnection() called; should be overriden"); } /** @@ -340,5 +349,4 @@ public void run() { } private final static Logger log = LoggerFactory.getLogger(AbstractSerialPortController.class); - } diff --git a/java/src/jmri/jmrix/AbstractUsbConnectionConfig.java b/java/src/jmri/jmrix/AbstractUsbConnectionConfig.java new file mode 100644 index 00000000000..2c575f91027 --- /dev/null +++ b/java/src/jmri/jmrix/AbstractUsbConnectionConfig.java @@ -0,0 +1,535 @@ +package jmri.jmrix; + +import java.awt.Color; +import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.ItemEvent; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Nonnull; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JViewport; +import javax.swing.ListCellRenderer; +import jmri.InstanceManager; +import jmri.UserPreferencesManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract base class for common implementation of the ConnectionConfig + * + * @author Bob Jacobsen Copyright (C) 2001, 2003 + * @author George Warner Copyright (C) 2017 + */ +abstract public class AbstractUsbConnectionConfig extends AbstractConnectionConfig { + /** + * Ctor for a functional object with no preexisting adapter. Expect that the + * subclass setInstance() will fill the adapter member. + */ + public AbstractUsbConnectionConfig() { + this(null); + log.debug("* AbstractUSBConnectionConfig()"); + } + + public AbstractUsbConnectionConfig(UsbPortAdapter p) { + adapter = p; + //addToActionList(); + log.debug("* AbstractUSBConnectionConfig({})", p); + } + + protected UsbPortAdapter adapter = null; + + @Override + public UsbPortAdapter getAdapter() { + log.debug("* getAdapter()"); + return adapter; + } + + protected boolean init = false; + + @SuppressWarnings("unchecked") + @Override + protected void checkInitDone() { + if (log.isDebugEnabled()) { + log.debug("init called for " + name()); + } + if (!init) { + if (adapter.getSystemConnectionMemo() != null) { + systemPrefixField.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (!adapter.getSystemConnectionMemo().setSystemPrefix(systemPrefixField.getText())) { + JOptionPane.showMessageDialog(null, Bundle.getMessage("ConnectionPrefixDialog", systemPrefixField.getText())); + systemPrefixField.setText(adapter.getSystemConnectionMemo().getSystemPrefix()); + } + } + }); + systemPrefixField.addFocusListener(new FocusListener() { + @Override + public void focusLost(FocusEvent e) { + if (!adapter.getSystemConnectionMemo().setSystemPrefix(systemPrefixField.getText())) { + JOptionPane.showMessageDialog(null, Bundle.getMessage("ConnectionPrefixDialog", systemPrefixField.getText())); + systemPrefixField.setText(adapter.getSystemConnectionMemo().getSystemPrefix()); + } + } + + @Override + public void focusGained(FocusEvent e) { + } + }); + connectionNameField.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (!adapter.getSystemConnectionMemo().setUserName(connectionNameField.getText())) { + JOptionPane.showMessageDialog(null, Bundle.getMessage("ConnectionNameDialog", connectionNameField.getText())); + connectionNameField.setText(adapter.getSystemConnectionMemo().getUserName()); + } + } + }); + connectionNameField.addFocusListener(new FocusListener() { + @Override + public void focusLost(FocusEvent e) { + if (!adapter.getSystemConnectionMemo().setUserName(connectionNameField.getText())) { + JOptionPane.showMessageDialog(null, Bundle.getMessage("ConnectionNameDialog", connectionNameField.getText())); + connectionNameField.setText(adapter.getSystemConnectionMemo().getUserName()); + } + } + + @Override + public void focusGained(FocusEvent e) { + } + }); + } + portBox.addFocusListener(new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + refreshPortBox(); + } + + @Override + public void focusLost(FocusEvent e) { + } + + }); + + for (String i : options.keySet()) { + final String item = i; + if (options.get(i).getComponent() instanceof JComboBox) { + ((JComboBox) options.get(i).getComponent()).addActionListener((ActionEvent e) -> { + adapter.setOptionState(item, options.get(item).getItem()); + }); + } + } + init = true; + } // if (!init) + } // checkInitDone() + + @Override + public void updateAdapter() { + log.debug("* updateAdapter()"); + } + + protected UserPreferencesManager p = InstanceManager.getDefault(UserPreferencesManager.class); + protected JComboBox portBox = new JComboBox<>(); + protected JLabel portBoxLabel; + + @Override + public String getInfo() { + log.debug("* getInfo()"); + String t = (String) portBox.getSelectedItem(); + if (t != null) { + return t; + } else if ((adapter != null) && (adapter.getCurrentPortName() != null)) { + return adapter.getCurrentPortName(); + } + + return JmrixConfigPane.NONE; + } + + List newList = null; + List originalList = null; + String invalidPort = null; + + public void refreshPortBox() { + log.debug("* refreshPortBox()"); + if (!init) { + newList = getPortNames(); + portBox.setRenderer(new ComboBoxRenderer()); + // Add this line to ensure that the combo box header isn't made too narrow + portBox.setPrototypeDisplayValue("A fairly long port name of 40 characters"); //NO18N + } else { + List v2 = getPortNames(); + if (v2.equals(originalList)) { + log.debug("List of valid Ports has not changed, therefore we will not refresh the port list"); + // but we will insist on setting the current value into the port + adapter.setPort((String) portBox.getSelectedItem()); + return; + } + log.debug("List of valid Ports has been changed, therefore we will refresh the port list"); + newList = new ArrayList<>(v2); + } + + if (newList == null) { + log.error("port name List v is null!"); + return; + } + + /* as we make amendments to the list of port in newList, we keep a copy of it before + modification, this copy is then used to validate against any changes in the port lists. + */ + originalList = new ArrayList<>(newList); + if (portBox.getActionListeners().length > 0) { + portBox.removeActionListener(portBox.getActionListeners()[0]); + } + portBox.removeAllItems(); + log.debug("getting fresh list of available Serial Ports"); + + if (newList.isEmpty()) { + newList.add(0, Bundle.getMessage("noPortsFound")); + } + String portName = adapter.getCurrentPortName(); + if (portName != null && !portName.equals(Bundle.getMessage("noneSelected")) && !portName.equals(Bundle.getMessage("noPortsFound"))) { + if (!newList.contains(portName)) { + newList.add(0, portName); + invalidPort = portName; + portBox.setForeground(Color.red); + } else if (invalidPort != null && invalidPort.equals(portName)) { + invalidPort = null; + } + } else { + if (!newList.contains(portName)) { + newList.add(0, Bundle.getMessage("noneSelected")); + } else if (p.getComboBoxLastSelection(adapter.getClass().getName() + ".port") == null) { + newList.add(0, Bundle.getMessage("noneSelected")); + } + } + + updateUsbPortNames(portName, portBox, newList); + + // If there's no name selected, select one that seems most likely + boolean didSetName = false; + if ((portName == null) + || portName.equals(Bundle.getMessage("noneSelected")) + || portName.equals(Bundle.getMessage("noPortsFound"))) { +// for (int i = 0; i < portBox.getItemCount(); i++) { +// for (String friendlyName : getPortFriendlyNames()) { +// if ((portBox.getItemAt(i)).contains(friendlyName)) { +// portBox.setSelectedIndex(i); +// adapter.setPort(portBox.getItemAt(i)); +// didSetName = true; +// break; +// } +// } +// } + // if didn't set name, don't leave it hanging + if (!didSetName) { + portBox.setSelectedIndex(0); + } + } + // finally, insist on synchronization of selected port name with underlying port + + adapter.setPort((String) portBox.getSelectedItem()); + + // add a listener for later changes + portBox.addActionListener( + (ActionEvent e) -> { + String port = (String) portBox.getSelectedItem(); + adapter.setPort(port); + } + ); + } + + /** + * {@inheritDoc} + */ + @Override + public void loadDetails(final JPanel details) { + log.debug("* loadDetails()"); + _details = details; + setInstance(); + if (!init) { + //Build up list of options + String[] optionsAvailable = adapter.getOptions(); + options.clear(); + for (String i : optionsAvailable) { + JComboBox opt = new JComboBox<>(adapter.getOptionChoices(i)); + opt.setSelectedItem(adapter.getOptionState(i)); + // check that it worked + if (!adapter.getOptionState(i).equals(opt.getSelectedItem())) { + // no, set 1st option choice + opt.setSelectedIndex(0); + // log before setting new value to show old value + log.warn("Loading found invalid value for option {}, found \"{}\", setting to \"{}\"", i, adapter.getOptionState(i), opt.getSelectedItem()); + adapter.setOptionState(i, (String) opt.getSelectedItem()); + } + options.put(i, new Option(adapter.getOptionDisplayName(i), opt, adapter.isOptionAdvanced(i))); + } + } + + try { + newList = getPortNames(); + if (log.isDebugEnabled()) { + log.debug("loadDetails called in class " + this.getClass().getName()); + log.debug("adapter class: " + adapter.getClass().getName()); + log.debug("loadDetails called for " + name()); + if (newList != null) { + log.debug("Found " + newList.size() + " ports"); + } else { + log.debug("Zero-length port List"); + } + } + } catch (UnsatisfiedLinkError e1) { + log.error("UnsatisfiedLinkError - the serial library has not been installed properly"); + log.error("java.library.path=" + System.getProperty("java.library.path", "")); + JOptionPane.showMessageDialog(null, "Failed to load comm library.\nYou have to fix that before setting preferences."); + return; + } + + if (adapter.getSystemConnectionMemo() != null) { + systemPrefixField.setText(adapter.getSystemConnectionMemo().getSystemPrefix()); + connectionNameField.setText(adapter.getSystemConnectionMemo().getUserName()); + NUMOPTIONS = NUMOPTIONS + 2; + } + + refreshPortBox(); + + NUMOPTIONS = NUMOPTIONS + options.size(); + + portBoxLabel = new JLabel(Bundle.getMessage("UsbPortLocationLabel")); + + showAdvanced.setFont(showAdvanced.getFont().deriveFont(9f)); + showAdvanced.setForeground(Color.blue); + showAdvanced.addItemListener((ItemEvent e) -> { + showAdvancedItems(); + }); + showAdvancedItems(); + init = false; // need to reload action listeners + checkInitDone(); + } + + @Override + protected void showAdvancedItems() { + log.debug("* showAdvancedItems()"); + _details.removeAll(); + cL.anchor = GridBagConstraints.WEST; + cL.insets = new Insets(2, 5, 0, 5); + cR.insets = new Insets(2, 0, 0, 5); + cR.anchor = GridBagConstraints.WEST; + cR.gridx = 1; + cL.gridx = 0; + int i = 0; + + boolean incAdvancedOptions = isPortAdvanced(); + + if (!incAdvancedOptions) { + for (String item : options.keySet()) { + if (options.get(item).isAdvanced()) { + incAdvancedOptions = true; + break; + } + } + } + + _details.setLayout(gbLayout); + + i = addStandardDetails(incAdvancedOptions, i); + + showAdvanced.setVisible(incAdvancedOptions); + + if (incAdvancedOptions && showAdvanced.isSelected()) { + if (isPortAdvanced()) { + cR.gridy = i; + cL.gridy = i; + gbLayout.setConstraints(portBoxLabel, cL); + gbLayout.setConstraints(portBox, cR); + + //panel.add(row1Label); + _details.add(portBoxLabel); + _details.add(portBox); + i++; + } + + for (String item : options.keySet()) { + if (options.get(item).isAdvanced()) { + cR.gridy = i; + cL.gridy = i; + gbLayout.setConstraints(options.get(item).getLabel(), cL); + gbLayout.setConstraints(options.get(item).getComponent(), cR); + _details.add(options.get(item).getLabel()); + _details.add(options.get(item).getComponent()); + i++; + } + } + } + cL.gridwidth = 2; + for (JComponent item : additionalItems) { + cL.gridy = i; + gbLayout.setConstraints(item, cL); + _details.add(item); + i++; + } + cL.gridwidth = 1; + + if ((_details.getParent() != null) + && (_details.getParent() instanceof JViewport)) { + JViewport vp = (JViewport) _details.getParent(); + vp.revalidate(); + vp.repaint(); + } + } + + protected int addStandardDetails(boolean incAdvanced, int i) { + log.debug("* addStandardDetails()"); + if (!isPortAdvanced()) { + cR.gridy = i; + cL.gridy = i; + gbLayout.setConstraints(portBoxLabel, cL); + gbLayout.setConstraints(portBox, cR); + _details.add(portBoxLabel); + _details.add(portBox); + i++; + } + + return addStandardDetails(adapter, incAdvanced, i); + } + + public boolean isPortAdvanced() { + log.debug("* isPortAdvanced()"); + return false; + } + + @Override + public String getManufacturer() { + log.debug("* getManufacturer()"); + return adapter.getManufacturer(); + } + + @Override + public void setManufacturer(String manufacturer) { + log.debug("* setManufacturer('{}')", manufacturer); + if (adapter != null) { + adapter.setManufacturer(manufacturer); + } + } + + @Override + public boolean getDisabled() { + log.debug("* getDisabled()"); + if (adapter == null) { + return true; + } + return adapter.getDisabled(); + } + + @Override + public void setDisabled(boolean disabled) { + log.debug("* setDisabled({})", disabled ? "True" : "False"); + if (adapter != null) { + adapter.setDisabled(disabled); + } + } + + @Override + public String getConnectionName() { + log.debug("* getConnectionName()"); + if ((adapter != null) && (adapter.getSystemConnectionMemo() != null)) { + return adapter.getSystemConnectionMemo().getUserName(); + } else { + return name(); + } + } + + @Override + public void dispose() { + log.debug("* dispose()"); + if (adapter != null) { + adapter.dispose(); + adapter = null; + } + //removeFromActionList(); + super.dispose(); + + } + + class ComboBoxRenderer extends JLabel + implements ListCellRenderer { + + public ComboBoxRenderer() { + setHorizontalAlignment(LEFT); + setVerticalAlignment(CENTER); + } + + /* + * This method finds the image and text corresponding + * to the selected value and returns the label, set up + * to display the text and image. + */ + @Override + public Component getListCellRendererComponent( + JList list, + String name, + int index, + boolean isSelected, + boolean cellHasFocus) { + + String displayName = name; + setOpaque(index > -1); + setForeground(Color.black); + list.setSelectionForeground(Color.black); + if (isSelected && index > -1) { + setBackground(list.getSelectionBackground()); + } else { + setBackground(list.getBackground()); + } + if (invalidPort != null) { + String port = displayName; + if ((port == null) || port.isEmpty() || port.equals(invalidPort)) { + list.setSelectionForeground(Color.red); + setForeground(Color.red); + } + } + + setText(displayName); + + return this; + } + } + + /** + * Handle friendly port names. Note that this changes the selection in + * portCombo, so that should be tracked after this returns. + * + * @param portName The currently-selected port name + * @param portCombo The combo box that's displaying the available ports + * @param portList The list of valid (unfriendly) port names + */ + protected synchronized static void updateUsbPortNames(String portName, JComboBox portCombo, List portList) { + for (int i = 0; i < portList.size(); i++) { + String commPort = portList.get(i); + portCombo.addItem(commPort); + if (commPort.equals(portName)) { + portCombo.setSelectedIndex(i); + } + } + } + + @Nonnull + protected List getPortNames() { + log.error("getPortNames() called in abstract class; should be overridden."); + return new ArrayList<>(); + } + + private final static Logger log + = LoggerFactory.getLogger(AbstractUsbConnectionConfig.class); + +} diff --git a/java/src/jmri/jmrix/JmrixBundle.properties b/java/src/jmri/jmrix/JmrixBundle.properties index 567216e4652..8f19a5c0198 100644 --- a/java/src/jmri/jmrix/JmrixBundle.properties +++ b/java/src/jmri/jmrix/JmrixBundle.properties @@ -53,7 +53,11 @@ TooltipChooseLogFile = Click here to select a new output log file SystemManufacturer = System manufacturer SystemConnection = System connection Settings = Settings +# generic connection type descriptions +TypeSerial = Serial +TypeUSB = USB SerialPortLabel = Serial port: +UsbPortLocationLabel = Usb Port Location: BaudRateLabel = Baud rate: CommunicationPortLabel = Communication Port: #FlowControlTitle = Flow Control @@ -208,7 +212,6 @@ NotYetDialogString = Sorry, this function is not yet operational.\n({0}) # Command/Packet frame items MenuItemSendCommand = Send Command SendXCommandTitle = Send {0} Command -SendPacketTitle = Send Packet CommandLabel = Command: ReplyLabel = Reply: PacketLabel = Packet: @@ -226,7 +229,6 @@ SendOneLabel = Send one packet: SendSequenceLabel = Send a sequence of packets: Packet = Packet WaitMsec = Wait (msec) -ButtonGo = Go # cmri/rps/maple/acela shared items ConfigNodesTitle = Configure Nodes diff --git a/java/src/jmri/jmrix/JmrixBundle_da.properties b/java/src/jmri/jmrix/JmrixBundle_da.properties index 6f4eaf5d069..4433bd3cfa4 100644 --- a/java/src/jmri/jmrix/JmrixBundle_da.properties +++ b/java/src/jmri/jmrix/JmrixBundle_da.properties @@ -208,7 +208,6 @@ NotYetDialogString = Sorry, this function is not yet operational.\n({0}) # Command/Packet frame items MenuItemSendCommand = Send Command SendXCommandTitle = Send {0} Command -SendPacketTitle = Send Packet CommandLabel = Command: ReplyLabel = Reply: PacketLabel = Packet: diff --git a/java/src/jmri/jmrix/JmrixBundle_de.properties b/java/src/jmri/jmrix/JmrixBundle_de.properties index 40165026035..a047a3f5b40 100644 --- a/java/src/jmri/jmrix/JmrixBundle_de.properties +++ b/java/src/jmri/jmrix/JmrixBundle_de.properties @@ -72,6 +72,8 @@ PortFieldToolTip = Portnummer der TCP Verbindung AdNameFieldToolTip = Erwartete ZeroConf/mDNS Advertisement Identifikation ServiceTypeFieldLabel = Service Typ Name: ServiceTypeFieldToolTip = ZeroConf/mDNS Service Typ +# generic connection type description +TypeSerial = Serielle SerialPortLabel = Serielle Schnittstelle: BaudRateLabel = Baudzahl: TipBaudRateFixed = Die Baudzahl f\u00fcr dieses Protokoll is nicht einstellbar @@ -180,7 +182,6 @@ NotYetDialogString = Entschuldiging. Diese Option ist bisher nicht implemen # Packet frame items MenuItemSendCommand = Sende Befehl -SendPacketTitle = Sende Paket CommandLabel = Befehl: ReplyLabel = Antwort: PacketLabel = Paket: diff --git a/java/src/jmri/jmrix/JmrixBundle_fr.properties b/java/src/jmri/jmrix/JmrixBundle_fr.properties index ae6179b3225..77a8700ac90 100644 --- a/java/src/jmri/jmrix/JmrixBundle_fr.properties +++ b/java/src/jmri/jmrix/JmrixBundle_fr.properties @@ -50,9 +50,11 @@ TooltipAutoScroll = Si coch\u00e9e, toujours d\u00e9filer jusqu'\u00e0 la TooltipChooseLogFile = Cliquez ici pour s\u00e9lectionner une nouvelle sortie du fichier journal #JmrixConfigPane -SystemManufacturer = Fabricant syst\u00e8me -SystemConnection = Connexion syst\u00e8me -Settings = R\u00e9glages +SystemManufacturer = Fabricant syst\u00e8me +SystemConnection = Connexion syst\u00e8me +Settings = R\u00e9glages +TypeSerial = S\u00e9rie +TypeUSB = USB #JmrixAbstractConnectionConfig (item on the above ConfigPane) AdditionalConnectionSettings = R\u00e9glages Connexion Suppl\u00e9mentaire diff --git a/java/src/jmri/jmrix/JmrixBundle_nl.properties b/java/src/jmri/jmrix/JmrixBundle_nl.properties index 69e9c6db091..e6957934d11 100644 --- a/java/src/jmri/jmrix/JmrixBundle_nl.properties +++ b/java/src/jmri/jmrix/JmrixBundle_nl.properties @@ -62,6 +62,8 @@ ConnectionName = Connectie-naam: TipBaudRateFixed = Voor dit protocol ligt de baud rate vast TipBaudRateMatch = Dient overeen te komen met de baud rate instelling van de hardware BaudRateLabel = Baud rate (snelheid): +# generic connection type description +TypeSerial = Seri\u00eble SerialPortLabel = Seri\u00eble poort: #FlowControl items FlowOptionNo = geen flow control @@ -206,7 +208,6 @@ NotYetDialogString = Sorry, deze functie werkt nog niet.\n({0}) # Command/Packet frame items MenuItemSendCommand = Verstuur commando SendXCommandTitle = Verstuur {0}-commando -SendPacketTitle = Verstuur Packet CommandLabel = Commando: ReplyLabel = Antwoord: PacketLabel = Packet: @@ -224,7 +225,6 @@ SendOneLabel = Verstuur 1 packet: SendSequenceLabel = Verstuur reeks packets: Packet = Packet WaitMsec = wacht (ms) -ButtonGo = Start # cmri/rps/maple shared items LabelPoll = Verzoek diff --git a/java/src/jmri/jmrix/SystemConnectionMemo.java b/java/src/jmri/jmrix/SystemConnectionMemo.java index ad16f18d01a..a4c25666639 100644 --- a/java/src/jmri/jmrix/SystemConnectionMemo.java +++ b/java/src/jmri/jmrix/SystemConnectionMemo.java @@ -6,11 +6,11 @@ import java.util.ResourceBundle; import javax.annotation.Nonnull; import javax.annotation.OverridingMethodsMustInvokeSuper; -import jmri.InstanceManager; import jmri.ConsistManager; +import jmri.InstanceManager; +import jmri.beans.Bean; import jmri.implementation.DccConsistManager; import jmri.implementation.NmraConsistManager; -import jmri.beans.Bean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,6 +70,7 @@ public void register() { /** * Provide access to the system prefix string. + *

                * This was previously called the "System letter". * * @return System prefix @@ -109,6 +110,7 @@ public final boolean setSystemPrefix(@Nonnull String systemPrefix) { /** * Provide access to the system user name string. + *

                * This was previously fixed at configuration time. * * @return User name @@ -152,23 +154,23 @@ public final boolean setUserName(@Nonnull String userName) { */ @OverridingMethodsMustInvokeSuper public boolean provides(Class c) { - if(c.equals(jmri.ConsistManager.class)){ - if(consistManager!=null){ - return true; // we have a consist manager already - } else if(provides(jmri.CommandStation.class)){ - return true; // we can construct an NMRAConsistManager - } else if(provides(jmri.AddressedProgrammerManager.class)){ - return true; // we can construct a DccConsistManager - } else { - return false; - } + if (c.equals(jmri.ConsistManager.class)) { + if (consistManager != null) { + return true; // we have a consist manager already + } else if (provides(jmri.CommandStation.class)) { + return true; // we can construct an NMRAConsistManager + } else if (provides(jmri.AddressedProgrammerManager.class)) { + return true; // we can construct a DccConsistManager + } else { + return false; + } } else { - return false; // nothing, by default + return false; // nothing, by default } } /** - * Does this connection provide a manager of this type? + * get a manager of this type * * @param Type of manager to get * @param T Type of manager to get @@ -176,10 +178,10 @@ public boolean provides(Class c) { */ @OverridingMethodsMustInvokeSuper public T get(Class T) { - if(T.equals(jmri.ConsistManager.class)){ - return (T) getConsistManager(); + if (T.equals(jmri.ConsistManager.class)) { + return (T) getConsistManager(); } else { - return null; // nothing, by default + return null; // nothing, by default } } @@ -261,20 +263,20 @@ public boolean isRestartRequired() { * NOTE: Consist manager defaults to NULL */ public ConsistManager getConsistManager() { - if(consistManager == null) { - // a consist manager doesn't exist, so we can create it. - if(provides(jmri.CommandStation.class)){ - setConsistManager(new NmraConsistManager(get(jmri.CommandStation.class))); - } else if(provides(jmri.AddressedProgrammerManager.class)){ - setConsistManager(new DccConsistManager(get(jmri.AddressedProgrammerManager.class))); - } + if (consistManager == null) { + // a consist manager doesn't exist, so we can create it. + if (provides(jmri.CommandStation.class)) { + setConsistManager(new NmraConsistManager(get(jmri.CommandStation.class))); + } else if (provides(jmri.AddressedProgrammerManager.class)) { + setConsistManager(new DccConsistManager(get(jmri.AddressedProgrammerManager.class))); + } } return consistManager; } public void setConsistManager(ConsistManager c) { consistManager = c; - jmri.InstanceManager.store(consistManager,ConsistManager.class); + jmri.InstanceManager.store(consistManager, ConsistManager.class); } private ConsistManager consistManager = null; diff --git a/java/src/jmri/jmrix/UsbPortAdapter.java b/java/src/jmri/jmrix/UsbPortAdapter.java new file mode 100755 index 00000000000..e9d5db934e9 --- /dev/null +++ b/java/src/jmri/jmrix/UsbPortAdapter.java @@ -0,0 +1,218 @@ +package jmri.jmrix; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Nonnull; +import javax.usb.UsbControlIrp; +import javax.usb.UsbDevice; +import javax.usb.UsbDisconnectedException; +import javax.usb.UsbException; +import jmri.util.usb.UsbUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Enables basic setup of a USB interface for a jmrix implementation. + * + * @author George Warner Copyright (C) 2017 + */ +public class UsbPortAdapter extends AbstractPortController { + + private Short vendorID = 0; + private Short productID = 0; + private String serialNumber = null; + protected UsbDevice usbDevice = null; + + public UsbPortAdapter(SystemConnectionMemo memo) { + super(memo); + } + + public Short getVendorID() { + return vendorID; + } + + public void setVendorID(Short value) { + vendorID = value; + } + + public Short getProductID() { + return productID; + } + + public void setProductID(Short value) { + productID = value; + } + + /** + * Get the device serial number. + * + * @return the serial number or null if there is no serial number + */ + public String getSerialNumber() { + if (serialNumber != null && serialNumber.trim().isEmpty()) { + serialNumber = null; + } + return serialNumber; + } + + /** + * Set the device serial number. + * + * @param serialNumber the serial number; if null, empty, or only containing + * whitespace, sets property to null + */ + public void setSerialNumber(String serialNumber) { + if (serialNumber == null || serialNumber.trim().isEmpty()) { + this.serialNumber = null; + } else { + this.serialNumber = serialNumber; + } + } + + public UsbDevice getUsbDevice() { + if (usbDevice == null) { + log.debug("Getting device at {}", port); + String error = openPort(port, serialNumber); + if (error != null) { + log.error(error); + } + } + return usbDevice; + } + + public String openPort(String portName, String serialNumber) { + usbDevice = UsbUtil.getMatchingDevice(vendorID, productID, serialNumber, portName); + if (usbDevice == null) { + List< UsbDevice> usbDevices = UsbUtil.getMatchingDevices(vendorID, productID, serialNumber); + if (usbDevices.size() == 1) { + usbDevice = usbDevices.get(0); + } else { + // search for device with same vendor/product ID, but possibly different serial number + usbDevices = UsbUtil.getMatchingDevices(vendorID, productID, null); + if (usbDevices.size() == 1) { + usbDevice = usbDevices.get(0); + } else { + return String.format("Single USB device with vendor id %s and product id %s not found.", vendorID, productID); + } + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public void connect() throws java.io.IOException { + log.debug("connect()"); + } + + /** + * {@inheritDoc} + */ + @Override + public DataInputStream getInputStream() { + log.debug("getInputStream()"); + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public DataOutputStream getOutputStream() { + log.debug("getOutputStream()"); + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public void recover() { + log.debug("recover()"); + } + + /** + * {@inheritDoc} + */ + @Override + public void configure() { + log.debug("configure()"); + } + + /** + * Get the list of USB locations with devices matching a single + * vendor/product ID combination. These are "portNames" to match the calling + * API. + * + * @return the list of locations with matching devices; this is an empty + * list if there are no matches + */ + @Nonnull + public List getPortNames() { + log.debug("getPortNames()"); + + List results = new ArrayList<>(); + List usbDevices = UsbUtil.getMatchingDevices(vendorID, productID, null); + usbDevices.forEach((device) -> { + results.add(UsbUtil.getLocation(device)); + }); + + return results; + } + + private String port = null; + + public void setPort(String s) { + log.debug("setPort('{}')", s); + port = s; + } + + /** + * {@inheritDoc} + */ + @Override + public String getCurrentPortName() { + log.debug("getCurrentPortName()"); + return port; + } + + /** + * send USB control transfer + * + * @param requestType the request type + * @param request the request + * @param value the value + * @param index the index + * @param data the data + * @return true if successful sent + */ + public boolean sendControlTransfer(int requestType, int request, int value, int index, byte[] data) { + boolean result = false; // assume failure (pessimist!) + if (usbDevice != null) { + try { + UsbControlIrp usbControlIrp = usbDevice.createUsbControlIrp( + (byte) requestType, (byte) request, + (short) value, (short) index); + if (data == null) { + data = new byte[0]; + } + usbControlIrp.setData(data); + usbControlIrp.setLength(data.length); + + //log.trace("sendControlTransfer, requestType: {}, request: {}, value: {}, index: {}, data: {}", requestType, request, value, index, getByteString(data)); + usbDevice.syncSubmit(usbControlIrp); + result = true; // it's good! + } catch (IllegalArgumentException | UsbException | UsbDisconnectedException e) { + log.error("Exception transferring control", e); + } + } + return result; + } + + private final static Logger log = LoggerFactory.getLogger(UsbPortAdapter.class + ); +} diff --git a/java/src/jmri/jmrix/anyma/AnymaDMX_ConnectionConfig.java b/java/src/jmri/jmrix/anyma/AnymaDMX_ConnectionConfig.java new file mode 100644 index 00000000000..23cbd6e3458 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/AnymaDMX_ConnectionConfig.java @@ -0,0 +1,88 @@ +package jmri.jmrix.anyma; + +import java.util.List; +import jmri.jmrix.AbstractUsbConnectionConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Definition of objects to handle configuring an Anyma DMX layout connection + * via a AnymaDMX_UsbPortAdapter object. + *

                + * This uses the {@link AnymaDMX_UsbPortAdapter} class to do the actual + * connection. + * + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + * @see AnymaDMX_UsbPortAdapter + */ +public class AnymaDMX_ConnectionConfig extends AbstractUsbConnectionConfig { + + /** + * Ctor for an object being created during load process; Swing init is + * deferred. + * + * @param p the pre-existing adapter + */ + public AnymaDMX_ConnectionConfig(AnymaDMX_UsbPortAdapter p) { + super(p); + log.debug("* constructor('{}').", p); + } + + /** + * Ctor for a functional Swing object with no prexisting adapter + */ + public AnymaDMX_ConnectionConfig() { + this(new AnymaDMX_UsbPortAdapter()); + } + + /** + * {@inheritDoc} + */ + @Override + public void updateAdapter() { + log.debug("* updateAdapter()"); + if ((adapter.getSystemConnectionMemo() != null) + && !adapter.getSystemConnectionMemo().setSystemPrefix(systemPrefixField.getText())) { + systemPrefixField.setText(adapter.getSystemConnectionMemo().getSystemPrefix()); + connectionNameField.setText(adapter.getSystemConnectionMemo().getUserName()); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void setInstance() { + log.debug("* setInstance()"); + if (adapter == null) { + adapter = new AnymaDMX_UsbPortAdapter(); + } + //if (adapter.getDMXController() == null) { + // // don't show more than once every 30 seconds + // if (!GraphicsEnvironment.isHeadless() + // && (this.DMXMessageShown == null || ((new Date().getTime() - this.DMXMessageShown.getTime()) / 1000 % 60) > 30)) { + // JOptionPane.showMessageDialog(this._details, + // Bundle.getMessage("NoDMXControllerMessage"), + // Bundle.getMessage("NoDMXControllerTitle"), + // JOptionPane.ERROR_MESSAGE); + // this.DMXMessageShown = new Date(); + // } + //} + } + + @Override + public String name() { + log.debug("* name()"); + return getConnectionName(); + } + + @Override + protected List getPortNames() { + log.debug("* getPortNames()"); + return getAdapter().getPortNames(); + } + + private final static Logger log + = LoggerFactory.getLogger(AnymaDMX_ConnectionConfig.class); +} diff --git a/java/src/jmri/jmrix/anyma/AnymaDMX_ConnectionTypeList.java b/java/src/jmri/jmrix/anyma/AnymaDMX_ConnectionTypeList.java new file mode 100644 index 00000000000..4156da62af5 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/AnymaDMX_ConnectionTypeList.java @@ -0,0 +1,33 @@ +package jmri.jmrix.anyma; + +import jmri.jmrix.ConnectionTypeList; +import org.openide.util.lookup.ServiceProvider; + +/** + * Returns a list of valid Anyma DMX Connection Types + *

                + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +@ServiceProvider(service = ConnectionTypeList.class) +public class AnymaDMX_ConnectionTypeList implements ConnectionTypeList { + + protected static final String ANYMA_DMX = "Anyma DMX512"; + + /** + * {@inheritDoc} + */ + public String[] getAvailableProtocolClasses() { + return new String[]{ + "jmri.jmrix.anyma.AnymaDMX_ConnectionConfig" + }; + } + + /** + * {@inheritDoc} + */ + @Override + public String[] getManufacturers() { + return new String[]{ANYMA_DMX}; + } +} diff --git a/java/src/jmri/jmrix/anyma/AnymaDMX_SystemConnectionMemo.java b/java/src/jmri/jmrix/anyma/AnymaDMX_SystemConnectionMemo.java new file mode 100644 index 00000000000..e07958e8391 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/AnymaDMX_SystemConnectionMemo.java @@ -0,0 +1,406 @@ +package jmri.jmrix.anyma; + +import java.util.ResourceBundle; +import javax.annotation.Nonnull; +import jmri.InstanceManager; +import jmri.Light; +import jmri.LightManager; +import jmri.Manager.NameValidity; +import jmri.jmrix.SystemConnectionMemo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Minimal SystemConnectionMemo for anyma dmx systems. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_SystemConnectionMemo extends SystemConnectionMemo { + + private boolean configured = false; + + /** + * constructor + */ + public AnymaDMX_SystemConnectionMemo() { + this("DX", AnymaDMX_ConnectionTypeList.ANYMA_DMX); // default to "DX" prefix + log.debug("* Constructor()"); + } + + /** + * constructor + */ + public AnymaDMX_SystemConnectionMemo(@Nonnull String prefix, @Nonnull String userName) { + super(prefix, userName); + + log.debug("* Constructor ({}, {})", prefix, userName); + + register(); // registers general type + InstanceManager.store(this, AnymaDMX_SystemConnectionMemo.class); // also register as specific type + } + + private AnymaDMX_TrafficController trafficController = null; + + /** + * get the traffic controller + * + * @return the traffic controller + */ + protected AnymaDMX_TrafficController getTrafficController() { + return trafficController; + } + + /** + * set the traffic controller + * + * @param trafficController the traffic controller + */ + protected void setTrafficController(AnymaDMX_TrafficController trafficController) { + this.trafficController = trafficController; + } + + /** + * public method to get the user name for a valid system name + * + * @param systemName the system name + * @return "" (null string) if system name is not valid or does not exist + */ + public String getUserNameFromSystemName(String systemName) { + log.debug("* getUserNameFromSystemName('{}')", systemName); + String result = ""; // not any known light + int offset = checkSystemPrefix(systemName); + if (offset > 0) { + if (systemName.length() > offset) { + if (systemName.charAt(offset) == 'L') { + Light lgt = null; + lgt = InstanceManager.lightManagerInstance().getBySystemName(systemName); + if (lgt != null) { + result = lgt.getUserName(); + } + } + } + } + return result; + } + + /** + * Public static method to parse a anyma dmx system name and return the + * channel number. Notes: + *

                  + *
                • Channels are numbered from 1 to 512.
                • + *
                • Does not check whether that node is defined on current system.
                • + *
                + * + * @return 0 if an error is found. + */ + public int getChannelFromSystemName(String systemName) { + int result = 0; + log.debug("* getChannelFromSystemName('{}')", systemName); + + int offset = checkSystemPrefix(systemName); + if (offset > 1) { + if (validSystemNameFormat(systemName, systemName.charAt(offset)) == NameValidity.VALID) { + // Find the beginning of the channel number field + int k = 0; + for (int i = offset; i < systemName.length(); i++) { + if (systemName.charAt(i) == 'L') { + k = i + 1; + break; + } + } + if (k > offset) { // k = position of "L" char in name + try { + result = Integer.parseInt(systemName.substring(k)); + } catch (Exception e) { + log.warn("invalid character in channel number field of anyma dmx system name: {}", systemName); + } + } + } else { + log.error("No point in normalizing if a valid system name format is not present"); + } + } else { + log.error("invalid system prefix in anyma dmx system name: {}", systemName); + } + return result; + } + + /** + * Public static method to check and skip the System Prefix string on a + * system name. + * + * @return offset of the 1st character past the prefix, or -1 if not valid + * for this connection + */ + public int checkSystemPrefix(String systemName) { + log.debug("* checkSystemPrefix('{}')", systemName); + int result = -1; + if (systemName.startsWith(getSystemPrefix())) { + result = getSystemPrefix().length(); + } + return result; + } + + /** + * Public static method to normalize a anyma dmx system name. + *

                + * This routine is used to ensure that each system name is uniquely linked + * to one anyma dmx channel, by removing any extra zeros inserted by the + * user. + * + * @return "" (empty string) if the supplied system name does not have a + * valid format. Otherwise a normalized name is returned in the same + * format as the input name. + */ + public String normalizeSystemName(String systemName) { + String result = ""; + + log.debug("* normalizeSystemName('{}')", systemName); + + int offset = checkSystemPrefix(systemName); + if (offset > 1) { + if (validSystemNameFormat(systemName, systemName.charAt(offset)) == NameValidity.VALID) { + int channelNum = Integer.parseInt(systemName.substring(offset + 1)); + result = systemName.substring(0, offset + 1) + Integer.toString(channelNum); + } else { + // No point in normalizing if a valid system name format is not present + } + } else { + log.error("invalid system prefix in anyma dmx system name: '{}'", systemName); // fix test first + } + return result; + } + + /** + * Public static method to convert one format anyma dmx system name to the + * alternate format. + * + * @return "" (empty string) if the supplied system name does not have a + * valid format, or if there is no representation in the alternate + * naming scheme + */ + public String convertSystemNameToAlternate(String systemName) { + log.debug("* convertSystemNameToAlternate('{}')", systemName); + String result = ""; + + int offset = checkSystemPrefix(systemName); + if (offset > 0) { + if (validSystemNameFormat(systemName, systemName.charAt(offset)) == NameValidity.VALID) { + int channelNum = Integer.parseInt(systemName.substring(offset + 1)); + result = systemName.substring(0, offset + 1) + Integer.toString(channelNum); + } else { + log.error("valid system name format not present in anyma dmx system name: {}", systemName); + } + } else { + log.error("invalid system prefix in anyma dmx system name: {}", systemName); + } + return result; + } + + /** + * Public static method to validate system name format. Does not check + * whether that node is defined on current system. + * + * @return enum indicating current validity, which might be just as a prefix + */ + public NameValidity validSystemNameFormat(String systemName, char type) { + log.debug("* validSystemNameFormat('{}', '{}')", systemName, type); + NameValidity result = NameValidity.INVALID; // assume failure (pessimist!) + + int offset = checkSystemPrefix(systemName); + if (offset > 0) { + if (systemName.charAt(offset) == type) { + // This is a CLnnnxxx pattern address + int num; + try { + num = Integer.parseInt(systemName.substring(offset + 1)); + if ((num >= 1) && (num <= 512)) { + result = NameValidity.VALID; + } else { + log.debug("number field out of range in anyma dmx system name: {}", systemName); + } + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + log.debug("invalid character in number field of anyma dmx system name: {}", systemName); + } + } else { + log.error("invalid type character in anyma dmx system name: {}", systemName); + } + } else { + log.error("invalid system prefix in anyma dmx system name: {}", systemName); + } + return result; + } + + /** + * Public static method to construct a anyma dmx system name from type + * character, node address, and channel number. + *

                + * If the supplied character is not valid, or the node address is out of the + * 0 - 127 range, or the channel number is out of the 1 - 512 range, an + * error message is logged and the null string "" is returned. + * + * @return a system name in the DXaLnnnxxx format + */ + public String makeSystemName(String type, int nAddress, int channelNum) { + log.debug("* makeSystemName('{}', {}, {})", type, nAddress, channelNum); + String nName = ""; + if (type.equals("L")) { + if ((nAddress >= 0) && (nAddress < 1000)) { + if ((channelNum >= 1) && (channelNum <= 512)) { + nName = getSystemPrefix() + nAddress + type + Integer.toString(channelNum); + } else { + log.warn("invalid channel number proposed for system name"); + return nName; + } + } else { + log.warn("invalid node address proposed for system name"); + return nName; + } + } else { + log.error("invalid type character proposed for system name"); + return nName; + } + return nName; + } + + /** + * Public static method to validate anyma dmx system name for configuration. + * Does validate node number and system prefix. + * + * @return 'true' if system name has a valid meaning in current + * configuration, else returns 'false'. + */ + public boolean validSystemNameConfig(String systemName, char type) { + log.debug("* validSystemNameConfig('{}', '{}')", systemName, type); + boolean result = false; // assume failure (pessimist!) + if (validSystemNameFormat(systemName, type) == NameValidity.VALID) { + if (type == 'L') { + int channel = getChannelFromSystemName(systemName); + if ((channel >= 1) && (channel <= 512)) { + result = true; // The channel is valid + } + } else { + log.error("Invalid type specification in validSystemNameConfig call"); + } + } else { + log.error("valid system name format is not present"); + } + return result; + } + + /** + * Public static method to parse a anyma dmx system name and return the Usb + * Node Address + *

                + * Nodes are numbered from 0 - 127. Does not check whether that node is + * defined on current system. + * + * @return '-1' if invalid systemName format or if the node is not found. + */ + public int getNodeAddressFromSystemName(String systemName) { + int result = -1; // assume failure (pessimist!) + log.debug("* getNodeAddressFromSystemName('{}')", systemName); + int offset = checkSystemPrefix(systemName); + if (offset > 1) { + if (systemName.charAt(offset) == 'L') { + int num = Integer.parseInt(systemName.substring(offset + 1)); + if (num > 0) { + result = num; + } else { + log.warn("invalid anyma dmx system name: " + systemName); + } + } else { + log.error("invalid character in header field of system name: {}", systemName); + } + } + return result; + } + + /** + * {@inheritDoc} + */ + public boolean provides(Class c) { + return (get(c) != null); + } + + /** + * {@inheritDoc} + */ + @SuppressWarnings("unchecked") + @Override + public T get(Class T) { + T result = null; // nothing by default + log.debug("* get({})", T.toString()); + if (!getDisabled()) { + if (!configured) { + configureManagers(); + } + if (T.equals(LightManager.class)) { + result = (T) getLightManager(); + } + } + return result; + } + + /** + * Configure the common managers for anyma dmx connections. This puts the + * common manager config in one place. + */ + public void configureManagers() { + log.debug("* configureManagers()"); + InstanceManager.setLightManager(getLightManager()); + + if (configured) { + log.warn("calling configureManagers for a second time", new Exception("traceback")); + } + configured = true; + } + + private UsbLightManager lightManager; + + /** + * get the light manager + * + * @return the light manager + */ + public UsbLightManager getLightManager() { + log.debug("* getLightManager()"); + UsbLightManager result = null; + if (!getDisabled()) { + if (lightManager == null) { + lightManager = new UsbLightManager(this); + } + result = lightManager; + } + return result; + } + + /** + * get the action model resource bundle + * + * @return the ResourceBundle + */ + @Override + protected ResourceBundle getActionModelResourceBundle() { + log.debug("* getActionModelResourceBundle()"); + return null; //ResourceBundle.getBundle("jmri.jmrix.anyma.AnymaDMX_Bundle"); + } + + /** + * dispose + */ + @Override + public void dispose() { + log.debug("* dispose()"); + InstanceManager.deregister(this, AnymaDMX_SystemConnectionMemo.class); + if (lightManager != null) { + InstanceManager.deregister(lightManager, UsbLightManager.class); + } + super.dispose(); + } + + private final static Logger log + = LoggerFactory.getLogger(AnymaDMX_SystemConnectionMemo.class); +} diff --git a/java/src/jmri/jmrix/anyma/AnymaDMX_TrafficController.java b/java/src/jmri/jmrix/anyma/AnymaDMX_TrafficController.java new file mode 100644 index 00000000000..638b2844e74 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/AnymaDMX_TrafficController.java @@ -0,0 +1,134 @@ +package jmri.jmrix.anyma; + +import static java.lang.System.arraycopy; + +import java.util.Arrays; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import javax.usb.UsbConst; +import jmri.util.MathUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Traffic controller for Anyma DMX + *

                + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_TrafficController { + + private byte[] old_data = new byte[512]; + private byte[] new_data = new byte[512]; + private ScheduledExecutorService execService = null; + private AnymaDMX_UsbPortAdapter controller = null; + + /** + * constructor + */ + public AnymaDMX_TrafficController() { + // this forces first pass to transmit everything + Arrays.fill(old_data, (byte) -1); + + execService = Executors.newScheduledThreadPool(5); + execService.scheduleAtFixedRate(() -> { + // if the new_data has changed... + if (!Arrays.equals(old_data, new_data)) { + // find indexes to first/last bytes that are different + int from = old_data.length; + int to = 0; + for (int i = 0; i < old_data.length; i++) { + if (old_data[i] != new_data[i]) { + from = Math.min(from, i); + to = i; + } + } + if (from <= to) { + int len = to - from + 1; + byte[] buf = new byte[len]; + System.arraycopy(new_data, from, buf, 0, len); + if (sendChannelRangeValues(from, to, buf)) { + arraycopy(new_data, from, old_data, from, len); + } + } + } + }, 0, 100L, TimeUnit.MILLISECONDS); // 10 times per second + } + + /** + * Make connection to existing PortController (adapter) object. + * + * @param p the AnymaDMX_UsbPortAdapter we're connecting to + */ + public void connectPort(AnymaDMX_UsbPortAdapter p) { + if (controller != null) { + log.warn("connectPort called when already connected"); + } else { + log.debug("connectPort invoked"); + } + controller = p; + } + + /** + * set a channel's value + * + * @param channel the channel (1 - 512 inclusive) + * @param value the value + */ + public void setChannelValue(int channel, byte value) { + if ((1 <= channel) && (channel <= 512)) { + new_data[channel - 1] = value; + } + } + + /** + * set the values for a range of channels + * + * @param from the beginning index (inclusive) + * @param to the ending index (inclusive) + * @param buf the data to send + * note: the from/to indexes are 1-512 (inclusive) + */ + public void setChannelRangeValues(int from, int to, byte buf[]) { + if ((1 <= from) && (from <= 512) && (1 <= to) && (to <= 512)) { + int len = to - from + 1; + if (len == buf.length) { + arraycopy(new_data, from - 1, buf, 0, len); + } else { + log.error("range does not match buffer size"); + } + } else { + log.error("channel(s) out of range (1-512): {from: {}, to: {}}.", + from, to); + } + } + + /** + * send the values for a range of channels (to the controller) + * + * @param from the beginning index (inclusive) + * @param to the ending index (inclusive) + * @param buf the data to send + * @return true if successful + * note: the from/to indexes are 0-511 (inclusive) + */ + private boolean sendChannelRangeValues(int from, int to, byte buf[]) { + boolean result = false; // assume failure (pessimist!) + if (controller != null) { + from = MathUtil.pin(from, 0, 511); + to = MathUtil.pin(to, from, 511); + int len = to - from + 1; + byte requestType = UsbConst.REQUESTTYPE_TYPE_VENDOR + | UsbConst.REQUESTTYPE_RECIPIENT_DEVICE + | UsbConst.ENDPOINT_DIRECTION_OUT; + byte request = 0x02; // anyma dmx cmd_SetChannelRange + result = controller.sendControlTransfer( + requestType, request, len, from, buf); + } + return result; + } + + private final static Logger log + = LoggerFactory.getLogger(AnymaDMX_TrafficController.class); +} diff --git a/java/src/jmri/jmrix/anyma/AnymaDMX_UsbLight.java b/java/src/jmri/jmrix/anyma/AnymaDMX_UsbLight.java new file mode 100644 index 00000000000..5e1616e2b39 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/AnymaDMX_UsbLight.java @@ -0,0 +1,125 @@ +package jmri.jmrix.anyma; + +import static jmri.Light.OFF; + +import jmri.implementation.AbstractVariableLight; +import jmri.util.MathUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * AnymaDMX_UsbLight.java + *

                + * Implementation of the Light Object for anyma dmx + *

                + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_UsbLight extends AbstractVariableLight { + + private AnymaDMX_SystemConnectionMemo _memo = null; + + /** + * Create a Light object, with only system name. + *

                + * @param systemName the system name (previously validated) + * @param memo the system memo + */ + public AnymaDMX_UsbLight(String systemName, AnymaDMX_SystemConnectionMemo memo) { + super(systemName); + log.debug("* UsbLight constructor called"); + _memo = memo; + // Initialize the Light + initializeLight(); + } + + /** + * Create a Light object, with both system and user names. + *

                + * @param systemName the system name (previously validated) + * @param userName the user name + * @param memo the system memo + */ + public AnymaDMX_UsbLight(String systemName, + String userName, AnymaDMX_SystemConnectionMemo memo) { + super(systemName, userName); + log.debug("* UsbLight constructor called"); + _memo = memo; + initializeLight(); + } + + /** + * Sets up system dependent instance variables and sets system independent + * instance variables to default values Note: most instance variables are in + * AbstractLight.java + */ + private void initializeLight() { + log.debug("* UsbLight.initializeLight() called"); + // Extract the Channel from the name + mChannel = _memo.getChannelFromSystemName(getSystemName()); + // Set initial state + setState(OFF); + } + + /** + * System dependent instance variables + */ + private int mChannel = 0; // channel within the node (1-512) + + /** + * {@inheritDoc} + */ + @Override + protected void doNewState(int oldState, int newState) { + log.debug("* UsbLight.doNewState({}, {}) called", oldState, newState); + AnymaDMX_TrafficController trafficController = _memo.getTrafficController(); + if (trafficController != null) { + if (newState == ON) { + trafficController.setChannelValue(mChannel, (byte) 0xFF); + } else if (newState == OFF) { + trafficController.setChannelValue(mChannel, (byte) 0x00); + } else { + log.warn("illegal state requested for Light: " + getSystemName()); + } + } + } + + /** + * {@inheritDoc} + */ + protected void sendIntensity(double intensity) { + log.debug("* sendIntensity({})", "" + intensity); + AnymaDMX_TrafficController trafficController = _memo.getTrafficController(); + if (trafficController != null) { + byte value = (byte) MathUtil.pin(intensity * 255.0, 0.0, 255.0); + trafficController.setChannelValue(mChannel, value); + } + } + + /** + * {@inheritDoc} + */ + protected void sendOnOffCommand(int newState) { + log.debug("* sendOnOffCommand({})", newState); + AnymaDMX_TrafficController trafficController = _memo.getTrafficController(); + if (trafficController != null) { + if (newState == ON) { + trafficController.setChannelValue(mChannel, (byte) 0xFF); + } else if (newState == OFF) { + trafficController.setChannelValue(mChannel, (byte) 0x00); + } else { + log.warn("illegal state requested for Light: " + getSystemName()); + } + } + } + + /** + * {@inheritDoc} + */ + protected int getNumberOfSteps() { + return 256; + } + + private final static Logger log + = LoggerFactory.getLogger(AnymaDMX_UsbLight.class); +} diff --git a/java/src/jmri/jmrix/anyma/AnymaDMX_UsbPortAdapter.java b/java/src/jmri/jmrix/anyma/AnymaDMX_UsbPortAdapter.java new file mode 100644 index 00000000000..274ed5d842f --- /dev/null +++ b/java/src/jmri/jmrix/anyma/AnymaDMX_UsbPortAdapter.java @@ -0,0 +1,45 @@ +package jmri.jmrix.anyma; + +import jmri.jmrix.UsbPortAdapter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Provides an Adapter to allow the system connection memo and multiple + * AnymaDMX_ managers to be handled. + *

                + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_UsbPortAdapter extends UsbPortAdapter { + + /** + * constructor + */ + public AnymaDMX_UsbPortAdapter() { + super(new AnymaDMX_SystemConnectionMemo()); + log.debug("* Constructor"); + + setVendorID((short) 0x16C0); + setProductID((short) 0x05DC); + } + + /** + * {@inheritDoc} + */ + public void configure() { + log.debug("* configure() called."); + + // connect to the traffic controller + AnymaDMX_TrafficController controller = new AnymaDMX_TrafficController(); + controller.connectPort(this); + + AnymaDMX_SystemConnectionMemo memo = (AnymaDMX_SystemConnectionMemo) getSystemConnectionMemo(); + + memo.setTrafficController(controller); + memo.configureManagers(); + } + + private final static Logger log + = LoggerFactory.getLogger(AnymaDMX_UsbPortAdapter.class); +} diff --git a/java/src/jmri/jmrix/anyma/Bundle.java b/java/src/jmri/jmrix/anyma/Bundle.java new file mode 100644 index 00000000000..eac560a6d4a --- /dev/null +++ b/java/src/jmri/jmrix/anyma/Bundle.java @@ -0,0 +1,111 @@ +package jmri.jmrix.anyma; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.util.Locale; +import javax.annotation.CheckReturnValue; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +@ParametersAreNonnullByDefault +@CheckReturnValue +@SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS", justification = "Desired pattern is repeated class names with package-level access to members") + +@javax.annotation.concurrent.Immutable + +/** + * Provides standard access for resource bundles in a package. + *

                + * Convention is to provide a subclass of this name in each package, working off + * the local resource bundle name. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class Bundle extends jmri.jmrix.Bundle { + + @Nullable + private static final String name = "jmri.jmrix.anyma.Bundle"; + + // + // below here is boilerplate to be copied exactly + // + /** + * Provides a translated string for a given key from the package resource + * bundle or parent. + *

                + * Note that this is intentionally package-local access. + * + * @param key Bundle key to be translated + * @return Internationalized text + */ + static String getMessage(String key) { + return b.handleGetMessage(key); + } + + /** + * Provides a translated string for a given key in a given locale from the + * package resource bundle or parent. + *

                + * Note that this is intentionally package-local access. + * + * @param locale The locale to be used + * @param key Bundle key to be translated + * @return Internationalized text + */ + static String getMessage(Locale locale, String key) { + return b.handleGetMessage(locale, key); + } + + /** + * Merges user data with a translated string for a given key from the + * package resource bundle or parent. + *

                + * Uses the transformation conventions of the Java MessageFormat utility. + *

                + * Note that this is intentionally package-local access. + * + * @see java.text.MessageFormat + * @param key Bundle key to be translated + * @param subs One or more objects to be inserted into the message + * @return Internationalized text + */ + static String getMessage(String key, Object... subs) { + return b.handleGetMessage(key, subs); + } + + /** + * Merges user data with a translated string for a given key in a given + * locale from the package resource bundle or parent. + *

                + * Uses the transformation conventions of the Java MessageFormat utility. + *

                + * Note that this is intentionally package-local access. + * + * @see java.text.MessageFormat + * @param locale The locale to be used + * @param key Bundle key to be translated + * @param subs One or more objects to be inserted into the message + * @return Internationalized text + */ + static String getMessage(Locale locale, String key, Object... subs) { + return b.handleGetMessage(locale, key, subs); + } + + private final static Bundle b = new Bundle(); + + @Override + @Nullable + protected String bundleName() { + return name; + } + + @Override + protected jmri.Bundle getBundle() { + return b; + } + + @Override + protected String retry(Locale locale, String key) { + return super.getBundle().handleGetMessage(locale, key); + } +} diff --git a/java/src/jmri/jmrix/anyma/Bundle.properties b/java/src/jmri/jmrix/anyma/Bundle.properties new file mode 100644 index 00000000000..d2ec0cec5b3 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/Bundle.properties @@ -0,0 +1,12 @@ +# +# AnymaDMX_Bundle.properties +# +#Message for error selecting Anyma DMX connection on non-Anyma DMX system +NoDmxControllerMessage=The Anyma DMX Controller can not be created.
                This connection will not be configurable.

                This is expected if not running on a Anyma DMX. +#Title for error selecting Anyma DMX connection on non-Anyma DMX system +NoDmxControllerTitle=Error Creating Anyma DMX Controller + +#ErrorAssignDialog = The output channel{0} is currently assigned to {1}. +#ErrorAssignLine2L = Light can not be created as specified. + +AddOutputEntryToolTip = enter a number from 1 to 512 (inclusive). diff --git a/java/src/jmri/jmrix/anyma/UsbLightManager.java b/java/src/jmri/jmrix/anyma/UsbLightManager.java new file mode 100644 index 00000000000..1373531f125 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/UsbLightManager.java @@ -0,0 +1,153 @@ +package jmri.jmrix.anyma; + +import jmri.Light; +import jmri.Manager; +import jmri.managers.AbstractLightManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Implement light manager for anyma dmx usb systems + *

                + * System names are "DXLnnn", where nnn is the channel number without padding. + *

                + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +public class UsbLightManager extends AbstractLightManager { + + private AnymaDMX_SystemConnectionMemo _memo = null; + + /** + * constructor + * + * @param memo the system connection memo + */ + public UsbLightManager(AnymaDMX_SystemConnectionMemo memo) { + log.debug("* UsbLightManager constructor called"); + _memo = memo; + } + + /** + * {@inheritDoc} + */ + @Override + public String getSystemPrefix() { + log.debug("* UsbLightManager.getSystemPrefix() called"); + return _memo.getSystemPrefix(); + } + + /** + * Method to create a new Light based on the system name. + *

                + * Assumes calling method has checked that a Light with this system name + * does not already exist. + * + * @param systemName the system name to use for this light + * @param userName the user name to use for this light + * @return null if the system name is not in a valid format or if the system + * name does not correspond to a valid channel + */ + @Override + public Light createNewLight(String systemName, String userName) { + log.debug("* UsbLightManager.createNewLight() called"); + Light result = null; // assume failure (pessimist!) + + int nAddress = _memo.getNodeAddressFromSystemName(systemName); + if (nAddress != -1) { + int channelNum = _memo.getChannelFromSystemName(systemName); + if (channelNum != 0) { + // Validate the systemName + if (_memo.validSystemNameFormat(systemName, 'L') == Manager.NameValidity.VALID) { + if (_memo.validSystemNameConfig(systemName, 'L')) { + result = new AnymaDMX_UsbLight(systemName, userName, _memo); + } else { + log.warn("Light System Name does not refer to configured hardware: " + systemName); + } + } else { + log.error("Invalid Light System Name format: " + systemName); + } + } else { + log.error("Invalid channel number from System Name: " + systemName); + } + } + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public Manager.NameValidity validSystemNameFormat(String systemName) { + log.debug("* UsbLightManager.validSystemNameFormat() called"); + return _memo.validSystemNameFormat(systemName, 'L'); + } + + /** + * Public method to validate system name for configuration. + * + * @param systemName the system name to validate + * @return 'true' if system name has a valid meaning in current + * configuration, else return 'false' + */ + @Override + public boolean validSystemNameConfig(String systemName) { + log.debug("* UsbLightManager.validSystemNameConfig() called"); + return _memo.validSystemNameConfig(systemName, 'L'); + } + + /** + * Public method to normalize a system name. + * + * @param systemName the system name to normalize + * @return a normalized system name if system name has a valid format, else + * returns "" + */ + @Override + public String normalizeSystemName(String systemName) { + log.debug("* UsbLightManager.normalizeSystemName() called"); + return _memo.normalizeSystemName(systemName); + } + + /** + * Public method to convert system name to its alternate format + * + * @param systemName the system name to convert + * @return a normalized system name if system name is valid and has a valid + * alternate representation, else returns "" + */ + @Override + public String convertSystemNameToAlternate(String systemName) { + log.debug("* UsbLightManager.convertSystemNameToAlternate() called"); + return _memo.convertSystemNameToAlternate(systemName); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean supportsVariableLights(String systemName) { + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean allowMultipleAdditions(String systemName) { + return true; + } + + /** + * {@inheritDoc} + */ + @Override + public String getEntryToolTip() { + log.debug("* UsbLightManager.getEntryToolTip() called"); + //TODO: Why doesn't this work?!? + return null; //BundleBundle.getMessage("AddOutputEntryToolTip"); + } + + private final static Logger log + = LoggerFactory.getLogger(UsbLightManager.class); +} diff --git a/java/src/jmri/jmrix/anyma/configurexml/AnymaDMX_ConnectionConfigXml.java b/java/src/jmri/jmrix/anyma/configurexml/AnymaDMX_ConnectionConfigXml.java new file mode 100644 index 00000000000..9d1648df7c6 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/configurexml/AnymaDMX_ConnectionConfigXml.java @@ -0,0 +1,73 @@ +package jmri.jmrix.anyma.configurexml; + +import jmri.jmrix.ConnectionConfig; +import jmri.jmrix.UsbPortAdapter; +import jmri.jmrix.anyma.AnymaDMX_ConnectionConfig; +import jmri.jmrix.anyma.AnymaDMX_UsbPortAdapter; +import jmri.jmrix.configurexml.AbstractUsbConnectionConfigXml; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Handle XML persistence of layout connections by persisting the + * AnymaDMX_UsbPortAdapter. Note this is named as the XML version of a + * AnymaDMX_ConnectionConfig object, but it's actually persisting the + * AnymaDMX_UsbPortAdapter. + *

                + * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class + * is the one actually registered. Reads are brought here directly via the class + * attribute in the XML. + * + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_ConnectionConfigXml extends AbstractUsbConnectionConfigXml { + + /** + * constructor + */ + public AnymaDMX_ConnectionConfigXml() { + super(); + log.debug("* constructor()"); + } + + /** + * get instance + */ + @Override + protected void getInstance() { + log.debug("* getInstance()"); + if (getAdapter() == null) { + setAdapter(new AnymaDMX_UsbPortAdapter()); + //if (adapter.getAnymaDMX_Controller() == null) { + // try { + // this.creationErrorEncountered("Not running on Anyma DMX.", adapter.getSystemPrefix(), adapter.getUserName(), null); + // } catch (JmriConfigureXmlException ex) { + // log.error("Not running on Anyma DMX.", ex); + // } + //} + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void getInstance(Object object) { + setAdapter((UsbPortAdapter) ((ConnectionConfig) object).getAdapter()); + } + + /** + * register + */ + @Override + protected void register() { + if (adapter instanceof AnymaDMX_UsbPortAdapter) { + this.register(new AnymaDMX_ConnectionConfig( + (AnymaDMX_UsbPortAdapter) adapter)); + } + } + + private final static Logger log + = LoggerFactory.getLogger(AnymaDMX_ConnectionConfigXml.class); +} diff --git a/java/src/jmri/jmrix/anyma/configurexml/UsbLightManagerXml.java b/java/src/jmri/jmrix/anyma/configurexml/UsbLightManagerXml.java new file mode 100644 index 00000000000..1b84ae83bf8 --- /dev/null +++ b/java/src/jmri/jmrix/anyma/configurexml/UsbLightManagerXml.java @@ -0,0 +1,56 @@ +package jmri.jmrix.anyma.configurexml; + +import javax.annotation.Nonnull; +import jmri.managers.configurexml.AbstractLightManagerConfigXML; +import org.jdom2.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Provides load and store functionality for configuring AnymaDMX_LightManagers. + *

                + * Uses the store method from the abstract base class, but provides a load + * method here. + * + * @author George Warner Copyright (c) 2017 + * @since 4.9.6 + */ +public class UsbLightManagerXml extends AbstractLightManagerConfigXML { + + /** + * constructor + */ + public UsbLightManagerXml() { + super(); + log.debug("* AnymaDMX_LightManagerXml constructor called"); + } + + /** + * {@inheritDoc} + */ + @Override + public void setStoreElementClass(@Nonnull Element lights) { + log.debug("* AnymaDMX_LightManagerXml.setStoreElementClass() called"); + lights.setAttribute("class", this.getClass().getName()); + } + + /** + * {@inheritDoc} + */ + @Override + public void load(@Nonnull Element element, @Nonnull Object o) { + log.error("Invalid AnymaDMX_LightManagerXml.load() method called"); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean load(@Nonnull Element shared, @Nonnull Element perNode) { + log.debug("* AnymaDMX_LightManagerXml.load() called"); + // load individual lights + return loadLights(shared); + } + + private final static Logger log = LoggerFactory.getLogger(UsbLightManagerXml.class); +} diff --git a/java/src/jmri/jmrix/bachrus/ActiveFlag.java b/java/src/jmri/jmrix/bachrus/ActiveFlag.java deleted file mode 100644 index b2c0711cd2d..00000000000 --- a/java/src/jmri/jmrix/bachrus/ActiveFlag.java +++ /dev/null @@ -1,29 +0,0 @@ -package jmri.jmrix.bachrus; - - -/** - * Provide a flag to indicate that the system provided by this package is - * active. - *

                - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loadings. - * - * @author Andrew Crosland Copyright (C) 2010 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlag { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } - -} - - diff --git a/java/src/jmri/jmrix/bachrus/serialdriver/SerialDriverAdapter.java b/java/src/jmri/jmrix/bachrus/serialdriver/SerialDriverAdapter.java index eb208b35b75..be9a2204390 100644 --- a/java/src/jmri/jmrix/bachrus/serialdriver/SerialDriverAdapter.java +++ b/java/src/jmri/jmrix/bachrus/serialdriver/SerialDriverAdapter.java @@ -137,9 +137,6 @@ public void configure() { this.getSystemConnectionMemo().getTrafficController().connectPort(this); this.getSystemConnectionMemo().configureManagers(); - - jmri.jmrix.bachrus.ActiveFlag.setActive(); - } // base class methods for the SprogPortController interface diff --git a/java/src/jmri/jmrix/can/adapters/gridconnect/GcSerialDriverAdapter.java b/java/src/jmri/jmrix/can/adapters/gridconnect/GcSerialDriverAdapter.java index a2e1ca07ea6..ae3b4ba9c75 100644 --- a/java/src/jmri/jmrix/can/adapters/gridconnect/GcSerialDriverAdapter.java +++ b/java/src/jmri/jmrix/can/adapters/gridconnect/GcSerialDriverAdapter.java @@ -7,7 +7,6 @@ import java.io.InputStream; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; - import jmri.jmrix.can.TrafficController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,7 +24,7 @@ * @author Andrew Crosland Copyright (C) 2008 * @author Balazs Racz Copyright (C) 2017 */ -public class GcSerialDriverAdapter extends GcPortController implements jmri.jmrix.SerialPortAdapter { +public class GcSerialDriverAdapter extends GcPortController { protected SerialPort activeSerialPort = null; @@ -61,7 +60,7 @@ public String openPort(String portName, String appName) { } activeSerialPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); } catch (UnsupportedCommOperationException e) { - log.error("Cannot set serial parameters on port " + portName + ": " + e.getMessage()); + log.error("Cannot set serial parameters on port {}: {}", portName, e.getMessage()); return "Cannot set serial parameters on port " + portName + ": " + e.getMessage(); } @@ -71,8 +70,9 @@ public String openPort(String portName, String appName) { // set timeout // activeSerialPort.enableReceiveTimeout(1000); - log.debug("Serial timeout was observed as: " + activeSerialPort.getReceiveTimeout() - + " " + activeSerialPort.isReceiveTimeoutEnabled()); + log.debug("Serial timeout was observed as: {} {}", + activeSerialPort.getReceiveTimeout(), + activeSerialPort.isReceiveTimeoutEnabled()); // get and save stream serialStream = activeSerialPort.getInputStream(); @@ -97,8 +97,7 @@ public String openPort(String portName, String appName) { } catch (NoSuchPortException p) { return handlePortNotFound(p, portName, log); } catch (UnsupportedCommOperationException | IOException ex) { - log.error("Unexpected exception while opening port " + portName + " trace follows: " + ex); - ex.printStackTrace(); + log.error("Unexpected exception while opening port {}", portName, ex); return "Unexpected error while opening port " + portName + ": " + ex; } @@ -123,7 +122,7 @@ public void configure() { this.getSystemConnectionMemo().setProtocol(getOptionState(option1Name)); - // do central protocol-specific configuration + // do central protocol-specific configuration //jmri.jmrix.can.ConfigurationManager.configure(getOptionState(option1Name)); this.getSystemConnectionMemo().configureManagers(); @@ -134,14 +133,15 @@ protected GcTrafficController makeGcTrafficController() { } /** - * Helper class wrapping the input serial port's InputStream. It starts a helper thread at - * high priority that reads the input serial port as fast as it can, buffering all incoming - * data in memory in a queue. The queue in unbounded and readers will get the data from the - * queue. + * Helper class wrapping the input serial port's InputStream. It starts a + * helper thread at high priority that reads the input serial port as fast + * as it can, buffering all incoming data in memory in a queue. The queue in + * unbounded and readers will get the data from the queue. *

                * This class is thread-safe. */ - private class AsyncBufferInputStream extends FilterInputStream { + private static class AsyncBufferInputStream extends FilterInputStream { + AsyncBufferInputStream(InputStream inputStream, String portName) { super(inputStream); this.portName = portName; @@ -153,12 +153,14 @@ private class AsyncBufferInputStream extends FilterInputStream { } /** - * Helper function that tries to perform a read from the underlying port with a given - * maximum length. - * @param len how many bytes to request from the port. Setting this to 1 will apparently - * block the thread if there are zero bytes available. - * @return a block of data read, or nullptr if fatal IO errors make further use - * of this port impossible. + * Helper function that tries to perform a read from the underlying port + * with a given maximum length. + * + * @param len how many bytes to request from the port. Setting this to 1 + * will apparently block the thread if there are zero bytes + * available. + * @return a block of data read, or nullptr if fatal IO errors make + * further use of this port impossible. */ private BufferEntry tryRead(int len) { BufferEntry tail = new BufferEntry(); @@ -172,7 +174,7 @@ private BufferEntry tryRead(int len) { log.error("Closing read thread due to too many IO errors", e); return null; } else { - log.warn("Error reading serial port " + portName, e); + log.warn("Error reading serial port {}", portName, e); } } return tail; @@ -183,7 +185,7 @@ private BufferEntry tryRead(int len) { */ private void readThreadBody() { BufferEntry tail; - while(true) { + while (true) { // Try to read one byte to block the thread. tail = tryRead(1); if (tail == null) { @@ -210,14 +212,16 @@ private void readThreadBody() { } else { break; } - } while(true); + } while (true); } } /** - * We queue objects of this class between the read thread and the actual read() methods. + * We queue objects of this class between the read thread and the actual + * read() methods. */ - private class BufferEntry { + private static class BufferEntry { + // data payload byte[] data; // how many bytes of data are filled in @@ -269,7 +273,7 @@ public synchronized int read(byte[] bytes, int skip, int len) throws IOException // the read thread and return the last exception to the reader. private final static int MAX_IO_ERRORS_TO_ABORT = 10; // Queue holding the buffered data. - private BlockingQueue readAhead = new LinkedBlockingQueue<>(); + private final BlockingQueue readAhead = new LinkedBlockingQueue<>(); // The last entry we got from the queue if there are still bytes we need to return from it. BufferEntry head = null; // Offset of next live byte in head. @@ -301,7 +305,7 @@ public DataOutputStream getOutputStream() { try { return new DataOutputStream(activeSerialPort.getOutputStream()); } catch (java.io.IOException e) { - log.error("getOutputStream exception: " + e); + log.error("getOutputStream exception: {}", e.getMessage()); } return null; } @@ -312,7 +316,9 @@ public boolean status() { } /** - * Get an array of valid baud rates. + * Get an array of valid baud rates in US English locale. + * + * @return valid baud rates in US English locale */ @Override public String[] validBaudRates() { @@ -320,7 +326,9 @@ public String[] validBaudRates() { } /** - * And the corresponding values. + * Get an array of valid baud rates. + * + * @return valid baud rates */ public int[] validBaudValues() { return new int[]{57600, 115200, 230400, 250000, 333333, 460800}; diff --git a/java/src/jmri/jmrix/can/cbus/CbusBundle.properties b/java/src/jmri/jmrix/can/cbus/CbusBundle.properties index 2e547872c08..4e6022fdb6d 100644 --- a/java/src/jmri/jmrix/can/cbus/CbusBundle.properties +++ b/java/src/jmri/jmrix/can/cbus/CbusBundle.properties @@ -20,7 +20,6 @@ CbusMessageTitle = CBUS Message CanFrameTitle = CAN Frame PacketHistoryTitle = Packet History StatisticsTitle = Statistics -#SendPacketTitle = Send Packet TooltipSendPacket = Send a CBUS packet MostRecentPacketTitle = Most Recently Received Packet diff --git a/java/src/jmri/jmrix/can/cbus/CbusBundle_de.properties b/java/src/jmri/jmrix/can/cbus/CbusBundle_de.properties index 16e344159d1..cb7b916e7dc 100644 --- a/java/src/jmri/jmrix/can/cbus/CbusBundle_de.properties +++ b/java/src/jmri/jmrix/can/cbus/CbusBundle_de.properties @@ -21,7 +21,6 @@ CbusMessageTitle = CAN Bericht CanFrameTitle = CAN Frame PacketHistoryTitle = Paketgeschichte StatisticsTitle = Statistik -#SendPacketTitle = Sende Packet MostRecentPacketTitle = Zuletzt empfangenes Packet TooltipShowPrios = Wenn ausgew\u00e4hlt, werden CBUS Priorit\u00e4ten in die Geschichte angezeigt diff --git a/java/src/jmri/jmrix/can/cbus/CbusBundle_nl.properties b/java/src/jmri/jmrix/can/cbus/CbusBundle_nl.properties index 83e31259af5..28414a92304 100644 --- a/java/src/jmri/jmrix/can/cbus/CbusBundle_nl.properties +++ b/java/src/jmri/jmrix/can/cbus/CbusBundle_nl.properties @@ -21,7 +21,6 @@ CbusMessageTitle = CAN Bericht CanFrameTitle = CAN Frame PacketHistoryTitle = Packet-geschiedenis StatisticsTitle = Statistieken -#SendPacketTitle = Verstuur Packet MostRecentPacketTitle = Laatst ontvangen Packet TooltipShowPrios = Indien geselecteerd, worden CBUS Prioriteiten toegevoegd voor elk bericht diff --git a/java/src/jmri/jmrix/cmri/CMRISystemConnectionMemo.java b/java/src/jmri/jmrix/cmri/CMRISystemConnectionMemo.java index ba323f21301..a7f40a492bb 100644 --- a/java/src/jmri/jmrix/cmri/CMRISystemConnectionMemo.java +++ b/java/src/jmri/jmrix/cmri/CMRISystemConnectionMemo.java @@ -4,12 +4,18 @@ import javax.annotation.Nonnull; import jmri.InstanceManager; import jmri.Light; +import jmri.Manager.NameValidity; import jmri.Sensor; import jmri.Turnout; -import jmri.Manager.NameValidity; import jmri.jmrix.AbstractNode; import jmri.jmrix.SystemConnectionMemo; -import jmri.jmrix.cmri.serial.*; +import jmri.jmrix.cmri.serial.SerialLightManager; +import jmri.jmrix.cmri.serial.SerialNode; +import jmri.jmrix.cmri.serial.SerialSensorManager; +import jmri.jmrix.cmri.serial.SerialTrafficController; +import jmri.jmrix.cmri.serial.SerialTurnoutManager; +import jmri.jmrix.cmri.swing.CMRIComponentFactory; +import jmri.jmrix.swing.ComponentFactory; /** * Minimal SystemConnectionMemo for C/MRI systems. @@ -29,28 +35,30 @@ public CMRISystemConnectionMemo(@Nonnull String prefix, @Nonnull String userName InstanceManager.store(this, CMRISystemConnectionMemo.class); // also register as specific type // create and register the ComponentFactory for the GUI - InstanceManager.store(cf = new jmri.jmrix.cmri.swing.CMRIComponentFactory(this), - jmri.jmrix.swing.ComponentFactory.class); + cf = new CMRIComponentFactory(this); + InstanceManager.store(cf, ComponentFactory.class); log.debug("Created CMRISystemConnectionMemo"); } private SerialTrafficController tc = null; - jmri.jmrix.swing.ComponentFactory cf = null; + ComponentFactory cf = null; /** * Set the traffic controller instance associated with this connection memo. * * @param s jmri.jmrix.cmri.serial.SerialTrafficController object to use. */ - public void setTrafficController(SerialTrafficController s){ + public void setTrafficController(SerialTrafficController s) { tc = s; } /** * Get the traffic controller instance associated with this connection memo. + * + * @return the traffic controller, created if needed */ - public SerialTrafficController getTrafficController(){ + public SerialTrafficController getTrafficController() { if (tc == null) { setTrafficController(new SerialTrafficController()); log.debug("Auto create of SerialTrafficController for initial configuration"); @@ -59,9 +67,11 @@ public SerialTrafficController getTrafficController(){ } /** - * Public static method to the user name for a valid system name. + * Get the user name for a valid system name. * - * @return "" (null string) if the system name is not valid or does not exist + * @param systemName the system name + * @return "" (null string) if the system name is not valid or does not + * exist */ public String getUserNameFromSystemName(String systemName) { int offset = checkSystemPrefix(systemName); @@ -72,44 +82,41 @@ public String getUserNameFromSystemName(String systemName) { // not a valid system name for C/MRI return ""; } - if (systemName.charAt(offset) == 'S') { - Sensor s = null; - s = InstanceManager.sensorManagerInstance().getBySystemName(systemName); - if (s != null) { - return s.getUserName(); - } else { - return ""; - } - } else if (systemName.charAt(offset) == 'T') { - Turnout t = null; - t = InstanceManager.turnoutManagerInstance().getBySystemName(systemName); - if (t != null) { - return t.getUserName(); - } else { - return ""; - } - } else if (systemName.charAt(offset) == 'L') { - Light lgt = null; - lgt = InstanceManager.lightManagerInstance().getBySystemName(systemName); - if (lgt != null) { - return lgt.getUserName(); - } else { - return ""; - } + switch (systemName.charAt(offset)) { + case 'S': + Sensor s = InstanceManager.sensorManagerInstance().getBySystemName(systemName); + if (s != null) { + return s.getUserName(); + } else { + return ""; + } + case 'T': + Turnout t = InstanceManager.turnoutManagerInstance().getBySystemName(systemName); + if (t != null) { + return t.getUserName(); + } else { + return ""; + } + case 'L': + Light lgt = InstanceManager.lightManagerInstance().getBySystemName(systemName); + if (lgt != null) { + return lgt.getUserName(); + } else { + return ""; + } + default: + break; } // not any known sensor, light, or turnout return ""; } /** - * Public static method to parse a C/MRI system name and return the bit - * number. Notes: - *

                  - *
                • Bits are numbered from 1.
                • - *
                • Does not check whether that node is defined on current system.
                • - *
                + * Get the bit number from a C/MRI system name. Bits are numbered from 1. + * Does not check whether that node is defined on current system. * - * @return 0 if an error is found. + * @param systemName the system name + * @return 0 if an error is found */ public int getBitFromSystemName(String systemName) { int offset = checkSystemPrefix(systemName); @@ -128,13 +135,13 @@ public int getBitFromSystemName(String systemName) { k = i + 1; } } - int n = 0; // bit number + int n; // bit number if (k == 0) { // here if 'B' not found, name must be CLnnxxx format int num; try { - num = Integer.valueOf(systemName.substring(offset + 1)).intValue(); - } catch (Exception e) { + num = Integer.parseInt(systemName.substring(offset + 1)); + } catch (NumberFormatException e) { log.warn("invalid character in number field of system name: {}", systemName); return 0; } @@ -147,7 +154,7 @@ public int getBitFromSystemName(String systemName) { } else { // k = position of "B" char in name try { n = Integer.parseInt(systemName.substring(k)); // why use a different formula than 13 lines up? - } catch (Exception e) { + } catch (NumberFormatException e) { log.warn("invalid character in bit number field of CMRI system name: {}", systemName); return 0; } @@ -156,11 +163,11 @@ public int getBitFromSystemName(String systemName) { } /** - * Public static method to check and skip the System Prefix - * string on a system name. + * Check and skip the System Prefix string on a system name. * + * @param systemName the system name * @return offset of the 1st character past the prefix, or -1 if not valid - * for this connection + * for this connection */ public int checkSystemPrefix(String systemName) { if (!systemName.startsWith(getSystemPrefix())) { @@ -170,11 +177,14 @@ public int checkSystemPrefix(String systemName) { } /** - * Public static method to test if a C/MRI output bit is free for assignment. - * Test is not performed if the node address or bit number is invalid. + * Test if a C/MRI output bit is free for assignment. Test is not performed + * if the node address or bit number is invalid. * + * @param nAddress the node address + * @param bitNum the output bit number * @return "" (empty string) if the specified output bit is free for - * assignment, else returns the system name of the conflicting assignment. + * assignment, else returns the system name of the conflicting + * assignment. */ public String isOutputBitFree(int nAddress, int bitNum) { if ((nAddress < 0) || (nAddress > 127)) { @@ -185,15 +195,12 @@ public String isOutputBitFree(int nAddress, int bitNum) { log.warn("invalid bit number in free bit test"); return ""; } - Turnout t = null; - String sysName = ""; - sysName = makeSystemName("T", nAddress, bitNum); - t = InstanceManager.turnoutManagerInstance().getBySystemName(sysName); + String sysName = makeSystemName("T", nAddress, bitNum); + Turnout t = InstanceManager.turnoutManagerInstance().getBySystemName(sysName); if (t != null) { return sysName; } - String altName = ""; - altName = convertSystemNameToAlternate(sysName); + String altName = convertSystemNameToAlternate(sysName); t = InstanceManager.turnoutManagerInstance().getBySystemName(altName); if (t != null) { return altName; @@ -207,19 +214,16 @@ public String isOutputBitFree(int nAddress, int bitNum) { } } else { altName = convertSystemNameToAlternate(sysName); - if (altName != null) { - t = InstanceManager.turnoutManagerInstance().getBySystemName(altName); - if (t != null) { - if (t.getNumberOutputBits() == 2) { - return altName; - } + t = InstanceManager.turnoutManagerInstance().getBySystemName(altName); + if (t != null) { + if (t.getNumberOutputBits() == 2) { + return altName; } } } } - Light lgt = null; sysName = makeSystemName("L", nAddress, bitNum); - lgt = InstanceManager.lightManagerInstance().getBySystemName(sysName); + Light lgt = InstanceManager.lightManagerInstance().getBySystemName(sysName); if (lgt != null) { return sysName; } @@ -233,13 +237,15 @@ public String isOutputBitFree(int nAddress, int bitNum) { } /** - * Public static method to normalize a C/MRI system name. + * Normalize a C/MRI system name. *

                * This routine is used to ensure that each system name is uniquely linked * to one C/MRI bit, by removing extra zeros inserted by the user. * - * @return "" (empty string) if the supplied system name does not have a valid format. - * Otherwise a normalized name is returned in the same format as the input name. + * @param systemName the system name + * @return "" (empty string) if the supplied system name does not have a + * valid format. Otherwise a normalized name is returned in the same + * format as the input name. */ public String normalizeSystemName(String systemName) { int offset = checkSystemPrefix(systemName); @@ -251,7 +257,7 @@ public String normalizeSystemName(String systemName) { // No point in normalizing if a valid system name format is not present return ""; } - String nName = ""; + String nName; String s = ""; int k = 0; boolean noB = true; @@ -263,12 +269,12 @@ public String normalizeSystemName(String systemName) { } } if (noB) { - int num = Integer.valueOf(systemName.substring(offset+1)).intValue(); + int num = Integer.parseInt(systemName.substring(offset + 1)); int nAddress = num / 1000; int bitNum = num - (nAddress * 1000); nName = systemName.substring(0, offset + 1) + Integer.toString((nAddress * 1000) + bitNum); } else { - int nAddress = Integer.valueOf(s).intValue(); + int nAddress = Integer.parseInt(s); int bitNum = Integer.parseInt(systemName.substring(k, systemName.length())); nName = systemName.substring(0, offset + 1) + Integer.toString(nAddress) + "B" + Integer.toString(bitNum); } @@ -276,11 +282,12 @@ public String normalizeSystemName(String systemName) { } /** - * Public static method to convert one format C/MRI system name to the - * alternate format. + * Convert one format C/MRI system name to the alternate format. * - * @return "" (empty string) if the supplied system name does not have a valid - * format, or if there is no representation in the alternate naming scheme + * @param systemName the system name + * @return "" (empty string) if the supplied system name does not have a + * valid format, or if there is no representation in the alternate + * naming scheme */ public String convertSystemNameToAlternate(String systemName) { int offset = checkSystemPrefix(systemName); @@ -292,7 +299,7 @@ public String convertSystemNameToAlternate(String systemName) { // No point in trying if a valid system name format is not present return ""; } - String altName = ""; + String altName; String s = ""; int k = 0; boolean noB = true; @@ -304,12 +311,12 @@ public String convertSystemNameToAlternate(String systemName) { } } if (noB) { - int num = Integer.valueOf(systemName.substring(offset + 1)).intValue(); + int num = Integer.parseInt(systemName.substring(offset + 1)); int nAddress = num / 1000; int bitNum = num - (nAddress * 1000); altName = systemName.substring(0, offset + 1) + Integer.toString(nAddress) + "B" + Integer.toString(bitNum); } else { - int nAddress = Integer.valueOf(s).intValue(); + int nAddress = Integer.parseInt(s); int bitNum = Integer.parseInt(systemName.substring(k, systemName.length())); if (bitNum > 999) { // bit number is out-of-range for a CLnnnxxx address @@ -321,9 +328,11 @@ public String convertSystemNameToAlternate(String systemName) { } /** - * Public static method to validate system name format. - * Does not check whether that node is defined on current system. + * Validate system name format. Does not check whether that node is defined + * on current system. * + * @param systemName the system name + * @param type the device type * @return enum indicating current validity, which might be just as a prefix */ public NameValidity validSystemNameFormat(String systemName, char type) { @@ -350,8 +359,8 @@ public NameValidity validSystemNameFormat(String systemName, char type) { // This is a CLnnnxxx pattern address int num; try { - num = Integer.valueOf(systemName.substring(offset+1)).intValue(); - } catch (Exception e) { + num = Integer.parseInt(systemName.substring(offset + 1)); + } catch (NumberFormatException e) { log.debug("invalid character in number field of CMRI system name: {}", systemName); return NameValidity.INVALID; } @@ -376,8 +385,8 @@ public NameValidity validSystemNameFormat(String systemName, char type) { } int num; try { - num = Integer.valueOf(s).intValue(); - } catch (Exception e) { + num = Integer.parseInt(s); + } catch (NumberFormatException e) { log.debug("invalid character in node address field of CMRI system name: {}", systemName); return NameValidity.INVALID; } @@ -387,7 +396,7 @@ public NameValidity validSystemNameFormat(String systemName, char type) { } try { num = Integer.parseInt(systemName.substring(k)); - } catch (Exception e) { + } catch (NumberFormatException e) { log.debug("invalid character in bit number field of CMRI system name: {}", systemName); return NameValidity.INVALID; } @@ -404,12 +413,14 @@ public NameValidity validSystemNameFormat(String systemName, char type) { } /** - * Public static method to test if a C/MRI input bit is free for assignment. - * Test is not performed if the node address is invalid or bit number is - * greater than 2048. + * Test if a C/MRI input bit is free for assignment. Test is not performed + * if the node address is invalid or bit number is greater than 2048. * + * @param nAddress the address to test + * @param bitNum the bit number to tests * @return "" (empty string) if the specified input bit is free for - * assignment, else returns the system name of the conflicting assignment. + * assignment, else returns the system name of the conflicting + * assignment. */ public String isInputBitFree(int nAddress, int bitNum) { if ((nAddress < 0) || (nAddress > 127)) { @@ -420,15 +431,12 @@ public String isInputBitFree(int nAddress, int bitNum) { log.warn("invalid bit number in free bit test"); return ""; } - Sensor s = null; - String sysName = ""; - sysName = makeSystemName("S", nAddress, bitNum); - s = InstanceManager.sensorManagerInstance().getBySystemName(sysName); + String sysName = makeSystemName("S", nAddress, bitNum); + Sensor s = InstanceManager.sensorManagerInstance().getBySystemName(sysName); if (s != null) { return sysName; } - String altName = ""; - altName = convertSystemNameToAlternate(sysName); + String altName = convertSystemNameToAlternate(sysName); s = InstanceManager.sensorManagerInstance().getBySystemName(altName); if (s != null) { return altName; @@ -438,17 +446,20 @@ public String isInputBitFree(int nAddress, int bitNum) { } /** - * Public static method to construct a C/MRI system name from type - * character, node address, and bit number. + * Construct a C/MRI system name from type character, node address, and bit + * number. *

                * If the supplied character is not valid, or the node address is out of the * 0 - 127 range, or the bit number is out of the 1 - 2048 range, an error * message is logged and the null string "" is returned. * - * @return a system name in the CLnnnxxx, CTnnnxxx, or CSnnnxxx - * format if the bit number is 1 - 999. If the bit number is 1000 - 2048, - * the system name is returned in the CLnnnBxxxx, CTnnnBxxxx, or CSnnnBxxxx - * format. The returned name is normalized. + * @param type the device type + * @param nAddress the address to use + * @param bitNum the bit number to assign + * @return a system name in the CLnnnxxx, CTnnnxxx, or CSnnnxxx format if + * the bit number is 1 - 999. If the bit number is 1000 - 2048, the + * system name is returned in the CLnnnBxxxx, CTnnnBxxxx, or + * CSnnnBxxxx format. The returned name is normalized. */ public String makeSystemName(String type, int nAddress, int bitNum) { String nName = ""; @@ -473,10 +484,12 @@ public String makeSystemName(String type, int nAddress, int bitNum) { } /** - * Public static method to parse a C/MRI system name and return the Serial - * Node. + * Get the serial node from a C/MRI system name. * - * @return 'null' if invalid systemName format or if the node is not found + * @param systemName the system name + * @param tc the controller for the node + * @return the node or null if invalid systemName format or if the node is + * not found */ public AbstractNode getNodeFromSystemName(String systemName, SerialTrafficController tc) { // get the node address @@ -489,11 +502,14 @@ public AbstractNode getNodeFromSystemName(String systemName, SerialTrafficContro } /** - * Public static method to validate C/MRI system name for configuration. - * Does validate node number and system prefix. + * Validate C/MRI system name for configuration. Validates node number and + * system prefix. * - * @return 'true' if system name has a valid meaning in current configuration, - * else returns 'false'. + * @param systemName the system name to check + * @param type the device type + * @param tc the controller for the device + * @return true if system name has a valid meaning in current configuration; + * otherwise false */ public boolean validSystemNameConfig(String systemName, char type, SerialTrafficController tc) { if (validSystemNameFormat(systemName, type) != NameValidity.VALID) { @@ -525,12 +541,12 @@ public boolean validSystemNameConfig(String systemName, char type, SerialTraffic } /** - * Public static method to parse a C/MRI system name and return the Serial - * Node Address + * Get the serial node address from a C/MRI system name. *

                - * Nodes are numbered from 0 - 127. Does not check - * whether that node is defined on current system. + * Nodes are numbered from 0 - 127. Does not check whether that node is + * defined on current system. * + * @param systemName the name containing the node * @return '-1' if invalid systemName format or if the node is not found. */ public int getNodeAddressFromSystemName(String systemName) { @@ -552,7 +568,7 @@ public int getNodeAddressFromSystemName(String systemName) { } int ua; if (noB) { - int num = Integer.valueOf(systemName.substring(offset + 1)).intValue(); + int num = Integer.parseInt(systemName.substring(offset + 1)); if (num > 0) { ua = num / 1000; } else { @@ -566,7 +582,7 @@ public int getNodeAddressFromSystemName(String systemName) { } else { try { ua = Integer.parseInt(s); - } catch (Exception e) { + } catch (NumberFormatException e) { log.warn("invalid character in CMRI system name: {}", systemName); return -1; } @@ -585,9 +601,8 @@ public boolean provides(Class type) { return true; } else if (type.equals(jmri.LightManager.class)) { return true; - } else { - return false; // nothing, by default } + return false; // nothing, by default } @SuppressWarnings("unchecked") @@ -609,22 +624,18 @@ public T get(Class T) { } /** - * Configure the common managers for CMRI connections. This puts the - * common manager config in one place. + * Configure the common managers for CMRI connections. This puts the common + * manager config in one place. */ public void configureManagers() { - InstanceManager.setSensorManager( - getSensorManager()); + InstanceManager.setSensorManager(getSensorManager()); getTrafficController().setSensorManager(getSensorManager()); - InstanceManager.setTurnoutManager( - getTurnoutManager()); + InstanceManager.setTurnoutManager(getTurnoutManager()); - InstanceManager.setLightManager( - getLightManager()); + InstanceManager.setLightManager(getLightManager()); } - protected SerialTurnoutManager turnoutManager; public SerialTurnoutManager getTurnoutManager() { @@ -670,16 +681,16 @@ protected ResourceBundle getActionModelResourceBundle() { public void dispose() { InstanceManager.deregister(this, CMRISystemConnectionMemo.class); if (cf != null) { - InstanceManager.deregister(cf, jmri.jmrix.swing.ComponentFactory.class); + InstanceManager.deregister(cf, ComponentFactory.class); } if (turnoutManager != null) { - InstanceManager.deregister(turnoutManager, jmri.jmrix.cmri.serial.SerialTurnoutManager.class); + InstanceManager.deregister(turnoutManager, SerialTurnoutManager.class); } if (lightManager != null) { - InstanceManager.deregister(lightManager, jmri.jmrix.cmri.serial.SerialLightManager.class); + InstanceManager.deregister(lightManager, SerialLightManager.class); } if (sensorManager != null) { - InstanceManager.deregister(sensorManager, jmri.jmrix.cmri.serial.SerialSensorManager.class); + InstanceManager.deregister(sensorManager, SerialSensorManager.class); } super.dispose(); } diff --git a/java/src/jmri/jmrix/cmri/serial/assignment/ListFrame.java b/java/src/jmri/jmrix/cmri/serial/assignment/ListFrame.java index 63577fa3124..4259c8f4ed0 100644 --- a/java/src/jmri/jmrix/cmri/serial/assignment/ListFrame.java +++ b/java/src/jmri/jmrix/cmri/serial/assignment/ListFrame.java @@ -32,7 +32,7 @@ * Frame for running CMRI assignment list. * * @author Dave Duchamp Copyright (C) 2006 - * @author Chuck Catania Copyright (C) 2016, 2017 + * @author Chuck Catania Copyright (C) 2016, 2017 */ public class ListFrame extends jmri.util.JmriJFrame { @@ -143,7 +143,7 @@ public void actionPerformed(ActionEvent event) { panel1.add(panel12); Border panel1Border = BorderFactory.createEtchedBorder(); Border panel1Titled = BorderFactory.createTitledBorder(panel1Border, - Bundle.getMessage("NodePanelName")+" "+_memo.getUserName()); + Bundle.getMessage("NodePanelName") + " " + _memo.getUserName()); panel1.setBorder(panel1Titled); contentPane.add(panel1); @@ -173,9 +173,9 @@ public void actionPerformed(ActionEvent event) { userColumn.setMaxWidth(450); userColumn.setResizable(true); TableColumn commentColumn = assignmentColumnModel.getColumn(AssignmentTableModel.COMMENT_COLUMN); - userColumn.setMinWidth(90); - userColumn.setMaxWidth(250); - userColumn.setResizable(true); + commentColumn.setMinWidth(90); + commentColumn.setMaxWidth(250); + commentColumn.setResizable(true); JScrollPane assignmentScrollPane = new JScrollPane(assignmentTable); assignmentPanel.add(assignmentScrollPane, BorderLayout.CENTER); if (inputSelected) { @@ -281,27 +281,25 @@ public void displayNodeInfo(String nodeID) { nodeInfoText.setText("USIC_SUSIC - " + bitsPerCard + Bundle.getMessage("BitsPerCard") + ", " + numInputBits + " " + Bundle.getMessage("InputBitsAnd") + " " + numOutputBits + " " + Bundle.getMessage("OutputBits")); + } else if (type == SerialNode.CPNODE) { + int bitsPerCard = selNode.getNumBitsPerCard(); + int numInputCards = selNode.numInputCards(); + int numOutputCards = selNode.numOutputCards(); + numInputBits = bitsPerCard * numInputCards; + numOutputBits = bitsPerCard * numOutputCards; + nodeInfoText.setText("CPNODE - " + bitsPerCard + " " + Bundle.getMessage("BitsPerCard") + + ", " + numInputBits + " " + Bundle.getMessage("InputBitsAnd") + " " + + numOutputBits + " " + Bundle.getMessage("OutputBits")); + } else if (type == SerialNode.CPMEGA) { + int bitsPerCard = selNode.getNumBitsPerCard(); + int numInputCards = selNode.numInputCards(); + int numOutputCards = selNode.numOutputCards(); + numInputBits = bitsPerCard * numInputCards; + numOutputBits = bitsPerCard * numOutputCards; + nodeInfoText.setText("CPMEGA - " + bitsPerCard + " " + Bundle.getMessage("BitsPerCard") + + ", " + numInputBits + " " + Bundle.getMessage("InputBitsAnd") + " " + + numOutputBits + " " + Bundle.getMessage("OutputBits")); } - else if (type == SerialNode.CPNODE) { //c2 - int bitsPerCard = selNode.getNumBitsPerCard(); - int numInputCards = selNode.numInputCards(); - int numOutputCards = selNode.numOutputCards(); - numInputBits = bitsPerCard*numInputCards; - numOutputBits = bitsPerCard*numOutputCards; - nodeInfoText.setText("CPNODE - "+bitsPerCard+" "+Bundle.getMessage("BitsPerCard")+ - ", "+numInputBits+" "+Bundle.getMessage("InputBitsAnd")+" "+ - numOutputBits+" "+Bundle.getMessage("OutputBits")); - } - else if (type == SerialNode.CPMEGA) { //c2 - int bitsPerCard = selNode.getNumBitsPerCard(); - int numInputCards = selNode.numInputCards(); - int numOutputCards = selNode.numOutputCards(); - numInputBits = bitsPerCard*numInputCards; - numOutputBits = bitsPerCard*numOutputCards; - nodeInfoText.setText("CPMEGA - "+bitsPerCard+" "+Bundle.getMessage("BitsPerCard")+ - ", "+numInputBits+" "+Bundle.getMessage("InputBitsAnd")+" "+ - numOutputBits+" "+Bundle.getMessage("OutputBits")); - } // here insert code for new types of C/MRI nodes } @@ -327,7 +325,7 @@ public void printButtonActionPerformed(java.awt.event.ActionEvent e) { colWidth[1] = assignmentColumnModel.getColumn(AssignmentTableModel.ADDRESS_COLUMN).getWidth(); colWidth[2] = assignmentColumnModel.getColumn(AssignmentTableModel.SYSNAME_COLUMN).getWidth(); colWidth[3] = assignmentColumnModel.getColumn(AssignmentTableModel.USERNAME_COLUMN).getWidth(); - colWidth[4] = assignmentColumnModel.getColumn(AssignmentTableModel.COMMENT_COLUMN).getWidth(); //c2 + colWidth[4] = assignmentColumnModel.getColumn(AssignmentTableModel.COMMENT_COLUMN).getWidth(); // set up a page title String head; @@ -420,25 +418,17 @@ public Object getValueAt(int r, int c) { curRow = r; curRowSysName = sName; } - } - else if (c==COMMENT_COLUMN) // c2 - { - String sName = null; - if (curRow!=r) - { - if (inputSelected) - { - sName = _memo.isInputBitFree(selNodeNum,(r+1)); - } - else - { - sName = _memo.isOutputBitFree(selNodeNum,(r+1)); + } else if (c == COMMENT_COLUMN) { + String sName = null; + if (curRow != r) { + if (inputSelected) { + sName = _memo.isInputBitFree(selNodeNum, (r + 1)); + } else { + sName = _memo.isOutputBitFree(selNodeNum, (r + 1)); } curRow = r; curRowSysName = sName; - } - - else { + } else { sName = curRowSysName; } if (sName == null) { @@ -447,7 +437,7 @@ else if (c==COMMENT_COLUMN) // c2 return (_memo.getUserNameFromSystemName(sName)); } } - + return ""; } @@ -460,20 +450,19 @@ public void setValueAt(Object type, int r, int c) { public static final int ADDRESS_COLUMN = 1; public static final int SYSNAME_COLUMN = 2; public static final int USERNAME_COLUMN = 3; - public static final int COMMENT_COLUMN = 4; //c2 - public static final int MAX_COLS = COMMENT_COLUMN + 1; //c2 + public static final int COMMENT_COLUMN = 4; + public static final int MAX_COLS = COMMENT_COLUMN + 1; /** * Print or print preview the assignment table. Printed in * proportionately sized columns across the page with headings and * vertical lines between each column. Data is word wrapped within a - * column. Can only handle 4 columns of data as strings. - * Adapted from routines in BeanTableDataModel.java by Bob Jacobsen - * and Dennis Miller + * column. Can only handle 4 columns of data as strings. Adapted from + * routines in BeanTableDataModel.java by Bob Jacobsen and Dennis Miller */ public void printTable(HardcopyWriter w, int colWidth[]) { // determine the column sizes - proportionately sized, with space between for lines - int[] columnSize = new int[MAX_COLS]; //c2 + int[] columnSize = new int[MAX_COLS]; int charPerLine = w.getCharactersPerLine(); int tableLineWidth = 0; // table line width in characters int totalColWidth = 0; @@ -601,8 +590,7 @@ protected void printColumns(HardcopyWriter w, String columnStrings[], int column Bundle.getMessage("HeadingAddress"), Bundle.getMessage("HeadingSystemName"), Bundle.getMessage("HeadingUserName"), - Bundle.getMessage("HeadingComment") //c2 - + Bundle.getMessage("HeadingComment") }; private final static Logger log = LoggerFactory.getLogger(ListFrame.class); diff --git a/java/src/jmri/jmrix/cmri/serial/nodeconfig/NodeConfigFrame.java b/java/src/jmri/jmrix/cmri/serial/nodeconfig/NodeConfigFrame.java index 662753895cb..5134cb321ae 100644 --- a/java/src/jmri/jmrix/cmri/serial/nodeconfig/NodeConfigFrame.java +++ b/java/src/jmri/jmrix/cmri/serial/nodeconfig/NodeConfigFrame.java @@ -3,6 +3,7 @@ import java.awt.BorderLayout; import java.awt.Container; import java.awt.FlowLayout; +import javax.annotation.Nonnull; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.DefaultCellEditor; @@ -21,7 +22,6 @@ import javax.swing.table.TableModel; import jmri.jmrix.cmri.CMRISystemConnectionMemo; import jmri.jmrix.cmri.serial.SerialNode; -import jmri.jmrix.cmri.serial.SerialSensorManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +58,7 @@ public class NodeConfigFrame extends jmri.util.JmriJFrame { protected boolean changedNode = false; // true if a node was changed, deleted, or added protected boolean editMode = false; // true if in edit mode - protected SerialNode curNode = null; // Serial Node being editted + protected transient SerialNode curNode = null; // Serial Node being editted protected int nodeAddress = 0; // Node address protected int nodeType = SerialNode.SMINI; // Node type protected int bitsPerCard = 24; // number of bits per card @@ -77,9 +77,9 @@ public class NodeConfigFrame extends jmri.util.JmriJFrame { protected String editStatus2 = Bundle.getMessage("NotesEdit2", Bundle.getMessage("ButtonUpdate")); // NOI18N protected String editStatus3 = Bundle.getMessage("NotesEdit3", Bundle.getMessage("ButtonCancel")); // NOI18N - private CMRISystemConnectionMemo _memo = null; + private final transient CMRISystemConnectionMemo _memo; - public NodeConfigFrame(CMRISystemConnectionMemo memo) { + public NodeConfigFrame(@Nonnull CMRISystemConnectionMemo memo) { super(); _memo = memo; @@ -121,27 +121,24 @@ public void initComponents() { nodeTypeBox.addItem("SMINI"); // NOI18N nodeTypeBox.addItem("USIC_SUSIC"); // NOI18N // Here add code for other types of nodes - nodeTypeBox.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent event) { - String s = (String) nodeTypeBox.getSelectedItem(); - if (s.equals("SMINI")) { // NOI18N - panel2.setVisible(false); - panel2a.setVisible(true); - cardSizeText.setVisible(false); - cardSizeBox.setVisible(false); - nodeType = SerialNode.SMINI; - } else if (s.equals("USIC_SUSIC")) { // NOI18N - panel2.setVisible(true); - panel2a.setVisible(false); - cardSizeText.setVisible(true); - cardSizeBox.setVisible(true); - nodeType = SerialNode.USIC_SUSIC; - } - // Here add code for other types of nodes - // reset notes as appropriate - resetNotes(); + nodeTypeBox.addActionListener((java.awt.event.ActionEvent event) -> { + String s = (String) nodeTypeBox.getSelectedItem(); + if (s.equals("SMINI")) { // NOI18N + panel2.setVisible(false); + panel2a.setVisible(true); + cardSizeText.setVisible(false); + cardSizeBox.setVisible(false); + nodeType = SerialNode.SMINI; + } else if (s.equals("USIC_SUSIC")) { // NOI18N + panel2.setVisible(true); + panel2a.setVisible(false); + cardSizeText.setVisible(true); + cardSizeBox.setVisible(true); + nodeType = SerialNode.USIC_SUSIC; } + // Here add code for other types of nodes + // reset notes as appropriate + resetNotes(); }); nodeTypeBox.setToolTipText(Bundle.getMessage("TipNodeType")); // NOI18N JPanel panel12 = new JPanel(); @@ -156,17 +153,14 @@ public void actionPerformed(java.awt.event.ActionEvent event) { cardSizeBox.addItem(Bundle.getMessage("CardSize24")); // NOI18N cardSizeBox.addItem(Bundle.getMessage("CardSize32")); // NOI18N // here add code for other node types, if required - cardSizeBox.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent event) { - String s = (String) cardSizeBox.getSelectedItem(); - if (s.equals(Bundle.getMessage("CardSize24"))) { // NOI18N - bitsPerCard = 24; - } else if (s.equals(Bundle.getMessage("CardSize32"))) { // NOI18N - bitsPerCard = 32; - } -// here add code for other node types, if required + cardSizeBox.addActionListener((java.awt.event.ActionEvent event) -> { + String s = (String) cardSizeBox.getSelectedItem(); + if (s.equals(Bundle.getMessage("CardSize24"))) { // NOI18N + bitsPerCard = 24; + } else if (s.equals(Bundle.getMessage("CardSize32"))) { // NOI18N + bitsPerCard = 32; } + // here add code for other node types, if required }); cardSizeBox.setToolTipText(Bundle.getMessage("TipCardSize")); // NOI18N cardSizeText.setVisible(false); @@ -276,55 +270,40 @@ public void actionPerformed(java.awt.event.ActionEvent event) { addButton.setText(Bundle.getMessage("ButtonAdd")); // NOI18N addButton.setVisible(true); addButton.setToolTipText(Bundle.getMessage("TipAddButton")); // NOI18N - addButton.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent e) { - addButtonActionPerformed(); - } + addButton.addActionListener((java.awt.event.ActionEvent e) -> { + addButtonActionPerformed(); }); panel4.add(addButton); editButton.setText(Bundle.getMessage("ButtonEdit")); // NOI18N editButton.setVisible(true); editButton.setToolTipText(Bundle.getMessage("TipEditButton")); // NOI18N panel4.add(editButton); - editButton.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent e) { - editButtonActionPerformed(); - } + editButton.addActionListener((java.awt.event.ActionEvent e) -> { + editButtonActionPerformed(); }); panel4.add(deleteButton); deleteButton.setText(Bundle.getMessage("ButtonDelete")); // NOI18N deleteButton.setVisible(true); deleteButton.setToolTipText(Bundle.getMessage("TipDeleteButton")); // NOI18N panel4.add(deleteButton); - deleteButton.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent e) { - deleteButtonActionPerformed(); - } + deleteButton.addActionListener((java.awt.event.ActionEvent e) -> { + deleteButtonActionPerformed(); }); panel4.add(doneButton); doneButton.setText(Bundle.getMessage("ButtonDone")); // NOI18N doneButton.setVisible(true); doneButton.setToolTipText(Bundle.getMessage("TipDoneButton")); // NOI18N panel4.add(doneButton); - doneButton.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent e) { - doneButtonActionPerformed(); - } + doneButton.addActionListener((java.awt.event.ActionEvent e) -> { + doneButtonActionPerformed(); }); panel4.add(updateButton); updateButton.setText(Bundle.getMessage("ButtonUpdate")); // NOI18N updateButton.setVisible(true); updateButton.setToolTipText(Bundle.getMessage("TipUpdateButton")); // NOI18N panel4.add(updateButton); - updateButton.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent e) { - updateButtonActionPerformed(); - } + updateButton.addActionListener((java.awt.event.ActionEvent e) -> { + updateButtonActionPerformed(); }); updateButton.setVisible(false); panel4.add(cancelButton); @@ -332,11 +311,8 @@ public void actionPerformed(java.awt.event.ActionEvent e) { cancelButton.setVisible(true); cancelButton.setToolTipText(Bundle.getMessage("TipCancelButton")); // NOI18N panel4.add(cancelButton); - cancelButton.addActionListener(new java.awt.event.ActionListener() { - @Override - public void actionPerformed(java.awt.event.ActionEvent e) { - cancelButtonActionPerformed(); - } + cancelButton.addActionListener((java.awt.event.ActionEvent e) -> { + cancelButtonActionPerformed(); }); cancelButton.setVisible(false); contentPane.add(panel4); @@ -388,8 +364,8 @@ public void addButtonActionPerformed() { // configure the new node setNodeParameters(); // register any orphan sensors that this node may have - if (_memo != null && _memo.getSensorManager() != null) { - ((SerialSensorManager) _memo.getSensorManager()).registerSensorsForNode(curNode); + if (_memo.getSensorManager() != null) { + _memo.getSensorManager().registerSensorsForNode(curNode); } // reset after succefully adding node resetNotes(); @@ -429,7 +405,7 @@ public void editButtonActionPerformed() { } else if (nodeType == SerialNode.USIC_SUSIC) { nodeTypeBox.setSelectedItem("USIC_SUSIC"); // NOI18N } -// here add code for other node types + // here add code for other node types // Node specific initialization if (nodeType == SerialNode.USIC_SUSIC) { bitsPerCard = curNode.getNumBitsPerCard(); @@ -482,7 +458,7 @@ public void editButtonActionPerformed() { } else if (nodeType == SerialNode.SMINI) { panel2a.setVisible(true); } -// here insert code for other node types + // here insert code for other node types // Switch buttons editMode = true; addButton.setVisible(false); @@ -632,7 +608,9 @@ public void cancelButtonActionPerformed() { } /** - * Method to close the window when the close box is clicked + * Handle a closing window. + * + * @param e the triggering event */ @Override public void windowClosing(java.awt.event.WindowEvent e) { @@ -680,9 +658,9 @@ void setNodeParameters() { } // consistency check if (numSet != num2LSearchLights) { - log.error("Inconsistent numbers of 2-lead searchlights. numSet = " // NOI18N - + Integer.toString(numSet) + ", num2LSearchLights = " // NOI18N - + Integer.toString(num2LSearchLights)); + log.error("Inconsistent numbers of 2-lead searchlights. numSet = {}, num2LSearchLights = {}", + numSet, + num2LSearchLights); } break; case SerialNode.USIC_SUSIC: @@ -692,16 +670,25 @@ void setNodeParameters() { int numInput = 0; int numOutput = 0; for (int i = 0; i < 64; i++) { - if ("No Card".equals(cardType[i])) { // NOI18N - curNode.setCardTypeByAddress(i, SerialNode.NO_CARD); - } else if ("Input Card".equals(cardType[i])) { // NOI18N - curNode.setCardTypeByAddress(i, SerialNode.INPUT_CARD); - numInput++; - } else if ("Output Card".equals(cardType[i])) { // NOI18N - curNode.setCardTypeByAddress(i, SerialNode.OUTPUT_CARD); - numOutput++; + if (null == cardType[i]) { + log.error("Unexpected card type - {}", cardType[i]); // NOI18N } else { - log.error("Unexpected card type - " + cardType[i]); // NOI18N + switch (cardType[i]) { + case "No Card": // NOI18N + curNode.setCardTypeByAddress(i, SerialNode.NO_CARD); + break; + case "Input Card": // NOI18N + curNode.setCardTypeByAddress(i, SerialNode.INPUT_CARD); + numInput++; + break; + case "Output Card": // NOI18N + curNode.setCardTypeByAddress(i, SerialNode.OUTPUT_CARD); + numOutput++; + break; + default: + log.error("Unexpected card type - {}", cardType[i]); // NOI18N + break; + } } } // consistency check @@ -711,8 +698,7 @@ void setNodeParameters() { break; // here add code for other node types default: - log.error("Unexpected node type in setNodeParameters- " // NOI18N - + Integer.toString(nodeType)); + log.error("Unexpected node type in setNodeParameters- {}", nodeType); // NOI18N break; } // Cause reinitialization of this Node to reflect these parameters @@ -756,24 +742,24 @@ private void resetNotes2() { * is placed in statusText1. */ private int readNodeAddress() { - int addr = -1; + int addr; try { addr = Integer.parseInt(nodeAddrField.getText()); - } catch (Exception e) { + if ((addr < 0) || (addr > 127)) { + statusText1.setText(Bundle.getMessage("Error6")); + statusText1.setVisible(true); + errorInStatus1 = true; + resetNotes2(); + addr = -1; + } + } catch (NumberFormatException e) { statusText1.setText(Bundle.getMessage("Error5")); statusText1.setVisible(true); errorInStatus1 = true; resetNotes2(); - return -1; - } - if ((addr < 0) || (addr > 127)) { - statusText1.setText(Bundle.getMessage("Error6")); - statusText1.setVisible(true); - errorInStatus1 = true; - resetNotes2(); - return -1; + addr = -1; } - return (addr); + return addr; } /** @@ -786,7 +772,7 @@ protected boolean readReceiveDelay() { // get the transmission delay try { receiveDelay = Integer.parseInt(receiveDelayField.getText()); - } catch (Exception e) { + } catch (NumberFormatException e) { statusText1.setText(Bundle.getMessage("Error7")); // NOI18N statusText1.setVisible(true); receiveDelay = 0; @@ -824,7 +810,7 @@ protected boolean readPulseWidth() { // get the pulse width try { pulseWidth = Integer.parseInt(pulseWidthField.getText()); - } catch (Exception e) { + } catch (NumberFormatException e) { statusText1.setText(Bundle.getMessage("Error18")); // NOI18N statusText1.setVisible(true); pulseWidth = 500; @@ -942,7 +928,7 @@ protected boolean checkConsistency() { break; // here add code for other types of nodes default: - log.warn("Unexpected node type - " + Integer.toString(nodeType)); // NOI18N + log.warn("Unexpected node type - {}", nodeType); // NOI18N break; } return true; @@ -998,9 +984,11 @@ public boolean isCellEditable(int r, int c) { public static final int ADDRESS_COLUMN = 0; public static final int TYPE_COLUMN = 1; } - private String[] cardConfigColumnNames = {Bundle.getMessage("HeadingCardAddress"), - Bundle.getMessage("HeadingCardType")}; - private String[] cardType = new String[64]; + private final String[] cardConfigColumnNames = { + Bundle.getMessage("HeadingCardAddress"), + Bundle.getMessage("HeadingCardType") + }; + private final String[] cardType = new String[64]; /** * Set up model for SMINI table for designating oscillating 2-lead @@ -1053,11 +1041,7 @@ public Object getValueAt(int r, int c) { } } else { int index = (r * 8) + (c - 1); - if (searchlightBits[index]) { - return (Boolean.TRUE); - } else { - return (Boolean.FALSE); - } + return searchlightBits[index]; } } @@ -1065,7 +1049,7 @@ public Object getValueAt(int r, int c) { public void setValueAt(Object type, int r, int c) { if (c > 0) { int index = (r * 8) + (c - 1); - if (!((Boolean) type).booleanValue()) { + if (!((Boolean) type)) { searchlightBits[index] = false; if (firstSearchlight[index]) { searchlightBits[index + 1] = false; @@ -1101,10 +1085,12 @@ public boolean isCellEditable(int r, int c) { public static final int PORT_COLUMN = 0; } - private String[] searchlightConfigColumnNames = {Bundle.getMessage("HeadingPort"), // NOI18N - "0", "1", "2", "3", "4", "5", "6", "7"}; - private boolean[] searchlightBits = new boolean[48]; // true if this bit is a searchlight bit - private boolean[] firstSearchlight = new boolean[48]; // true if first of a pair of searchlight bits + private final String[] searchlightConfigColumnNames = { + Bundle.getMessage("HeadingPort"), // NOI18N + "0", "1", "2", "3", "4", "5", "6", "7" + }; + private final boolean[] searchlightBits = new boolean[48]; // true if this bit is a searchlight bit + private final boolean[] firstSearchlight = new boolean[48]; // true if first of a pair of searchlight bits private final static Logger log = LoggerFactory.getLogger(NodeConfigFrame.class); diff --git a/java/src/jmri/jmrix/cmri/serial/nodeconfigmanager/NodeConfigManagerFrame.java b/java/src/jmri/jmrix/cmri/serial/nodeconfigmanager/NodeConfigManagerFrame.java index be2faaa9721..4b7e104a911 100644 --- a/java/src/jmri/jmrix/cmri/serial/nodeconfigmanager/NodeConfigManagerFrame.java +++ b/java/src/jmri/jmrix/cmri/serial/nodeconfigmanager/NodeConfigManagerFrame.java @@ -17,34 +17,31 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** - * Frames for a table view to manage CMRInet node configuration management. c2 - * Created a table view for node configuration operations. Add, Edit, Delete - * and Update are executed from the NodeTableManager. - * This class was derived from the NodeConfig class. + * Frames for a table view to manage CMRInet node configuration management. c2 + * Created a table view for node configuration operations. Add, Edit, Delete and + * Update are executed from the NodeTableManager. This class was derived from + * the NodeConfig class. * - * @author Bob Jacobsen Copyright (C) 2004 - * @author Dave Duchamp Copyright (C) 2004 - * @author Chuck Catania Copyright (C) 2013, 2014, 2015, 2016, 2017 + * @author Bob Jacobsen Copyright (C) 2004 + * @author Dave Duchamp Copyright (C) 2004 + * @author Chuck Catania Copyright (C) 2013, 2014, 2015, 2016, 2017 */ - public class NodeConfigManagerFrame extends jmri.util.JmriJFrame { - ArrayList cmriNode = new ArrayList<>(); //c2 + ArrayList cmriNode = new ArrayList<>(); public int numConfigNodes = 0; public int numBits = 48; // number of bits in assignment table public int numInputBits = 24; // number of input bits for selected node public int numOutputBits = 48; // number of output bits for selected node - protected int selectedNodeAddr = -1; //c2 - protected int selectedTableRow = -1; //c2 + protected int selectedNodeAddr = -1; + protected int selectedTableRow = -1; protected boolean doingPrint = false; // node select pane items - JLabel nodeLabel = new JLabel(Bundle.getMessage("NodeBoxLabel")+" "); + JLabel nodeLabel = new JLabel(Bundle.getMessage("NodeBoxLabel") + " "); // node table pane items protected JPanel nodeTablePanel = null; @@ -54,48 +51,48 @@ public class NodeConfigManagerFrame extends jmri.util.JmriJFrame { protected JTable nodeTable = null; // button pane items - JButton addButton = new JButton(Bundle.getMessage("AddButtonText") ); - JButton doneButton = new JButton(Bundle.getMessage("DoneButtonText") ); - JButton printButton = new JButton(Bundle.getMessage("PrintButtonText") ); + JButton addButton = new JButton(Bundle.getMessage("AddButtonText")); + JButton doneButton = new JButton(Bundle.getMessage("DoneButtonText")); + JButton printButton = new JButton(Bundle.getMessage("PrintButtonText")); NodeConfigManagerFrame curFrame; - protected javax.swing.JTextField nodeAddrField = new javax.swing.JTextField(3); - protected javax.swing.JLabel nodeAddrStatic = new javax.swing.JLabel("000"); - protected javax.swing.JComboBox nodeTypeBox; - protected javax.swing.JTextField receiveDelayField = new javax.swing.JTextField(3); - protected javax.swing.JTextField nodeDescription = new javax.swing.JTextField(32); //c2 - protected javax.swing.JTextField pulseWidthField = new javax.swing.JTextField(4); - protected javax.swing.JComboBox cardSizeBox; - protected javax.swing.JComboBox cardSize8Box; - protected javax.swing.JLabel cardSizeText = new javax.swing.JLabel(" "+Bundle.getMessage("LabelCardSize")); - protected javax.swing.JLabel onBoardBytesText = new javax.swing.JLabel(Bundle.getMessage("LabelOnBoardBytes")+ " 3 Input Bytes, 6 Output Bytes"); - - protected javax.swing.JButton addNodeButton = new javax.swing.JButton(Bundle.getMessage("ButtonAdd")); - protected javax.swing.JButton editNodeButton = new javax.swing.JButton(Bundle.getMessage("ButtonEdit")); - protected javax.swing.JButton deleteNodeButton = new javax.swing.JButton(Bundle.getMessage("ButtonDelete")); - protected javax.swing.JButton doneNodeButton = new javax.swing.JButton(Bundle.getMessage("ButtonDone")); - protected javax.swing.JButton updateNodeButton = new javax.swing.JButton(Bundle.getMessage("ButtonUpdate")); - protected javax.swing.JButton cancelNodeButton = new javax.swing.JButton(Bundle.getMessage("ButtonCancel")); - - protected javax.swing.JLabel statusText1 = new javax.swing.JLabel(); - protected javax.swing.JLabel statusText2 = new javax.swing.JLabel(); - protected javax.swing.JLabel statusText3 = new javax.swing.JLabel(); - - protected javax.swing.JPanel panel2 = new JPanel(); - protected javax.swing.JPanel panel2a = new JPanel(); - protected javax.swing.JPanel panel2b = new JPanel(); //c2 - protected javax.swing.JPanel panel2c = new JPanel(); //c2 IOX config - protected javax.swing.JPanel panelnodeDescBox = new JPanel(); //c2 node desctipion box - protected javax.swing.JPanel panelnodeDesc= new JPanel(); //c2 node description - protected javax.swing.JPanel panelnetOpt = new JPanel(); //c2 CMRInet options - protected javax.swing.JPanel panelnetOptBox = new JPanel(); //c2 CMRInet options frame - protected javax.swing.JPanel panelnodeOpt = new JPanel(); //c2 node options + protected JTextField nodeAddrField = new JTextField(3); + protected JLabel nodeAddrStatic = new JLabel("000"); + protected JComboBox nodeTypeBox; + protected JTextField receiveDelayField = new JTextField(3); + protected JTextField nodeDescription = new JTextField(32); + protected JTextField pulseWidthField = new JTextField(4); + protected JComboBox cardSizeBox; + protected JComboBox cardSize8Box; + protected JLabel cardSizeText = new JLabel(" " + Bundle.getMessage("LabelCardSize")); + protected JLabel onBoardBytesText = new JLabel(Bundle.getMessage("LabelOnBoardBytes") + " 3 Input Bytes, 6 Output Bytes"); + + protected JButton addNodeButton = new JButton(Bundle.getMessage("ButtonAdd")); + protected JButton editNodeButton = new JButton(Bundle.getMessage("ButtonEdit")); + protected JButton deleteNodeButton = new JButton(Bundle.getMessage("ButtonDelete")); + protected JButton doneNodeButton = new JButton(Bundle.getMessage("ButtonDone")); + protected JButton updateNodeButton = new JButton(Bundle.getMessage("ButtonUpdate")); + protected JButton cancelNodeButton = new JButton(Bundle.getMessage("ButtonCancel")); + + protected JLabel statusText1 = new JLabel(); + protected JLabel statusText2 = new JLabel(); + protected JLabel statusText3 = new JLabel(); + + protected JPanel panel2 = new JPanel(); + protected JPanel panel2a = new JPanel(); + protected JPanel panel2b = new JPanel(); + protected JPanel panel2c = new JPanel(); //c2 IOX config + protected JPanel panelnodeDescBox = new JPanel(); //c2 node desctipion box + protected JPanel panelnodeDesc = new JPanel(); //c2 node description + protected JPanel panelnetOpt = new JPanel(); //c2 CMRInet options + protected JPanel panelnetOptBox = new JPanel(); //c2 CMRInet options frame + protected JPanel panelnodeOpt = new JPanel(); //c2 node options protected boolean changedNode = false; // true if a node was changed, deleted, or added protected boolean editMode = false; // true if in edit mode - protected SerialNode curNode = null; // Serial Node being editted + protected SerialNode curNode = null; // Serial Node being edited protected int nodeAddress = 0; // Node address protected int nodeType = SerialNode.SMINI; // Node type - default SMINI protected int bitsPerCard = 24; // number of bits per card @@ -128,7 +125,7 @@ public class NodeConfigManagerFrame extends jmri.util.JmriJFrame { // -------------------------- // CMRInet Options CheckBoxes // -------------------------- - protected JCheckBox cbx_cmrinetopt_AUTOPOLL = new JCheckBox(Bundle.getMessage("cmrinetOpt0"),true); + protected JCheckBox cbx_cmrinetopt_AUTOPOLL = new JCheckBox(Bundle.getMessage("cmrinetOpt0"), true); protected JCheckBox cbx_cmrinetopt_USECMRIX = new JCheckBox(Bundle.getMessage("cmrinetOpt1")); protected JCheckBox cbx_cmrinetopt_USEBCC = new JCheckBox(Bundle.getMessage("cmrinetOpt2")); protected JCheckBox cbx_cmrinetopt_BIT8 = new JCheckBox(Bundle.getMessage("cmrinetOpt8")); @@ -168,17 +165,16 @@ public NodeConfigManagerFrame(CMRISystemConnectionMemo memo) { * {@inheritDoc} */ @Override - public void initComponents() - { + public void initComponents() { // set the frame's initial state setTitle(Bundle.getMessage("WindowTitle")); - setSize(500,150); + setSize(500, 150); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); // load the SerialNode data - initializeNodes(); + initializeNodes(); // Set up the assignment panel nodeTablePanel = new JPanel(); @@ -194,7 +190,7 @@ public void initComponents() nodeTable.setRowHeight(30); nodeTable.getTableHeader().setReorderingAllowed(false); - nodeTable.setPreferredScrollableViewportSize(new java.awt.Dimension(300,350)); + nodeTable.setPreferredScrollableViewportSize(new java.awt.Dimension(300, 350)); TableColumnModel assignmentColumnModel = nodeTable.getColumnModel(); DefaultTableCellRenderer dtcen = new DefaultTableCellRenderer(); @@ -269,9 +265,9 @@ public void initComponents() JScrollPane nodeTableScrollPane = new JScrollPane(nodeTable); Border inputBorderTitled = BorderFactory.createTitledBorder(inputBorder, - Bundle.getMessage("Connection")+" "+_memo.getUserName(), - TitledBorder.LEFT,TitledBorder.ABOVE_TOP); - nodeTablePanel.add(nodeTableScrollPane,BorderLayout.CENTER); + Bundle.getMessage("Connection") + " " + _memo.getUserName(), + TitledBorder.LEFT, TitledBorder.ABOVE_TOP); + nodeTablePanel.add(nodeTableScrollPane, BorderLayout.CENTER); nodeTablePanel.setBorder(inputBorderTitled); setPreferredSize(new Dimension(950, 550)); @@ -280,63 +276,36 @@ public void initComponents() contentPane.add(nodeTablePanel); - /** - * ------------------------- - * Setup main window buttons - * ------------------------- - */ + // Setup main window buttons JPanel panel3 = new JPanel(); - panel3.setLayout(new BoxLayout(panel3,FlowLayout.RIGHT)); + panel3.setLayout(new BoxLayout(panel3, FlowLayout.RIGHT)); panel3.setPreferredSize(new Dimension(950, 50)); - /** - * ----------------- - * Set up Add button - * ----------------- - */ + // Set up Add button addButton.setVisible(true); - addButton.setToolTipText(Bundle.getMessage("AddButtonTip") ); - addButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent e) { - addButtonActionPerformed(e); - } - + addButton.setToolTipText(Bundle.getMessage("AddButtonTip")); + addButton.addActionListener((java.awt.event.ActionEvent e) -> { + addButtonActionPerformed(e); + }); + panel3.add(addButton); - }); - panel3.add(addButton); - - /** - * ------------------- - * Set up Print button - * ------------------- - */ + // Set up Print button printButton.setVisible(true); - printButton.setToolTipText(Bundle.getMessage("PrintButtonTip") ); - if (numConfigNodes > 0) { - printButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - printButtonActionPerformed(e); - } - }); - } - panel3.add(printButton); + printButton.setToolTipText(Bundle.getMessage("PrintButtonTip")); + if (numConfigNodes > 0) { + printButton.addActionListener((java.awt.event.ActionEvent e) -> { + printButtonActionPerformed(e); + }); + } + panel3.add(printButton); - /** - * ------------------ - * Set up Done button - * ------------------ - */ + // Set up Done button doneButton.setVisible(true); - doneButton.setToolTipText(Bundle.getMessage("DoneButtonTip") ); - doneButton.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent e) { - doneButtonActionPerformed(); - } - - }); - panel3.add(doneButton); + doneButton.setToolTipText(Bundle.getMessage("DoneButtonTip")); + doneButton.addActionListener((java.awt.event.ActionEvent e) -> { + doneButtonActionPerformed(); + }); + panel3.add(doneButton); contentPane.add(panel3); addHelpMenu("package.jmri.jmrix.cmri.serial.nodeconfigmanager.NodeConfigManagerFrame", true); @@ -346,56 +315,49 @@ public void actionPerformed(java.awt.event.ActionEvent e) { } /** - * -------------------------------------------- - * Extract the node address from the node table - * -------------------------------------------- + * Get the selected node address from the node table. */ public int getSelectedNodeAddr() { - return (Integer)nodeTable.getValueAt(nodeTable.getSelectedRow(),0); + return (Integer) nodeTable.getValueAt(nodeTable.getSelectedRow(), 0); } /** - * ------------------------------------------------------------------ - * Node browser button handlers - * The reminder to save changes is only done at the main window close - * ------------------------------------------------------------------ + * Handle the done button click. */ public void doneButtonActionPerformed() { - if(changedNode) - { - JOptionPane.showMessageDialog(this, - Bundle.getMessage("Reminder1")+"\n"+Bundle.getMessage("Reminder2"), - Bundle.getMessage("ReminderTitle"), - JOptionPane.INFORMATION_MESSAGE); - } - changedNode = false; - setVisible(false); - dispose(); + if (changedNode) { + JOptionPane.showMessageDialog(this, + Bundle.getMessage("Reminder1") + "\n" + Bundle.getMessage("Reminder2"), + Bundle.getMessage("ReminderTitle"), + JOptionPane.INFORMATION_MESSAGE); + } + changedNode = false; + setVisible(false); + dispose(); } public void addButtonActionPerformed(ActionEvent e) { NodeConfigManagerFrame f = new NodeConfigManagerFrame(_memo); try { - f.initNodeConfigWindow(); - } - catch (Exception ex) { - log.info("addButtonActionPerformed Exception-C2: "+ex.toString()); - } + f.initNodeConfigWindow(); + } catch (Exception ex) { + log.info("addButtonActionPerformed Exception-C2: " + ex.toString()); + } f.nodeTableModel = nodeTableModel; f.initNodeVariables(); f.buttonSet_ADD(); - f.setLocation(100,100); + f.setLocation(100, 100); f.setVisible(true); } - /** - * --------------- - * Print Button - * -------------- - */ - public void printButtonActionPerformed(java.awt.event.ActionEvent e) { + /** + * Print. + * + * @param e the triggering event + */ + public void printButtonActionPerformed(java.awt.event.ActionEvent e) { int[] colWidth = new int[10]; - // initialize column widths + // initialize column widths TableColumnModel nodeTableColumnModel = nodeTable.getColumnModel(); colWidth[0] = nodeTableColumnModel.getColumn(NodeTableModel.NODENUM_COLUMN).getWidth(); colWidth[1] = nodeTableColumnModel.getColumn(NodeTableModel.NODETYPE_COLUMN).getWidth(); @@ -408,33 +370,24 @@ public void printButtonActionPerformed(java.awt.event.ActionEvent e) { colWidth[8] = nodeTableColumnModel.getColumn(NodeTableModel.NUMBITS_COLUMN).getWidth(); colWidth[9] = nodeTableColumnModel.getColumn(NodeTableModel.NUMBITS_COLUMN).getWidth(); - // set up a page title - String head = "CMRInet Node Table"; - // initialize a printer writer + // set up a page title + String head = "CMRInet Node Table"; + // initialize a printer writer HardcopyWriter writer = null; try { - writer = new HardcopyWriter(curFrame, head, 10, .8, .5, .5, .5, false); - } catch (HardcopyWriter.PrintCanceledException ex) { - return; - } - writer.increaseLineSpacing(20); - // print the assignments - (nodeTableModel).printTable(writer,colWidth); - } - + writer = new HardcopyWriter(curFrame, head, 10, .8, .5, .5, .5, false); + } catch (HardcopyWriter.PrintCanceledException ex) { + return; + } + writer.increaseLineSpacing(20); + // print the assignments + (nodeTableModel).printTable(writer, colWidth); + } /** - * --------------------------------- - * Node table SELECT button handlers - * --------------------------------- + * Edit node table selection. */ - - /** -------- - * EDIT - * -------- - */ - public void editActionSelected() - { + public void editActionSelected() { selectedNodeAddr = getSelectedNodeAddr(); NodeConfigManagerFrame f = new NodeConfigManagerFrame(_memo); @@ -442,85 +395,75 @@ public void editActionSelected() f.selectedTableRow = nodeTable.convertRowIndexToModel(nodeTable.getSelectedRow()); try { - f.initNodeConfigWindow(); - f.editNodeButtonActionPerformed(selectedNodeAddr); - } - catch (Exception ex) { - log.info("editActionSelected Exception-C2: "+ex.toString()); + f.initNodeConfigWindow(); + f.editNodeButtonActionPerformed(selectedNodeAddr); + } catch (Exception ex) { + log.info("editActionSelected", ex); - } - f.setLocation(200,200); + } + f.setLocation(200, 200); f.buttonSet_EDIT(); f.setVisible(true); } - /* ---------- - * DELETE - * ---------- + /** + * Handle the delete button click */ - public void deleteActionSelected() - { + public void deleteActionSelected() { selectedNodeAddr = getSelectedNodeAddr(); NodeConfigManagerFrame f = new NodeConfigManagerFrame(_memo); f.nodeTableModel = nodeTableModel; f.selectedTableRow = nodeTable.convertRowIndexToModel(nodeTable.getSelectedRow()); try { - f.initNodeConfigWindow(); - f.deleteNodeButtonActionPerformed(selectedNodeAddr); - } - catch (Exception ex) { - log.info("deleteActionSelected Exception-C2: "+ex.toString()); + f.initNodeConfigWindow(); + f.deleteNodeButtonActionPerformed(selectedNodeAddr); + } catch (Exception ex) { + log.info("deleteActionSelected", ex); - } - f.setLocation(200,200); + } + f.setLocation(200, 200); f.buttonSet_DELETE(); f.setVisible(true); } /** - * ------------ - * I/O BIT INFO - * ------------ + * Handle info action. */ - public void infoActionSelected() - { + public void infoActionSelected() { selectedNodeAddr = getSelectedNodeAddr(); NodeIOListFrame f = new NodeIOListFrame(_memo); try { - f.initComponents(); - f.displayNodeIOBits(selectedNodeAddr); - } - catch (Exception ex) { - log.info("infoActionSelected Exception-C2: "+ex.toString()); + f.initComponents(); + f.displayNodeIOBits(selectedNodeAddr); + } catch (Exception ex) { + log.info("infoActionSelected Exception-C2: " + ex.toString()); - } - f.setLocation(100,100); + } + f.setLocation(100, 100); f.setVisible(true); } /** - * Method to initialize configured nodes and sets up the node select combo box + * Method to initialize configured nodes and sets up the node select combo + * box */ - public void initializeNodes() - { - String str = ""; + public void initializeNodes() { + String str = ""; - // get all configured nodes - if (!cmriNode.isEmpty()) - { + // get all configured nodes + if (!cmriNode.isEmpty()) { cmriNode.clear(); } - SerialNode node = (SerialNode) _memo.getTrafficController().getNode(0); + SerialNode node = (SerialNode) _memo.getTrafficController().getNode(0); int index = 1; - while (node != null) - { + while (node != null) { cmriNode.add(node); node = (SerialNode) _memo.getTrafficController().getNode(index); - index ++; - } + index++; + } numConfigNodes = cmriNode.size(); } @@ -528,117 +471,127 @@ public void initializeNodes() /** * Set up table for displaying bit assignments */ - public class NodeTableModel extends AbstractTableModel //c2 - { + public class NodeTableModel extends AbstractTableModel { + public String getColumnName(int c) { return nodeTableColumnsNames[c]; } + public Class getColumnClass(int c) { switch (c) { case NODENUM_COLUMN: - return Integer.class; + return Integer.class; case NODETYPE_COLUMN: - return String.class; + return String.class; case NUMBITS_COLUMN: case NUMINCARDS_COLUMN: case NUMOUTCARDS_COLUMN: case NUMINBYTES_COLUMN: case NUMOUTBYTES_COLUMN: - return Integer.class; + return Integer.class; case SELECT_COLUMN: - return String.class; + return String.class; case NODEDESC_COLUMN: default: - return String.class; + return String.class; } } - public boolean isCellEditable(int r,int c) - { - if (c==SELECT_COLUMN) - return true; - else - return false; + + public boolean isCellEditable(int r, int c) { + if (c == SELECT_COLUMN) { + return true; + } else { + return false; + } } - public int getColumnCount () {return NUM_COLUMNS;} - public int getRowCount () {return cmriNode.size();} - public void removeRow(int row){ + + public int getColumnCount() { + return NUM_COLUMNS; + } + + public int getRowCount() { + return cmriNode.size(); + } + + public void removeRow(int row) { cmriNode.remove(row); numConfigNodes = cmriNode.size(); fireTableRowsDeleted(row, row); } + public void addRow(SerialNode newNode) { cmriNode.add(newNode); numConfigNodes = cmriNode.size(); fireTableDataChanged(); } + public void changeRow(int row, SerialNode aNode) { cmriNode.set(row, aNode); fireTableDataChanged(); } - public void setValueAt(Object value, int row, int col) { + + public void setValueAt(Object value, int row, int col) { if (col == SELECT_COLUMN) { - if ( Bundle.getMessage("SelectEdit").equals(value) ) - { - editActionSelected(); - } - else - if (Bundle.getMessage("SelectInfo").equals(value) ) - { - infoActionSelected(); - } - else - if (Bundle.getMessage("SelectDelete").equals(value) ) - { - deleteActionSelected(); + if (Bundle.getMessage("SelectEdit").equals(value)) { + editActionSelected(); + } else if (Bundle.getMessage("SelectInfo").equals(value)) { + infoActionSelected(); + } else if (Bundle.getMessage("SelectDelete").equals(value)) { + deleteActionSelected(); } - } else log.info("setValueAt Row"+row+" value "+value); + } else { + log.info("setValueAt Row" + row + " value " + value); + } fireTableDataChanged(); } - public Object getValueAt (int r,int c) { - switch(c) - { - case NODENUM_COLUMN: - if (!doingPrint) - return cmriNode.get(r).getNodeAddress(); - else - return Integer.toString(cmriNode.get(r).getNodeAddress()); - case NODETYPE_COLUMN: - return " "+nodeTableTypes[cmriNode.get(r).getNodeType()]; + public Object getValueAt(int r, int c) { + switch (c) { + case NODENUM_COLUMN: + if (!doingPrint) { + return cmriNode.get(r).getNodeAddress(); + } else { + return Integer.toString(cmriNode.get(r).getNodeAddress()); + } - case NUMBITS_COLUMN: - return Integer.toString(cmriNode.get(r).getNumBitsPerCard()); + case NODETYPE_COLUMN: + return " " + nodeTableTypes[cmriNode.get(r).getNodeType()]; - case NUMINCARDS_COLUMN: - if (cmriNode.get(r).getNodeType() == SerialNode.SMINI) - return Integer.toString(cmriNode.get(r).numInputCards()*3); - else - return Integer.toString(cmriNode.get(r).numInputCards()); + case NUMBITS_COLUMN: + return Integer.toString(cmriNode.get(r).getNumBitsPerCard()); - case NUMOUTCARDS_COLUMN: - if (cmriNode.get(r).getNodeType() == SerialNode.SMINI) - return Integer.toString(cmriNode.get(r).numOutputCards()*3); - else - return Integer.toString(cmriNode.get(r).numOutputCards()); + case NUMINCARDS_COLUMN: + if (cmriNode.get(r).getNodeType() == SerialNode.SMINI) { + return Integer.toString(cmriNode.get(r).numInputCards() * 3); + } else { + return Integer.toString(cmriNode.get(r).numInputCards()); + } - case NUMINBYTES_COLUMN: - return Integer.toString((cmriNode.get(r).getNumBitsPerCard())*cmriNode.get(r).numInputCards()); + case NUMOUTCARDS_COLUMN: + if (cmriNode.get(r).getNodeType() == SerialNode.SMINI) { + return Integer.toString(cmriNode.get(r).numOutputCards() * 3); + } else { + return Integer.toString(cmriNode.get(r).numOutputCards()); + } - case NUMOUTBYTES_COLUMN: - return Integer.toString((cmriNode.get(r).getNumBitsPerCard())*cmriNode.get(r).numOutputCards()); + case NUMINBYTES_COLUMN: + return Integer.toString((cmriNode.get(r).getNumBitsPerCard()) * cmriNode.get(r).numInputCards()); - case SELECT_COLUMN: + case NUMOUTBYTES_COLUMN: + return Integer.toString((cmriNode.get(r).getNumBitsPerCard()) * cmriNode.get(r).numOutputCards()); - return "Select"; - case NODEDESC_COLUMN: + case SELECT_COLUMN: + + return "Select"; + case NODEDESC_COLUMN: - return " "+cmriNode.get(r).getcmriNodeDesc(); - default: - return ""; + return " " + cmriNode.get(r).getcmriNodeDesc(); + default: + return ""; } } @@ -651,18 +604,17 @@ public Object getValueAt (int r,int c) { public static final int NUMOUTBYTES_COLUMN = 6; public static final int SELECT_COLUMN = 7; public static final int NODEDESC_COLUMN = 8; - public static final int NUM_COLUMNS = NODEDESC_COLUMN+1; + public static final int NUM_COLUMNS = NODEDESC_COLUMN + 1; // private String[] pollStatus = {"ERROR","IDLE","POLLING","TIMEOUT","SLOW POLL"}; - /** - * Method to print or print preview the assignment table. - * Printed in proportionately sized columns across the page with headings and - * vertical lines between each column. Data is word wrapped within a column. - * Can only handle 4 columns of data as strings. - * Adapted from routines in BeanTableDataModel.java by Bob Jacobsen and Dennis Miller - */ - public void printTable(HardcopyWriter w,int colWidth[]) { + * Method to print or print preview the assignment table. Printed in + * proportionately sized columns across the page with headings and + * vertical lines between each column. Data is word wrapped within a + * column. Can only handle 4 columns of data as strings. Adapted from + * routines in BeanTableDataModel.java by Bob Jacobsen and Dennis Miller + */ + public void printTable(HardcopyWriter w, int colWidth[]) { // determine the column sizes - proportionately sized, with space between for lines int[] columnSize = new int[NUM_COLUMNS]; int charPerLine = w.getCharactersPerLine(); @@ -670,299 +622,286 @@ public void printTable(HardcopyWriter w,int colWidth[]) { int totalColWidth = 0; doingPrint = true; - for (int j = 0; j < NUM_COLUMNS; j++) - if(j!=SELECT_COLUMN) { - totalColWidth += colWidth[j]; + for (int j = 0; j < NUM_COLUMNS; j++) { + if (j != SELECT_COLUMN) { + totalColWidth += colWidth[j]; + } } - float ratio = ((float)charPerLine)/((float)totalColWidth); - for (int j = 0; j < NUM_COLUMNS; j++) - if(j!=SELECT_COLUMN) { - columnSize[j] = ((int)(colWidth[j]*ratio)) - 1; - tableLineWidth += (columnSize[j] + 1); + float ratio = ((float) charPerLine) / ((float) totalColWidth); + for (int j = 0; j < NUM_COLUMNS; j++) { + if (j != SELECT_COLUMN) { + columnSize[j] = ((int) (colWidth[j] * ratio)) - 1; + tableLineWidth += (columnSize[j] + 1); + } } // Draw horizontal dividing line - w.write(w.getCurrentLineNumber(),0,w.getCurrentLineNumber(),tableLineWidth); + w.write(w.getCurrentLineNumber(), 0, w.getCurrentLineNumber(), tableLineWidth); // print the column header labels String[] columnStrings = new String[NUM_COLUMNS]; // Put each column header in the array for (int i = 0; i < NUM_COLUMNS; i++) { - if(i!=SELECT_COLUMN) { + if (i != SELECT_COLUMN) { columnStrings[i] = this.getColumnName(i); } } - // w.setFontStyle(Font.BOLD); - printColumns(w,columnStrings,columnSize); + // w.setFontStyle(Font.BOLD); + printColumns(w, columnStrings, columnSize); w.setFontStyle(0); // draw horizontal line - w.write(w.getCurrentLineNumber(),0,w.getCurrentLineNumber(),tableLineWidth); + w.write(w.getCurrentLineNumber(), 0, w.getCurrentLineNumber(), tableLineWidth); // now print each row of data String[] spaces = new String[NUM_COLUMNS]; // create base strings the width of each of the columns - for (int k = 0; k < NUM_COLUMNS; k++) - if( k!=SELECT_COLUMN) { - spaces[k] = ""; - for (int i = 0; i < columnSize[k]; i++) - { - spaces[k] = spaces[k] + " "; - } - } - for (int i = 0; i < this.getRowCount(); i++) - { - for (int j = 0; j < NUM_COLUMNS; j++) if(j!=SELECT_COLUMN) { - //check for special, null contents - if (this.getValueAt(i, j) == null) { - columnStrings[j] = spaces[j]; + for (int k = 0; k < NUM_COLUMNS; k++) { + if (k != SELECT_COLUMN) { + spaces[k] = ""; + for (int i = 0; i < columnSize[k]; i++) { + spaces[k] = spaces[k] + " "; + } } - else {columnStrings[j] = (String)this.getValueAt(i, j); + } + for (int i = 0; i < this.getRowCount(); i++) { + for (int j = 0; j < NUM_COLUMNS; j++) { + if (j != SELECT_COLUMN) { + //check for special, null contents + if (this.getValueAt(i, j) == null) { + columnStrings[j] = spaces[j]; + } else { + columnStrings[j] = (String) this.getValueAt(i, j); + } + } } - } - printColumns(w, columnStrings, columnSize); - // draw horizontal line - w.write(w.getCurrentLineNumber(),0,w.getCurrentLineNumber(),tableLineWidth); + printColumns(w, columnStrings, columnSize); + // draw horizontal line + w.write(w.getCurrentLineNumber(), 0, w.getCurrentLineNumber(), tableLineWidth); } - doingPrint=false; + doingPrint = false; w.close(); } - protected void printColumns(HardcopyWriter w, String columnStrings[], int columnSize[]) - { + protected void printColumns(HardcopyWriter w, String columnStrings[], int columnSize[]) { String columnString = ""; StringBuilder lineString = new StringBuilder(""); String[] spaces = new String[NUM_COLUMNS]; // create base strings the width of each of the columns - for (int k = 0; k < NUM_COLUMNS; k++) - if(k!=SELECT_COLUMN) { + for (int k = 0; k < NUM_COLUMNS; k++) { + if (k != SELECT_COLUMN) { spaces[k] = ""; - for (int i = 0; i < columnSize[k]; i++) {spaces[k] = spaces[k] + " "; + for (int i = 0; i < columnSize[k]; i++) { + spaces[k] = spaces[k] + " "; } + } } // loop through each column boolean complete = false; - while (!complete){ - complete = true; - for (int i = 0; i < NUM_COLUMNS; i++) if (i!=SELECT_COLUMN) { - // if the column string is too wide cut it at word boundary (valid delimiters are space, - and _) - // use the initial part of the text,pad it with spaces and place the remainder back in the array - // for further processing on next line - // if column string isn't too wide, pad it to column width with spaces if needed - if (columnStrings[i].length() > columnSize[i]) { - // this column string will not fit on one line - boolean noWord = true; - for (int k = columnSize[i]; k >= 1 ; k--) { - if (columnStrings[i].substring(k-1,k).equals(" ") - || columnStrings[i].substring(k-1,k).equals("-") - || columnStrings[i].substring(k-1,k).equals("_")) { - columnString = columnStrings[i].substring(0,k) - + spaces[i].substring(columnStrings[i].substring(0,k).length()); - columnStrings[i] = columnStrings[i].substring(k); - noWord = false; + while (!complete) { + complete = true; + for (int i = 0; i < NUM_COLUMNS; i++) { + if (i != SELECT_COLUMN) { + // if the column string is too wide cut it at word boundary (valid delimiters are space, - and _) + // use the initial part of the text,pad it with spaces and place the remainder back in the array + // for further processing on next line + // if column string isn't too wide, pad it to column width with spaces if needed + if (columnStrings[i].length() > columnSize[i]) { + // this column string will not fit on one line + boolean noWord = true; + for (int k = columnSize[i]; k >= 1; k--) { + if (columnStrings[i].substring(k - 1, k).equals(" ") + || columnStrings[i].substring(k - 1, k).equals("-") + || columnStrings[i].substring(k - 1, k).equals("_")) { + columnString = columnStrings[i].substring(0, k) + + spaces[i].substring(columnStrings[i].substring(0, k).length()); + columnStrings[i] = columnStrings[i].substring(k); + noWord = false; + complete = false; + break; + } + } + if (noWord) { + columnString = columnStrings[i].substring(0, columnSize[i]); + columnStrings[i] = columnStrings[i].substring(columnSize[i]); complete = false; - break; } - } - if (noWord) { - columnString = columnStrings[i].substring(0,columnSize[i]); - columnStrings[i] = columnStrings[i].substring(columnSize[i]); - complete = false; + } else { + // this column string will fit on one line + columnString = columnStrings[i] + spaces[i].substring(columnStrings[i].length()); + columnStrings[i] = ""; + } + lineString.append(columnString).append(" "); } } - else { - // this column string will fit on one line - columnString = columnStrings[i] + spaces[i].substring(columnStrings[i].length()); - columnStrings[i] = ""; - } - lineString.append(columnString).append(" "); - } - try { + try { w.write(lineString.toString()); //write vertical dividing lines int iLine = w.getCurrentLineNumber(); - for (int i = 0, k = 0; i < w.getCharactersPerLine(); k++) if (k!=SELECT_COLUMN){ - w.write( iLine, i, iLine + 1, i); - if (k(); panel11.add(nodeTypeBox); nodeTypeBox.addItem("SMINI"); nodeTypeBox.addItem("USIC_SUSIC"); - nodeTypeBox.addItem("CPNODE"); //c2 + nodeTypeBox.addItem("CPNODE"); - //--------------------------------------------------------------- - // Hide the menu item until MRCS are ready to release the cpMega - // nodeTypeBox.addItem("CPMEGA"); - //--------------------------------------------------------------- + // Hide the menu item until MRCS are ready to release the cpMega + // nodeTypeBox.addItem("CPMEGA"); - /** - * Here add code for other types of nodes + /* + * Here add code for other types of nodes */ + nodeTypeBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent event) { + String s = (String) nodeTypeBox.getSelectedItem(); + + if (s.equals("SMINI")) { + panel2.setVisible(false); + panel2a.setVisible(true); + panel2b.setVisible(false); + panel2c.setVisible(false); + cardSizeText.setVisible(false); + cardSizeBox.setVisible(false); + cardSize8Box.setVisible(false); + panelnodeDescBox.setVisible(true); + panelnodeDesc.setVisible(true); + panelnetOpt.setVisible(true); + panelnetOptBox.setVisible(true); + panelnodeOpt.setVisible(false); + nodeType = SerialNode.SMINI; + onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes") + " 3 Input, 6 Output"); + } else if (s.equals("USIC_SUSIC")) { + panel2.setVisible(true); + panel2a.setVisible(false); + panel2b.setVisible(false); + panel2c.setVisible(false); + cardSizeText.setVisible(true); + cardSizeBox.setVisible(true); + cardSize8Box.setVisible(false); + panelnodeDescBox.setVisible(true); + panelnodeDesc.setVisible(true); + panelnetOpt.setVisible(true); + panelnetOptBox.setVisible(true); + panelnodeOpt.setVisible(false); + nodeType = SerialNode.USIC_SUSIC; + onBoardBytesText.setText(" "); + } else if (s.equals("CPNODE")) { + panel2.setVisible(false); + panel2a.setVisible(false); + panel2b.setVisible(true); + panel2c.setVisible(false); // IOX bytes + cardSizeText.setVisible(true); + cardSizeBox.setVisible(false); + cardSize8Box.setVisible(true); + panelnodeDescBox.setVisible(true); + panelnodeDesc.setVisible(true); + panelnetOpt.setVisible(true); + panelnetOptBox.setVisible(true); + panelnodeOpt.setVisible(true); + nodeType = SerialNode.CPNODE; + onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes") + " 2 Bytes"); + } else if (s.equals("CPMEGA")) { + panel2.setVisible(false); + panel2a.setVisible(false); + panel2b.setVisible(true); + panel2c.setVisible(true); // IOX bytes + cardSizeText.setVisible(true); + cardSizeBox.setVisible(false); + cardSize8Box.setVisible(true); + panelnodeDescBox.setVisible(true); + panelnodeDesc.setVisible(true); + panelnetOpt.setVisible(true); + panelnetOptBox.setVisible(true); + panelnodeOpt.setVisible(true); + nodeType = SerialNode.CPMEGA; + onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes") + " 8 Bytes"); + } + /* + * Here add code for other types of nodes + */ - nodeTypeBox.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent event) - { - String s = (String)nodeTypeBox.getSelectedItem(); - - if (s.equals("SMINI")) - { - panel2.setVisible(false); - panel2a.setVisible(true); - panel2b.setVisible(false); - panel2c.setVisible(false); - cardSizeText.setVisible(false); - cardSizeBox.setVisible(false); - cardSize8Box.setVisible(false); - panelnodeDescBox.setVisible(true); - panelnodeDesc.setVisible(true); - panelnetOpt.setVisible(true); - panelnetOptBox.setVisible(true); - panelnodeOpt.setVisible(false); - nodeType = SerialNode.SMINI; - onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes")+" 3 Input, 6 Output"); - } - else if (s.equals("USIC_SUSIC")) - { - panel2.setVisible(true); - panel2a.setVisible(false); - panel2b.setVisible(false); - panel2c.setVisible(false); - cardSizeText.setVisible(true); - cardSizeBox.setVisible(true); - cardSize8Box.setVisible(false); - panelnodeDescBox.setVisible(true); - panelnodeDesc.setVisible(true); - panelnetOpt.setVisible(true); - panelnetOptBox.setVisible(true); - panelnodeOpt.setVisible(false); - nodeType = SerialNode.USIC_SUSIC; - onBoardBytesText.setText(" "); - } - else if (s.equals("CPNODE")) //c2 - { - panel2.setVisible(false); - panel2a.setVisible(false); - panel2b.setVisible(true); - panel2c.setVisible(false); // IOX bytes - cardSizeText.setVisible(true); - cardSizeBox.setVisible(false); - cardSize8Box.setVisible(true); - panelnodeDescBox.setVisible(true); - panelnodeDesc.setVisible(true); - panelnetOpt.setVisible(true); - panelnetOptBox.setVisible(true); - panelnodeOpt.setVisible(true); - nodeType = SerialNode.CPNODE; - onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes")+" 2 Bytes"); - } - else if (s.equals("CPMEGA")) //c2 - { - panel2.setVisible(false); - panel2a.setVisible(false); - panel2b.setVisible(true); - panel2c.setVisible(true); // IOX bytes - cardSizeText.setVisible(true); - cardSizeBox.setVisible(false); - cardSize8Box.setVisible(true); - panelnodeDescBox.setVisible(true); - panelnodeDesc.setVisible(true); - panelnetOpt.setVisible(true); - panelnetOptBox.setVisible(true); - panelnodeOpt.setVisible(true); - nodeType = SerialNode.CPMEGA; - onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes")+" 8 Bytes"); - } - /** - * Here add code for other types of nodes - */ - - - /** - * reset notes as appropriate - */ - resetNotes(); + // reset notes as appropriate + resetNotes(); } - }); + }); nodeTypeBox.setToolTipText(Bundle.getMessage("TipNodeType")); JPanel panel12 = new JPanel(); panel12.setLayout(new FlowLayout()); - panel12.add(new JLabel(Bundle.getMessage("LabelDelay")+" ")); + panel12.add(new JLabel(Bundle.getMessage("LabelDelay") + " ")); panel12.add(receiveDelayField); receiveDelayField.setToolTipText(Bundle.getMessage("TipDelay")); receiveDelayField.setText("0"); @@ -974,27 +913,23 @@ else if (s.equals("CPMEGA")) //c2 cardSizeBox.addItem(Bundle.getMessage("CardSize24")); cardSizeBox.addItem(Bundle.getMessage("CardSize32")); cardSize8Box.addItem(Bundle.getMessage("CardSize8")); - /** - * Here add code for other types of nodes - */ + /* + * Here add code for other types of nodes + */ - cardSizeBox.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(java.awt.event.ActionEvent event) - { - String s = (String)cardSizeBox.getSelectedItem(); - if (s.equals(Bundle.getMessage("CardSize24"))) { - bitsPerCard = 24; - } - else if (s.equals(Bundle.getMessage("CardSize32"))) { - bitsPerCard = 32; - } - else if (s.equals(Bundle.getMessage("CardSize8"))) { - bitsPerCard = 8; - } - // here add code for other node types, if required + cardSizeBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent event) { + String s = (String) cardSizeBox.getSelectedItem(); + if (s.equals(Bundle.getMessage("CardSize24"))) { + bitsPerCard = 24; + } else if (s.equals(Bundle.getMessage("CardSize32"))) { + bitsPerCard = 32; + } else if (s.equals(Bundle.getMessage("CardSize8"))) { + bitsPerCard = 8; + } + // here add code for other node types, if required } - }); + }); cardSizeBox.setToolTipText(Bundle.getMessage("TipCardSize")); cardSizeText.setVisible(false); cardSizeBox.setVisible(false); @@ -1002,7 +937,7 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { JPanel panel13 = new JPanel(); panel13.setLayout(new FlowLayout()); - panel13.add(new JLabel(Bundle.getMessage("LabelPulseWidth")+" ")); + panel13.add(new JLabel(Bundle.getMessage("LabelPulseWidth") + " ")); panel13.add(pulseWidthField); pulseWidthField.setToolTipText(Bundle.getMessage("TipPulseWidth")); pulseWidthField.setText("500"); @@ -1013,31 +948,27 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { panel14.setVisible(true); // Load the top half of the common window - //--------------------------------------- panel1.add(panel11); panel1.add(panel12); - panel1.add(panel13); - panel1.add(panel14); + panel1.add(panel13); + panel1.add(panel14); contentPane.add(panel1); - /** - * Set up USIC/SUSIC card type configuration table - *------------------------------------------------- - */ + // Set up USIC/SUSIC card type configuration table JPanel panel21 = new JPanel(); panel21.setLayout(new BoxLayout(panel21, BoxLayout.Y_AXIS)); panel21.add(new JLabel(Bundle.getMessage("HintCardTypePartA"))); - panel21.add(new JLabel(" "+Bundle.getMessage("HintCardTypePartB"))); - panel21.add(new JLabel(" "+Bundle.getMessage("HintCardTypePartC"))); + panel21.add(new JLabel(" " + Bundle.getMessage("HintCardTypePartB"))); + panel21.add(new JLabel(" " + Bundle.getMessage("HintCardTypePartC"))); panel21.add(new JLabel(" ")); panel21.add(new JLabel(Bundle.getMessage("HintCardTypePartD"))); - panel21.add(new JLabel(" "+Bundle.getMessage("HintCardTypePartE"))); - panel21.add(new JLabel(" "+Bundle.getMessage("HintCardTypePartF"))); + panel21.add(new JLabel(" " + Bundle.getMessage("HintCardTypePartE"))); + panel21.add(new JLabel(" " + Bundle.getMessage("HintCardTypePartF"))); panel2.add(panel21); TableModel cardConfigModel = new CardConfigModel(); JTable cardConfigTable = new JTable(cardConfigModel); cardConfigTable.setRowSelectionAllowed(false); - cardConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180,95)); //c2 + cardConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(180, 95)); JComboBox cardTypeCombo = new JComboBox<>(); cardTypeCombo.addItem(Bundle.getMessage("CardTypeOutput")); @@ -1055,42 +986,36 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { cardTypeColumn.setMaxWidth(100); JScrollPane cardScrollPane = new JScrollPane(cardConfigTable); - panel2.add(cardScrollPane,BorderLayout.CENTER); + panel2.add(cardScrollPane, BorderLayout.CENTER); contentPane.add(panel2); panel2.setVisible(false); - /** - * Set up SMINI oscillating 2-lead searchlight configuration table - * ---------------------------------------------------------------- - */ + // Set up SMINI oscillating 2-lead searchlight configuration table JPanel panel2a1 = new JPanel(); panel2a1.setLayout(new BoxLayout(panel2a1, BoxLayout.Y_AXIS)); panel2a1.add(new JLabel(Bundle.getMessage("HintSearchlightPartA"))); - panel2a1.add(new JLabel(" "+Bundle.getMessage("HintSearchlightPartB"))); - panel2a1.add(new JLabel(" "+Bundle.getMessage("HintSearchlightPartC"))); + panel2a1.add(new JLabel(" " + Bundle.getMessage("HintSearchlightPartB"))); + panel2a1.add(new JLabel(" " + Bundle.getMessage("HintSearchlightPartC"))); panel2a1.add(new JLabel(" ")); panel2a1.add(new JLabel(Bundle.getMessage("HintSearchlightPartD"))); - panel2a1.add(new JLabel(" "+Bundle.getMessage("HintSearchlightPartE"))); - panel2a1.add(new JLabel(" "+Bundle.getMessage("HintSearchlightPartF"))); + panel2a1.add(new JLabel(" " + Bundle.getMessage("HintSearchlightPartE"))); + panel2a1.add(new JLabel(" " + Bundle.getMessage("HintSearchlightPartF"))); panel2a.add(panel2a1); TableModel searchlightConfigModel = new SearchlightConfigModel(); JTable searchlightConfigTable = new JTable(searchlightConfigModel); searchlightConfigTable.setRowSelectionAllowed(false); - searchlightConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(208,100)); + searchlightConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(208, 100)); TableColumnModel searchlightColumnModel = searchlightConfigTable.getColumnModel(); TableColumn portColumn = searchlightColumnModel.getColumn(SearchlightConfigModel.PORT_COLUMN); portColumn.setMinWidth(90); portColumn.setMaxWidth(100); JScrollPane searchlightScrollPane = new JScrollPane(searchlightConfigTable); - panel2a.add(searchlightScrollPane,BorderLayout.CENTER); + panel2a.add(searchlightScrollPane, BorderLayout.CENTER); contentPane.add(panel2a); panel2.setVisible(false); - /** - * Set up CPMEGA on board byte I/O assignments - * ------------------------------------------ - */ + // Set up CPMEGA on board byte I/O assignments JPanel panel2b3 = new JPanel(); panel2b3.setLayout(new BoxLayout(panel2b3, BoxLayout.Y_AXIS)); panel2b3.add(new JLabel("Assign Onboard Bytes")); @@ -1099,7 +1024,7 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { TableModel osnodeConfigModel = new OSnodeConfigModel(); JTable osnodeConfigTable = new JTable(osnodeConfigModel); osnodeConfigTable.setRowSelectionAllowed(false); - osnodeConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(170,95)); //160 + osnodeConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(170, 95)); //160 JComboBox osnodeTypeCombo = new JComboBox<>(); osnodeTypeCombo.addItem(Bundle.getMessage("CardTypeOutput")); @@ -1117,14 +1042,11 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { x21Column.setMaxWidth(100); JScrollPane osnodeScrollPane = new JScrollPane(osnodeConfigTable); - panel2c.add(osnodeScrollPane,BorderLayout.CENTER); + panel2c.add(osnodeScrollPane, BorderLayout.CENTER); contentPane.add(panel2c); panel2.setVisible(false); - /** - * Set up I/O Expander (IOX) port assignments - * ------------------------------------------ - */ + // Set up I/O Expander (IOX) port assignments JPanel panel2b1 = new JPanel(); panel2b1.setLayout(new BoxLayout(panel2b1, BoxLayout.Y_AXIS)); panel2b1.add(new JLabel("Assign IOX Ports")); @@ -1134,7 +1056,7 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { TableModel cpnodeConfigModel = new CPnodeConfigModel(); JTable cpnodeConfigTable = new JTable(cpnodeConfigModel); cpnodeConfigTable.setRowSelectionAllowed(false); - cpnodeConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(200,130)); //160 + cpnodeConfigTable.setPreferredScrollableViewportSize(new java.awt.Dimension(200, 130)); //160 JComboBox cpnodeTypeCombo = new JComboBox<>(); cpnodeTypeCombo.addItem(Bundle.getMessage("CardTypeOutput")); @@ -1152,14 +1074,11 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { x2Column.setMaxWidth(100); JScrollPane cpnodeScrollPane = new JScrollPane(cpnodeConfigTable); - panel2b.add(cpnodeScrollPane,BorderLayout.CENTER); + panel2b.add(cpnodeScrollPane, BorderLayout.CENTER); contentPane.add(panel2b); panel2b.setVisible(false); - /** - * node Description field - all node types have this field - * ------------------------------------------------------- - */ + // node Description field - all node types have this field panelnodeDescBox.setLayout(new BoxLayout(panelnodeDescBox, BoxLayout.Y_AXIS)); panelnodeDesc.setLayout(new FlowLayout()); panelnodeDesc.add(new JLabel("Description:")); @@ -1168,75 +1087,66 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { panelnodeDesc.setVisible(true); contentPane.add(panelnodeDesc); - /** - * Set up CMRInet Options - * ---------------------- - */ - panelnetOpt.setLayout(new GridLayout(0,2)); + // Set up CMRInet Options + panelnetOpt.setLayout(new GridLayout(0, 2)); panelnetOpt.add(cbx_cmrinetopt_AUTOPOLL); cbx_cmrinetopt_AUTOPOLL.addItemListener(nodeOptHandler); panelnetOpt.add(cbx_cmrinetopt_USECMRIX); cbx_cmrinetopt_USECMRIX.addItemListener(nodeOptHandler); - cbx_cmrinetopt_USECMRIX.setVisible(false); //--------- + cbx_cmrinetopt_USECMRIX.setVisible(false); panelnetOpt.add(cbx_cmrinetopt_USEBCC); cbx_cmrinetopt_USEBCC.addItemListener(nodeOptHandler); - cbx_cmrinetopt_USEBCC.setVisible(false); //--------- + cbx_cmrinetopt_USEBCC.setVisible(false); panelnetOpt.add(cbx_cmrinetopt_BIT8); cbx_cmrinetopt_BIT8.addItemListener(nodeOptHandler); - cbx_cmrinetopt_BIT8.setVisible(false); //--------- + cbx_cmrinetopt_BIT8.setVisible(false); panelnetOpt.add(cbx_cmrinetopt_BIT15); cbx_cmrinetopt_BIT15.addItemListener(nodeOptHandler); - cbx_cmrinetopt_BIT15.setVisible(false); //--------- + cbx_cmrinetopt_BIT15.setVisible(false); Border panelnetOptBorder = BorderFactory.createEtchedBorder(); - Border panelnetOptTitled = BorderFactory.createTitledBorder(panelnetOptBorder,"CMRInet Options"); + Border panelnetOptTitled = BorderFactory.createTitledBorder(panelnetOptBorder, "CMRInet Options"); panelnetOpt.setBorder(panelnetOptTitled); - panelnetOpt.setVisible(true); //--------- + panelnetOpt.setVisible(true); contentPane.add(panelnetOpt); panelnetOptBox.add(Box.createHorizontalStrut(50)); contentPane.add(panelnetOptBox); - /** - * Set up cpNode Options - * ---------------------- - */ - panelnodeOpt.setLayout(new GridLayout(0,2)); + // Set up cpNode Options + panelnodeOpt.setLayout(new GridLayout(0, 2)); panelnodeOpt.add(cbx_cpnodeopt_SENDEOT); cbx_cpnodeopt_SENDEOT.addItemListener(nodeOptHandler); - cbx_cpnodeopt_SENDEOT.setVisible(true); //--------- + cbx_cpnodeopt_SENDEOT.setVisible(true); panelnodeOpt.add(cbx_cpnodeopt_BIT1); cbx_cpnodeopt_BIT1.addItemListener(nodeOptHandler); - cbx_cpnodeopt_BIT1.setVisible(false); //--------- + cbx_cpnodeopt_BIT1.setVisible(false); panelnodeOpt.add(cbx_cpnodeopt_BIT2); cbx_cpnodeopt_BIT2.addItemListener(nodeOptHandler); - cbx_cpnodeopt_BIT2.setVisible(false); //--------- + cbx_cpnodeopt_BIT2.setVisible(false); panelnodeOpt.add(cbx_cpnodeopt_BIT8); cbx_cpnodeopt_BIT8.addItemListener(nodeOptHandler); - cbx_cpnodeopt_BIT8.setVisible(false); //--------- + cbx_cpnodeopt_BIT8.setVisible(false); panelnodeOpt.add(cbx_cpnodeopt_BIT15); cbx_cpnodeopt_BIT15.addItemListener(nodeOptHandler); - cbx_cpnodeopt_BIT15.setVisible(false); //--------- + cbx_cpnodeopt_BIT15.setVisible(false); Border panelnodeOptBorder = BorderFactory.createEtchedBorder(); - Border panelnodeOptTitled = BorderFactory.createTitledBorder(panelnodeOptBorder,"cpNode Options"); + Border panelnodeOptTitled = BorderFactory.createTitledBorder(panelnodeOptBorder, "cpNode Options"); panelnodeOpt.setBorder(panelnodeOptTitled); panelnodeOpt.setVisible(false); contentPane.add(panelnodeOpt); - /** - * Set up the notes area panel for various message displays - * -------------------------------------------------------- - */ + // Set up the notes area panel for various message displays JPanel panel3 = new JPanel(); panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS)); JPanel panel31 = new JPanel(); @@ -1255,78 +1165,64 @@ else if (s.equals(Bundle.getMessage("CardSize8"))) { panel3.add(panel32); panel3.add(panel33); Border panel3Border = BorderFactory.createEtchedBorder(); - Border panel3Titled = BorderFactory.createTitledBorder(panel3Border,Bundle.getMessage("BoxLabelNotes")); + Border panel3Titled = BorderFactory.createTitledBorder(panel3Border, Bundle.getMessage("BoxLabelNotes")); panel3.setBorder(panel3Titled); contentPane.add(panel3); - /** - * Set up the functions buttons - * ----------------------------- - */ + // Set up the functions buttons JPanel panel4 = new JPanel(); panel4.setLayout(new FlowLayout()); addNodeButton.setText(Bundle.getMessage("ButtonAdd")); addNodeButton.setVisible(false); addNodeButton.setToolTipText(Bundle.getMessage("TipAddButton")); - addNodeButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - addNodeButtonActionPerformed(); - } - }); + addNodeButton.addActionListener((java.awt.event.ActionEvent e) -> { + addNodeButtonActionPerformed(); + }); panel4.add(addNodeButton); deleteNodeButton.setText(Bundle.getMessage("ButtonDelete")); deleteNodeButton.setVisible(false); deleteNodeButton.setToolTipText(Bundle.getMessage("TipDeleteButton")); - deleteNodeButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - deleteNodeButtonActionConfirm(); - } - }); + deleteNodeButton.addActionListener((java.awt.event.ActionEvent e) -> { + deleteNodeButtonActionConfirm(); + }); panel4.add(deleteNodeButton); updateNodeButton.setText(Bundle.getMessage("ButtonUpdate")); updateNodeButton.setVisible(false); updateNodeButton.setToolTipText(Bundle.getMessage("TipUpdateButton")); - updateNodeButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - updateNodeButtonActionPerformed(); - } - }); + updateNodeButton.addActionListener((java.awt.event.ActionEvent e) -> { + updateNodeButtonActionPerformed(); + }); panel4.add(updateNodeButton); cancelNodeButton.setText(Bundle.getMessage("ButtonCancel")); cancelNodeButton.setVisible(false); cancelNodeButton.setToolTipText(Bundle.getMessage("TipCancelButton")); - cancelNodeButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - cancelNodeButtonActionPerformed(); - } - }); + cancelNodeButton.addActionListener((java.awt.event.ActionEvent e) -> { + cancelNodeButtonActionPerformed(); + }); panel4.add(cancelNodeButton); doneNodeButton.setText(Bundle.getMessage("ButtonDone")); doneNodeButton.setVisible(false); doneNodeButton.setToolTipText(Bundle.getMessage("TipDoneButton")); - doneNodeButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent e) { - doneNodeButtonActionPerformed(); - } - }); + doneNodeButton.addActionListener((java.awt.event.ActionEvent e) -> { + doneNodeButtonActionPerformed(); + }); panel4.add(doneNodeButton); - contentPane.add(panel4); pack(); } - /** + /* * ------------------------------------------------------- * Methods to set the correct states of the window buttons * ------------------------------------------------------- */ - public void buttonSet_ADD() { + public void buttonSet_ADD() { setTitle("ADD NODE"); statusText1.setText(addStatus1); statusText1.setVisible(true); @@ -1343,7 +1239,8 @@ public void buttonSet_ADD() { doneNodeButton.setVisible(false); cancelNodeButton.setVisible(true); } - public void buttonSet_EDIT() { + + public void buttonSet_EDIT() { setTitle("EDIT NODE"); statusText1.setText(editStatus1); statusText1.setVisible(true); @@ -1358,7 +1255,8 @@ public void buttonSet_EDIT() { doneNodeButton.setVisible(false); cancelNodeButton.setVisible(true); } - public void buttonSet_DELETE() { + + public void buttonSet_DELETE() { setTitle("DELETE NODE"); statusText1.setText(delStatus1); statusText1.setVisible(true); @@ -1375,46 +1273,48 @@ public void buttonSet_DELETE() { } public void addNodeButtonActionPerformed() { - /** - * Check that a node with this address does not exist - */ + // Check that a node with this address does not exist curNode = null; int nodeAddress = readNodeAddress(); - if (nodeAddress < 0) return; + if (nodeAddress < 0) { + return; + } - /** - * get a SerialNode corresponding to this node address if one exists - */ + // get a SerialNode corresponding to this node address if one exists curNode = (SerialNode) _memo.getTrafficController().getNodeFromAddress(nodeAddress); + // curNode can never be null at this point. Was this intended to catch + // an exception? if (curNode != null) { - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error1")+Integer.toString(nodeAddress)+ - Bundle.getMessage("Error2"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error1") + Integer.toString(nodeAddress) + + Bundle.getMessage("Error2"), "", JOptionPane.ERROR_MESSAGE); - statusText1.setText(Bundle.getMessage("Error1")+Integer.toString(nodeAddress)+ - Bundle.getMessage("Error2")); + statusText1.setText(Bundle.getMessage("Error1") + Integer.toString(nodeAddress) + + Bundle.getMessage("Error2")); statusText1.setVisible(true); errorInStatus1 = true; resetNotes2(); return; } - /** - * get node information from window and check for data consistency - */ - if ( !readReceiveDelay() ) return; - if ( !readPulseWidth() ) return; - if ( !checkConsistency() ) return; - - /** - * ------------------------------ - * all ready, create the new node - * ------------------------------ - */ - curNode = new SerialNode(nodeAddress,nodeType,_memo.getTrafficController()); + // get node information from window and check for data consistency + if (!readReceiveDelay()) { + return; + } + if (!readPulseWidth()) { + return; + } + if (!checkConsistency()) { + return; + } + + // all ready, create the new node + curNode = new SerialNode(nodeAddress, nodeType, _memo.getTrafficController()); + // curNode cannot be null or an execption would have been thrown; + // what exceptions should this be catching (no documented exceptions are thrown by constructor)? if (curNode == null) { statusText1.setText(Bundle.getMessage("Error3")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error3")+Integer.toString(nodeAddress),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error3") + Integer.toString(nodeAddress), "", JOptionPane.ERROR_MESSAGE); log.error("Error creating Serial Node, constructor returned null"); errorInStatus1 = true; resetNotes2(); @@ -1423,22 +1323,19 @@ public void addNodeButtonActionPerformed() { nodeTableModel.addRow(curNode); // configure the new node - //----------------------- setNodeParameters(); // register any orphan sensors that this node may have - //---------------------------------------------------- - if (_memo.getSensorManager() != null) + if (_memo.getSensorManager() != null) { (_memo.getSensorManager()).registerSensorsForNode(curNode); + } // reset text displays after succefully adding node - //------------------------------------------------- resetNotes(); changedNode = true; // provide user feedback - //---------------------- - statusText1.setText(Bundle.getMessage("FeedBackAdd")+" "+Integer.toString(nodeAddress)); + statusText1.setText(Bundle.getMessage("FeedBackAdd") + " " + Integer.toString(nodeAddress)); statusText2.setVisible(false); statusText3.setVisible(true); doneNodeButton.setVisible(true); @@ -1447,18 +1344,18 @@ public void addNodeButtonActionPerformed() { } /** - * Method to load all of the configured node information from the serial node - * class. This method is called by Edit and Delete node. + * Load all of the configured node information from the serial node class. + * + * @param nodeaddr the node address */ - public void setupNodeInformationWindow(int nodeaddr) - { + public void setupNodeInformationWindow(int nodeaddr) { // Find Serial Node address - //------------------------- nodeAddress = nodeaddr; - if (nodeAddress < 0) return; + if (nodeAddress < 0) { + return; + } // get the SerialNode corresponding to this node address - //------------------------------------------------------ curNode = (SerialNode) _memo.getTrafficController().getNodeFromAddress(nodeAddress); if (curNode == null) { statusText1.setText(Bundle.getMessage("Error4")); @@ -1469,184 +1366,160 @@ public void setupNodeInformationWindow(int nodeaddr) } // Set up static node address from the table, cannot be changed - //------------------------------------------------------------- nodeAddrStatic.setText(Integer.toString(nodeAddress)); nodeAddrField.setVisible(false); nodeAddrStatic.setVisible(true); // get information for this node and set up combo box - //--------------------------------------------------- nodeType = curNode.getNodeType(); - switch (nodeType) //c2 - { - //------ + switch (nodeType) { + // SMINI - //------ case SerialNode.SMINI: nodeTypeBox.setSelectedItem("SMINI"); bitsPerCard = 24; cardSizeBox.setSelectedItem(Bundle.getMessage("CardSize24")); - onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes")+" 3 Input Bytes, 6 Output Bytes"); + onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes") + " 3 Input Bytes, 6 Output Bytes"); // set up the searchlight arrays num2LSearchLights = 0; - for (int i=0;i<48;i++) { - if ( curNode.isSearchLightBit(i) ) { - searchlightBits[i] = true; - searchlightBits[i+1] = true; - firstSearchlight[i] = true; - firstSearchlight[i+1] = false; - num2LSearchLights ++; - i++; - } - else { - searchlightBits[i] = false; - firstSearchlight[i] = false; + for (int i = 0; i < 48; i++) { + if (curNode.isSearchLightBit(i)) { + searchlightBits[i] = true; + searchlightBits[i + 1] = true; + firstSearchlight[i] = true; + firstSearchlight[i + 1] = false; + num2LSearchLights++; + i++; + } else { + searchlightBits[i] = false; + firstSearchlight[i] = false; + } } - } - break; - //----------- + break; + // USIC/SUSIC - //----------- case SerialNode.USIC_SUSIC: - nodeTypeBox.setSelectedItem("USIC_SUSIC"); + nodeTypeBox.setSelectedItem("USIC_SUSIC"); bitsPerCard = curNode.getNumBitsPerCard(); - if (bitsPerCard==24) { - cardSizeBox.setSelectedItem(Bundle.getMessage("CardSize24")); + if (bitsPerCard == 24) { + cardSizeBox.setSelectedItem(Bundle.getMessage("CardSize24")); } - if (bitsPerCard==32) { - cardSizeBox.setSelectedItem(Bundle.getMessage("CardSize32")); + if (bitsPerCard == 32) { + cardSizeBox.setSelectedItem(Bundle.getMessage("CardSize32")); } - onBoardBytesText.setText(" "); + onBoardBytesText.setText(" "); + + break; - break; - //------- // CPNODE - //------- case SerialNode.CPNODE: - nodeTypeBox.setSelectedItem("CPNODE"); + nodeTypeBox.setSelectedItem("CPNODE"); bitsPerCard = 8; cardSize8Box.setSelectedItem(Bundle.getMessage("CardSize8")); - onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes")+" 2 Bytes"); + onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes") + " 2 Bytes"); - // -------------- // cpNode Options - // -------------- cbx_cpnodeopt_SENDEOT.setSelected(curNode.iscpnodeBit(SerialNode.optbitNode_SENDEOT)); cbx_cpnodeopt_BIT1.setSelected(false); cbx_cpnodeopt_BIT2.setSelected(false); cbx_cpnodeopt_BIT8.setSelected(curNode.iscpnodeBit(SerialNode.optbitNode_BIT8)); cbx_cpnodeopt_BIT15.setSelected(curNode.iscpnodeBit(SerialNode.optbitNode_BIT15)); - break; - //------- + break; + // CPMEGA - //------- case SerialNode.CPMEGA: - nodeTypeBox.setSelectedItem("CPMEGA"); + nodeTypeBox.setSelectedItem("CPMEGA"); bitsPerCard = 8; cardSize8Box.setSelectedItem(Bundle.getMessage("CardSize8")); - onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes")+" 8 Bytes"); + onBoardBytesText.setText(Bundle.getMessage("LabelOnBoardBytes") + " 8 Bytes"); - // -------------- // cpMega Options - // -------------- cbx_cpnodeopt_SENDEOT.setSelected(curNode.iscpnodeBit(SerialNode.optbitNode_SENDEOT)); cbx_cpnodeopt_BIT1.setSelected(false); cbx_cpnodeopt_BIT2.setSelected(false); cbx_cpnodeopt_BIT8.setSelected(curNode.iscpnodeBit(SerialNode.optbitNode_BIT8)); cbx_cpnodeopt_BIT15.setSelected(curNode.iscpnodeBit(SerialNode.optbitNode_BIT15)); - break; + break; default: - log.error("Unknown Node Type "+nodeType); - break; + log.error("Unknown Node Type {}", nodeType); + break; } - /** - * ---------------------------------- - * CMRInet Options for all node types - *----------------------------------- - */ + // CMRInet Options for all node types cbx_cmrinetopt_AUTOPOLL.setSelected(curNode.isCMRInetBit(SerialNode.optbitNet_AUTOPOLL)); cbx_cmrinetopt_USECMRIX.setSelected(curNode.isCMRInetBit(SerialNode.optbitNet_USECMRIX)); cbx_cmrinetopt_USEBCC.setSelected(curNode.isCMRInetBit(SerialNode.optbitNet_USEBCC)); cbx_cmrinetopt_BIT8.setSelected(curNode.isCMRInetBit(SerialNode.optbitNet_BIT8)); cbx_cmrinetopt_BIT15.setSelected(curNode.isCMRInetBit(SerialNode.optbitNet_BIT15)); - // set up receive delay receiveDelay = curNode.getTransmissionDelay(); receiveDelayField.setText(Integer.toString(receiveDelay)); - // set up pulse width + // set up pulse width pulseWidth = curNode.getPulseWidth(); pulseWidthField.setText(Integer.toString(pulseWidth)); - // node description + // node description nodeDescText = curNode.getcmriNodeDesc(); nodeDescription.setText(nodeDescText); // set up card types - for (int i=0;i<64;i++) - { + for (int i = 0; i < 64; i++) { if (curNode.isOutputCard(i)) { cardType[i] = Bundle.getMessage("CardTypeOutput"); - } - else if (curNode.isInputCard(i)) { + } else if (curNode.isInputCard(i)) { cardType[i] = Bundle.getMessage("CardTypeInput"); - } - else { + } else { cardType[i] = Bundle.getMessage("CardTypeNone"); } } - if (nodeType == SerialNode.CPMEGA) - for (int i=0;i<8;i++) // Remap the onboard bytes - { - if (curNode.isOutputCard(i)) { - onBoardType[i] = Bundle.getMessage("CardTypeOutput"); - } - else if (curNode.isInputCard(i)) { - onBoardType[i] = Bundle.getMessage("CardTypeInput"); - } - else { - onBoardType[i] = Bundle.getMessage("CardTypeNone"); + if (nodeType == SerialNode.CPMEGA) { + for (int i = 0; i < 8; i++) // Remap the onboard bytes + { + if (curNode.isOutputCard(i)) { + onBoardType[i] = Bundle.getMessage("CardTypeOutput"); + } else if (curNode.isInputCard(i)) { + onBoardType[i] = Bundle.getMessage("CardTypeInput"); + } else { + onBoardType[i] = Bundle.getMessage("CardTypeNone"); + } } } // ensure that table displays correctly panel2.setVisible(false); panel2a.setVisible(false); - if (nodeType==SerialNode.USIC_SUSIC) { + if (nodeType == SerialNode.USIC_SUSIC) { panel2.setVisible(true); - } - else if (nodeType==SerialNode.SMINI) { + } else if (nodeType == SerialNode.SMINI) { panel2a.setVisible(true); - } - else if (nodeType==SerialNode.CPNODE) { + } else if (nodeType == SerialNode.CPNODE) { panel2c.setVisible(false); panel2b.setVisible(true); - } - else if (nodeType==SerialNode.CPMEGA) { + } else if (nodeType == SerialNode.CPMEGA) { panel2c.setVisible(true); panel2b.setVisible(false); } } - /** - * Method to create and load edit function window + * Create and load edit function window. + * + * @param nodeaddr the node address */ -// public void editNodeButtonActionPerformed(int nodeaddr) { - public void editNodeButtonActionPerformed(int nodeaddr) - { + public void editNodeButtonActionPerformed(int nodeaddr) { // Find Serial Node address - //------------------------- + nodeAddress = nodeaddr; - if (nodeAddress < 0) return; + if (nodeAddress < 0) { + return; + } // get the SerialNode corresponding to this node address - //------------------------------------------------------ curNode = (SerialNode) _memo.getTrafficController().getNodeFromAddress(nodeAddress); if (curNode == null) { statusText1.setText(Bundle.getMessage("Error4")); @@ -1657,11 +1530,9 @@ public void editNodeButtonActionPerformed(int nodeaddr) } // Load the node data into the window - //----------------------------------- - setupNodeInformationWindow( nodeAddress ); + setupNodeInformationWindow(nodeAddress); // Switch to edit notes - //--------------------- editMode = true; statusText1.setText(editStatus1); statusText1.setVisible(true); @@ -1672,16 +1543,21 @@ public void editNodeButtonActionPerformed(int nodeaddr) } /** - * Method to handle update button + * Handle update button clicked. */ - public void updateNodeButtonActionPerformed() - { + public void updateNodeButtonActionPerformed() { // get node information from window - if ( !readReceiveDelay() ) return; - if ( !readPulseWidth() ) return; + if (!readReceiveDelay()) { + return; + } + if (!readPulseWidth()) { + return; + } // check consistency of node information - if ( !checkConsistency() ) return; + if (!checkConsistency()) { + return; + } // update node information if (curNode.getNodeType() != nodeType) { @@ -1692,7 +1568,7 @@ public void updateNodeButtonActionPerformed() // cmri node description c2 curNode.setcmriNodeDesc(nodeDescription.getText()); setNodeParameters(); - nodeTableModel.changeRow(selectedTableRow,curNode); + nodeTableModel.changeRow(selectedTableRow, curNode); // Switch buttons changedNode = true; @@ -1703,24 +1579,23 @@ public void updateNodeButtonActionPerformed() nodeAddrStatic.setVisible(true); // provide user feedback - statusText1.setText(Bundle.getMessage("FeedBackUpdate")+" "+Integer.toString(nodeAddress)); + statusText1.setText(Bundle.getMessage("FeedBackUpdate") + " " + Integer.toString(nodeAddress)); statusText2.setVisible(false); cancelNodeButton.setVisible(false); errorInStatus1 = true; } /** - * Method to handle delete button pressed + * Handle delete button pressed. */ - public void deleteNodeButtonActionConfirm() - { + public void deleteNodeButtonActionConfirm() { // confirm deletion with the user - //------------------------------- - if ( JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( - this,Bundle.getMessage("ConfirmDelete1")+"\n"+ - Bundle.getMessage("ConfirmDelete2"),Bundle.getMessage("ConfirmDeleteTitle"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.WARNING_MESSAGE) ) { + + if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog( + this, Bundle.getMessage("ConfirmDelete1") + "\n" + + Bundle.getMessage("ConfirmDelete2"), Bundle.getMessage("ConfirmDeleteTitle"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.WARNING_MESSAGE)) { // delete this node _memo.getTrafficController().deleteNode(deleteNodeAddress); @@ -1730,7 +1605,7 @@ public void deleteNodeButtonActionConfirm() // provide user feedback resetNotes(); - statusText1.setText(Bundle.getMessage("FeedBackDelete")+" "+Integer.toString(deleteNodeAddress)); + statusText1.setText(Bundle.getMessage("FeedBackDelete") + " " + Integer.toString(deleteNodeAddress)); statusText1.setVisible(true); errorInStatus1 = true; changedNode = true; @@ -1738,57 +1613,53 @@ public void deleteNodeButtonActionConfirm() doneNodeButton.setVisible(true); cancelNodeButton.setVisible(false); statusText2.setVisible(false); - } - else { + } else { // reset as needed resetNotes(); } } + /** - * Method to set up delete node window + * Set up delete node window. + * + * @param nodeAddr the node address */ - public void deleteNodeButtonActionPerformed(int nodeAddr) - { - // Set up static node address + public void deleteNodeButtonActionPerformed(int nodeAddr) { + // Set up static node address nodeAddress = nodeAddr; nodeAddrStatic.setText(Integer.toString(nodeAddress)); nodeAddrField.setVisible(false); nodeAddrStatic.setVisible(true); // Find Serial Node address - if (nodeAddress < 0) - { + if (nodeAddress < 0) { log.info("nodeAddress < 0"); return; } // get the SerialNode corresponding to this node address - //------------------------------------------------------ curNode = (SerialNode) _memo.getTrafficController().getNodeFromAddress(nodeAddress); deleteNodeAddress = nodeAddr; // Load the node data into the window - //----------------------------------- - setupNodeInformationWindow( nodeAddress ); + + setupNodeInformationWindow(nodeAddress); // get the node corresponding to this node address - //------------------------------------------------ if (curNode == null) { statusText1.setText(Bundle.getMessage("Error4")); statusText1.setVisible(true); errorInStatus1 = true; resetNotes2(); - } - else { + } else { statusText1.setText(Bundle.getMessage("NotesDel3")); statusText1.setVisible(true); } } /** - * Method to handle done button + * Handle done button clicked. */ - public void doneNodeButtonActionPerformed() - { + public void doneNodeButtonActionPerformed() { if (editMode) { // Reset editMode = false; @@ -1804,28 +1675,14 @@ public void doneNodeButtonActionPerformed() nodeAddrStatic.setVisible(false); } - /** - * The reminder dialog is now only displayed when closing the - * node config manager window - */ - /* - if (changedNode) { - Remind user to Save new configuration - JOptionPane.showMessageDialog(this, - Bundle.getMessage("Reminder1")+"\n"+Bundle.getMessage("Reminder2"), - Bundle.getMessage("ReminderTitle"), - JOptionPane.INFORMATION_MESSAGE); - } - */ setVisible(false); dispose(); } /** - * Method to handle cancel button + * Handle cancel button clicked. */ - public void cancelNodeButtonActionPerformed() - { + public void cancelNodeButtonActionPerformed() { // Reset editMode = false; changedNode = false; @@ -1841,150 +1698,128 @@ public void cancelNodeButtonActionPerformed() nodeAddrField.setVisible(false); nodeAddrStatic.setVisible(false); // refresh notes panel - // statusText1.setText(stdStatus1); - // statusText2.setText(stdStatus2); - // statusText3.setText(stdStatus3); + // statusText1.setText(stdStatus1); + // statusText2.setText(stdStatus2); + // statusText3.setText(stdStatus3); setVisible(false); dispose(); } - /** - * Method to close the window when the close box is clicked - */ - public void windowClosing(java.awt.event.WindowEvent e) - { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { doneNodeButtonActionPerformed(); super.windowClosing(e); } /** - * Set the node parameters by type. Some parameters are specific to - * a particular node type + * Set the node parameters by type. Some parameters are specific to a + * particular node type. */ - void setNodeParameters() - { + void setNodeParameters() { // receive delay is common for all node types - int numInput = 0; - int numOutput = 0; - curNode.setTransmissionDelay(receiveDelay); + int numInput = 0; + int numOutput = 0; + curNode.setTransmissionDelay(receiveDelay); // pulse width is common for all node types curNode.setPulseWidth(pulseWidth); // continue in a node specific way - switch (nodeType) - { - //------ + switch (nodeType) { + // SMINI - //------ case SerialNode.SMINI: // Note: most parameters are set by default on creation int numSet = 0; // Configure 2-lead oscillating searchlights - first clear unneeded searchlights - for (int j=0;j<47;j++) { - if ( curNode.isSearchLightBit(j) ) { - if(!firstSearchlight[j]) { + for (int j = 0; j < 47; j++) { + if (curNode.isSearchLightBit(j)) { + if (!firstSearchlight[j]) { // this is the first bit of a deleted searchlight - clear it curNode.clear2LeadSearchLight(j); // skip over the second bit of the cleared searchlight - j ++; - } - else { + j++; + } else { // this is the first bit of a kept searchlight - skip second bit - j ++; + j++; } } } // Add needed searchlights that are not already configured - for (int i=0;i<47;i++) { - if ( firstSearchlight[i] ) { - if ( !curNode.isSearchLightBit(i) ) { + for (int i = 0; i < 47; i++) { + if (firstSearchlight[i]) { + if (!curNode.isSearchLightBit(i)) { // this is the first bit of an added searchlight curNode.set2LeadSearchLight(i); } - numSet ++; + numSet++; } } // consistency check if (numSet != num2LSearchLights) { - log.error("Inconsistent numbers of 2-lead searchlights. numSet = "+ - Integer.toString(numSet)+", num2LSearchLights = "+ - Integer.toString(num2LSearchLights) ); + log.error("Inconsistent numbers of 2-lead searchlights. numSet = " + + Integer.toString(numSet) + ", num2LSearchLights = " + + Integer.toString(num2LSearchLights)); } // Force created node to be polled as the default curNode.setOptNet_AUTOPOLL(1); - break; + break; - //----------- // USIC/SUSIC - //----------- case SerialNode.USIC_SUSIC: // set number of bits per card curNode.setNumBitsPerCard(bitsPerCard); // configure the input/output cards numInput = 0; numOutput = 0; - for (int i=0;i<64;i++) { - if ( "No Card".equals(cardType[i]) ) { - curNode.setCardTypeByAddress(i,SerialNode.NO_CARD); - } - else if ( "Input Card".equals(cardType[i]) ) { - curNode.setCardTypeByAddress(i,SerialNode.INPUT_CARD); - numInput ++; - } - else if ( "Output Card".equals(cardType[i]) ) { - curNode.setCardTypeByAddress(i,SerialNode.OUTPUT_CARD); - numOutput ++; - } - else { - log.error("Unexpected card type - "+cardType[i]); + for (int i = 0; i < 64; i++) { + if ("No Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.NO_CARD); + } else if ("Input Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.INPUT_CARD); + numInput++; + } else if ("Output Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.OUTPUT_CARD); + numOutput++; + } else { + log.error("Unexpected card type - " + cardType[i]); } } // consistency check - if ( numCards != (numOutput+numInput) ) { + if (numCards != (numOutput + numInput)) { log.error("Inconsistent numbers of cards - setNodeParameters."); } // Force created node to be polled as the default curNode.setOptNet_AUTOPOLL(1); - break; + break; - //------- // CPNODE - //------- - case SerialNode.CPNODE: //c2 + case SerialNode.CPNODE: // set number of bits per card bitsPerCard = 8; curNode.setNumBitsPerCard(bitsPerCard); - numInput = 2; + numInput = 2; numOutput = 2; - // configure the input/output cards - for (int i=4;i<64;i++) // Skip the onboard bytes + // configure the input/output cards + for (int i = 4; i < 64; i++) // Skip the onboard bytes { - if ( "No Card".equals(cardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.NO_CARD); - } - else if ( "Input Card".equals(cardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.INPUT_CARD); + if ("No Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.NO_CARD); + } else if ("Input Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.INPUT_CARD); numInput++; - } - else if ( "Output Card".equals(cardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.OUTPUT_CARD); + } else if ("Output Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.OUTPUT_CARD); numOutput++; - } - else - { - log.error("Unexpected card type - "+cardType[i]); + } else { + log.error("Unexpected card type - " + cardType[i]); } } // Set the node option bits. Some are moved from the CMRInet options - //------------------------------------------------------------------- curNode.setOptNet_AUTOPOLL(cbx_cmrinetopt_AUTOPOLL.isSelected() ? 1 : 0); curNode.setOptNode_SENDEOT(cbx_cpnodeopt_SENDEOT.isSelected() ? 1 : 0); @@ -1993,65 +1828,48 @@ else if ( "Output Card".equals(cardType[i]) ) curNode.setOptNode_BIT8(cbx_cpnodeopt_BIT8.isSelected() ? 1 : 0); curNode.setOptNode_BIT15(cbx_cpnodeopt_BIT15.isSelected() ? 1 : 0); - break; + break; - //------- // CPMEGA - //------- - case SerialNode.CPMEGA: //c2 + case SerialNode.CPMEGA: // set number of bits per card bitsPerCard = 8; curNode.setNumBitsPerCard(bitsPerCard); - numInput = 0; + numInput = 0; numOutput = 0; - for (int i=0;i<8;i++) // Pick up the onboard bytes + for (int i = 0; i < 8; i++) // Pick up the onboard bytes { - if ( "No Card".equals(onBoardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.NO_CARD); - } - else if ( "Input Card".equals(onBoardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.INPUT_CARD); + if ("No Card".equals(onBoardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.NO_CARD); + } else if ("Input Card".equals(onBoardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.INPUT_CARD); numInput++; - } - else if ( "Output Card".equals(onBoardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.OUTPUT_CARD); + } else if ("Output Card".equals(onBoardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.OUTPUT_CARD); numOutput++; - } - else - { - log.error("Unexpected card type - "+onBoardType[i]); + } else { + log.error("Unexpected card type - " + onBoardType[i]); } } // configure the IOX cards - for (int i=8;i<64;i++) // Skip the onboard bytes + for (int i = 8; i < 64; i++) // Skip the onboard bytes { - if ( "No Card".equals(cardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.NO_CARD); - } - else if ( "Input Card".equals(cardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.INPUT_CARD); + if ("No Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.NO_CARD); + } else if ("Input Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.INPUT_CARD); numInput++; - } - else if ( "Output Card".equals(cardType[i]) ) - { - curNode.setCardTypeByAddress(i,SerialNode.OUTPUT_CARD); + } else if ("Output Card".equals(cardType[i])) { + curNode.setCardTypeByAddress(i, SerialNode.OUTPUT_CARD); numOutput++; - } - else - { - log.error("Unexpected card type - "+cardType[i]); + } else { + log.error("Unexpected card type - " + cardType[i]); } } // Set the node option bits. Some are moved from the CMRInet options - //------------------------------------------------------------------- curNode.setOptNet_AUTOPOLL(1); // Default node to be polled curNode.setOptNode_SENDEOT(cbx_cpnodeopt_SENDEOT.isSelected() ? 1 : 0); @@ -2060,72 +1878,60 @@ else if ( "Output Card".equals(cardType[i]) ) curNode.setOptNode_BIT8(cbx_cpnodeopt_BIT8.isSelected() ? 1 : 0); curNode.setOptNode_BIT15(cbx_cpnodeopt_BIT15.isSelected() ? 1 : 0); - break; + break; default: - log.error("Unexpected node type in setNodeParameters- "+Integer.toString(nodeType)); - break; + log.error("Unexpected node type in setNodeParameters- " + Integer.toString(nodeType)); + break; } - /** - * Set the node description for all types - */ + // Set the node description for all types curNode.setcmriNodeDesc(nodeDescription.getText()); - /** - * Cause reinitialization of this Node to reflect these parameters - * --------------------------------------------------------------- - */ + // Cause reinitialization of this Node to reflect these parameters _memo.getTrafficController().initializeSerialNode(curNode); } /** - * Method to reset the notes error after error display + * Reset the notes error after error display. */ - private void resetNotes() - { + private void resetNotes() { if (errorInStatus1) { if (editMode) { - statusText1.setText(editStatus1); - } - else { - // statusText1.setText(stdStatus1); + statusText1.setText(editStatus1); + } else { + // statusText1.setText(stdStatus1); } errorInStatus1 = false; } resetNotes2(); } + /** - * Reset the second line of Notes area + * Reset the second line of Notes area. */ - private void resetNotes2() - { + private void resetNotes2() { if (errorInStatus2) { if (editMode) { statusText1.setText(editStatus2); - } - else { - // statusText2.setText(stdStatus2); + } else { + // statusText2.setText(stdStatus2); } errorInStatus2 = false; } } /** - * Read node address and check for legal range - * If successful, a node address in the range 0-127 is returned. - * If not successful, -1 is returned and an appropriate error - * message is placed in statusText1. + * Read node address and check for legal range. Sets the error message in + * {@link #statusText1} if not legal. + * + * @return A node address in the range 0-127 if legal; -1 if not legal */ - private int readNodeAddress() - { + private int readNodeAddress() { int addr = -1; - try - { + try { addr = Integer.parseInt(nodeAddrField.getText()); - } - catch (Exception e) - { + } catch (NumberFormatException e) { statusText1.setText(Bundle.getMessage("Error5")); statusText1.setVisible(true); errorInStatus1 = true; @@ -2133,11 +1939,11 @@ private int readNodeAddress() return -1; } - if ( (addr < 0) || (addr > 127) ) { + if ((addr < 0) || (addr > 127)) { // statusText1.setText(Bundle.getMessage("Error6")); // statusText1.setVisible(true); errorInStatus1 = true; - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error6"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error6"), "", JOptionPane.ERROR_MESSAGE); resetNotes2(); return -1; } @@ -2145,23 +1951,19 @@ private int readNodeAddress() } /** - * Read receive delay from window - * Returns 'true' if successful, 'false' if an error was detected. - * If an error is detected, a suitable error message is placed in the - * Notes area + * Read receive delay from window. If an error is detected, a suitable error + * message is placed in the Notes area. + * + * @return true if successful; false otherwise */ - protected boolean readReceiveDelay() - { + protected boolean readReceiveDelay() { // get the transmission delay - try - { + try { receiveDelay = Integer.parseInt(receiveDelayField.getText()); - } - catch (Exception e) - { + } catch (NumberFormatException e) { statusText1.setText(Bundle.getMessage("Error7")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error7"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error7"), "", JOptionPane.ERROR_MESSAGE); receiveDelay = 0; errorInStatus1 = true; resetNotes2(); @@ -2170,7 +1972,7 @@ protected boolean readReceiveDelay() if (receiveDelay < 0) { statusText1.setText(Bundle.getMessage("Error8")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error8"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error8"), "", JOptionPane.ERROR_MESSAGE); receiveDelay = 0; errorInStatus1 = true; resetNotes2(); @@ -2179,7 +1981,7 @@ protected boolean readReceiveDelay() if (receiveDelay > 65535) { statusText1.setText(Bundle.getMessage("Error9")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error9"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error9"), "", JOptionPane.ERROR_MESSAGE); receiveDelay = 0; errorInStatus1 = true; resetNotes2(); @@ -2190,23 +1992,19 @@ protected boolean readReceiveDelay() } /** - * Read pulse width from window - * Returns 'true' if successful, 'false' if an error was detected. - * If an error is detected, a suitable error message is placed in the - * Notes area + * Read pulse width from window. If an error is detected, a suitable error + * message is placed in the Notes area. + * + * @return true if successful; false otherwise */ - protected boolean readPulseWidth() - { + protected boolean readPulseWidth() { // get the pulse width - try - { + try { pulseWidth = Integer.parseInt(pulseWidthField.getText()); - } - catch (Exception e) - { + } catch (NumberFormatException e) { statusText1.setText(Bundle.getMessage("Error18")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error18"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error18"), "", JOptionPane.ERROR_MESSAGE); pulseWidth = 500; errorInStatus1 = true; resetNotes2(); @@ -2215,9 +2013,9 @@ protected boolean readPulseWidth() if (pulseWidth < 100) { statusText1.setText(Bundle.getMessage("Error16")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error16"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error16"), "", JOptionPane.ERROR_MESSAGE); pulseWidth = 100; - pulseWidthField.setText(Integer.toString(pulseWidth)); + pulseWidthField.setText(Integer.toString(pulseWidth)); errorInStatus1 = true; resetNotes2(); return (false); @@ -2225,9 +2023,9 @@ protected boolean readPulseWidth() if (pulseWidth > 10000) { statusText1.setText(Bundle.getMessage("Error17")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error17"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error17"), "", JOptionPane.ERROR_MESSAGE); pulseWidth = 500; - pulseWidthField.setText(Integer.toString(pulseWidth)); + pulseWidthField.setText(Integer.toString(pulseWidth)); errorInStatus1 = true; resetNotes2(); return (false); @@ -2237,73 +2035,71 @@ protected boolean readPulseWidth() } /** - * Check for consistency errors by node type - * Returns 'true' if successful, 'false' if an error was detected. - * If an error is detected, a suitable error message is placed in the - * Notes area + * Check for consistency errors by node type. If an error is detected, a + * suitable error message is placed in the Notes area. + * + * @return true if successful; false otherwise */ - protected boolean checkConsistency() - { - switch (nodeType) - { + protected boolean checkConsistency() { + switch (nodeType) { case SerialNode.SMINI: // ensure that number of searchlight bits is consistent int numBits = 0; - for (int i = 0;i<48;i++) { - if (searchlightBits[i]) numBits ++; + for (int i = 0; i < 48; i++) { + if (searchlightBits[i]) { + numBits++; + } } - if ( (2*num2LSearchLights) != numBits ) { + if ((2 * num2LSearchLights) != numBits) { statusText1.setText(Bundle.getMessage("Error10")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error10"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error10"), "", JOptionPane.ERROR_MESSAGE); errorInStatus1 = true; resetNotes2(); return (false); } - break; + break; case SerialNode.USIC_SUSIC: // ensure that at least one card is defined numCards = 0; boolean atNoCard = false; - for (int i = 0; i<64 ; i++) { - if ( (cardType[i].equals(Bundle.getMessage("CardTypeOutput"))) || - (cardType[i].equals(Bundle.getMessage("CardTypeInput"))) ) { + for (int i = 0; i < 64; i++) { + if ((cardType[i].equals(Bundle.getMessage("CardTypeOutput"))) + || (cardType[i].equals(Bundle.getMessage("CardTypeInput")))) { if (atNoCard) { // gap error statusText1.setText(Bundle.getMessage("Error11")); statusText1.setVisible(true); statusText2.setText(Bundle.getMessage("Error12")); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error11")+Bundle.getMessage("Error12"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error11") + Bundle.getMessage("Error12"), "", JOptionPane.ERROR_MESSAGE); errorInStatus1 = true; errorInStatus2 = true; return (false); + } else { + numCards++; } - else { - numCards ++; - } - } - else if (cardType[i].equals(Bundle.getMessage("CardTypeNone"))) { + } else if (cardType[i].equals(Bundle.getMessage("CardTypeNone"))) { atNoCard = true; } } // ensure that at least one card has been defined - if ( numCards <= 0 ) { + if (numCards <= 0) { // no card error statusText1.setText(Bundle.getMessage("Error13")); statusText2.setText(Bundle.getMessage("Error14")); statusText1.setVisible(true); - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error13")+Bundle.getMessage("Error14"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error13") + Bundle.getMessage("Error14"), "", JOptionPane.ERROR_MESSAGE); errorInStatus1 = true; errorInStatus2 = true; return (false); } // check that card size is 24 or 32 bit - if ( (bitsPerCard!=24 ) && (bitsPerCard!=32) ) { + if ((bitsPerCard != 24) && (bitsPerCard != 32)) { // card size error statusText1.setText(Bundle.getMessage("Error15")); statusText1.setVisible(true); errorInStatus1 = true; - JOptionPane.showMessageDialog(this,Bundle.getMessage("Error15"),"",JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(this, Bundle.getMessage("Error15"), "", JOptionPane.ERROR_MESSAGE); resetNotes2(); return (false); } @@ -2313,42 +2109,41 @@ else if (cardType[i].equals(Bundle.getMessage("CardTypeNone"))) { int numOutput = curNode.numOutputCards(); int numInput = curNode.numInputCards(); // will the number of cards be reduced by this edit? - if ( numCards<(numOutput+numInput) ) { - if ( javax.swing.JOptionPane.NO_OPTION == javax.swing.JOptionPane.showConfirmDialog(this, - Bundle.getMessage("ConfirmUpdate1")+"\n"+ - Bundle.getMessage("ConfirmUpdate2")+"\n"+ - Bundle.getMessage("ConfirmUpdate3"), - Bundle.getMessage("ConfirmUpdateTitle"), - javax.swing.JOptionPane.YES_NO_OPTION, - javax.swing.JOptionPane.WARNING_MESSAGE) ) { + if (numCards < (numOutput + numInput)) { + if (JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(this, + Bundle.getMessage("ConfirmUpdate1") + "\n" + + Bundle.getMessage("ConfirmUpdate2") + "\n" + + Bundle.getMessage("ConfirmUpdate3"), + Bundle.getMessage("ConfirmUpdateTitle"), + JOptionPane.YES_NO_OPTION, + JOptionPane.WARNING_MESSAGE)) { // user said don't update - cancel the update return (false); } } } - break; - case SerialNode.CPNODE: //c2 - for (int j = 0; j<64; j++) - { - if ( (cardType[j].equals(Bundle.getMessage("CardTypeOutput"))) || - (cardType[j].equals(Bundle.getMessage("CardTypeInput"))) ) - numCards ++; + break; + case SerialNode.CPNODE: + for (int j = 0; j < 64; j++) { + if ((cardType[j].equals(Bundle.getMessage("CardTypeOutput"))) + || (cardType[j].equals(Bundle.getMessage("CardTypeInput")))) { + numCards++; + } } - break; - case SerialNode.CPMEGA: //c2 - for (int j = 0; j<64; j++) - { - if ( (cardType[j].equals(Bundle.getMessage("CardTypeOutput"))) || - (cardType[j].equals(Bundle.getMessage("CardTypeInput"))) ) - numCards ++; + break; + case SerialNode.CPMEGA: + for (int j = 0; j < 64; j++) { + if ((cardType[j].equals(Bundle.getMessage("CardTypeOutput"))) + || (cardType[j].equals(Bundle.getMessage("CardTypeInput")))) { + numCards++; + } } - break; + break; - - // here add code for other types of nodes + // here add code for other types of nodes default: - log.warn("Unexpected node type - "+Integer.toString(nodeType)); - break; + log.warn("Unexpected node type - {}", nodeType); + break; } return true; } @@ -2356,61 +2151,93 @@ else if (cardType[i].equals(Bundle.getMessage("CardTypeNone"))) { /** * Set up table for selecting card type by address for USIC_SUSIC nodes */ - public class CardConfigModel extends AbstractTableModel - { - public String getColumnName(int c) {return cardConfigColumnNames[c];} - public Class getColumnClass(int c) {return String.class;} - public int getColumnCount () {return 2;} - public int getRowCount () {return 64;} - public Object getValueAt (int r,int c) - { - if (c==0) - { - return " "+Integer.toString(r); - } - else if (c==1) - { - return " "+cardType[r]; + public class CardConfigModel extends AbstractTableModel { + + @Override + public String getColumnName(int c) { + return cardConfigColumnNames[c]; + } + + @Override + public Class getColumnClass(int c) { + return String.class; + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public int getRowCount() { + return 64; + } + + @Override + public Object getValueAt(int r, int c) { + if (c == 0) { + return " " + Integer.toString(r); + } else if (c == 1) { + return " " + cardType[r]; } return ""; } - public void setValueAt(Object type,int r,int c) - { - if (c==1) - { - cardType[r] = (String)type; + + @Override + public void setValueAt(Object type, int r, int c) { + if (c == 1) { + cardType[r] = (String) type; } } - public boolean isCellEditable(int r,int c) {return (c==1);} + + @Override + public boolean isCellEditable(int r, int c) { + return (c == 1); + } public static final int ADDRESS_COLUMN = 0; public static final int TYPE_COLUMN = 1; } - private String[] cardConfigColumnNames = {Bundle.getMessage("HeadingCardAddress"), - " "+Bundle.getMessage("HeadingCardType")}; - private String[] cardType = new String[64]; - private String[] onBoardType = new String[16]; + private final String[] cardConfigColumnNames = { + Bundle.getMessage("HeadingCardAddress"), + Bundle.getMessage("HeadingCardType") + }; + private final String[] cardType = new String[64]; + private final String[] onBoardType = new String[16]; /** - * Set up model for SMINI table for designating oscillating 2-lead searchlights + * Set up model for SMINI table for designating oscillating 2-lead + * searchlights */ - public class SearchlightConfigModel extends AbstractTableModel - { - public String getColumnName(int c) {return searchlightConfigColumnNames[c];} - public Class getColumnClass(int c) - { + public class SearchlightConfigModel extends AbstractTableModel { + + @Override + public String getColumnName(int c) { + return searchlightConfigColumnNames[c]; + } + + @Override + public Class getColumnClass(int c) { if (c > 0) { return Boolean.class; - } - else { + } else { return String.class; } } - public int getColumnCount () {return 9;} - public int getRowCount () {return 6;} - public Object getValueAt (int r,int c) - { - if (c==0) { + + @Override + public int getColumnCount() { + return 9; + } + + @Override + public int getRowCount() { + return 6; + } + + @Override + public Object getValueAt(int r, int c) { + if (c == 0) { switch (r) { case 0: return ("Card 0 Port A"); @@ -2427,47 +2254,37 @@ public Object getValueAt (int r,int c) default: return (""); } - } - else - { - int index = (r*8) + (c-1); - if (searchlightBits[index]) { - return (Boolean.TRUE); - } - else { - return (Boolean.FALSE); - } + } else { + int index = (r * 8) + (c - 1); + return searchlightBits[index]; } } - public void setValueAt(Object type,int r,int c) - { + + @Override + public void setValueAt(Object type, int r, int c) { if (c > 0) { - int index = (r*8) + (c-1); - if (!((Boolean)type).booleanValue()) - { + int index = (r * 8) + (c - 1); + if (!((Boolean) type)) { searchlightBits[index] = false; if (firstSearchlight[index]) { - searchlightBits[index+1] = false; + searchlightBits[index + 1] = false; firstSearchlight[index] = false; + } else { + searchlightBits[index - 1] = false; + firstSearchlight[index - 1] = false; } - else { - searchlightBits[index-1] = false; - firstSearchlight[index-1] = false; - } - num2LSearchLights --; - } - else { - if (index<47) { - if (!searchlightBits[index] && !searchlightBits[index+1]) - { + num2LSearchLights--; + } else { + if (index < 47) { + if (!searchlightBits[index] && !searchlightBits[index + 1]) { searchlightBits[index] = true; - searchlightBits[index+1] = true; + searchlightBits[index + 1] = true; firstSearchlight[index] = true; - firstSearchlight[index+1] = false; + firstSearchlight[index + 1] = false; if (index > 0) { - firstSearchlight[index-1] = false; + firstSearchlight[index - 1] = false; } - num2LSearchLights ++; + num2LSearchLights++; } } } @@ -2475,161 +2292,172 @@ public void setValueAt(Object type,int r,int c) panel2a.setVisible(true); } } - public boolean isCellEditable(int r,int c) {return (c!=0);} + + @Override + public boolean isCellEditable(int r, int c) { + return (c != 0); + } public static final int PORT_COLUMN = 0; } - private String[] searchlightConfigColumnNames = {Bundle.getMessage("HeadingPort"),"0","1","2","3","4","5","6","7"}; - private boolean[] searchlightBits = new boolean[48]; // true if this bit is a searchlight bit - private boolean[] firstSearchlight = new boolean[48]; // true if first of a pair of searchlight bits - - /* ------------------------------- */ - /* cpNode options checkbox handler */ - /* ------------------------------- */ - private class HandlerClass implements ItemListener - { - public void itemStateChanged(ItemEvent e){ - JCheckBox checkbox = (JCheckBox) e.getSource(); - - // Network options - //---------------- - if (checkbox == cbx_cmrinetopt_AUTOPOLL) - { - curNode.setCMRInetOpts(SerialNode.optbitNet_AUTOPOLL,(cbx_cmrinetopt_AUTOPOLL.isSelected() ? 1 : 0)); - } else + private final String[] searchlightConfigColumnNames = {Bundle.getMessage("HeadingPort"), "0", "1", "2", "3", "4", "5", "6", "7"}; + private final boolean[] searchlightBits = new boolean[48]; // true if this bit is a searchlight bit + private final boolean[] firstSearchlight = new boolean[48]; // true if first of a pair of searchlight bits - if (checkbox == cbx_cmrinetopt_USECMRIX) - { - curNode.setCMRInetOpts(SerialNode.optbitNet_USECMRIX,(cbx_cmrinetopt_USECMRIX.isSelected() ? 1 : 0)); - curNode.setcpnodeOpts(SerialNode.optbitNet_USECMRIX,curNode.getCMRInetOpts(SerialNode.optbitNet_USECMRIX)); - } else - - if (checkbox == cbx_cmrinetopt_USEBCC) - { - curNode.setCMRInetOpts(SerialNode.optbitNet_USEBCC,(cbx_cmrinetopt_USEBCC.isSelected() ? 1 : 0)); - curNode.setcpnodeOpts(SerialNode.optbitNet_USEBCC,curNode.getCMRInetOpts(SerialNode.optbitNet_USEBCC)); - } else - - if (checkbox == cbx_cmrinetopt_BIT8) - { - curNode.setCMRInetOpts(SerialNode.optbitNet_BIT8,(cbx_cmrinetopt_BIT8.isSelected() ? 1 : 0)); - } else + /** + * Handles checkboxes for cpNode options + */ + private class HandlerClass implements ItemListener { - if (checkbox == cbx_cmrinetopt_BIT15) - { - curNode.setCMRInetOpts(SerialNode.optbitNet_BIT15,(cbx_cmrinetopt_BIT15.isSelected() ? 1 : 0)); - } else + @Override + public void itemStateChanged(ItemEvent e) { + JCheckBox checkbox = (JCheckBox) e.getSource(); - // cpNode options - //--------------- - if (checkbox == cbx_cpnodeopt_SENDEOT) - { - curNode.setcpnodeOpts(SerialNode.optbitNode_SENDEOT,(cbx_cpnodeopt_SENDEOT.isSelected() ? 1 : 0)); - } else - if (checkbox == cbx_cpnodeopt_BIT1) - { + if (checkbox == cbx_cmrinetopt_AUTOPOLL) { + curNode.setCMRInetOpts(SerialNode.optbitNet_AUTOPOLL, (cbx_cmrinetopt_AUTOPOLL.isSelected() ? 1 : 0)); + } else if (checkbox == cbx_cmrinetopt_USECMRIX) { + curNode.setCMRInetOpts(SerialNode.optbitNet_USECMRIX, (cbx_cmrinetopt_USECMRIX.isSelected() ? 1 : 0)); + curNode.setcpnodeOpts(SerialNode.optbitNet_USECMRIX, curNode.getCMRInetOpts(SerialNode.optbitNet_USECMRIX)); + } else if (checkbox == cbx_cmrinetopt_USEBCC) { + curNode.setCMRInetOpts(SerialNode.optbitNet_USEBCC, (cbx_cmrinetopt_USEBCC.isSelected() ? 1 : 0)); + curNode.setcpnodeOpts(SerialNode.optbitNet_USEBCC, curNode.getCMRInetOpts(SerialNode.optbitNet_USEBCC)); + } else if (checkbox == cbx_cmrinetopt_BIT8) { + curNode.setCMRInetOpts(SerialNode.optbitNet_BIT8, (cbx_cmrinetopt_BIT8.isSelected() ? 1 : 0)); + } else if (checkbox == cbx_cmrinetopt_BIT15) { + curNode.setCMRInetOpts(SerialNode.optbitNet_BIT15, (cbx_cmrinetopt_BIT15.isSelected() ? 1 : 0)); + } else if (checkbox == cbx_cpnodeopt_SENDEOT) { + curNode.setcpnodeOpts(SerialNode.optbitNode_SENDEOT, (cbx_cpnodeopt_SENDEOT.isSelected() ? 1 : 0)); + } else if (checkbox == cbx_cpnodeopt_BIT1) { cbx_cpnodeopt_BIT1.setSelected(false); - } else - if (checkbox == cbx_cpnodeopt_BIT2) - { + } else if (checkbox == cbx_cpnodeopt_BIT2) { cbx_cpnodeopt_BIT2.setSelected(false); - } else - if (checkbox == cbx_cpnodeopt_BIT8) - { - curNode.setcpnodeOpts(SerialNode.optbitNode_BIT8,(cbx_cpnodeopt_BIT8.isSelected() ? 1 : 0)); + } else if (checkbox == cbx_cpnodeopt_BIT8) { + curNode.setcpnodeOpts(SerialNode.optbitNode_BIT8, (cbx_cpnodeopt_BIT8.isSelected() ? 1 : 0)); + } else if (checkbox == cbx_cpnodeopt_BIT15) { + curNode.setcpnodeOpts(SerialNode.optbitNode_BIT15, (cbx_cpnodeopt_BIT15.isSelected() ? 1 : 0)); } - if (checkbox == cbx_cpnodeopt_BIT15) - { - curNode.setcpnodeOpts(SerialNode.optbitNode_BIT15,(cbx_cpnodeopt_BIT15.isSelected() ? 1 : 0)); - } - changedNode = true; + changedNode = true; } } /** * Set up table for selecting card type by address for CPNODE/CPMEGA nodes */ - public class CPnodeConfigModel extends AbstractTableModel //c2 - { - public String getColumnName(int c) {return cpnodeConfigColumnNames[c];} - public Class getColumnClass(int c) {return String.class;} - public int getColumnCount () {return 2;} - public int getRowCount () {return 16;} - public Object getValueAt (int r,int c) - { - String[] cdPort = {" A"," B"}; - String val = " "; - switch(c) - { - case CARDNUM_COLUMN: - int i=r/2; - if (r%2 == 0) - val = Integer.toHexString(0x20+i)+" "; - return " "+val+" "+cdPort[(r%2)]; - case CARDTYPE_COLUMN: - return " "+cardType[r+cpNodeOnboard]; - default: - return ""; + public class CPnodeConfigModel extends AbstractTableModel { + + @Override + public String getColumnName(int c) { + return cpnodeConfigColumnNames[c]; + } + + @Override + public Class getColumnClass(int c) { + return String.class; + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public int getRowCount() { + return 16; + } + + @Override + public Object getValueAt(int r, int c) { + String[] cdPort = {" A", " B"}; + String val = " "; + switch (c) { + case CARDNUM_COLUMN: + int i = r / 2; + if (r % 2 == 0) { + val = Integer.toHexString(0x20 + i) + " "; + } + return " " + val + " " + cdPort[(r % 2)]; + case CARDTYPE_COLUMN: + return " " + cardType[r + cpNodeOnboard]; + default: + return ""; } } - public void setValueAt(Object type,int r,int c) - { - if (c==1) - { - cardType[r+cpNodeOnboard] = (String)type; + @Override + public void setValueAt(Object type, int r, int c) { + if (c == 1) { + cardType[r + cpNodeOnboard] = (String) type; } } - public boolean isCellEditable(int r,int c) {return (c==1);} + + @Override + public boolean isCellEditable(int r, int c) { + return (c == 1); + } public static final int CARDNUM_COLUMN = 0; public static final int CARDTYPE_COLUMN = 1; } - private String[] cpnodeConfigColumnNames = {"IOX Addr Port","Port Type"}; + private final String[] cpnodeConfigColumnNames = {"IOX Addr Port", "Port Type"}; /** * Set up table for selecting card type by address for CPNODE/CPMEGA nodes */ - public class OSnodeConfigModel extends AbstractTableModel //c2 - { - public String getColumnName(int c) {return osnodeConfigColumnNames[c];} - public Class getColumnClass(int c) {return String.class;} - public int getColumnCount () {return 2;} - public int getRowCount () {return 8;} - public Object getValueAt (int r,int c) - { - String val = " "; - switch(c) - { - case CARDNUM_COLUMN: - int i=r; - val = i+" "; - return " "+val; - case CARDTYPE_COLUMN: - return " "+onBoardType[r]; - default: - return ""; + public class OSnodeConfigModel extends AbstractTableModel { + + @Override + public String getColumnName(int c) { + return osnodeConfigColumnNames[c]; + } + + @Override + public Class getColumnClass(int c) { + return String.class; + } + + @Override + public int getColumnCount() { + return 2; + } + + @Override + public int getRowCount() { + return 8; + } + + @Override + public Object getValueAt(int r, int c) { + switch (c) { + case CARDNUM_COLUMN: + int i = r; + return " " + i + " "; + case CARDTYPE_COLUMN: + return " " + onBoardType[r]; + default: + return ""; } } - public void setValueAt(Object type,int r,int c) - { - if (c==CARDTYPE_COLUMN) - { - onBoardType[r] = (String)type; + @Override + public void setValueAt(Object type, int r, int c) { + if (c == CARDTYPE_COLUMN) { + onBoardType[r] = (String) type; } } - public boolean isCellEditable(int r,int c) {return (c==1);} + + @Override + public boolean isCellEditable(int r, int c) { + return (c == 1); + } public static final int CARDNUM_COLUMN = 0; public static final int CARDTYPE_COLUMN = 1; } - private String[] osnodeConfigColumnNames = {" Byte ","Port Type"}; + private final String[] osnodeConfigColumnNames = {" Byte ", "Port Type"}; - private int[] cpnodeOpts = new int[16]; // Local storage for node options - private int[] cmrinetOpts = new int[16]; // Local storage for node options + private final int[] cpnodeOpts = new int[16]; // Local storage for node options + private final int[] cmrinetOpts = new int[16]; // Local storage for node options private final static Logger log = LoggerFactory.getLogger(NodeConfigManagerFrame.class); } - diff --git a/java/src/jmri/jmrix/cmri/serial/nodeiolist/NodeIOListFrame.java b/java/src/jmri/jmrix/cmri/serial/nodeiolist/NodeIOListFrame.java index 3cbb02945e8..f6ec3d4ab7e 100644 --- a/java/src/jmri/jmrix/cmri/serial/nodeiolist/NodeIOListFrame.java +++ b/java/src/jmri/jmrix/cmri/serial/nodeiolist/NodeIOListFrame.java @@ -22,7 +22,7 @@ */ public class NodeIOListFrame extends jmri.util.JmriJFrame { - ArrayList cmriNode = new ArrayList(); //c2 + ArrayList cmriNode = new ArrayList(); protected boolean inputSelected = true; // true if displaying input assignments, false for output protected SerialNode selNode = null; @@ -39,7 +39,7 @@ public class NodeIOListFrame extends jmri.util.JmriJFrame { JRadioButton outputBits = new JRadioButton(Bundle.getMessage("ShowOutputButton"), false); JLabel nodeInfoText = new JLabel("Node Information Text"); - JLabel nodeDesc = new JLabel("Description:"); //c2 + JLabel nodeDesc = new JLabel("Description:"); // assignment pane items protected JPanel assignmentPanel = null; @@ -114,7 +114,7 @@ public void actionPerformed(ActionEvent event) { JPanel panel12 = new JPanel(); panel12.add(nodeInfoText); - JPanel panel13 = new JPanel(); //c2 + JPanel panel13 = new JPanel(); panel13.add(nodeDesc); panel13.setVisible(true); nodeDesc.setVisible(false); @@ -279,7 +279,7 @@ public void displayNodeIOBits(int nodeID) { ((AssignmentTableModel) assignmentListModel).fireTableDataChanged(); } - /* Done button handler */ //c2 + /* Done button handler */ public void doneButtonActionPerformed() { setVisible(false); dispose(); diff --git a/java/src/jmri/jmrix/cmri/serial/serialdriver/configurexml/ConnectionConfigXml.java b/java/src/jmri/jmrix/cmri/serial/serialdriver/configurexml/ConnectionConfigXml.java index dd19a21419c..887f108711d 100644 --- a/java/src/jmri/jmrix/cmri/serial/serialdriver/configurexml/ConnectionConfigXml.java +++ b/java/src/jmri/jmrix/cmri/serial/serialdriver/configurexml/ConnectionConfigXml.java @@ -2,6 +2,7 @@ import java.util.List; import java.util.StringTokenizer; +import jmri.jmrix.AbstractSerialConnectionConfig; import jmri.jmrix.cmri.CMRISystemConnectionMemo; import jmri.jmrix.cmri.serial.SerialNode; import jmri.jmrix.cmri.serial.SerialTrafficController; @@ -9,16 +10,18 @@ import jmri.jmrix.cmri.serial.serialdriver.SerialDriverAdapter; import jmri.jmrix.configurexml.AbstractSerialConnectionConfigXml; import org.jdom2.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * Handle XML persistance of layout connections by persisting the + * Handle XML persistence of layout connections by persisting the * SerialDriverAdapter (and connections). Note this is named as the XML version * of a ConnectionConfig object, but it's actually persisting the * SerialDriverAdapter. *

                - * This class is invoked from jmrix.JmrixConfigPaneXml on write, as that class - * is the one actually registered. Reads are brought here directly via the class - * attribute in the XML. + * This class is invoked from {@link jmri.jmrix.configurexml.JmrixConfigPaneXml} + * on write, as that class is the one actually registered. Reads are brought + * here directly via the class attribute in the XML. * * @author Bob Jacobsen Copyright: Copyright (c) * @author Chuck Catania Copyright: Copyright (c) 2014, 2015, 2016, 2017 @@ -62,49 +65,47 @@ protected void extendElement(Element e) { while (node != null) { // add node as an element Element n = new Element("node"); - n.setAttribute("name", "" + node.getNodeAddress()); + n.setAttribute("name", Integer.toString(node.getNodeAddress())); e.addContent(n); // add parameters to the node as needed - n.addContent(makeParameter("nodetype", "" + node.getNodeType())); - n.addContent(makeParameter("bitspercard", "" + node.getNumBitsPerCard())); - n.addContent(makeParameter("transmissiondelay", "" + node.getTransmissionDelay())); - n.addContent(makeParameter("num2lsearchlights", "" + node.getNum2LSearchLights())); - n.addContent(makeParameter("pulsewidth", "" + node.getPulseWidth())); + n.addContent(makeParameter("nodetype", Integer.toString(node.getNodeType()))); + n.addContent(makeParameter("bitspercard", Integer.toString(node.getNumBitsPerCard()))); + n.addContent(makeParameter("transmissiondelay", Integer.toString(node.getTransmissionDelay()))); + n.addContent(makeParameter("num2lsearchlights", Integer.toString(node.getNum2LSearchLights()))); + n.addContent(makeParameter("pulsewidth", Integer.toString(node.getPulseWidth()))); - StringBuilder value = new StringBuilder(""); + StringBuilder value = new StringBuilder(); for (int i = 0; i < node.getLocSearchLightBits().length; i++) { value.append(Integer.toHexString(node.getLocSearchLightBits()[i] & 0xF)); } - n.addContent(makeParameter("locsearchlightbits", "" + value)); - value = new StringBuilder(""); + n.addContent(makeParameter("locsearchlightbits", value.toString())); + value = new StringBuilder(); for (int i = 0; i < node.getCardTypeLocation().length; i++) { value.append(Integer.toHexString(node.getCardTypeLocation()[i] & 0xF)); } - n.addContent(makeParameter("cardtypelocation", "" + value)); -// log.info("Node "+node.nodeAddress+" Card Type Written = "+value); + n.addContent(makeParameter("cardtypelocation", value.toString())); + log.debug("Node {} Card Type Written = {}", node.nodeAddress, value); - // CMRInet Options c2 - //----------------- + // CMRInet Options value = new StringBuilder(""); for (int i = 0; i < SerialNode.NUMCMRINETOPTS; i++) { value.append(Integer.toHexString((node.getCMRInetOpts(i) & 0xF))); } - n.addContent(makeParameter("cmrinetoptions", "" + value.toString().toUpperCase())); -// log.info("Node "+node.nodeAddress+" NET Options Written = "+value); + n.addContent(makeParameter("cmrinetoptions", value.toString().toUpperCase())); + log.debug("Node {} NET Options Written = {}", node.nodeAddress, value); // cpNode Options Classic CMRI nodes do not have options - //------------------------------------------------------- if (node.getNodeType() == SerialNode.CPNODE || node.getNodeType() == SerialNode.CPMEGA) { value = new StringBuilder(); for (int i = 0; i < SerialNode.NUMCPNODEOPTS; i++) { value.append(Integer.toHexString((node.getcpnodeOpts(i) & 0xF))); } - n.addContent(makeParameter("cpnodeoptions", "" + value.toString().toUpperCase())); -// log.info("Node "+node.nodeAddress+" NODE Options Written = "+value); + n.addContent(makeParameter("cpnodeoptions", value.toString().toUpperCase())); + log.debug("Node {} NODE Options Written = {}", node.nodeAddress, value); } // node description - n.addContent(makeParameter("cmrinodedesc", "" + node.getcmriNodeDesc())); + n.addContent(makeParameter("cmrinodedesc", node.getcmriNodeDesc())); // look for the next node node = (SerialNode) tc.getNode(index); @@ -128,7 +129,7 @@ protected void getInstance() { @Override protected void getInstance(Object object) { - adapter = ((ConnectionConfig) object).getAdapter(); + adapter = ((AbstractSerialConnectionConfig) object).getAdapter(); } @Override @@ -136,27 +137,23 @@ protected void unpackElement(Element shared, Element perNode) { // -------------------------------------- // Load the poll list sequence if present // -------------------------------------- - SerialNode plNode; List pl = shared.getChildren("polllist"); - if (pl.size() != 0) { + if (!pl.isEmpty()) { Element ps = pl.get(0); if (ps != null) { String pseq = ps.getAttributeValue("pollseq"); if (pseq != null) { StringTokenizer nodes = new StringTokenizer(pseq, " ,"); SerialTrafficController tcPL = ((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()).getTrafficController(); - plNode = (SerialNode) tcPL.getNode(0); while (nodes.hasMoreTokens()) { tcPL.cmriNetPollList.add(Integer.parseInt(nodes.nextToken())); } -// log.info("Poll List = "+tcPL.cmriNetPollList); + log.debug("Poll List = {}", tcPL.cmriNetPollList); } } } // Load the node specific parameters - // --------------------------------- -// int pollListSize = SerialTrafficController.instance().cmriNetPollList.size(); int pollListSize = ((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()).getTrafficController().cmriNetPollList.size(); int nextPollPos = pollListSize + 1; @@ -175,7 +172,7 @@ protected void unpackElement(Element shared, Element perNode) { String slb = findParmValue(n, "locsearchlightbits"); String ctl = findParmValue(n, "cardtypelocation"); - String opts = ""; //c2 + String opts = ""; // create node (they register themselves) SerialNode node = new SerialNode(addr, type, ((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()).getTrafficController()); @@ -184,13 +181,10 @@ protected void unpackElement(Element shared, Element perNode) { node.setNum2LSearchLights(num2l); node.setPulseWidth(pulseWidth); - // -------------------------------------------------------------------- // From the loaded poll list, assign the poll list position to the node - // -------------------------------------------------------------------- - int pls = 0; boolean assigned = false; if (pollListSize > 0) { - for (pls = 0; pls < pollListSize; pls++) { + for (int pls = 0; pls < pollListSize; pls++) { if (((CMRISystemConnectionMemo) adapter.getSystemConnectionMemo()).getTrafficController().cmriNetPollList.get(pls) == node.getNodeAddress()) { node.setPollListPosition(pls + 1); assigned = true; @@ -201,7 +195,7 @@ protected void unpackElement(Element shared, Element perNode) { } } - // CMRInet Options //c2 + // CMRInet Options //---------------- if (findParmValue(n, "cmrinetoptions") != null) { opts = findParmValue(n, "cmrinetoptions"); @@ -209,17 +203,17 @@ protected void unpackElement(Element shared, Element perNode) { for (int j = 0; j < SerialNode.NUMCMRINETOPTS; j++) { node.setCMRInetOpts(j, (opts.charAt(j) - '0')); } - // log.info("Node "+node.nodeAddress+" NET Options Read = "+opts); + log.debug("Node {} NET Options Read = {}", node.nodeAddress, opts); - } else // This must be the first time the nodes were loaded into a cpNode - // supported version. Set the Auto Poll option to avoid confusion - // with installed configurations. - { + } else { + // This must be the first time the nodes were loaded into a cpNode + // supported version. Set the Auto Poll option to avoid confusion + // with installed configurations. for (int j = 0; j < SerialNode.NUMCMRINETOPTS; j++) { node.setCMRInetOpts(j, 0); } node.setOptNet_AUTOPOLL(1); - // log.info("Node "+node.nodeAddress+" AUTO POLL Set "); + log.debug("Node {} AUTO POLL Set ", node.nodeAddress); } @@ -231,10 +225,8 @@ protected void unpackElement(Element shared, Element perNode) { node.setCardTypeLocation(j, (ctl.charAt(j) - '0')); } - if (type == SerialNode.CPNODE || type == SerialNode.CPMEGA) //c2 - { + if (type == SerialNode.CPNODE || type == SerialNode.CPMEGA) { // cpNode Options - //--------------- if (findParmValue(n, "cpnodeoptions") != null) { opts = findParmValue(n, "cpnodeoptions"); // Convert and load the value into the node options array @@ -243,13 +235,13 @@ protected void unpackElement(Element shared, Element perNode) { } } - // log.info("Node "+node.nodeAddress+" NODE Options Read = "+opts); + log.debug("Node {} NODE Options Read = {}", node.nodeAddress, opts); } if (findParmValue(n, "cmrinodedesc") != null) { node.setcmriNodeDesc(findParmValue(n, "cmrinodedesc")); } else { - // log.info("No Description - Node "+addr); + log.debug("No Description - Node {}", addr); } // Trigger initialization of this Node to reflect these parameters @@ -281,4 +273,5 @@ protected void register() { this.register(new ConnectionConfig(adapter)); } + private static final Logger log = LoggerFactory.getLogger(ConnectionConfigXml.class); } diff --git a/java/src/jmri/jmrix/configurexml/AbstractConnectionConfigXml.java b/java/src/jmri/jmrix/configurexml/AbstractConnectionConfigXml.java index 6f1dd49616a..335831822e1 100644 --- a/java/src/jmri/jmrix/configurexml/AbstractConnectionConfigXml.java +++ b/java/src/jmri/jmrix/configurexml/AbstractConnectionConfigXml.java @@ -19,6 +19,9 @@ abstract public class AbstractConnectionConfigXml extends AbstractXmlAdapter { public AbstractConnectionConfigXml() { } + /** + * get instance + */ abstract protected void getInstance(); abstract protected void register(); @@ -57,6 +60,13 @@ protected void storeCommon(Element e, PortAdapter adapter) { protected void extendElement(Element e) { } + /** + * load common attributes and elements + * + * @param shared the shared element + * @param perNode the per node element + * @param adapter the port adapter + */ protected void loadCommon(Element shared, Element perNode, PortAdapter adapter) { if (perNode.getAttribute("option1") != null) { String option1Setting = perNode.getAttribute("option1").getValue(); @@ -103,9 +113,14 @@ protected void loadCommon(Element shared, Element perNode, PortAdapter adapter) } } } - } + /** + * save options + * + * @param e the element + * @param adapter the port adapter + */ protected void saveOptions(Element e, PortAdapter adapter) { Element element = new Element("options"); String[] options = adapter.getOptions(); @@ -119,6 +134,13 @@ protected void saveOptions(Element e, PortAdapter adapter) { e.addContent(element); } + /** + * load options + * + * @param shared the shared element + * @param perNode the per node element + * @param adapter the port adapter + */ protected void loadOptions(Element shared, Element perNode, PortAdapter adapter) { if (perNode == null) { return; @@ -140,10 +162,7 @@ protected void unpackElement(Element shared, Element perNode) { } /** - * Update static data from XML file - * - * @param element Top level Element to unpack. - * @param o An object to update with data from element. + * {@inheritDoc} */ @Override public void load(Element element, Object o) { diff --git a/java/src/jmri/jmrix/configurexml/AbstractUsbConnectionConfigXml.java b/java/src/jmri/jmrix/configurexml/AbstractUsbConnectionConfigXml.java new file mode 100644 index 00000000000..c1c64951f43 --- /dev/null +++ b/java/src/jmri/jmrix/configurexml/AbstractUsbConnectionConfigXml.java @@ -0,0 +1,162 @@ +package jmri.jmrix.configurexml; + +import jmri.jmrix.UsbPortAdapter; +import org.jdom2.Element; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract base (and partial implementation) for classes persisting the status + * of (non-serial) USB adapters. + *

                + * IOW: if you're just using usb to access a serial buss on the other side then + * you should be using AbstractSerialConnectionConfigXml instead. + *

                + * @author Bob Jacobsen Copyright: Copyright (c) 2003 + * @author George Warner Copyright: Copyright (c) 2017 + */ +abstract public class AbstractUsbConnectionConfigXml extends AbstractConnectionConfigXml { + + /** + * constructor + */ + public AbstractUsbConnectionConfigXml() { + } + + protected UsbPortAdapter adapter; + + /** + * set the usb port adapter + * + * @param usbPortAdapter the usb port adapter to set + */ + protected void setAdapter(UsbPortAdapter usbPortAdapter) { + log.debug("setAdapter({})", usbPortAdapter); + adapter = usbPortAdapter; + } + + /** + * get the usb port adapter + * + * @return the usb port adapter + */ + protected UsbPortAdapter getAdapter() { + log.debug("getAdapter({})"); + return adapter; + } + + /** + * get instance + * + * @param object to get the instance of + */ + protected abstract void getInstance(Object object); + + /** + * {@inheritDoc} + */ + @Override + public Element store(Object object) { + log.debug("store({})", object); + getInstance(object); + Element e = new Element("connection"); + + if (adapter == null) { + log.warn("No adapter found while saving usb port configuration {}", object.toString()); + return null; + } + + // many of the following are required by the DTD; failing to include + // them makes the XML file unreadable, but at least the next + // invocation of the program can then continue. + storeCommon(e, adapter); + + if (adapter.getCurrentPortName() != null) { + e.setAttribute("port", adapter.getCurrentPortName()); + } else { + e.setAttribute("port", Bundle.getMessage("noneSelected")); + } + if (adapter.getSerialNumber() != null) { + e.setAttribute("serialNumber", adapter.getSerialNumber()); + } + + e.setAttribute("class", this.getClass().getName()); + + extendElement(e); + + return e; + } + + /** + * {@inheritDoc} + */ + @Override + protected void extendElement(Element e) { + log.debug("extendElement({})", e); + } + + /** + * load from xml elements + * + * @param shared element + * @param perNode element + * @return boolean true if successful + */ + @Override + public boolean load(Element shared, Element perNode) { + log.debug("load({}, {})", shared, perNode); + boolean result = true; // assume success (optimist!) + + getInstance(); + // configure port name + String portName = perNode.getAttributeValue("port"); + String serialNumber = perNode.getAttributeValue("serialNumber"); + if (serialNumber != null && serialNumber.isEmpty()) { + serialNumber = null; + } + adapter.setPort(portName); + adapter.setSerialNumber(serialNumber); + + loadCommon(shared, perNode, adapter); + + // register, so can be picked up next time + register(); + + // try to open the port + if (adapter.getDisabled()) { + unpackElement(shared, perNode); + return result; + } + + String status = adapter.openPort(portName, serialNumber); + if (status != null) { + // indicates an error, return it + handleException(status, "opening connection", null, null, null); + // now force end to operation + log.debug("load failed"); + return false; + } + + // if successful so far, go ahead and configure + adapter.configure(); + + // once all the configure processing has happened, do any + // extra config + unpackElement(shared, perNode); + return result; + } + + /** + * Update static data from XML file + * + * @param element Top level Element to unpack. + */ + @Override + public void load(Element element, Object o) { + log.error("method with two args invoked"); + } + + // initialize logging + private static final Logger log + = LoggerFactory.getLogger(AbstractUsbConnectionConfigXml.class); +} diff --git a/java/src/jmri/jmrix/dcc4pc/ActiveFlag.java b/java/src/jmri/jmrix/dcc4pc/ActiveFlag.java deleted file mode 100644 index a963a0b769e..00000000000 --- a/java/src/jmri/jmrix/dcc4pc/ActiveFlag.java +++ /dev/null @@ -1,28 +0,0 @@ -package jmri.jmrix.dcc4pc; - - -/** - * Provide a flag to indicate that the subsystem provided by this package is - * active. - *

                - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loadings. - * - * @author Bob Jacobsen Copyright (C) 2003 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlag { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } - -} - diff --git a/java/src/jmri/jmrix/dcc4pc/serialdriver/SerialDriverAdapter.java b/java/src/jmri/jmrix/dcc4pc/serialdriver/SerialDriverAdapter.java index ef997c09427..423ff3f746d 100644 --- a/java/src/jmri/jmrix/dcc4pc/serialdriver/SerialDriverAdapter.java +++ b/java/src/jmri/jmrix/dcc4pc/serialdriver/SerialDriverAdapter.java @@ -211,8 +211,6 @@ public void configure() { control.connectPort(this); this.getSystemConnectionMemo().configureManagers(); - jmri.jmrix.dcc4pc.ActiveFlag.setActive(); - } private final static Logger log = LoggerFactory.getLogger(SerialDriverAdapter.class); diff --git a/java/src/jmri/jmrix/dccpp/DCCppMultiMeter.java b/java/src/jmri/jmrix/dccpp/DCCppMultiMeter.java index 127aa8264b4..22d568fb520 100644 --- a/java/src/jmri/jmrix/dccpp/DCCppMultiMeter.java +++ b/java/src/jmri/jmrix/dccpp/DCCppMultiMeter.java @@ -1,8 +1,5 @@ package jmri.jmrix.dccpp; -import java.beans.PropertyChangeListener; -import java.util.Timer; -import java.util.TimerTask; import jmri.MultiMeter; import jmri.beans.Bean; import org.slf4j.Logger; @@ -13,18 +10,12 @@ * * @author Mark Underwood (C) 2015 */ -public class DCCppMultiMeter extends Bean implements MultiMeter, DCCppListener { - - private float current_float = 0.0f; - private float voltage_float = 0.0f; - - //private boolean is_enabled = false; - private UpdateTask intervalTask = null; - private Timer intervalTimer = null; +public class DCCppMultiMeter extends jmri.implementation.AbstractMultiMeter implements DCCppListener { private DCCppTrafficController tc = null; public DCCppMultiMeter(DCCppSystemConnectionMemo memo) { + super(DCCppConstants.METER_INTERVAL_MS); tc = memo.getDCCppTrafficController(); // TODO: For now this is OK since the traffic controller @@ -56,94 +47,8 @@ public void message(DCCppReply r) { public void message(DCCppMessage m) { } - protected void initTimer() { - intervalTask = new UpdateTask(this); - intervalTimer = new Timer(); - // At some point this will be dynamic intervals... - log.debug("Starting Meter Timer"); - intervalTimer.scheduleAtFixedRate(intervalTask, - DCCppConstants.METER_INTERVAL_MS, - DCCppConstants.METER_INTERVAL_MS); - } - - // Timer task for periodic updates... - private class UpdateTask extends TimerTask { - - private DCCppMultiMeter parent = null; - private boolean is_enabled = false; - - public UpdateTask(DCCppMultiMeter p) { - super(); - parent = p; - } - - //public void setInterval(int i) { sleep_interval = i; } - //public int interval() { return(sleep_interval); } - public void enable() { - is_enabled = true; - } - - public void disable() { - is_enabled = false; - } - - @Override - public void run() { - try { - if (is_enabled) { - //log.debug("Timer Pop"); - tc.sendDCCppMessage(DCCppMessage.makeReadTrackCurrentMsg(), parent); - } - Thread.sleep(DCCppConstants.METER_INTERVAL_MS); - } catch (InterruptedException e) { - log.error("Error running timer update task! {}", e); - } - } - } - - // MultiMeter Interface Methods - @Override - public void enable() { - log.debug("Enabling meter."); - intervalTask.enable(); - } - - @Override - public void disable() { - log.debug("Disabling meter."); - intervalTask.disable(); - } - - @Override - public void setCurrent(float c) { - float old = current_float; - current_float = c; - this.firePropertyChange(CURRENT, old, c); - } - - @Override - public void updateCurrent(float c) { - setCurrent(c); - } - - @Override - public float getCurrent() { - return current_float; - } - - @Override - public void setVoltage(float v) { - voltage_float = v; - } - - @Override - public void updateVoltage(float v) { - setVoltage(v); - } - - @Override - public float getVoltage() { - return voltage_float; + protected void requestUpdateFromLayout() { + tc.sendDCCppMessage(DCCppMessage.makeReadTrackCurrentMsg(), this); } @Override @@ -152,6 +57,7 @@ public void initializeHardwareMeter() { } @Override + // Handle a timeout notification public String getHardwareMeterName() { return ("DCC++"); } @@ -174,45 +80,6 @@ public boolean hasVoltage() { public void dispose() { } - /** - * Request a call-back when the minutes place of the time changes. - */ - @Override - public synchronized void addDataUpdateListener(PropertyChangeListener l) { - this.addPropertyChangeListener(CURRENT, l); - } - - /** - * Remove a request for call-back when the minutes place of the time - * changes. - */ - @Override - public synchronized void removeDataUpdateListener(PropertyChangeListener l) { - this.removePropertyChangeListener(CURRENT, l); - } - - /** - * Get the list of minute change listeners. - */ - @Override - public PropertyChangeListener[] getDataUpdateListeners() { - return this.getPropertyChangeListeners(CURRENT); - } - - /** - * - * @param p the property - * @param old the old value - * @param n the new value - * @deprecated use - * {@link #firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)} - * instead - */ - @Deprecated - protected void fireDataUpdate(String p, Object old, Object n) { - this.firePropertyChange(p, old, n); - } - // Handle a timeout notification @Override public void notifyTimeout(DCCppMessage msg) { diff --git a/java/src/jmri/jmrix/dccpp/DCCppReply.java b/java/src/jmri/jmrix/dccpp/DCCppReply.java index 997d50b6101..b8f4fad6513 100644 --- a/java/src/jmri/jmrix/dccpp/DCCppReply.java +++ b/java/src/jmri/jmrix/dccpp/DCCppReply.java @@ -71,7 +71,7 @@ public DCCppReply(String reply) { super(); setBinary(false); valueList = new ArrayList(); - char charList[] = reply.toCharArray(); + //char charList[] = reply.toCharArray(); //for(int i=0;i command @@ -220,7 +199,7 @@ synchronized protected void forwardCommandChangeToLayout(int s) { } log.debug("Sending Message: {}", msg.toString()); - tc.sendDCCppMessage(msg, this); + tc.sendDCCppMessage(msg, null); // status returned via manager } @Override @@ -234,17 +213,9 @@ protected void turnoutPushbuttonLockout(boolean _pushButtonLockout) { * request an update on status by sending a DCC++ message */ public void requestUpdateFromLayout() { - // Yeah, umm... DCC++ doesn't do this... yet. // (02/2017) Yes it does... using the command or possibly // some others. TODO: Plumb this in... IFF it is needed. - // To do this, we send an XPressNet Accessory Decoder Information - // Request. - // The generated message works for Feedback modules and turnouts - // with feedback, but the address passed is translated as though it - // is a turnout address. As a result, we substitute our base - // address in for the address. after the message is returned. - return; /* // DCCppMessage msg = DCCppMessage.getFeedbackRequestMsg(mNumber, @@ -257,24 +228,6 @@ public void requestUpdateFromLayout() { } - /* - //@Override - //synchronized public void setInverted(boolean inverted) { - // if (log.isDebugEnabled()) { - // log.debug("Inverting Turnout State for turnout xt" + mNumber); - // } - // _inverted = inverted; - // if (inverted) { - // _mThrown = jmri.Turnout.CLOSED; - // _mClosed = jmri.Turnout.THROWN; - // } else { - // _mThrown = jmri.Turnout.THROWN; - // _mClosed = jmri.Turnout.CLOSED; - // } - // super.setInverted(inverted); - //} - */ - @Override public boolean canInvert() { return true; @@ -307,7 +260,6 @@ synchronized public void message(DCCppReply l) { switch (getFeedbackMode()) { case EXACT: handleExactModeFeedback(l); - // IS THIS FALL THROUGH INTENTIONAL? SEEMS ODD break; case MONITORING: handleMonitoringModeFeedback(l); @@ -377,176 +329,57 @@ synchronized private void handleDirectModeFeedback(DCCppReply l) { * */ synchronized private void handleMonitoringModeFeedback(DCCppReply l) { - /* In Monitoring Mode, We have two cases to check if CommandedState - does not equal KnownState, otherwise, we only want to check to - see if the messages we recieve indicate this turnout chagned - state - */ if (log.isDebugEnabled()) { log.debug("Handle Message for turnout " + mNumber + " in MONITORING feedback mode "); } - //if(getCommandedState()==getKnownState() && internalState==IDLE) { - if (internalState == IDLE || internalState == STATUSREQUESTSENT) { - log.debug("In Idle or StatusRequestSent State"); - if (l.isTurnoutReply() && (l.getTOIDInt() == mNumber)) { - // This is a feedback message, we need to check and see if it - // indicates this turnout is to change state or if it is for - // another turnout. - log.debug("Turnout " + mNumber + " MONITORING feedback mode - state change from feedback."); - } - } else if (getCommandedState() != getKnownState() - || internalState == COMMANDSENT) { - log.debug ("In inconsistent or COMMANDSENT state toID = " + l.getTOIDInt()); - if (l.isTurnoutReply() && (l.getTOIDInt() == mNumber)) { - // In Monitoring mode, treat both turnouts with feedback - // and turnouts without feedback as turnouts without - // feedback. i.e. just interpret the feedback - // message, don't check to see if the motion is complete - if (parseMonitoringFeedbackMessage(l, 0) != -1) { - // We need to tell the turnout to shut off the output. - // No, we don't... we're just pretending here... - if (log.isDebugEnabled()) { - log.debug("Turnout " + mNumber + " MONITORING feedback mode - state change from feedback, CommandedState != KnownState."); - } - } - } + if (l.isTurnoutReply() && (l.getTOIDInt() == mNumber)) { + if (l.getTOIsThrown()) { + log.debug("Turnout is Thrown. Inverted = " + (getInverted() ? "True" : "False")); + synchronized (this) { + newCommandedState(getInverted() ? CLOSED : THROWN); + newKnownState(getCommandedState()); + } + } else if (l.getTOIsClosed()) { + log.debug("Turnout is Closed. Inverted = " + (getInverted() ? "True" : "False")); + synchronized (this) { + newCommandedState(getInverted() ? THROWN : CLOSED); + newKnownState(getCommandedState()); + } + } + internalState = IDLE; } return; } synchronized private void handleExactModeFeedback(DCCppReply l) { - /* In Exact Mode, We have two cases to check if CommandedState - does not equal KnownState, otherwise, we only want to check to - see if the messages we recieve indicate this turnout chagned - state + /* + Note for Outputs (EXACT mode), LOW is THROWN, HIGH is CLOSED + As defined in DCC++ Base Station SerialCommand.cpp */ if (log.isDebugEnabled()) { log.debug("Handle Message for turnout " + mNumber + " in EXACT feedback mode "); } - //if(getCommandedState()==getKnownState() && internalState==IDLE) { - if (internalState == IDLE || internalState == STATUSREQUESTSENT) { - if (l.isOutputCmdReply() && (l.getOutputNumInt() == mNumber)) { - // This is a feedback message, we need to check and see if it - // indicates this turnout is to change state or if it is for - // another turnout. - log.debug("Turnout " + mNumber + " EXACT feedback mode - state change from feedback."); - } - } else if (getCommandedState() != getKnownState() - || internalState == COMMANDSENT) { - if (l.isOutputCmdReply() && (l.getOutputNumInt() == mNumber)) { - // In Exact mode, treat both turnouts with feedback - // and turnouts without feedback as turnouts without - // feedback. i.e. just interpret the feedback - // message, don't check to see if the motion is complete - if (parseExactFeedbackMessage(l, 0) != -1) { - // We need to tell the turnout to shut off the output. - // No we don't we're just pretending... - if (log.isDebugEnabled()) { - log.debug("Turnout " + mNumber + " EXACT feedback mode - state change from feedback, CommandedState != KnownState."); - } - } - } + if (l.isOutputCmdReply() && (l.getOutputNumInt() == mNumber)) { + if (l.getOutputIsLow()) { + log.debug("Turnout is Thrown. Inverted = " + (getInverted() ? "True" : "False")); + synchronized (this) { + newCommandedState(getInverted() ? CLOSED : THROWN); + newKnownState(getCommandedState()); + } + } else if (l.getOutputIsHigh()) { + log.debug("Turnout is Closed. Inverted = " + (getInverted() ? "True" : "False")); + synchronized (this) { + newCommandedState(getInverted() ? THROWN : CLOSED); + newKnownState(getCommandedState()); + } + } + internalState = IDLE; } return; } - - /* - * parse the feedback message, and set the status of the turnout - * accordingly - * - * @param l - feedback broadcast message - * @param startByte - first Byte of message to check (kind of ignored) - * - * @return 0 if address matches our turnout -1 otherwise - */ - synchronized private int parseMonitoringFeedbackMessage(DCCppReply l, int startByte) { - // check validity & addressing - if (l.getTOIDInt() == mNumber) { - // is for this object, parse the message - if (log.isDebugEnabled()) { - log.debug("Message for turnout " + mNumber); - } - if (l.getTOIsThrown()) { - log.debug("Turnout is Thrown. Inverted = " + (getInverted() ? "True" : "False")); - synchronized (this) { - newCommandedState(getInverted() ? CLOSED : THROWN); - newKnownState(getCommandedState()); - } - return (0); - } else if (l.getTOIsClosed()) { - log.debug("Turnout is Closed. Inverted = " + (getInverted() ? "True" : "False")); - synchronized (this) { - newCommandedState(getInverted() ? THROWN : CLOSED); - newKnownState(getCommandedState()); - } - return (0); - } else { - log.debug("Turnout is inconsistent. Commanded = " + getCommandedState() + " Known = " + getKnownState()); - // the state is unknown or inconsistent. If the command state - // does not equal the known state, and the command repeat the - // last command - // - // This should never happen in the current version of DCC++ - if (getCommandedState() != getKnownState()) { - forwardCommandChangeToLayout(getCommandedState()); - } - return -1; - } - } - return (-1); - } - - /** parseExactFeedbackMessage() - * parse the feedback message, and set the status of the turnout - * accordingly - * - * Note for Outputs (EXACT mode), LOW is THROWN, HIGH is CLOSED - * As defined in DCC++ Base Station SerialCommand.cpp - * - * @param l - feedback broadcast message - * @param startByte - first Byte of message to check (kind of ignored) - * - * @return 0 if address matches our turnout -1 otherwise - */ - synchronized private int parseExactFeedbackMessage(DCCppReply l, int startByte) { - // check validity & addressing - if (l.getOutputNumInt() == mNumber) { - // is for this object, parse the message - if (log.isDebugEnabled()) { - log.debug("Message for turnout " + mNumber); - } - if (l.getOutputIsLow()) { - log.debug("Turnout is Thrown. Inverted = " + (getInverted() ? "True" : "False")); - synchronized (this) { - newCommandedState(getInverted() ? CLOSED : THROWN); - newKnownState(getCommandedState()); - } - return (0); - } else if (l.getOutputIsHigh()) { - log.debug("Turnout is Closed. Inverted = " + (getInverted() ? "True" : "False")); - synchronized (this) { - newCommandedState(getInverted() ? THROWN : CLOSED); - newKnownState(getCommandedState()); - } - return (0); - } else { - log.debug("Turnout is inconsistent. Commanded = " + getCommandedState() + " Known = " + getKnownState()); - // the state is unknown or inconsistent. If the command state - // does not equal the known state, and the command repeat the - // last command - // - // This should never happen in the current version of DCC++ - if (getCommandedState() != getKnownState()) { - forwardCommandChangeToLayout(getCommandedState()); - } - return -1; - } - } - return (-1); - } - + @Override public void dispose() { this.removePropertyChangeListener(_stateListener); diff --git a/java/src/jmri/jmrix/dccpp/DCCppTurnoutManager.java b/java/src/jmri/jmrix/dccpp/DCCppTurnoutManager.java index 8e51a2d7f7b..15896571aac 100644 --- a/java/src/jmri/jmrix/dccpp/DCCppTurnoutManager.java +++ b/java/src/jmri/jmrix/dccpp/DCCppTurnoutManager.java @@ -68,6 +68,30 @@ public void message(DCCppReply l) { if (null == getBySystemName(s)) { // need to create a new one, and send the message on // to the newly created object. + ((DCCppTurnout) provideTurnout(s)).setFeedbackMode(Turnout.MONITORING); + ((DCCppTurnout) provideTurnout(s)).initmessage(l); + } else { + // The turnout exists, forward this message to the + // turnout + ((DCCppTurnout) getBySystemName(s)).message(l); + } + } + } else if (l.isOutputCmdReply()) { + // parse message type + int addr = l.getOutputNumInt(); + if (addr >= 0) { + // check to see if the address has been operated before + // continuing. + if (log.isDebugEnabled()) { + log.debug("message has address: {}", addr); + } + // reach here for switch command; make sure we know + // about this one + String s = prefix + typeLetter() + addr; + if (null == getBySystemName(s)) { + // need to create a new one, and send the message on + // to the newly created object. + ((DCCppTurnout) provideTurnout(s)).setFeedbackMode(Turnout.EXACT); ((DCCppTurnout) provideTurnout(s)).initmessage(l); } else { // The turnout exists, forward this message to the diff --git a/java/src/jmri/jmrix/dccpp/dccppovertcp/DCCppOverTcpPacketizer.java b/java/src/jmri/jmrix/dccpp/dccppovertcp/DCCppOverTcpPacketizer.java index 3a73277dd53..fc4819cbe42 100644 --- a/java/src/jmri/jmrix/dccpp/dccppovertcp/DCCppOverTcpPacketizer.java +++ b/java/src/jmri/jmrix/dccpp/dccppovertcp/DCCppOverTcpPacketizer.java @@ -48,7 +48,7 @@ // However, at minimum, this would break backward compatibility for the interface, // so there is that to consider. Probably best to do this sooner than later, // to minimize that impact. -// +// public class DCCppOverTcpPacketizer extends DCCppPacketizer { static final String OLD_RECEIVE_PREFIX = "RECEIVE "; @@ -59,7 +59,7 @@ public class DCCppOverTcpPacketizer extends DCCppPacketizer { static final String NEW_SERVER_VERSION_STRING = "VERSION DCC++ Server "; boolean useOldPrefix = false; - + protected BufferedReader istreamReader = null; /** @@ -142,7 +142,7 @@ public void disconnectPort(DCCppNetworkPortController p) { public void sendDCCppMessage(DCCppMessage m, DCCppListener reply) { // update statistics //transmittedMsgCount++; - + log.debug("queue DCCpp packet: " + m.toString()); // in an atomic operation, queue the request and wake the xmit thread try { @@ -154,7 +154,7 @@ public void sendDCCppMessage(DCCppMessage m, DCCppListener reply) { log.warn("passing to xmit: unexpected exception: " + e); } } - + /** * Invoked at startup to start the threads needed here. */ @@ -164,7 +164,7 @@ public void startThreads() { + " max available = " + Thread.MAX_PRIORITY + " default = " + Thread.NORM_PRIORITY + " min available = " + Thread.MIN_PRIORITY); - + // make sure that the xmt priority is no lower than the current priority int xmtpriority = (Thread.MAX_PRIORITY - 1 > priority ? Thread.MAX_PRIORITY - 1 : Thread.MAX_PRIORITY); // start the XmtHandler in a thread of its own @@ -176,7 +176,7 @@ public void startThreads() { xmtThread.setDaemon(true); xmtThread.setPriority(Thread.MAX_PRIORITY - 1); xmtThread.start(); - + // start the RcvHandler in a thread of its own if (rcvHandler == null) { rcvHandler = new RcvHandler(this); @@ -185,36 +185,36 @@ public void startThreads() { rcvThread.setDaemon(true); rcvThread.setPriority(Thread.MAX_PRIORITY); rcvThread.start(); - + } - + /** * Captive class to handle incoming characters. This is a permanent loop, * looking for input messages in character form on the stream connected to * the LnPortnetworkController via connectPort. */ class RcvHandler implements Runnable { - + /** * Remember the DCCppPacketizer object */ - DCCppOverTcpPacketizer trafficController; - + //DCCppOverTcpPacketizer trafficController; + public RcvHandler(DCCppOverTcpPacketizer lt) { - trafficController = lt; + //trafficController = lt; } - + // readline is deprecated, but there are no problems // with multi-byte characters here. @SuppressWarnings({"deprecation", "null"}) @Override public void run() { - + String rxLine; while (true) { // loop permanently, program close will exit try { // start by looking for a complete line - + if (istreamReader == null) { log.error("istreamReader not initialized!"); return; @@ -224,15 +224,15 @@ public void run() { log.warn("run: input stream returned null, exiting loop"); return; } - + log.debug("Received: {}", rxLine); - + // Legacy support. If this message is the old JMRI version // handshake, flag us as in "old mode" if (rxLine.startsWith(OLD_SERVER_VERSION_STRING)) { useOldPrefix = true; } - + // Legacy support. If the old receive prefix is present // remove it. if (rxLine.startsWith(OLD_RECEIVE_PREFIX)) { @@ -264,7 +264,7 @@ public void run() { rxLine.lastIndexOf(">"))); //DCCppReply msg = new DCCppReply(rxLine.substring(rxLine.indexOf("<") + 1, // rxLine.lastIndexOf(">"))); - + if (!msg.isValidReplyFormat()) { log.warn("Invalid Reply Format: {}", msg.toString()); continue; @@ -273,13 +273,13 @@ public void run() { if (log.isDebugEnabled()) { log.debug("queue reply for notification"); } - + final DCCppReply thisMsg = msg; //final DCCppPacketizer thisTC = trafficController; // return a notification via the queue to ensure end Runnable r = new Runnable() { DCCppReply msgForLater = thisMsg; - + @Override public void run() { notifyReply(msgForLater, null); @@ -307,15 +307,15 @@ public void run() { } // end of permanent loop } } - + /** * Captive class to handle transmission */ class XmtHandler implements Runnable { - + @Override public void run() { - + while (true) { // loop permanently // any input? try { @@ -325,7 +325,7 @@ public void run() { synchronized (this) { msg = xmtList.removeFirst(); } - + // input - now send try { if (ostream != null) { @@ -354,14 +354,14 @@ public void run() { } catch (NoSuchElementException e) { // message queue was empty, wait for input log.debug("start wait"); - + new jmri.util.WaitHandler(this); // handle synchronization, spurious wake, interruption - + log.debug("end wait"); } } } } - + private final static Logger log = LoggerFactory.getLogger(DCCppOverTcpPacketizer.class); } diff --git a/java/src/jmri/jmrix/ecos/EcosLocoAddressManager.java b/java/src/jmri/jmrix/ecos/EcosLocoAddressManager.java index eec25a65469..ceb33500ada 100644 --- a/java/src/jmri/jmrix/ecos/EcosLocoAddressManager.java +++ b/java/src/jmri/jmrix/ecos/EcosLocoAddressManager.java @@ -467,8 +467,8 @@ public void actionPerformed(ActionEvent e) { if (remember.isSelected()) { p.setAddLocoToEcos(0x02); } - RosterToEcos rosterToEcos = new RosterToEcos(); - rosterToEcos.createEcosLoco(_re, adaptermemo); + RosterToEcos rosterToEcos = new RosterToEcos(adaptermemo); + rosterToEcos.createEcosLoco(_re); _re = null; dialog.dispose(); } @@ -482,8 +482,8 @@ public void actionPerformed(ActionEvent e) { dialog.setVisible(true); } if (p.getAddLocoToEcos() == 0x02) { - RosterToEcos rosterToEcos = new RosterToEcos(); - rosterToEcos.createEcosLoco(_re, adaptermemo); + RosterToEcos rosterToEcos = new RosterToEcos(adaptermemo); + rosterToEcos.createEcosLoco(_re); _re = null; } } diff --git a/java/src/jmri/jmrix/ecos/swing/locodatabase/EcosLocoTableAction.java b/java/src/jmri/jmrix/ecos/swing/locodatabase/EcosLocoTableAction.java index c8de78f3caa..308f786d129 100644 --- a/java/src/jmri/jmrix/ecos/swing/locodatabase/EcosLocoTableAction.java +++ b/java/src/jmri/jmrix/ecos/swing/locodatabase/EcosLocoTableAction.java @@ -39,7 +39,6 @@ import jmri.jmrix.ecos.EcosSystemConnectionMemo; import jmri.jmrix.ecos.utilities.EcosLocoToRoster; import jmri.jmrix.ecos.utilities.RemoveObjectFromEcos; -import jmri.util.com.sun.TableSorter; import jmri.util.swing.XTableColumnModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -231,21 +230,9 @@ public void setValueAt(Object value, int row, int col) { } } - /** - * {@inheritDoc } - */ - @Override - @Deprecated - public JTable makeJTable(TableSorter sorter) { - return this.makeJTable((TableModel) sorter); - } - @Override - public JTable makeJTable(@Nonnull String name, @Nonnull TableModel model, @Nullable RowSorter sorter) { - JTable table = this.makeJTable(model); - table.setName(name); - table.setRowSorter(sorter); - return table; + public JTable makeJTable(@Nonnull String name, @Nonnull TableModel model, @Nullable RowSorter sorter) { + return this.configureJTable(name, this.makeJTable(model), sorter); } private JTable makeJTable(@Nonnull TableModel model) { diff --git a/java/src/jmri/jmrix/ecos/utilities/AddRosterEntryToEcos.java b/java/src/jmri/jmrix/ecos/utilities/AddRosterEntryToEcos.java index d1bc4d5cde2..b3fef094ccf 100644 --- a/java/src/jmri/jmrix/ecos/utilities/AddRosterEntryToEcos.java +++ b/java/src/jmri/jmrix/ecos/utilities/AddRosterEntryToEcos.java @@ -56,8 +56,8 @@ public void actionPerformed(ActionEvent event) { String selEntry = (String) rosterEntry.getSelectedItem(); RosterEntry re = roster.entryFromTitle(selEntry); log.debug("Add " + re.getId() + " to ECoS"); - RosterToEcos rosterToEcos = new RosterToEcos(); - rosterToEcos.createEcosLoco(re, adaptermemo); + RosterToEcos rosterToEcos = new RosterToEcos(adaptermemo); + rosterToEcos.createEcosLoco(re); } void rosterEntryUpdate() { diff --git a/java/src/jmri/jmrix/ecos/utilities/RosterToEcos.java b/java/src/jmri/jmrix/ecos/utilities/RosterToEcos.java index a054f455e1a..08dec8cba43 100644 --- a/java/src/jmri/jmrix/ecos/utilities/RosterToEcos.java +++ b/java/src/jmri/jmrix/ecos/utilities/RosterToEcos.java @@ -1,7 +1,5 @@ package jmri.jmrix.ecos.utilities; -import jmri.InstanceManager; -import jmri.jmrit.decoderdefn.DecoderIndexFile; import jmri.jmrit.roster.RosterEntry; import jmri.jmrix.ecos.EcosListener; import jmri.jmrix.ecos.EcosLocoAddress; @@ -23,23 +21,21 @@ public class RosterToEcos implements EcosListener { private boolean createloco; EcosSystemConnectionMemo adaptermemo; - DecoderIndexFile decoderind = InstanceManager.getDefault(DecoderIndexFile.class); - - public RosterToEcos() { + public RosterToEcos(EcosSystemConnectionMemo memo) { + adaptermemo = memo; + tc = adaptermemo.getTrafficController(); + ep = adaptermemo.getPreferenceManager(); + objEcosLocoManager = adaptermemo.getLocoAddressManager(); } - public void createEcosLoco(RosterEntry re, EcosSystemConnectionMemo memo) { + public void createEcosLoco(RosterEntry re) { if (createloco == true) { return; } createloco = true; - adaptermemo = memo; - tc = adaptermemo.getTrafficController(); - ep = adaptermemo.getPreferenceManager(); _re = re; - objEcosLocoManager = adaptermemo.getLocoAddressManager(); - String protocol = ""; + String protocol; switch (re.getProtocol()) { case MOTOROLA: protocol = "MM28"; @@ -65,26 +61,36 @@ private String description() { String result = ""; String str = ep.getEcosLocoDescription(); - if ((str == null) || (str.equals(""))) { + if ((str == null) || (str.isEmpty())) { return _re.getId(); } char comp = '%'; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == comp) { - if (str.charAt(i + 1) == 'i') { - result = result + _re.getId(); - } else if (str.charAt(i + 1) == 'r') { - result = result + _re.getRoadName(); - } else if (str.charAt(i + 1) == 'n') { - result = result + _re.getRoadNumber(); - } else if (str.charAt(i + 1) == 'm') { - result = result + _re.getMfg(); - } else if (str.charAt(i + 1) == 'o') { - result = result + _re.getOwner(); - } else if (str.charAt(i + 1) == 'l') { - result = result + _re.getModel(); - } else if (str.charAt(i + 1) == 'c') { - result = result + _re.getComment(); + switch (str.charAt(i + 1)) { + case 'i': + result = result + _re.getId(); + break; + case 'r': + result = result + _re.getRoadName(); + break; + case 'n': + result = result + _re.getRoadNumber(); + break; + case 'm': + result = result + _re.getMfg(); + break; + case 'o': + result = result + _re.getOwner(); + break; + case 'l': + result = result + _re.getModel(); + break; + case 'c': + result = result + _re.getComment(); + break; + default: + break; } i++; } else { @@ -109,8 +115,8 @@ public void reply(EcosReply m) { for (int i = 1; i < lines.length - 1; i++) { if (lines[i].contains("10 id[")) { - start = lines[i].indexOf("[") + 1; - end = lines[i].indexOf("]"); + start = lines[i].indexOf('[') + 1; + end = lines[i].indexOf(']'); String EcosAddr = lines[i].substring(start, end); objEcosLoco = objEcosLocoManager.provideByEcosObject(EcosAddr); objEcosLoco.setEcosTempEntry(false); diff --git a/java/src/jmri/jmrix/internal/ConnectionConfig.java b/java/src/jmri/jmrix/internal/ConnectionConfig.java index 26a59edb865..58291cccb76 100644 --- a/java/src/jmri/jmrix/internal/ConnectionConfig.java +++ b/java/src/jmri/jmrix/internal/ConnectionConfig.java @@ -1,17 +1,20 @@ package jmri.jmrix.internal; +import jmri.jmrix.AbstractSimulatorConnectionConfig; +import jmri.jmrix.SerialPortAdapter; + /** * Definition of objects to handle configuring a virtual layout connection * * @author Bob Jacobsen Copyright (C) 2001, 2003, 2010 */ -public class ConnectionConfig extends jmri.jmrix.AbstractSimulatorConnectionConfig { +public class ConnectionConfig extends AbstractSimulatorConnectionConfig { /** * Ctor for an object being created during load process; * @param p serial port adapter */ - public ConnectionConfig(jmri.jmrix.SerialPortAdapter p) { + public ConnectionConfig(SerialPortAdapter p) { super(p); } @@ -36,5 +39,4 @@ protected void setInstance() { adapter = new InternalAdapter(); } } - } diff --git a/java/src/jmri/jmrix/jinput/TreeModel.java b/java/src/jmri/jmrix/jinput/TreeModel.java index f985a70b267..6748a18fe86 100644 --- a/java/src/jmri/jmrix/jinput/TreeModel.java +++ b/java/src/jmri/jmrix/jinput/TreeModel.java @@ -28,7 +28,7 @@ *

                * jinput requires that there be only one of these for a given USB system in a * given JVM so we use a pseudo-singlet "instance" approach - * + *

                * Class is final because it starts a survey thread, which runs while * constructor is still active. * @@ -43,8 +43,10 @@ private TreeModel() { // load initial USB objects boolean pass = loadSystem(); - if (!pass) log.error("loadSystem failed"); - + if (!pass) { + log.error("loadSystem failed"); + } + // If you don't call loadSystem, the following line was // needed to get the display to start // insertNodeInto(new UsbNode("System", null, null), dRoot, 0); @@ -53,8 +55,9 @@ private TreeModel() { runner.setName("jinput.TreeModel loader"); runner.start(); } + Runner runner; - + /** * Add a node to the tree if it doesn't already exist * @@ -64,7 +67,7 @@ private TreeModel() { * where in the tree to insert it. * @return node, regardless of whether needed or not */ - DefaultMutableTreeNode insertNode(DefaultMutableTreeNode pChild, DefaultMutableTreeNode pParent) { + private DefaultMutableTreeNode insertNode(DefaultMutableTreeNode pChild, DefaultMutableTreeNode pParent) { // if already exists, just return it int index; index = getIndexOfChild(pParent, pChild); @@ -73,7 +76,11 @@ DefaultMutableTreeNode insertNode(DefaultMutableTreeNode pChild, DefaultMutableT } // represent this one index = pParent.getChildCount(); - insertNodeInto(pChild, pParent, index); + try { + insertNodeInto(pChild, pParent, index); + } catch (IllegalArgumentException e) { + log.error("insertNode({}, {}) Exception {}", pChild, pParent, e); + } return pChild; } @@ -94,11 +101,13 @@ static public TreeModel instance() { // intended for test routines only void terminateThreads() throws InterruptedException { - if (runner == null) return; + if (runner == null) { + return; + } runner.interrupt(); runner.join(); } - + static private TreeModel instanceValue = null; class Runner extends Thread { @@ -208,12 +217,19 @@ public void run() { // ensure controller node exists directly under root String cname = controller.getName() + " [" + controller.getType().toString() + "]"; UsbNode cNode = UsbNode.getNode(cname, controller, null); - cNode = (UsbNode) insertNode(cNode, dRoot); - + try { + cNode = (UsbNode) insertNode(cNode, dRoot); + } catch (IllegalArgumentException e) { + log.error("insertNode({}, {}) Exception {}", cNode, dRoot, e); + } // Device (component) node String dname = component.getName() + " [" + component.getIdentifier().toString() + "]"; UsbNode dNode = UsbNode.getNode(dname, controller, component); - dNode = (UsbNode) insertNode(dNode, cNode); + try { + dNode = (UsbNode) insertNode(dNode, cNode); + } catch (IllegalArgumentException e) { + log.error("insertNode({}, {}) Exception {}", dNode, cNode, e); + } dNode.setValue(value); @@ -231,36 +247,50 @@ boolean loadSystem() { try { ca = ControllerEnvironment.getDefaultEnvironment().getControllers(); log.debug("Found " + ca.length + " controllers"); - } catch (Exception ex) { // this is probably ClassNotFoundException, but that's not part of the interface + } catch (Exception ex) { + // this is probably ClassNotFoundException, but that's not part of the interface // could not load some component(s) log.debug("Found no controllers, handled Exception", ex); ca = null; return false; } - for (int i = 0; i < ca.length; i++) { + for (Controller controller : controllers()) { + UsbNode controllerNode = null; + UsbNode deviceNode = null; // Get this controllers components (buttons and axis) - Component[] components = ca[i].getComponents(); - log.info("Controller " + ca[i].getName() + " has " + components.length + " components"); - for (int j = 0; j < components.length; j++) { - - Controller controller = ca[i]; - Component component = components[j]; - - // ensure controller node exists directly under root - String cname = controller.getName() + " [" + controller.getType().toString() + "]"; - UsbNode cNode = UsbNode.getNode(cname, controller, null); - cNode = (UsbNode) insertNode(cNode, dRoot); - - // Device (component) node - String dname = component.getName() + " [" + component.getIdentifier().toString() + "]"; - UsbNode dNode = UsbNode.getNode(dname, controller, component); - dNode = (UsbNode) insertNode(dNode, cNode); - - dNode.setValue(0.0f); + Component[] components = controller.getComponents(); + log.info("Controller " + controller.getName() + " has " + components.length + " components"); + for (Component component : components) { + try { + if (controllerNode == null) { + // ensure controller node exists directly under root + String controllerName = controller.getName() + " [" + controller.getType().toString() + "]"; + controllerNode = UsbNode.getNode(controllerName, controller, null); + controllerNode = (UsbNode) insertNode(controllerNode, dRoot); + } + // Device (component) node + String componentName = component.getName(); + String componentIdentifierString = component.getIdentifier().toString(); + // Skip unknown components + if (!componentName.equals("Unknown") && !componentIdentifierString.equals("Unknown")) { + String deviceName = componentName + " [" + componentIdentifierString + "]"; + deviceNode = UsbNode.getNode(deviceName, controller, component); + deviceNode = (UsbNode) insertNode(deviceNode, controllerNode); + deviceNode.setValue(0.0f); + } + } catch (IllegalStateException e) { + // node does not allow children + break; // skip this controller + } catch (IllegalArgumentException e) { + // ignore components that throw IllegalArgumentExceptions + log.error("insertNode({}, {}) Exception {}", deviceNode, controllerNode, e); + } catch (Exception e) { + // log all others + log.error("Exception " + e); + } } } - return true; } diff --git a/java/src/jmri/jmrix/jinput/UsbNode.java b/java/src/jmri/jmrix/jinput/UsbNode.java index 8874903f1d9..acc1d471116 100644 --- a/java/src/jmri/jmrix/jinput/UsbNode.java +++ b/java/src/jmri/jmrix/jinput/UsbNode.java @@ -34,9 +34,6 @@ public class UsbNode extends DefaultMutableTreeNode { @Override public int hashCode() { - if (component != null) { - return component.hashCode(); - } if (controller == null) { return super.hashCode(); } else { @@ -54,14 +51,14 @@ public Component getComponent() { @Override public boolean equals(Object a) { - if (a == null) { - return false; - } - if (!(a instanceof UsbNode)) { - return false; + boolean result = false; + if ((a != null) && (a instanceof UsbNode)) { + UsbNode usbNode = (UsbNode) a; + result = (name.equals(usbNode.name) + && (controller == usbNode.controller) + && (component == usbNode.component)); } - UsbNode opp = (UsbNode) a; - return (name.equals(opp.name)) && (controller == opp.controller) && (component == opp.component); + return result; } public void setValue(float val) { @@ -126,18 +123,13 @@ public String getName() { * component, or newly created */ static public UsbNode getNode(String name, Controller controller, Component component) { - Object key = controller; - if (component != null) { - key = component; - } - - UsbNode temp = NODES.get(key); - if (temp != null) { - return temp; + Object key = (component != null) ? component : controller; + UsbNode result = NODES.get(key); + if (result == null) { + result = new UsbNode(name, controller, component); + NODES.put(key, result); } - UsbNode node = new UsbNode(name, controller, component); - NODES.put(key, node); - return node; + return result; } private static final HashMap NODES = new HashMap<>(); diff --git a/java/src/jmri/jmrix/jinput/treecontrol/TreePanel.java b/java/src/jmri/jmrix/jinput/treecontrol/TreePanel.java index caee93928c3..2cf2c43531d 100644 --- a/java/src/jmri/jmrix/jinput/treecontrol/TreePanel.java +++ b/java/src/jmri/jmrix/jinput/treecontrol/TreePanel.java @@ -20,26 +20,16 @@ import javax.swing.tree.TreePath; import jmri.jmrix.jinput.TreeModel; import jmri.jmrix.jinput.UsbNode; +import net.java.games.input.Component; +import net.java.games.input.Controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Create a JPanel containing a tree of JInput sources. * - *


                - * This file is part of JMRI. - *

                - * JMRI is free software; you can redistribute it and/or modify it under the - * terms of version 2 of the GNU General Public License as published by the Free - * Software Foundation. See the "COPYING" file for a copy of this license. - *

                - * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. - *

                - * * @author Bob Jacobsen Copyright 2008 - */ + */ public class TreePanel extends JPanel { public TreePanel() { @@ -178,24 +168,19 @@ public void actionPerformed(ActionEvent e) { // starting listening for changes TreeModel.instance().addPropertyChangeListener( new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent e) { - if (currentNode == null) { - return; - } - if (e.getOldValue() != currentNode) { - return; - } - // right place, update - float value = ((Float) e.getNewValue()).floatValue(); - if (currentNode.getComponent().isAnalog()) { - componentValue.setText("" + value); - } else { - componentValue.setText((value > 0.0) ? "Yes" : "No"); - } + @Override + public void propertyChange(PropertyChangeEvent e) { + if ((currentNode != null) && (e.getOldValue() == currentNode)) { + // right place, update + float value = ((Float) e.getNewValue()).floatValue(); + if (currentNode.getComponent().isAnalog()) { + componentValue.setText("" + value); + } else { + componentValue.setText((value > 0.0) ? "Yes" : "No"); } } - ); + } + }); } void checkSensorBox() { @@ -232,27 +217,31 @@ void checkMemoryBox() { UsbNode currentNode = null; void update() { - if (currentNode.getController() != null) { - controllerName.setText(currentNode.getController().getName()); - controllerType.setText(currentNode.getController().getType().toString()); + Controller controller = currentNode.getController(); + if (controller != null) { + controllerName.setText(controller.getName()); + controllerType.setText(controller.getType().toString()); } else { controllerName.setText(""); controllerType.setText(""); } - if (currentNode.getComponent() != null) { - componentName.setText(currentNode.getComponent().getName()); - componentId.setText(currentNode.getComponent().getIdentifier().toString()); - if (currentNode.getComponent().isAnalog()) { + Component component = currentNode.getComponent(); + if (component != null) { + componentName.setText(component.getName()); + componentId.setText(component.getIdentifier().toString()); + if (component.isAnalog()) { componentAnalog.setText("Yes"); componentValue.setText("" + currentNode.getValue()); - componentRelative.setText(currentNode.getComponent().isRelative() ? "Yes" : "No"); + componentRelative.setText(component.isRelative() ? "Yes" : "No"); } else { componentAnalog.setText("No"); componentRelative.setText(""); componentValue.setText((currentNode.getValue() > 0.0) ? "Yes" : "No"); } - if ((currentNode.getAttachedSensor() != null) && (!currentNode.getAttachedSensor().equals(""))) { - sensorName.setText(currentNode.getAttachedSensor()); + + String attachedSensor = currentNode.getAttachedSensor(); + if ((attachedSensor != null) && !attachedSensor.isEmpty()) { + sensorName.setText(attachedSensor); sensorName.setEditable(false); sensorBox.setSelected(true); } else { @@ -260,8 +249,10 @@ void update() { sensorName.setEditable(true); sensorBox.setSelected(false); } - if ((currentNode.getAttachedMemory() != null) && (!currentNode.getAttachedMemory().equals(""))) { - memoryName.setText(currentNode.getAttachedMemory()); + + String attachedMemory = currentNode.getAttachedMemory(); + if ((attachedMemory != null) && (!attachedMemory.equals(""))) { + memoryName.setText(attachedMemory); memoryName.setEditable(false); memoryBox.setSelected(true); } else { diff --git a/java/src/jmri/jmrix/lenz/swing/stackmon/ StackMonBundle_fr.properties b/java/src/jmri/jmrix/lenz/swing/stackmon/StackMonBundle_fr.properties similarity index 100% rename from java/src/jmri/jmrix/lenz/swing/stackmon/ StackMonBundle_fr.properties rename to java/src/jmri/jmrix/lenz/swing/stackmon/StackMonBundle_fr.properties diff --git a/java/src/jmri/jmrix/loconet/Intellibox/IbxConnectionTypeList.java b/java/src/jmri/jmrix/loconet/Intellibox/IbxConnectionTypeList.java index c871d591b48..f7742c3528d 100644 --- a/java/src/jmri/jmrix/loconet/Intellibox/IbxConnectionTypeList.java +++ b/java/src/jmri/jmrix/loconet/Intellibox/IbxConnectionTypeList.java @@ -1,7 +1,7 @@ package jmri.jmrix.loconet.Intellibox; /** - * Returns a list of valid lenz XpressNet Connection Types + * Returns a list of valid Intellibox Connection Types *

                * @author Bob Jacobsen Copyright (C) 2010 * @author Kevin Dickerson Copyright (C) 2010 diff --git a/java/src/jmri/jmrix/loconet/Intellibox/IntelliboxAdapter.java b/java/src/jmri/jmrix/loconet/Intellibox/IntelliboxAdapter.java index 25e1b71c680..e35dcc0b504 100644 --- a/java/src/jmri/jmrix/loconet/Intellibox/IntelliboxAdapter.java +++ b/java/src/jmri/jmrix/loconet/Intellibox/IntelliboxAdapter.java @@ -7,9 +7,9 @@ /** * Update the code in jmri.jmrix.loconet.locobuffer so that it operates * correctly with the Intellibox on-board serial port. - *

                + *

                * Since this is by definition connected to an Intellibox, the command station - * prompt has limited choices + * prompt has limited choices. * * @author Alex Shepherd Copyright (C) 2004 * @author Bob Jacobsen Copyright (C) 2005, 2010 @@ -21,9 +21,9 @@ public IntelliboxAdapter() { // define command station options options.remove(option2Name); - options.put(option2Name, new Option("Command station type:", commandStationOptions(), false)); + options.put(option2Name, new Option(Bundle.getMessage("CommandStationTypeLabel"), commandStationOptions(), false)); - validSpeeds = new String[]{"19200", "38400", "115200"}; + validSpeeds = new String[]{Bundle.getMessage("Baud19200"), Bundle.getMessage("Baud38400"), Bundle.getMessage("Baud115200")}; validSpeedValues = new int[]{19200, 38400, 115200}; } @@ -68,11 +68,11 @@ public int[] validBaudNumber() { * Rephrase option 1, so that it doesn't talk about LocoBuffer */ public String option1Name() { - return "Serial connection uses "; + return Bundle.getMessage("XconnectionUsesLabel", Bundle.getMessage("TypeSerial")); } /** - * Provide just one valid command station value + * Provide just one valid command station value. */ public String[] commandStationOptions() { String[] retval = { diff --git a/java/src/jmri/jmrix/loconet/LnOpsModeProgrammer.java b/java/src/jmri/jmrix/loconet/LnOpsModeProgrammer.java index 73dcfbe5df3..738c84801d4 100644 --- a/java/src/jmri/jmrix/loconet/LnOpsModeProgrammer.java +++ b/java/src/jmri/jmrix/loconet/LnOpsModeProgrammer.java @@ -29,7 +29,9 @@ public class LnOpsModeProgrammer implements AddressedProgrammer, LocoNetListener boolean mLongAddr; ProgListener p; boolean doingWrite; - + boolean boardOpSwWriteVal; + javax.swing.Timer bdOpSwAccessTimer = null; + public LnOpsModeProgrammer(SlotManager pSlotMgr, LocoNetSystemConnectionMemo memo, int pAddress, boolean pLongAddr) { @@ -37,7 +39,7 @@ public LnOpsModeProgrammer(SlotManager pSlotMgr, this.memo = memo; mAddress = pAddress; mLongAddr = pLongAddr; - + // register to listen memo.getLnTrafficController().addLocoNetListener(~0, this); } @@ -46,11 +48,13 @@ public LnOpsModeProgrammer(SlotManager pSlotMgr, * Forward a write request to an ops-mode write operation */ @Override + @Deprecated public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException { mSlotMgr.writeCVOpsMode(CV, val, p, mAddress, mLongAddr); } @Override + @Deprecated public void readCV(int CV, ProgListener p) throws ProgrammerException { mSlotMgr.readCVOpsMode(CV, p, mAddress, mLongAddr); } @@ -59,7 +63,51 @@ public void readCV(int CV, ProgListener p) throws ProgrammerException { public void writeCV(String CV, int val, ProgListener p) throws ProgrammerException { this.p = null; // Check mode - if (getMode().equals(LnProgrammerManager.LOCONETSV1MODE)) { + if (getMode().equals(LnProgrammerManager.LOCONETBDOPSWMODE)) { + /** + * CV format is e.g. "113.12" where the first part defines the + * typeword for the specific board type and the second is the specific bit number + * Known values: + *

                  + *
                • 0x70 112 - PM4 + *
                • 0x71 113 - BDL16 + *
                • 0x72 114 - SE8 + *
                • 0x73 115 - DS64 + *
                + */ + if (bdOpSwAccessTimer == null) { + initiializeBdOpsAccessTimer(); + } + this.p = p; + doingWrite = true; + // Board programming mode + log.debug("write CV \"{}\" to {} addr:{}", CV, val, mAddress); + String[] parts = CV.split("\\."); + int typeWord = Integer.parseInt(parts[0]); + int state = Integer.parseInt(parts[parts.length>1 ? 1 : 0]); + + // make message + LocoNetMessage m = new LocoNetMessage(6); + m.setOpCode(LnConstants.OPC_MULTI_SENSE); + int element = 0x72; + if ((mAddress & 0x80) != 0) { + element |= 1; + } + m.setElement(1, element); + m.setElement(2, (mAddress-1) & 0x7F); + m.setElement(3, typeWord); + int loc = (state - 1) / 8; + int bit = (state - 1) - loc * 8; + m.setElement(4, loc * 16 + bit * 2 + (val&0x01)); + + // save a copy of the written value for use during reply + boardOpSwWriteVal = ((val & 0x01) == 1); + + log.debug(" Message {}", m); + memo.getLnTrafficController().sendLocoNetMessage(m); + + bdOpSwAccessTimer.start(); + } else if (getMode().equals(LnProgrammerManager.LOCONETSV1MODE)) { this.p = p; doingWrite = true; // SV1 mode @@ -73,7 +121,7 @@ public void writeCV(String CV, int val, ProgListener p) throws ProgrammerExcepti m.setElement(4, 0x01); log.debug(" Message {}", m); - memo.getLnTrafficController().sendLocoNetMessage(m); + memo.getLnTrafficController().sendLocoNetMessage(m); } else if (getMode().equals(LnProgrammerManager.LOCONETSV2MODE)) { this.p = p; // SV2 mode @@ -94,21 +142,62 @@ public void writeCV(String CV, int val, ProgListener p) throws ProgrammerExcepti public void readCV(String CV, ProgListener p) throws ProgrammerException { this.p = null; // Check mode - if (getMode().equals(LnProgrammerManager.LOCONETSV1MODE)) { + if (getMode().equals(LnProgrammerManager.LOCONETBDOPSWMODE)) { + /** + * CV format is e.g. "113.12" where the first part defines the + * typeword for the specific board type and the second is the specific bit number + * Known values: + *
                  + *
                • 0x70 112 - PM4 + *
                • 0x71 113 - BDL16 + *
                • 0x72 114 - SE8 + *
                • 0x73 115 - DS64 + *
                + */ + if (bdOpSwAccessTimer == null) { + initiializeBdOpsAccessTimer(); + } + this.p = p; + doingWrite = false; + // Board programming mode + log.debug("read CV \"{}\" addr:{}", CV, mAddress); + String[] parts = CV.split("\\."); + int typeWord = Integer.parseInt(parts[0]); + int state = Integer.parseInt(parts[parts.length>1 ? 1 : 0]); + + // make message + LocoNetMessage m = new LocoNetMessage(6); + m.setOpCode(LnConstants.OPC_MULTI_SENSE); + int element = 0x62; + if ((mAddress & 0x80) != 0) { + element |= 1; + } + m.setElement(1, element); + m.setElement(2, (mAddress-1) & 0x7F); + m.setElement(3, typeWord); + int loc = (state - 1) / 8; + int bit = (state - 1) - loc * 8; + m.setElement(4, loc * 16 + bit * 2); + + log.debug(" Message {}", m); + memo.getLnTrafficController().sendLocoNetMessage(m); + bdOpSwAccessTimer.start(); + + } else if (getMode().equals(LnProgrammerManager.LOCONETSV1MODE)) { this.p = p; doingWrite = false; // SV1 mode log.debug("read CV \"{}\" addr:{}", CV, mAddress); - + // make message int locoIOAddress = mAddress&0xFF; int locoIOSubAddress = ((mAddress+256)/256)&0x7F; LocoNetMessage m = jmri.jmrix.loconet.locoio.LocoIO.readCV(locoIOAddress, locoIOSubAddress, decodeCvNum(CV)); // force version 1 tag m.setElement(4, 0x01); - + log.debug(" Message {}", m); - memo.getLnTrafficController().sendLocoNetMessage(m); + memo.getLnTrafficController().sendLocoNetMessage(m); } else if (getMode().equals(LnProgrammerManager.LOCONETSV2MODE)) { this.p = p; // SV2 mode @@ -118,7 +207,7 @@ public void readCV(String CV, ProgListener p) throws ProgrammerException { loadSV2MessageFormat(m, mAddress, decodeCvNum(CV), 0); m.setElement(3, 0x02); // 1 byte read log.debug(" Message {}", m); - memo.getLnTrafficController().sendLocoNetMessage(m); + memo.getLnTrafficController().sendLocoNetMessage(m); } else { // DCC ops mode readCV(Integer.parseInt(CV), p); @@ -126,6 +215,7 @@ public void readCV(String CV, ProgListener p) throws ProgrammerException { } @Override + @Deprecated @SuppressWarnings("deprecation") // parent Programmer method deprecated, will remove at same time public final void confirmCV(int CV, int val, ProgListener p) throws ProgrammerException { confirmCV(""+CV, val, p); @@ -135,37 +225,90 @@ public final void confirmCV(int CV, int val, ProgListener p) throws ProgrammerEx public void confirmCV(String CV, int val, ProgListener p) throws ProgrammerException { this.p = null; // Check mode - if (getMode().equals(LnProgrammerManager.LOCONETSV2MODE)) { + if (getMode().equals(LnProgrammerManager.LOCONETBDOPSWMODE)) { + readCV(CV, p); + } + else if (getMode().equals(LnProgrammerManager.LOCONETSV2MODE)) { // SV2 mode log.error("confirm CV \"{}\" addr:{} in SV2 mode not implemented", CV, mAddress); p.programmingOpReply(0, ProgListener.UnknownError); } else { // DCC ops mode - confirmCV(Integer.parseInt(CV), val, p); + mSlotMgr.confirmCVOpsMode(CV, val, p, mAddress, mLongAddr); } } @Override public void message(LocoNetMessage m) { - // see if reply to LNSV 1 or LNSV2 request - if ((m.getElement( 0) & 0xFF) != 0xE5) return; - if ((m.getElement( 1) & 0xFF) != 0x10) return; log.debug("reply {}",m); - if (getMode().equals(LnProgrammerManager.LOCONETSV1MODE)) { - if ((m.getElement( 4) & 0xFF) != 0x01) return; // format 1 - if ((m.getElement( 5) & 0x70) != 0x00) return; // 5 - + if (getMode().equals(LnProgrammerManager.LOCONETBDOPSWMODE)) { + + // are we reading? If not, ignore + if (p == null) { + log.warn("received board-program reply message with no reply object: {}", m); + return; + } + + // check for right type, unit + if (m.getOpCode() != 0xb4 + || ((m.getElement(1) != 0x00) && (m.getElement(1) != 0x50))) { + return; + } + // got a message that is LONG_ACK reply to an BdOpsSw access + bdOpSwAccessTimer.stop(); // kill the timeout timer + + // LACK with 0x00 or 0x50 in byte 1; assume its to us. + + if (doingWrite) { + + int code = ProgListener.OK; + int val = boardOpSwWriteVal?1:0; + + ProgListener temp = p; + p = null; + temp.programmingOpReply(val, code); + + return; + } + + int val = 0; + if ((m.getElement(2) & 0x20) != 0) { + val = 1; + } + + // successful read if LACK return status is not 0x7F + int code = ProgListener.OK; + if ((m.getElement(2) == 0x7f)) { + code = ProgListener.UnknownError; + } + + ProgListener temp = p; + p = null; + temp.programmingOpReply(val, code); + + + } else if (getMode().equals(LnProgrammerManager.LOCONETSV1MODE)) { + // see if reply to LNSV 1 or LNSV2 request + if (((m.getElement( 0) & 0xFF) != 0xE5) || + ((m.getElement( 1) & 0xFF) != 0x10) || + ((m.getElement( 4) & 0xFF) != 0x01) || // format 1 + ((m.getElement( 5) & 0x70) != 0x00)) { + return; + } + // check for src address (?) moved to 0x50 // this might not be the right way to tell.... - if ((m.getElement(3) & 0x7F) != 0x50) return; - + if ((m.getElement(3) & 0x7F) != 0x50) { + return; + } + // more checks needed? E.g. addresses? - // Mode 1 return data comes back in + // Mode 1 return data comes back in // byte index 12, with the MSB in 0x01 of byte index 10 // - + // check pending activity if (p == null) { log.warn("received SV reply message with no reply object: {}", m); @@ -184,10 +327,16 @@ public void message(LocoNetMessage m) { temp.programmingOpReply(val, code); } } else if (getMode().equals(LnProgrammerManager.LOCONETSV2MODE)) { - if ((m.getElement(3) != 0x41) && (m.getElement(3) != 0x42)) return; // need a "Write One Reply", or a "Read One Reply" - if ((m.getElement( 4) & 0xFF) != 0x02) return; // format 2 - if ((m.getElement( 5) & 0x70) != 0x10) return; // need SVX1 high nibble = 1 - if ((m.getElement(10) & 0x70) != 0x10) return; // need SVX2 high nibble = 1 + // see if reply to LNSV 1 or LNSV2 request + if (((m.getElement( 0) & 0xFF) != 0xE5) || + ((m.getElement( 1) & 0xFF) != 0x10) || + ((m.getElement( 3) != 0x41) && (m.getElement(3) != 0x42)) || // need a "Write One Reply", or a "Read One Reply" + ((m.getElement( 4) & 0xFF) != 0x02) || // format 2) + ((m.getElement( 5) & 0x70) != 0x10) || // need SVX1 high nibble = 1 + ((m.getElement(10) & 0x70) != 0x10) // need SVX2 high nibble = 1 + ) { + return; + } // more checks needed? E.g. addresses? @@ -204,9 +353,9 @@ public void message(LocoNetMessage m) { p = null; temp.programmingOpReply(val, code); } - } + } } - + int decodeCvNum(String CV) { try { return Integer.valueOf(CV).intValue(); @@ -214,7 +363,7 @@ int decodeCvNum(String CV) { return 0; } } - + void loadSV2MessageFormat(LocoNetMessage m, int mAddress, int cvAddr, int data) { m.setElement(0, 0xE5); m.setElement(1, 0x10); @@ -226,7 +375,7 @@ void loadSV2MessageFormat(LocoNetMessage m, int mAddress, int cvAddr, int data) m.setElement(7, (mAddress>>8)&0xFF); m.setElement(8, cvAddr&0xFF); m.setElement(9, (cvAddr/256)&0xFF); - + // set SVX1 int svx1 = 0x10 |((m.getElement(6)&0x80) != 0 ? 0x01 : 0) // DST_L @@ -238,7 +387,7 @@ void loadSV2MessageFormat(LocoNetMessage m, int mAddress, int cvAddr, int data) m.setElement(7, m.getElement(7)&0x7F); m.setElement(8, m.getElement(8)&0x7F); m.setElement(9, m.getElement(9)&0x7F); - + // 10 will come back to SVX2 m.setElement(11, data&0xFF); m.setElement(12, (data>>8)&0xFF); @@ -257,7 +406,7 @@ void loadSV2MessageFormat(LocoNetMessage m, int mAddress, int cvAddr, int data) m.setElement(13, m.getElement(13)&0x7F); m.setElement(14, m.getElement(14)&0x7F); } - + // handle mode protected ProgrammingMode mode = ProgrammingMode.OPSBYTEMODE; @@ -281,10 +430,11 @@ public final ProgrammingMode getMode() { */ @Override public List getSupportedModes() { - List ret = new ArrayList(); + List ret = new ArrayList<>(4); ret.add(ProgrammingMode.OPSBYTEMODE); ret.add(LnProgrammerManager.LOCONETSV1MODE); ret.add(LnProgrammerManager.LOCONETSV2MODE); + ret.add(LnProgrammerManager.LOCONETBDOPSWMODE); return ret; } @@ -299,7 +449,9 @@ public List getSupportedModes() { @Nonnull @Override public Programmer.WriteConfirmMode getWriteConfirmMode(String addr) { - if (getMode().equals(ProgrammingMode.OPSBYTEMODE)) return WriteConfirmMode.NotVerified; + if (getMode().equals(ProgrammingMode.OPSBYTEMODE)) { + return WriteConfirmMode.NotVerified; + } return WriteConfirmMode.DecoderReply; } @@ -373,6 +525,18 @@ public String getAddress() { return "" + getAddressNumber() + " " + getLongAddress(); } + void initiializeBdOpsAccessTimer() { + if (bdOpSwAccessTimer == null) { + bdOpSwAccessTimer = new javax.swing.Timer(1000, (java.awt.event.ActionEvent e) -> { + ProgListener temp = p; + p = null; + temp.programmingOpReply(0, ProgListener.FailedTimeout); + }); + bdOpSwAccessTimer.setInitialDelay(1000); + bdOpSwAccessTimer.setRepeats(false); + } + } + // initialize logging private final static Logger log = LoggerFactory.getLogger(LnOpsModeProgrammer.class); diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle.properties index 325f064839f..09a66d9e852 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle.properties @@ -86,3 +86,19 @@ LN_MSG_SENSOR_STATE_HIGH = High # LnTurnout (Add to table pane) items AddOutputEntryToolTip = enter a number from 1 to 2048 (inclusive). AddInputEntryToolTip = enter a number from 1 to 2048 (inclusive). + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +TitleXConfig = Configure {0} +LabelC = C +LabelT = T +#ButtonRead = Read - is in jmri.NamedBeanBundle +#ButtonWrite = Write - idem +CheckBoxReserved = Show reserved option switches +Reserved = Reserved +HeadingText = Items describe effect on system operation when set "closed". +CmdStnConfigFxToolTip = set sw21-22-23 as\ + t-t-t\ + t-t-c\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode
                128 step FX mode
                14 step mode
                28 step mode
                diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_cs.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_cs.properties index d4abeb96d0a..4ab8ef1933e 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_cs.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_cs.properties @@ -58,3 +58,5 @@ LOCONETSV1MODE = Syst\u00e9mov\u00e1 prom\u011bnn\u00e1 Type 1 LOCONETSV2MODE = Syst\u00e9mov\u00e1 prom\u011bnn\u00e1 Type 2 LOCONETCSOPSWMODE = Cmd Station Op Switches LOCONETBDOPSWMODE = Board Op Switches + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_da.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_da.properties index ad12bccfa0e..6fb3f444ee3 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_da.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_da.properties @@ -1,9 +1,9 @@ # LocoNetBundle_da.properties # -# Danish translation by Sonny Hansen # Danish properties for the jmri.jmrix.loconet menu +# Translation by Sonny Hansen -MenuLocoNet = LocoNet +MenuLocoNet = LocoNet MenuItemLocoNetMonitor = LocoNet Monitor MenuItemSlotMonitor = Slot Monitor @@ -73,4 +73,11 @@ AbstractBoardProgPanel_GenericDeviceString = Enhed LN_MSG_SWITCH_STATE_CLOSED = RET LN_MSG_SWITCH_STATE_THROWN = AFVIGENDE LN_MSG_SENSOR_STATE_LOW = LAV -LN_MSG_SENSOR_STATE_HIGH = H\u00d8J \ No newline at end of file +LN_MSG_SENSOR_STATE_HIGH = H\u00d8J + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +LabelC = C +LabelT = T +CheckBoxReserved = Viser reserverede option switches +Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres +HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_de.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_de.properties index 809438ae2ed..7147aa524ab 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_de.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_de.properties @@ -1,7 +1,7 @@ # LocoNetBundle_de.properties # -# by Simon Ginsburg # German properties for the jmri.jmrix.loconet menu +# Translation by Simon Ginsburg MenuLocoNet = LocoNet @@ -58,5 +58,20 @@ AbstractBoardProgPanel_ReadFrom = Lese von {0} AbstractBoardProgPanel_WriteTo = Schreibe nach {0} AbstractBoardProgPanel_Done_Message = Modulzugriff beendet. AbstractBoardProgPanel_GenericDeviceString = Modul -LN_MSG_SWITCH_STATE_CLOSED=Geradeaus -LN_MSG_SWITCH_STATE_THROWN=Abzweigend +LN_MSG_SWITCH_STATE_CLOSED = Geradeaus +LN_MSG_SWITCH_STATE_THROWN = Abzweigend + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +TitleXConfig = {0} Konfigurator +LabelC = G +LabelT = A +CheckBoxReserved = Zeige reservierte Optionen +Reserved = Reserviert +HeadingText = Optionen zeigen Wirkung wenn "G"erade (closed) +CmdStnConfigFxToolTip = sw21-22-23 Konfigurationf\u00fcr:\ + t-t-t\ + t-t-c\ + c-t-t\ + c-c-t\ +
                128 Geschw.Stufen
                128 FX Modus
                14 Geschw.Stufen
                28 Geschw.Stufen
                \ +

                Achtung: Ihre Firmware Version kann andere Werte f\u00fcr OpSw 21-23 vorsehen

                diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_es.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_es.properties index 828d00a5d4a..f89f486ea24 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_es.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_es.properties @@ -1,12 +1,9 @@ -# LocoNetBundle.properties -# -# -# Default properties for the jmri.jmrix.loconet menu +# LocoNetBundle_es.properties # +# Spanish properties for the jmri.jmrix.loconet menu # Translated by Alfredo Sola 20040826 -# -MenuLocoNet = LocoNet +MenuLocoNet = LocoNet MenuItemLocoNetMonitor = Monitor de LocoNet MenuItemSlotMonitor = Monitor de slot @@ -20,5 +17,12 @@ MenuItemClockMon = Monitor de reloj MenuItemStartLocoNetServer = Arrancar servidor LocoNet MenuItemLocoStats = Monitor de estad\u00edsticas LocoBuffer MenuItemCmdStnConfig = Programador de opciones de la estaci\u00f3n de comados -MenuItemDownload=Herunterlade Firmware +MenuItemDownload = Download Firmware MenuItemDuplex = Configure Duplex Group + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +LabelC = C +LabelT = T +CheckBoxReserved = Mostrar ajustes reservados +Reserved = Reservado +HeadingText = Los objetos describen el efecto en la operaci\u00f3n cuando est\u00e1 en posici\u00f3n "cerrado" diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_fr.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_fr.properties index 17185c1e0ca..9bb08c31583 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_fr.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_fr.properties @@ -1,13 +1,11 @@ # LocoNetBundle_fr.properties # -# -# Default properties for the jmri.jmrix.loconet menu -# +# French properties for the jmri.jmrix.loconet menu # Translated by Herv\u00e9 BLOREC le 2013-8-14 -MenuLocoNet = LocoNet +MenuLocoNet = LocoNet -MenuItemLocoNetMonitor = Moniteur LocoNet +MenuItemLocoNetMonitor = Moniteur LocoNet MenuItemSlotMonitor = Moniteur de Slots MenuItemSendPacket = Envoyer Pacquet LocoNet MenuItemLocoIOProgrammer = Configurer LocoIO @@ -45,3 +43,10 @@ ERROR_WRITEALL_ABORTED = \u00c9crire tous les abandonn\u00e9s en raison d'adress ERROR_WRITEONE_ABORTED = \u00c9crire un abandonn\u00e9 en raison d'adresse invalide DEBUG_PARSING_LOCONET_MESSAGE = Message re\u00e7u ERROR_ABORTED_DUE_TO_TIMEOUT = Abandonn\u00e9 - pas de r\u00e9ponse de l'appareil apr\u00e8s plusieurs essais + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +LabelC = C +LabelT = T +CheckBoxReserved = Montrer les commutateurs d'options r\u00e9serv\u00e9es +Reserved = R\u00e9serv\u00e9 +HeadingText = Les \u00e9l\u00e9ments d\u00e9crivent l'effet sur le syst\u00e8me en position "ferm\u00e9" (= C) diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_it.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_it.properties index 776891d0d83..c3abbbce6a2 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_it.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_it.properties @@ -1,11 +1,9 @@ -# LocoNetBundle.properties +# LocoNetBundle_it.properties # -# -# Default properties for the jmri.jmrix.loconet menu -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -MenuLocoNet = LocoNet +# Italian properties for the jmri.jmrix.loconet menu +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) + +MenuLocoNet = LocoNet MenuItemLocoNetMonitor = Monitor LocoNet MenuItemSlotMonitor = Monitor Slots @@ -46,3 +44,9 @@ ERROR_WRITEONE_ABORTED = Scrivi Uno abortito a causa di indirizzo non valido DEBUG_PARSING_LOCONET_MESSAGE = Messaggio Ricevuto ERROR_ABORTED_DUE_TO_TIMEOUT = Interrotto - nessuna risposta dal dispositivo dopo molti tentativi +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +LabelC = C +LabelT = T +CheckBoxReserved = Visualizza opzioni riservate +Reserved = Riservato +HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_ja_JP.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_ja_JP.properties index 3b8f9bbbe96..1b60317abcf 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_ja_JP.properties @@ -1,11 +1,10 @@ -# LocoNetBundle.properties +# LocoNetBundle_ja_JP.properties # -# -# Default properties for the jmri.jmrix.loconet menu +# Japanese properties for the jmri.jmrix.loconet menu -MenuLocoNet = LocoNet\u2122 +MenuLocoNet = LocoNet\u2122 -MenuItemLocoNetMonitor = LocoNet\u2122\u76e3\u8996 +MenuItemLocoNetMonitor = LocoNet\u2122\u76e3\u8996 MenuItemSlotMonitor = \u30b9\u30ed\u30c3\u30c8\u30e2\u30cb\u30bf\u30fc MenuItemSendPacket = LocoNet\u2122\u30d1\u30b1\u30c3\u30c8\u9001\u4fe1 MenuItemLocoIOProgrammer = LocoIO\u8a2d\u5b9a @@ -25,3 +24,10 @@ MenuItemSoundEditor = SPJ\u52b9\u679c\u97f3\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\ MenuItemSetID = LocoNet\u2122 ID\u8abf\u6574 MenuItemPr3ModeSelect = PR3\u52d5\u4f5c\u30e2\u30fc\u30c9\u9078\u629e MenuItemDuplex = Configure Duplex Group + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +LabelC = \u9589 (C) +LabelT = T +CheckBoxReserved = \u4e88\u7d04\u6e08\u307f\u30aa\u30d7\u30b7\u30e7\u30f3\u30b9\u30a4\u30c3\u30c1\u3082\u8868\u793a\u3059\u308b +Reserved = \u4e88\u7d04 +HeadingText = \u5404\u9805\u76ee\u306f\u3001\u201d\u9589\u201d\u306b\u8a2d\u5b9a\u3055\u308c\u305f\u6642\u306b\u6709\u52b9\u306b\u306a\u308a\u307e\u3059\u3002 diff --git a/java/src/jmri/jmrix/loconet/LocoNetBundle_nl.properties b/java/src/jmri/jmrix/loconet/LocoNetBundle_nl.properties index f4f875e5f1a..00ea70e4b7d 100644 --- a/java/src/jmri/jmrix/loconet/LocoNetBundle_nl.properties +++ b/java/src/jmri/jmrix/loconet/LocoNetBundle_nl.properties @@ -75,10 +75,24 @@ AbstractBoardProgPanel_ErrorAddressRange = Adres niet in geldig bereik. Adres ki # when a "board type name" has not been provided by the class which extends # loconet.AbstractBoardProgPanel AbstractBoardProgPanel_GenericDeviceString = Module -LN_MSG_SWITCH_STATE_CLOSED=Rechtdoor -LN_MSG_SWITCH_STATE_THROWN=Afbuigend +LN_MSG_SWITCH_STATE_CLOSED = Rechtdoor +LN_MSG_SWITCH_STATE_THROWN = Afbuigend LN_MSG_SENSOR_STATE_LOW = Laag LN_MSG_SENSOR_STATE_HIGH = Hoog # LnTurnout (Add to table pane) items -AddOutputEntryToolTip = een getal van 1 tot en met 2048. +AddOutputEntryToolTip = een getal van 1 tot en met 2048. + +#cmdstnconfig shared Bundle items (hardware specific strings fetched using ResourceBundle) +TitleXConfig = Configureer {0} +LabelC = R +LabelT = A +CheckBoxReserved = Toon ook gereserveerde opties +Reserved = Gereserveerd +HeadingText = Opties beschrijven de toestand bij "R"echtdoor (Closed) +CmdStnConfigFxToolTip = stel sw21-22-23 in alsvoor:\ + t-t-t\ + t-t-c\ + c-t-t\ + c-c-t\ +
                128 staps modus
                128 staps FX modus
                14 staps modus
                28 staps modus
                diff --git a/java/src/jmri/jmrix/loconet/SlotManager.java b/java/src/jmri/jmrix/loconet/SlotManager.java index 3a3e18cd388..3f25be54b59 100644 --- a/java/src/jmri/jmrix/loconet/SlotManager.java +++ b/java/src/jmri/jmrix/loconet/SlotManager.java @@ -20,7 +20,7 @@ /** * Controls a collection of slots, acting as the counter-part of a LocoNet * command station. - *

                + *

                * A SlotListener can register to hear changes. By registering here, the * SlotListener is saying that it wants to be notified of a change in any slot. * Alternately, the SlotListener can register with some specific slot, done via @@ -33,18 +33,18 @@ * read from the command station, the first message directly setting F9 through * F28 will not have a place to store information. Instead, it will trigger a * slot read, so the following messages will be properly handled. - *

                + *

                * Some of the message formats used in this class are Copyright Digitrax, Inc. * and used with permission as part of the JMRI project. That permission does * not extend to uses in other software products. If you wish to use this code, * algorithm or these message formats outside of JMRI, please contact Digitrax * Inc for separate permission. - *

                + *

                * This Programmer implementation is single-user only. It's not clear whether * the command stations can have multiple programming requests outstanding (e.g. * service mode and ops mode, or two ops mode) at the same time, but this code * definitely can't. - *

                + * * @author Bob Jacobsen Copyright (C) 2001, 2003 */ public class SlotManager extends AbstractProgrammer implements LocoNetListener, CommandStation { @@ -749,6 +749,7 @@ public void setThrottledTransmitter(LocoNetThrottledTransmitter value, boolean m public LnCommandStationType getCommandStationType() { return commandStationType; } + protected LnCommandStationType commandStationType = null; /** diff --git a/java/src/jmri/jmrix/loconet/bluetooth/LocoNetBluetoothAdapter.java b/java/src/jmri/jmrix/loconet/bluetooth/LocoNetBluetoothAdapter.java index 9746d20a751..8adff09825c 100644 --- a/java/src/jmri/jmrix/loconet/bluetooth/LocoNetBluetoothAdapter.java +++ b/java/src/jmri/jmrix/loconet/bluetooth/LocoNetBluetoothAdapter.java @@ -37,8 +37,8 @@ public LocoNetBluetoothAdapter(LocoNetSystemConnectionMemo adapterMemo) { super(adapterMemo); option1Name = "CommandStation"; // NOI18N option2Name = "TurnoutHandle"; // NOI18N - options.put(option1Name, new Option("Command station type:", commandStationNames, false)); - options.put(option2Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); + options.put(option1Name, new Option(Bundle.getMessage("CommandStationTypeLabel"), commandStationNames, false)); + options.put(option2Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); // TODO I18N } Vector portNameVector = null; diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/CmdStnConfigPane.java b/java/src/jmri/jmrix/loconet/cmdstnconfig/CmdStnConfigPane.java index 5a80fe6a3c1..a95d8f98138 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/CmdStnConfigPane.java +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/CmdStnConfigPane.java @@ -23,23 +23,13 @@ import org.slf4j.LoggerFactory; /** - * User interface for Command Station Option Programming - *

                + * User interface for Command Station Option Programming. + *

                * Some of the message formats used in this class are Copyright Digitrax, Inc. * and used with permission as part of the JMRI project. That permission does * not extend to uses in other software products. If you wish to use this code, * algorithm or these message formats outside of JMRI, please contact Digitrax * Inc for separate permission. - *


                - * This file is part of JMRI. - *

                - * JMRI is free software; you can redistribute it and/or modify it under the - * terms of version 2 of the GNU General Public License as published by the Free - * Software Foundation. See the "COPYING" file for a copy of this license. - *

                - * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * @author Alex Shepherd Copyright (C) 2004 * @author Bob Jacobsen Copyright (C) 2006 @@ -49,21 +39,17 @@ public class CmdStnConfigPane extends LnPanel implements LocoNetListener { int CONFIG_SLOT = 127; int MIN_OPTION = 1; int MAX_OPTION = 72; - String labelT = "T"; - String labelC = "C"; - String labelTop = "Configure Command Station"; - String read = "Read"; - String write = "Write"; + String labelT; + String labelC; + String labelTop; + String read; + String write; int[] oldcontent = new int[10]; JCheckBox optionBox; - public CmdStnConfigPane() { - super(); - } - ResourceBundle rb; // internal members to hold widgets JButton readButton; @@ -74,6 +60,13 @@ public CmdStnConfigPane() { JLabel[] labels = new JLabel[MAX_OPTION]; boolean[] isReserved = new boolean[MAX_OPTION]; + /** + * Ctor + */ + public CmdStnConfigPane() { + super(); + } + @Override public String getHelpTarget() { return "package.jmri.jmrix.loconet.cmdstnconfig.CmdStnConfigFrame"; // NOI18N @@ -107,30 +100,35 @@ public void initComponents(LocoNetSystemConnectionMemo memo) { } log.debug("match /{}/", name); // NOI18N rb = ResourceBundle.getBundle("jmri.jmrix.loconet.cmdstnconfig." + name + "options"); // NOI18N - } catch (Exception e) { + } catch (Exception e) { // use standard option set log.warn("Failed to find properties for /{}/ command station type", name, e); // NOI18N rb = ResourceBundle.getBundle("jmri.jmrix.loconet.cmdstnconfig.Defaultoptions"); // NOI18N + // Localized strings common to all LocoNet command station models are fetched using Bundle.getMessage() } try { CONFIG_SLOT = Integer.parseInt(rb.getString("CONFIG_SLOT")); MIN_OPTION = Integer.parseInt(rb.getString("MIN_OPTION")); MAX_OPTION = Integer.parseInt(rb.getString("MAX_OPTION")); - labelT = rb.getString("LabelT"); - labelC = rb.getString("LabelC"); - labelTop = rb.getString("LabelTop"); - read = rb.getString("ButtonRead"); - write = rb.getString("ButtonWrite"); } catch (NumberFormatException e) { log.error("Failed to load values from /{}/ properties", name); // NOI18N } - log.debug("Constants: {} {} {}", CONFIG_SLOT, MIN_OPTION, MAX_OPTION); // NOI18N + labelT = Bundle.getMessage("LabelT"); + labelC = Bundle.getMessage("LabelC"); + labelTop = rb.getString("LabelTop"); + read = Bundle.getMessage("ButtonRead"); + write = Bundle.getMessage("ButtonWrite"); + String tooltip = Bundle.getMessage("CmdStnConfigFxToolTip"); + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); { - // section holding buttons buttons + // start with the CS title + add(new JLabel(labelTop)); + + // section holding buttons readButton = new JButton(read); writeButton = new JButton(write); @@ -138,13 +136,17 @@ public void initComponents(LocoNetSystemConnectionMemo memo) { pane.setLayout(new FlowLayout()); pane.add(readButton); pane.add(writeButton); + if (CONFIG_SLOT == -1) { // disable reading/writing for non-configurable CS types, ie. Intellibox-I/-II + readButton.setEnabled(false); + writeButton.setEnabled(false); + } add(pane); - optionBox = new JCheckBox(rb.getString("CheckBoxReserved")); + optionBox = new JCheckBox(Bundle.getMessage("CheckBoxReserved")); add(optionBox); // heading - add(new JLabel(rb.getString("HeadingText"))); + add(new JLabel(Bundle.getMessage("HeadingText"))); // section holding options JPanel options = new JPanel(); @@ -178,13 +180,23 @@ public void initComponents(LocoNetSystemConnectionMemo memo) { gc.anchor = GridBagConstraints.WEST; String label; try { - label = rb.getString("Option" + i); + label = rb.getString("Option" + i); // model specific Option descriptions NOI18N isReserved[i - MIN_OPTION] = false; } catch (java.util.MissingResourceException e) { - label = "" + i + ": " + rb.getString("Reserved"); + label = "" + i + ": " + Bundle.getMessage("Reserved"); isReserved[i - MIN_OPTION] = true; } JLabel l = new JLabel(label); + if (i > 20 && i < 24) { + log.debug("CS name: {}", name); + if (name.startsWith("DB150")) { + // DB150 is the only model using different OpSw 21-23 combos than the common tooltip, which is stored in LocoNetBundle + tooltip = rb.getString("DB150ConfigFxToolTip"); + } + t.setToolTipText(tooltip); + c.setToolTipText(tooltip); + l.setToolTipText(tooltip); + } labels[i - MIN_OPTION] = l; gl.setConstraints(l, gc); options.add(l); @@ -267,8 +279,7 @@ public void writeButtonActionPerformed(java.awt.event.ActionEvent e) { } /** - * - * Start the Frame operating by asking for a read + * Start the Frame operating by asking for a read. */ public void start() { // format and send request for slot contents @@ -281,7 +292,7 @@ public void start() { } /** - * Process the incoming message to look for Slot 127 Read + * Process the incoming message to look for Slot 127 Read. */ @Override public void message(LocoNetMessage msg) { @@ -330,4 +341,5 @@ public void dispose() { // initialize logging private final static Logger log = LoggerFactory.getLogger(CmdStnConfigPane.class); + } diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options.properties index 9e33cb03bd1..248cfd64b0a 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options.properties @@ -1,6 +1,5 @@ # DB150options.properties # -# # Default command station options for the DB150 (Empire Builder) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -9,26 +8,25 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 +DB150ConfigFxToolTip=set sw21-22-23 as\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode (factory default)
                14 step mode
                28 step mode
                128 step FX mode
                28 step FX mode
                \ +

                Note: Your firmware version may define a different pattern for OpSw 21-23

                LabelTop = DB150 (Empire Builder) Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" Option2 = 2: Booster only override Option3 = 3: Booster is autoreversing -Option5 = 5: Command station master mode +Option5 = 5: Command station master mode (normally 'c') Option13 = 13: Raise loco address purge time to 600 seconds Option14 = 14: Disable loco address purging Option15 = 15: Purge will force a loco to zero speed Option17 = 17: Automatic advanced consists are disabled Option18 = 18: Extend booster short shutdown to 1/2 second -Option19 = 19: Reserved Option20 = 20: Disable address 0 analog operation Option21 = 21: Global default for new loco: FX Option22 = 22: Global default for new loco: 28 step @@ -37,13 +35,11 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists +Option36 = 36: Clear all mobile decoder info and consists in DB150 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status -Option50 = 50: Longer booster short circuit recovery time +Option50 = 50: Longer Booster short circuit recovery time Option51 = 51: Do not allow EXT voltage RESTART - - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_da.properties index 14bee8aec64..11158b9e79d 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_da.properties @@ -1,7 +1,7 @@ -# DB150options.properties +# DB150options_da.properties # -#Danish translation by Sonny Hansen -#Overides some Default command station options for the DB150 (Empire Builder) +# Danish translation by Sonny Hansen +# Overides some Default command station options for the DB150 (Empire Builder) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -9,26 +9,24 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 - +DB150ConfigFxToolTip=set sw21-22-23 as\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode (factory default)
                14 step mode
                28 step mode
                128 step FX mode
                28 step FX mode
                \ +

                Note: Your firmware version may define a different pattern for OpSw 21-23

                LabelTop = DB150 (Empire Builder) Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Viser reserverede option switches -Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt Option2 = 2: Booster only override Option3 = 3: Booster is autoreversing -Option5 = 5: Command station master mode +Option5 = 5: Command station master mode (normally 'c') Option13 = 13: Raise loco address purge time to 600 seconds Option14 = 14: Disable loco address purging Option15 = 15: Purge will force a loco to zero speed Option17 = 17: Automatic advanced consists are disabled Option18 = 18: Extend booster short shutdown to 1/2 second -Option19 = 19: Reserved Option20 = 20: Disable address 0 analog operation Option21 = 21: Global default for new loco: FX Option22 = 22: Global default for new loco: 28 step @@ -37,13 +35,11 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists +Option36 = 36: Clear all mobile decoder info and consists in DB150 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status -Option50 = 50: Longer booster short circuit recovery time +Option50 = 50: Longer Booster short circuit recovery time Option51 = 51: Do not allow EXT voltage RESTART - - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_de.properties index b275fa48268..1f2ded12c6e 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_de.properties @@ -1,7 +1,7 @@ -# DB150options.properties +# DB150options_de.properties # -# by Simon Ginsburg # German command station options for the DB150 (Empire Builder) +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -9,41 +9,38 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 +DB150ConfigFxToolTip=sw21-22-23 Konfigurationf\u00fcr:\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                128 Geschw.Stufen (factory default)
                14 Geschw.Stufen
                28 Geschw.Stufen
                128 Stufen FX Modus
                28 Stufen FX Modus
                \ +

                Achtung: Ihre Firmware Version kann andere Werte f\u00fcr OpSw 21-23 vorsehen

                LabelTop = DB150 (Empire Builder) Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen - -Option2 = 2\: Verst\u00e4rker \u00dcbersteuerung -Option3 = 3\: Verst\u00e4rker mit Kehrschleifenautomatik -Option5 = 5\: Zentraleinheitenmodus -Option13 = 13\: Lokadressl\u00f6schen erst nach 600 Sekunden -Option14 = 14\: Kein Lokadressl\u00f6schen -Option15 = 15\: Lokadressl\u00f6schen erst nach dem Senden eines Stillstandssignals -Option17 = 17\: Automatisches Ezeugen von Decoderbasierter Mehrlokkompositionen ausgeschaltet -Option18 = 18\: Kurzschlussdetektionszeit des Verst\u00e4rkers auf 1/2 Sekunden verl\u00e4ngert -Option19 = 19\: Reserviert -Option20 = 20\: Analogbetriebsadresse 0 ausgeschaltet -Option21 = 21\: Vorgabewert f\u00fcr neue Lok\: FX -Option22 = 22\: Vorgabewert f\u00fcr neue Lok\: 28 Stufen -Option23 = 23\: Vorgabewert f\u00fcr neue Lok\: 14 Stufen -Option27 = 27\: Normale Weichenschaltung ausgeschaltet (Bushby Bit) -Option28 = 28\: Abfrage der DS54 beim Aufstarten ausgeschaltet -Option33 = 33\: Nach Spannungswiederkehr Gleisspannungsmodus wiederherstellen -Option34 = 34\: Nach Spannungswiederkehr automatische Gleisspannung zulassen -Option36 = 36\: Alle Informationen von Loks und Mehrfachtraktionen l\u00f6schen -Option38 = 38\: Lokinfo l\u00f6schen -Option39 = 39\: Gesamtspeicher l\u00f6schen -Option41 = 41\: Diagnoseton bei jedem erhaltenen LocoNet Befehl -Option42 = 42\: Dreifachton beim L\u00f6schen einer Lokadresse ausschalten -Option43 = 43\: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten -Option50 = 50\: Verl\u00e4ngerte Ausschaltzeit nach Kurzschlussdetektion -Option51 = 51\: Spannungseinschaltbefehl von extern ausgeschaltet - +Option2 = 2: Verst\u00e4rker \u00dcbersteuerung +Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik +Option5=5: Zentraleinheitenmodus (Normal = 'c') +Option13 = 13: Lokadressl\u00f6schen erst nach 600 Sekunden +Option14 = 14: Kein Lokadressl\u00f6schen +Option15 = 15: Lokadressl\u00f6schen erst nach dem Senden eines Stillstandssignals +Option17 = 17: Automatisches Ezeugen von Decoderbasierter Mehrfachtraktion ausgeschaltet +Option18 = 18: Kurzschlussdetektionszeit des Verst\u00e4rkers auf 1/2 Sekunden verl\u00e4ngert +Option20 = 20: Analogbetriebsadresse 0 ausgeschaltet +Option21 = 21: Vorgabewert f\u00fcr neue Lok: FX +Option22 = 22: Vorgabewert f\u00fcr neue Lok: 28 Stufen +Option23 = 23: Vorgabewert f\u00fcr neue Lok: 14 Stufen +Option27 = 27: Normale Weichenschaltung ausgeschaltet (Bushby Bit) +Option28 = 28: Abfrage der DS54 beim Aufstarten ausgeschaltet +Option33 = 33: Nach Spannungswiederkehr Gleisspannungsmodus wiederherstellen +Option34 = 34: Nach Spannungswiederkehr automatische Gleisspannung zulassen +Option36 = 36: Alle Informationen von Loks und Mehrfachtraktionen l\u00f6schen +Option38 = 38: Lokinfo l\u00f6schen +Option39 = 39: Gesamtspeicher l\u00f6schen +Option41 = 41: Diagnoseton bei jedem erhaltenen LocoNet Befehl +Option42 = 42: Dreifachton beim L\u00f6schen einer Lokadresse ausschalten +Option43 = 43: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten +Option50 = 50: Verl\u00e4ngerte Ausschaltzeit nach Kurzschlussdetektion +Option51 = 51: EXT Spannungseinschaltbefehl RESTART ausgeschaltet diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_es.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_es.properties index 7809a9775e4..3d6319ebd82 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_es.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_es.properties @@ -1,7 +1,6 @@ -# DB150options.properties +# DB150options_es.properties # -# -# Default command station options for the DB150 (Empire Builder) +# Spanish command station options for the DB150 (Empire Builder) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -9,16 +8,15 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 - +DB150ConfigFxToolTip=set sw21-22-23 as\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode (factory default)
                14 step mode
                28 step mode
                128 step FX mode
                28 step FX mode
                \ +

                Note: Your firmware version may define a different pattern for OpSw 21-23

                LabelTop = Programador de DB150 (Empire Builder) -LabelC = C -LabelT = T -ButtonRead = Leer -ButtonWrite = Escribir -CheckBoxReserved = Mostrar ajustes reservados -Reserved = Reservado - -HeadingText = Los objetos describen el efecto en la operaci\u00f3n cuando est\u00e1 en posici\u00f3n "cerrado" Option2 = 2: Solo booster Option3 = 3: El booster est\u00e1 en autoinversi\u00f3n @@ -28,7 +26,6 @@ Option14 = 14: Deshabilitar purga de direcciones de locomotoras Option15 = 15: La purga forzar\u00e1 a la locomotora a velocidad cero Option17 = 17: Deshabilitados los mandos m\u00faltiples avanzados autom\u00e1ticos Option18 = 18: Extender la parada por cortocircuito del booster a 1/2 segundo -Option19 = 19: Reservado Option20 = 20: Deshabilitar la direcci\u00f3n 0 de operaci\u00f3n anal\u00f3gica Option21 = 21: Valor por defecto global para nueva locomotora: FX Option22 = 22: Valor por defecto global para nueva locomotora: 28 pasos @@ -43,5 +40,5 @@ Option39 = 39: Limpiar toda la memoria interna Option41 = 41: Pulso de diagn\u00f3stico cuando se reciba comando LocoNet Option42 = 42: Deshabilitar los 3 pitidos cuando se purga la direcci\u00f3n de una locomotora Option43 = 43: Deshabilitar la actualizaci\u00f3n del estado de la v\u00eda por LocoNet -Option50 = 50: Tiempo de recuperaci\u00f3n de cortocircuitos del booster m\u00e1s largo +Option50 = 50: Tiempo de recuperaci\u00f3n de cortocircuitos del Booster m\u00e1s largo Option51 = 51: No permitir reinicio del voltaje EXT diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_fr.properties index 7060bba5653..532c85078f0 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_fr.properties @@ -1,7 +1,6 @@ -# DB150options.properties +# DB150options_fr.properties # -# -# Default command station options for the DB150 (Empire Builder) +# French command station options for the DB150 (Empire Builder) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -9,41 +8,37 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 - +DB150ConfigFxToolTip=set sw21-22-23 as\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode (factory default)
                14 step mode
                28 step mode
                128 step FX mode
                28 step FX mode
                \ +

                Note: Your firmware version may define a different pattern for OpSw 21-23

                LabelTop = Programmateur DB150 (Empire Builder) -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" -Option2 = 2: Booster seulement ignoré +Option2 = 2: Booster seulement ignor\u00e9 Option3 = 3: Booster est autoreverse -Option5 = 5: Centrale en mode Maitre -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option17 = 17: Les Couplage Automatique avancé est désactivé -Option18 = 18: Étendre l'arrêt du booster à 1/2 seconde -Option19 = 19: Réservé -Option20 = 20: Désactive l'adresse 0 pour une exploitaion analogique -Option21 = 21: Réglage par défaut pour une nouvelle loco: FX -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans -Option27 = 27: Désactiver les commandes de commutation normale(Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option36 = 36: Effacer toutes les informations du décodeur mobile et des couplages +Option5 = 5: Centrale en mode Maitre (normale 'c') +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option17 = 17: Les Couplage Automatique avanc\u00e9 est d\u00e9sactiv\u00e9 +Option18 = 18: \u00c9tendre l'arr\u00eat du booster \u00e1 1/2 seconde +Option20 = 20: D\u00e9sactive l'adresse 0 pour une exploitaion analogique +Option21 = 21: R\u00e9glage par d\u00e9faut pour une nouvelle loco: FX +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans +Option27 = 27: D\u00e9sactiver les commandes de commutation normale (Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option36 = 36: Effacer toutes les informations du d\u00e9codeur mobile et des couplages Option38 = 38: Effacer l'inventaire Loco -Option39 = 39: Effacer toute la mémoire interne -Option41 = 41: Clic de Diagnostic quand la commande LocoNet est reçue -Option42 = 42: Désactiver 3 beeps quand l'adresse loc est purgée -Option43 = 43: Désactive Mise à jour LocoNet de l'état de la voie -Option50 = 50: Temps de reénclenchement plus long du booster sur court-circuit -Option51 = 51: Ne pas autoriser le REDÉMARRAGE d'une tension EXT (avec 2nd booster en parallèle)) - - +Option39 = 39: Effacer toute la m\u00e9moire interne +Option41 = 41: Clic de Diagnostic quand la commande LocoNet est re\u00e7ue +Option42 = 42: D\u00e9sactiver 3 beeps quand l'adresse loc est purg\u00e9e +Option43 = 43: D\u00e9sactive Mise \u00e1 jour LocoNet de l'\u00e9tat de la voie +Option50 = 50: Temps de re\u00e9nclenchement plus long du Booster sur court-circuit +Option51 = 51: Ne pas autoriser le RED\u00c9MARRAGE d'une tension EXT (avec 2nd booster en parall\u00e8le) diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_it.properties index ac5afbeb63a..a6929dc5f93 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_it.properties @@ -1,9 +1,7 @@ -# DB150options.properties +# DB150options_it.properties # -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the DB150 (Empire Builder) +# Italian command station options for the DB150 (Empire Builder) +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,26 +9,24 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 - +DB150ConfigFxToolTip=set sw21-22-23 as\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode (factory default)
                14 step mode
                28 step mode
                128 step FX mode
                28 step FX mode
                \ +

                Note: Your firmware version may define a different pattern for OpSw 21-23

                LabelTop = Programmatore DB150 (Empire Builder) -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option2 = 2: Programma come Solo-Booster Option3 = 3: Booster in Auto Reverse Option5 = 5: Centrale in Modo Master Option13 = 13: Incrementa tempo cancellazione indirizzo loco a 600 secondi Option14 = 14: Disabilita cancellazione indirizzo loco -Option15 = 15: Cancellazione forzer\u00E0 loco a velocit\u00E0 zero +Option15 = 15: Cancellazione forzer\u00e0 loco a velocit\u00e0 zero Option17 = 17: Consist Automatico Advanzato disabilitato Option18 = 18: Estendi interruzione alim. booster per cortcirc. a 1/2 secondo -Option19 = 19: Riservato Option20 = 20: Disabilita indirizzo 0 (analogico) Option21 = 21: Default Globale per nuova loco: FX Option22 = 22: Default Globale per nuova loco: 28 step @@ -45,7 +41,5 @@ Option39 = 39: Cancella tutta la memoria inerna Option41 = 41: Click Diagnostica su comando LocoNet ricevuto Option42 = 42: Disabilita 3 beeps quando si cancella Indirizzo loco Option43 = 43: Disabilita Aggiornamento Stato Binari LocoNet -Option50 = 50: Allunga tempo di ripristino booster da corto circuito +Option50 = 50: Allunga tempo di ripristino Booster da corto circuito Option51 = 51: Non permettere RESTART da Tensione EXT - - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_ja_JP.properties index 9ce7e766998..5661c1ff978 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_ja_JP.properties @@ -1,5 +1,4 @@ -# DB150options.properties -# +# DB150options_ja_JP.properties # # Japanese command station options for the DB150 (Empire Builder) # Translated by Sakae Akanuma @@ -10,39 +9,37 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 +DB150ConfigFxToolTip=set sw21-22-23 as\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                to activate:
                128 step mode (factory default)
                14 step mode
                28 step mode
                128 step FX mode
                28 step FX mode
                \ +

                Note: Your firmware version may define a different pattern for OpSw 21-23

                +LabelTop = DB150 (\u30a8\u30f3\u30d1\u30a4\u30a2\u30d3\u30eb\u30c0\u30fc\u2122) \u30d7\u30ed\u30b0\u30e9\u30de -LabelTop = DB150 (\u30A8\u30F3\u30D1\u30A4\u30A2\u30D3\u30EB\u30C0\u30FC\u2122) \u30D7\u30ED\u30B0\u30E9\u30DE -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC\u307F -CheckBoxReserved = \u4E88\u7D04\u6E08\u307F\u30AA\u30D7\u30B7\u30E7\u30F3\u30B9\u30A4\u30C3\u30C1\u3082\u8868\u793A\u3059\u308B -Reserved = \u4E88\u7D04 - -HeadingText = \u5404\u9805\u76EE\u306F\u3001\u201D\u9589\u201D\u306B\u8A2D\u5B9A\u3055\u308C\u305F\u6642\u306B\u6709\u52B9\u306B\u306A\u308A\u307E\u3059\u3002 - -Option2 = 2: \u30D6\u30FC\u30B9\u30BF\u30FC\u306E\u307F\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9 -Option3 = 3: \u30D6\u30FC\u30B9\u30BF\u30FC\u306F\u30AA\u30FC\u30C8\u30EA\u30D0\u30FC\u30B9\u30E2\u30FC\u30C9 -Option5 = 5: \u30B3\u30DE\u30F3\u30C9\u30B9\u30C6\u30FC\u30B7\u30E7\u30F3\u30DE\u30B9\u30BF\u30FC\u30E2\u30FC\u30C9 -Option13 = 13: \u52D5\u529B\u8ECA\u306E\u5236\u5FA1\u309210\u5206\u5F8C\u306B\u81EA\u52D5\u7684\u306B\u89E3\u653E\u3059\u308B -Option14 = 14: \u52D5\u529B\u8ECA\u306E\u30A2\u30C9\u30EC\u30B9\u3092\u958B\u653E\u3057\u306A\u3044\u3002 -Option15 = 15: \u5236\u5FA1\u3092\u5207\u308A\u96E2\u3057\u305F\u52D5\u529B\u8ECA\u3092\u5F37\u5236\u505C\u6B62\u3059\u308B\u3002 -Option17 = 17: \u81EA\u52D5\u30A2\u30C9\u30D0\u30F3\u30B9\u30C9\u30B3\u30F3\u30B7\u30B9\u30C8\u3092\u7121\u52B9\u306B\u3059\u308B\u3002 -Option18 = 18: \u30D6\u30FC\u30B9\u30BF\u30FC \u77ED\u7D61\u6642\u306E\u30B7\u30E3\u30C3\u30C8\u30C0\u30A6\u30F3\u6642\u9593\u30921/2\u79D2\u306B\u5EF6\u9577\u3059\u308B\u3002 -Option19 = 19: \u30EA\u30B6\u30FC\u30D6 -Option20 = 20: \u30A2\u30C9\u30EC\u30B9\uFF10\u3067\u30A2\u30CA\u30ED\u30B0\u52D5\u529B\u8ECA\u3092\u4F7F\u7528\u3057\u306A\u3044 -Option21 = 21: \u65B0\u898F\u767B\u9332\u52D5\u529B\u8ECA\u3092FX\u30E2\u30FC\u30C9\u3068\u3059\u308B\u3002 -Option22 = 22: \u65B0\u898F\u52D5\u529B\u8ECA\u306E\u898F\u5B9A\u306E\u30B9\u30D4\u30FC\u30C9\u30B9\u30C6\u30C3\u30D7\u309228\u30B9\u30C6\u30C3\u30D7\u30E2\u30FC\u30C9\u3068\u3059\u308B -Option23 = 23: \u65B0\u898F\u52D5\u529B\u8ECA\u306E\u898F\u5B9A\u306E\u30B9\u30D4\u30FC\u30C9\u30B9\u30C6\u30C3\u30D7\u309214\u30B9\u30C6\u30C3\u30D7\u30E2\u30FC\u30C9\u3068\u3059\u308B -Option27 = 27: \u901A\u5E38\u306E\u30B9\u30A4\u30C3\u30C1\u7981\u6B62\u30B3\u30DE\u30F3\u30C9 (Bushby bit) -Option28 = 28: \u96FB\u6E90\u6295\u5165\u6642\u306EDS54 interrogate \u3092\u7121\u52B9\u306B\u3059\u308B -Option33 = 33: \u958B\u59CB\u6642\u306B\u7DDA\u8DEF\u96FB\u6E90\u306E\u901A\u96FB\u306E\u6709\u7121\u3092\u524D\u56DE\u540C\u69D8\u3068\u3059\u308B +Option2 = 2: \u30d6\u30fc\u30b9\u30bf\u30fc\u306e\u307f\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9 +Option3 = 3: \u30d6\u30fc\u30b9\u30bf\u30fc\u306f\u30aa\u30fc\u30c8\u30ea\u30d0\u30fc\u30b9\u30e2\u30fc\u30c9 +Option5 = 5: \u30b3\u30de\u30f3\u30c9\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u30de\u30b9\u30bf\u30fc\u30e2\u30fc\u30c9 +Option13 = 13: \u52d5\u529b\u8eca\u306e\u5236\u5fa1\u309210\u5206\u5f8c\u306b\u81ea\u52d5\u7684\u306b\u89e3\u653e\u3059\u308b +Option14 = 14: \u52d5\u529b\u8eca\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u958b\u653e\u3057\u306a\u3044\u3002 +Option15 = 15: \u5236\u5fa1\u3092\u5207\u308a\u96e2\u3057\u305f\u52d5\u529b\u8eca\u3092\u5f37\u5236\u505c\u6b62\u3059\u308b\u3002 +Option17 = 17: \u81ea\u52d5\u30a2\u30c9\u30d0\u30f3\u30b9\u30c9\u30b3\u30f3\u30b7\u30b9\u30c8\u3092\u7121\u52b9\u306b\u3059\u308b\u3002 +Option18 = 18: \u30d6\u30fc\u30b9\u30bf\u30fc \u77ed\u7d61\u6642\u306e\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u6642\u9593\u30921/2\u79d2\u306b\u5ef6\u9577\u3059\u308b\u3002 +Option20 = 20: \u30a2\u30c9\u30ec\u30b9\uff10\u3067\u30a2\u30ca\u30ed\u30b0\u52d5\u529b\u8eca\u3092\u4f7f\u7528\u3057\u306a\u3044 +Option21 = 21: \u65b0\u898f\u767b\u9332\u52d5\u529b\u8eca\u3092FX\u30e2\u30fc\u30c9\u3068\u3059\u308b\u3002 +Option22 = 22: \u65b0\u898f\u52d5\u529b\u8eca\u306e\u898f\u5b9a\u306e\u30b9\u30d4\u30fc\u30c9\u30b9\u30c6\u30c3\u30d7\u309228\u30b9\u30c6\u30c3\u30d7\u30e2\u30fc\u30c9\u3068\u3059\u308b +Option23 = 23: \u65b0\u898f\u52d5\u529b\u8eca\u306e\u898f\u5b9a\u306e\u30b9\u30d4\u30fc\u30c9\u30b9\u30c6\u30c3\u30d7\u309214\u30b9\u30c6\u30c3\u30d7\u30e2\u30fc\u30c9\u3068\u3059\u308b +Option27 = 27: \u901a\u5e38\u306e\u30b9\u30a4\u30c3\u30c1\u7981\u6b62\u30b3\u30de\u30f3\u30c9 (Bushby bit) +Option28 = 28: \u96fb\u6e90\u6295\u5165\u6642\u306eDS54 interrogate \u3092\u7121\u52b9\u306b\u3059\u308b +Option33 = 33: \u958b\u59cb\u6642\u306b\u7dda\u8def\u96fb\u6e90\u306e\u901a\u96fb\u306e\u6709\u7121\u3092\u524d\u56de\u540c\u69d8\u3068\u3059\u308b Option34 = 34: Allow track to power up to run state -Option36 = 36: \u5168\u30E2\u30D0\u30A4\u30EB\u30C7\u30B3\u30FC\u30C0\u30FC\u60C5\u5831\u53CA\u3073\u30B3\u30F3\u30B7\u30B9\u30C8\u60C5\u5831\u6D88\u53BB -Option38 = 38: \u8ECA\u4E21\u306E\u30ED\u30FC\u30B9\u30BF\u30FC\u3092\u6D88\u53BB\u3059\u308B -Option39 = 39: \u5185\u90E8\u30E1\u30E2\u30EA\u30FC\u5168\u6D88\u53BB -Option41 = 41: LocoNet\u30B3\u30DE\u30F3\u30C9\u53D7\u4FE1\u6642\u3001\u97F3\u3067\u78BA\u8A8D\u3059\u308B +Option36 = 36: \u5168\u30e2\u30d0\u30a4\u30eb\u30c7\u30b3\u30fc\u30c0\u30fc\u60c5\u5831\u53ca\u3073\u30b3\u30f3\u30b7\u30b9\u30c8\u60c5\u5831\u6d88\u53bb +Option38 = 38: \u8eca\u4e21\u306e\u30ed\u30fc\u30b9\u30bf\u30fc\u3092\u6d88\u53bb\u3059\u308b +Option39 = 39: \u5185\u90e8\u30e1\u30e2\u30ea\u30fc\u5168\u6d88\u53bb +Option41 = 41: LocoNet\u30b3\u30de\u30f3\u30c9\u53d7\u4fe1\u6642\u3001\u97f3\u3067\u78ba\u8a8d\u3059\u308b Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status -Option50 = 50: \u56DE\u8DEF\u77ED\u7D61\u6642\u30D6\u30FC\u30B9\u30BF\u30FC\u5FA9\u5E30\u6642\u9593\u9577 +Option50 = 50: \u56de\u8def\u77ed\u7d61\u6642\u30d6\u30fc\u30b9\u30bf\u30fc\u5fa9\u5e30\u6642\u9593\u9577 Option51 = 51: Do not allow EXT voltage RESTART diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_nl.properties new file mode 100644 index 00000000000..3396e0e3e43 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DB150options_nl.properties @@ -0,0 +1,47 @@ +# DB150options_nl.properties +# +# Dutch command station options for the DCS50 (Zephyr) +# Translation by Egbert Broerse + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 57 +DB150ConfigFxToolTip=stel sw21-22-23 in als\ + t-t-t\ + t-t-c\ + t-c-t\ + c-t-t\ + c-c-t\ +
                voor:
                128 staps modus (factory default)
                14 staps modus
                28 staps modus
                128 staps FX modus
                28 staps FX modus
                \ +

                Note: Je firmware versie kan een afwijkend patroon voor OpSw 21-23 vereisen

                + +LabelTop = DB150 (Empire Builder) Configuratie + +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option5 = 5: Stel in als Centrale (normaal 'c') +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in DB150 +Option38 = 38: Clear the loco roster +Option39 = 39: Alle geheugens DCS50 wissen (reset fabrieksinstelling) +Option41 = 41: Diagnostic click when LocoNet command received +Option42 = 42: Disable 3 beeps when loco address purged +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option50 = 50: Longer Booster short circuit recovery time +Option51 = 51: Do not allow EXT voltage RESTART diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options.properties index ce49ac8685d..f9980582a27 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options.properties @@ -1,6 +1,5 @@ # DCS100options.properties # -# # Default command station options for the DCS100 (Chief) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -11,27 +10,19 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS100 (Chief) Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" -Option2 = 2: Make DCS100 a booster only, not a command station +Option2 = 2: Run as Booster only, not Command Station (always 't') Option3 = 3: Booster is autoreversing -Option5 = 5: Command station master mode -Option9 = 9: Allow Motorola trinary echo for 1-256 -Option10 = 10: Expand trinary switch echo -Option11 = 11: Make certain trinary switches long duration -Option12 = 12: Trinary addresses 1-80 allowed +Option5 = 5: Command Station master mode (always 'c') +Option9 = 9: Allow Motorola trinary switch packet echo for 1-64 +Option10 = 10: Expand M trinary switch echo range to 1-256 +Option11 = 11: Make M trinary switches 57-64 long duration (1 sec) +Option12 = 12: Motorola trinary mobile addresses 1-80 allowed Option13 = 13: Raise loco address purge time to 600 seconds Option14 = 14: Disable loco address purging Option15 = 15: Purge will force a loco to zero speed Option17 = 17: Automatic advanced consists are disabled -Option18 = 18: Extend booster short shutdown to 1/2 second +Option18 = 18: Extend Booster short shutdown to 1/2 second Option20 = 20: Disable address 0 analog operation Option21 = 21: Global default for new loco: FX Option22 = 22: Global default for new loco: 28 step @@ -43,10 +34,10 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes -Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS100 +Option37 = 37: Clear all routes in DSC100 +Option38 = 38: Clear the loco roster in DCS100 +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_da.properties index c45d96862fc..30aa0a57b28 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_da.properties @@ -1,7 +1,7 @@ -# DCS100options.properties +# DCS100options_da.properties # -# -# Danish translation by Sonny Hansen#Overrides Default command station options for the DCS100 (Chief) +# Danish translation by Sonny Hansen +# Overrides Default command station options for the DCS100 (Chief) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS100 (Chief) Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Viser reserverede option switches -Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt Option2 = 2: Make DCS100 a booster only, not a command station Option3 = 3: Booster is autoreversing @@ -43,10 +35,10 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in DCS100 +Option37 = 37: Clear all routes in DCS100 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_de.properties index 1654635aafd..15ae80e8023 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_de.properties @@ -1,7 +1,7 @@ -# DCS100options.properties +# DCS100options_de.properties # -# by Simon Ginsburg # German command station options for the DCS100 (Chief) +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS100 (Chief) Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_fr.properties index 5310100a830..b50f6a28b23 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_fr.properties @@ -1,8 +1,6 @@ -#DCS100options.properties +#DCS100options_fr.properties # -# Revision $Revision$ -# -# Default command station options for the DCS100 (Chief) +# French default command station options for the DCS100 (Chief) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -12,42 +10,35 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmateur DCS100 (Chief) -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" -Option2 = 2: configure DCS100 en Booster seulement, pas en centrale +Option2 = 2: Configure DCS100 en Booster seulement, pas une Centrale Option3 = 3: Booster est autoreverse Option5 = 5: Centrale en mode Maitre -Option9 = 9: Autoriser l'écho ternaire de Motorola pour 1-256 -Option10 = 10: Étend l'écho des Commutateurs ternaires +Option9 = 9: Autoriser l'\u00e9cho ternaire de Motorola pour 1-256 +Option10 = 10: \u00c9tend l'\u00e9cho des Commutateurs ternaires Option11 = 11: Make certain trinary switches long duration -Option12 = 12: Adresses ternaires 1-80 autorisées -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option17 = 17: Les Couplage Automatique avancé est désactivé -Option18 = 18: Étendre l'arrêt du booster à 1/2 seconde -Option20 = 20: Désactive l'adresse 0 pour une exploitaion analogique -Option21 = 21: Réglage par défaut pour une nouvelle loco: FX -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans -Option27 = 27: Désactiver les commandes de commutation normale(Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension -Option31 = 31: Compteur Itinéraire/commutateur de sortie quand non ternaire -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option36 = 36: Effacer toutes les informations du décodeur mobile et des couplages -Option37 = 37: Effacer tous les itinéraires +Option12 = 12: Adresses ternaires 1-80 autoris\u00e9es +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option17 = 17: Les Couplage Automatique avanc\u00e9 est d\u00e9sactiv\u00e9 +Option18 = 18: \u00c9tendre l'arr\u00e8t du booster \u00e1 1/2 seconde +Option20 = 20: D\u00e9sactive l'adresse 0 pour une exploitaion analogique +Option21 = 21: R\u00e9glage par d\u00e9faut pour une nouvelle loco: FX +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans +Option27 = 27: D\u00e9sactiver les commandes de commutation normale (Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension +Option31 = 31: Compteur Itin\u00e9raire/commutateur de sortie quand non ternaire +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option36 = 36: Effacer toutes les informations du d\u00e9codeur mobile et des couplages +Option37 = 37: Effacer tous les itin\u00e9raires Option38 = 38: Effacer l'inventaire Loco -Option39 = 39: Effacer toute la mémoire interne -Option41 = 41: Clic de Diagnostic quand la commande LocoNet est reçue -Option42 = 42: Désactiver 3 beeps quand l'adresse loc est purgée -Option43 = 43: Désactive Mise à jour LocoNet de l'état de la voie -Option44 = 44: Étendre les emplacements à 120 -Option45 = 45: Désactiver la réponse quand l'état des commutateurs et demandé -Option47 = 47: Le programme de la voie est générateur de freinage +Option39 = 39: Effacer toute la m\u00e9moire interne +Option41 = 41: Clic de Diagnostic quand la commande LocoNet est re\u00e7ue +Option42 = 42: D\u00e9sactiver 3 beeps quand l'adresse loc est purg\u00e9e +Option43 = 43: D\u00e9sactive Mise \u00e1 jour LocoNet de l'\u00e9tat de la voie +Option44 = 44: \u00c9tendre les emplacements \u00e1 120 +Option45 = 45: D\u00e9sactiver la r\u00e9ponse quand l'\u00e9tat des commutateurs et demand\u00e9 +Option47 = 47: Le programme de la voie est g\u00e9n\u00e9rateur de freinage diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_it.properties index ef135df572b..33d7a189afd 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_it.properties @@ -1,9 +1,7 @@ -# DCS100options.properties +# DCS100options_it.properties # -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the DCS100 (Chief) +# Italian command station options for the DCS100 (Chief) +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -13,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmatore DCS100 (Chief) -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option2 = 2: Programma DCS100 come Solo-Booster, non come Centrale Option3 = 3: Booster in Auto Reverse diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_ja_JP.properties index 198730b0ca3..652ca61538b 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_ja_JP.properties @@ -1,5 +1,4 @@ -# DCS100options.properties -# +# DCS100options_ja_JP.properties # # Japanese command station options for the DCS100 (Chief) # Translated by Sakae Akanuma @@ -11,15 +10,7 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 -LabelTop = DCS100 (\u30C1\u30FC\u30D5\u2122) \u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u307F\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC -CheckBoxReserved = Show reserved option switches -Reserved = \u4E88\u7D04 - -HeadingText = Items describe effect on system operation when set "closed" +LabelTop = DCS100 (\u30c1\u30fc\u30d5\u2122) \u30d7\u30ed\u30b0\u30e9\u30de\u30fc Option2 = 2: Make DCS100 a booster only, not a command station Option3 = 3: Booster is autoreversing @@ -44,10 +35,10 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in DCS100 +Option37 = 37: Clear all routes in DCS100 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_nl.properties new file mode 100644 index 00000000000..149323f0b8a --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS100options_nl.properties @@ -0,0 +1,47 @@ +# DCS100options_nl.properties +# +# Dutch command station options for the DCS100 (Chief) +# Translation by Simon Ginsburg + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS100 (Chief) Configuratie + +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option5 = 5: Stel in als Centrale +Option9 = 9: Motorola Trinary Echo voor adressen 1-64 aan +Option10 = 10: Motorola Trinary wissel-echo uitbreiden tot 256 +Option11 = 11: M Trinary wissels 57-64 met langere schakeltijd +Option12 = 12: Motorola Trinary adressen 1-80 actief +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option25 = 25: Doorverwijzen uitgeschakeld +Option26 = 26: Wisselstraten actief +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option31=31:Gebruik Wissel(straten) Uitgang als Motorola Modus uitgeschakeld is +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in DCS100 +Option37 = 37: Alle Wisselstaten in DCS100 wissen +Option38 = 38: Locinfo in DCS100 wissen +Option39 = 39: Alle geheugens DCS100 wissen (reset fabrieksinstelling) +Option41 = 41: Diagnosetoon bij elk ontvangen LocoNet-bericht +Option42 = 42: Drie tonen bij wissen van Locadres uitschakelen +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option44 = 44: Locadresopslag uitbreiden tot 120 slots +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option47 = 47: Programmeerspoor werkt als rembaanvak diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options.properties index 41b2052c9cf..4a422b9c622 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options.properties @@ -1,6 +1,5 @@ # DCS200options.properties # -# # Default command station options for the DCS200 # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -11,16 +10,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS200 Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" -Option2 = 2: Make DCS200 a booster only, not a command station +Option2 = 2: Run DCS200 as Booster only, not a Command Station Option3 = 3: Booster is autoreversing Option5 = 5: Command station master mode Option9 = 9: Allow Motorola trinary echo for 1-256 @@ -43,14 +34,13 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in DCS200 +Option37 = 37: Clear all routes in DCS200 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status Option44 = 44: Expand slots to 120 Option45 = 45: Disable reply for switch state request Option47 = 47: Program track is brake generator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_da.properties index 3d2c0a7d53f..b96f84321c4 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_da.properties @@ -1,7 +1,6 @@ -# DCS200options.properties +# DCS200options_da.properties # -# -# Default command station options for the DCS200 +# Danish command station options for the DCS200 # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,16 +10,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS200 Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Viser reserverede option switches -Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt -Option2 = 2: Make DCS200 a booster only, not a command station +Option2 = 2: Run DCS200 as Booster only, not a Command Station Option3 = 3: Booster is autoreversing Option5 = 5: Command station master mode Option9 = 9: Allow Motorola trinary echo for 1-256 @@ -43,14 +34,13 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in DCS200 +Option37 = 37: Clear all routes in DCS200 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status Option44 = 44: Expand slots to 120 Option45 = 45: Disable reply for switch state request Option47 = 47: Program track is brake generator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_de.properties index 9cd69f66b9a..c7f63f9c9a0 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_de.properties @@ -1,7 +1,7 @@ -# DCS200options.properties +# DCS200options_de.properties # -# by Simon Ginsburg # German command station options for the DCS200 +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -10,15 +10,7 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 -LabelTop = DCS200 (Chief) Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen +LabelTop = DCS200 Konfigurator Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik @@ -53,4 +45,3 @@ Option43 = 43: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten Option44 = 44: Lokadressspeicher auf 120 erweitern Option45 = 45: Antworten auf Weichenpositionsanfragen ausschalten Option47 = 47: Programmiergleis ist zugleich Bremsweginitiator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_fr.properties index 0d8d530e19e..8985fd0b8a7 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_fr.properties @@ -1,7 +1,6 @@ -# DCS200options.properties +# DCS200options_fr.properties # -# -# Default command station options for the DCS200 +# French command station options for the DCS200 # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -10,48 +9,38 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 +LabelTop = Programmateur DCS200 -LabelTop = Programmateur DCS200 -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" - -Option2 = 2: Booster seulement ignoré - Option3 = 3: Booster est autoreverse -Option5 = 5: Centrale en mode Maitre -Option9 = 9: Autoriser l'écho ternaire de Motorola pour 1-256 -Option10 = 10: Étend l'écho des Commutateurs ternaires +Option2 = 2: Booster seulement ignor\u00e9 +Option3 = 3: Booster est autoreverse +Option5 = 5: Centrale en mode Maitre +Option9 = 9: Autoriser l'\u00e9cho ternaire de Motorola pour 1-256 +Option10 = 10: \u00c1tend l'\u00e9cho des Commutateurs ternaires Option11 = 11: Make certain trinary switches long duration -Option12 = 12: Adresses ternaires 1-80 autorisées -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option17 = 17: la fonction Couplage Automatique avancé est désactivée -Option18 = 18: Étendre l'arrêt du booster à 1/2 seconde -Option20 = 20: Désactive l'adresse 0 pour une exploitaion analogique -Option21 = 21: Réglage par défaut pour une nouvelle loco: FX -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans +Option12 = 12: Adresses ternaires 1-80 autoris\u00e9es +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option17 = 17: la fonction Couplage Automatique avanc\u00e9 est d\u00e9sactiv\u00e9e +Option18 = 18: \u00c9tendre l'arr\u00eat du booster \u00e1 1/2 seconde +Option20 = 20: D\u00e9sactive l'adresse 0 pour une exploitaion analogique +Option21 = 21: R\u00e9glage par d\u00e9faut pour une nouvelle loco: FX +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans Option25 = 25: Disable aliasing -Option26 = 26: Désactiver les itinéraires -Option27 = 27: Désactiver les commandes de commutation normale(Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension +Option26 = 26: D\u00e9sactiver les itin\u00e9raires +Option27 = 27: D\u00e9sactiver les commandes de commutation normale (Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension Option31 = 31: Meter route/switch output when not in trinary -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option36 = 36: Effacer toutes les informations du décodeur mobile et des couplages -Option37 = 37: Effacer tous les itinéraires +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option36 = 36: Effacer toutes les informations du d\u00e9codeur mobile et des couplages +Option37 = 37: Effacer tous les itin\u00e9raires Option38 = 38: Effacer l'inventaire Loco -Option39 = 39: Effacer toute la mémoire interne -Option41 = 41: Clic de Diagnostice quand la commande LocoNet est reçue -Option42 = 42: Désactiver 3 beeps quand l'adresse loco est purgée -Option43 = 43: Désactive Mise à jour LocoNet de l'état de la voie -Option44 = 44: Étendre les emplacements à 120 -Option45 = 45: Désactiver la réponse quand l'état des commutateurs est demandé -Option47 = 47: Le programme de la voie est générateur de freinage - +Option39 = 39: Effacer toute la m\u00e9moire interne +Option41 = 41: Clic de Diagnostice quand la commande LocoNet est re\u00e7ue +Option42 = 42: D\u00e9sactiver 3 beeps quand l'adresse loco est purg\u00e9e +Option43 = 43: D\u00e9sactive Mise \u00e1 jour LocoNet de l'\u00e9tat de la voie +Option44 = 44: \u00c9tendre les emplacements \u00e1 120 +Option45 = 45: D\u00e9sactiver la r\u00e9ponse quand l'\u00e9tat des commutateurs est demand\u00e9 +Option47 = 47: Le programme de la voie est g\u00e9n\u00e9rateur de freinage diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_it.properties index ec0510a9e99..225e88326bb 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_it.properties @@ -1,9 +1,7 @@ -# DCS200options.properties +# DCS200options_it.properties # -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the DCS200 +# Italian command station options for the DCS200 +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -13,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmatore DCS200 -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option2 = 2: Programma DCS200 come Solo-Booster, non come Centrale Option3 = 3: Booster in Auto Reverse @@ -31,7 +21,7 @@ Option11 = 11: Rendi a lunga durata alcuni switches ternari Option12 = 12: Indirizzi ternari 1-80 permessi Option13 = 13: Incrementa tempo cancellazione indirizzo loco a 600 secondi Option14 = 14: Disabilita cancellazione indirizzo loco -Option15 = 15: Cancellazione forzer\u00E0 loco a velocit\u00E0 zero +Option15 = 15: Cancellazione forzer\u00e0 loco a velocit\u00e0 zero Option17 = 17: Consist Automatico Avanzato disabilitato Option18 = 18: Estendi interruzione alim. booster per cortcirc. a 1/2 secondo Option20 = 20: Disabilita indirizzo 0 (analogico) diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_ja_JP.properties index 64c263f963b..901b9cdd8dc 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_ja_JP.properties @@ -1,7 +1,6 @@ -# DCS200options.properties +# DCS200options_ja_JP.properties # -# -# Default command station options for the DCS200 +# Japanese command station options for the DCS200 # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -10,17 +9,9 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 -LabelTop = DCS200\u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u307F\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC -CheckBoxReserved = Show reserved option switches -Reserved = \u4E88\u7D04 - -HeadingText = Items describe effect on system operation when set "closed" +LabelTop = DCS200\u30d7\u30ed\u30b0\u30e9\u30de\u30fc -Option2 = 2: Make DCS200 a booster only, not a command station +Option2 = 2: Run DCS200 as Booster only, not a Command Station Option3 = 3: Booster is autoreversing Option5 = 5: Command station master mode Option9 = 9: Allow Motorola trinary echo for 1-256 @@ -43,14 +34,13 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in DCS200 +Option37 = 37: Clear all routes in DCS200 Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status Option44 = 44: Expand slots to 120 Option45 = 45: Disable reply for switch state request Option47 = 47: Program track is brake generator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_nl.properties new file mode 100644 index 00000000000..0ed6bfb0851 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS200options_nl.properties @@ -0,0 +1,47 @@ +# DCS200options_nl.properties +# +# Dutch command station options for the DCS200 (Chief) +# Translation by Simon Ginsburg + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS200 Configuratie + +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option5 = 5: Stel in als Centrale +Option9 = 9: Motorola Trinary Echo voor adressen 1-64 aan +Option10 = 10: Motorola Trinary wissel-echo uitbreiden tot 256 +Option11 = 11: M Trinary wissels 57-64 met langere schakeltijd +Option12 = 12: Motorola Trinary adressen 1-80 actief +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option25 = 25: Doorverwijzen uitgeschakeld +Option26 = 26: Wisselstraten actief +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option31 = 31: Snelle Wisselstraten/Wissels tenzij in Motorola Modus +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in DCS200 +Option37 = 37: Alle Wisselstaten in DCS200 wissen +Option38 = 38: Locinfo in DCS200 wissen +Option39 = 39: Alle geheugens DCS200 wissen (reset fabrieksinstelling) +Option41 = 41: Diagnosetoon bij elk ontvangen LocoNet-bericht +Option42 = 42: Drie tonen bij wissen van Locadres uitschakelen +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option44 = 44: Locadresopslag uitbreiden tot 120 slots +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option47 = 47: Programmeerspoor werkt als rembaanvak diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options.properties index 7f842180f3f..979c52cdd35 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options.properties @@ -10,14 +10,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS210 Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" Option2 = 2: Make DCS210 a booster only, not a command station Option3 = 3: Booster is autoreversing @@ -31,6 +23,7 @@ Option20 = 20: Disable address 0 analog operation Option21 = 21: Global default for new loco: FX Option22 = 22: Global default for new loco: 28 step Option23 = 23: Global default for new loco: 14 step +# next line has a special meaning in the DCS210 Option25 = 25: Disable route echo over LocoNet Option26 = 26: Enable routes Option27 = 27: Disable normal switch commands (Bushby bit) @@ -39,10 +32,10 @@ Option31 = 31: Fast route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state Option35 = 35: Disable Loco Reset Button -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in DCS210 +Option37 = 37: Clear all routes in DCS210 Option38 = 38: Loco Reset button activates 'Slot zeroing' -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option40 = 40: Reset all mobile decoder info, consists, routes, and Voltage Trim to factory default Option41 = 41: Diagnostic click when LocoNet command received or Routes being output Option42 = 42: Disable 2 beeps when loco address purged diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options_de.properties new file mode 100644 index 00000000000..5bb9f3d3fb3 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options_de.properties @@ -0,0 +1,45 @@ +# DCS210options_de.properties +# +# German command station options for the DCS200 +# Translation by Simon Ginsburg + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS210 Konfigurator + +Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion +Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik +Option6 = 6: Decoder vor Programmieren nicht pr\u00fcfen +Option13 = 13: Lokadressl\u00f6schen erst nach 600 Sekunden +Option14 = 14: Kein Lokadressl\u00f6schen +Option15 = 15: Lokadressl\u00f6schen erst nach dem Senden eines Stillstandssignals +Option17 = 17: Automatisches Ezeugen von Decoderbasierter Mehrlokkompositionen ausgeschaltet +Option18 = 18: Kurzschlussdetektionszeit des Verst\u00e4rkers auf 1/2 Sekunden verl\u00e4ngert +Option20 = 20: Analogbetriebsadresse 0 ausgeschaltet +Option21 = 21: Vorgabewert f\u00fcr neue Lok: FX +Option22 = 22: Vorgabewert f\u00fcr neue Lok: 28 Stufen +Option23 = 23: Vorgabewert f\u00fcr neue Lok: 14 Stufen +# next line has a special meaning in the DCS210 +Option25 = 25: Routewiederholung \u00fcbers LocoNet abgeschaltet +Option26 = 26: Weichenstra\u00dfen eingeschaltet +Option27 = 27: Normale Weichenschaltung ausgeschaltet (Bushby Bit) +Option28 = 28: Abfrage der DS54 beim Aufstarten ausgeschaltet +Option31 = 31: Verwende Weichenstra\u00dfen/Weichen Ausgang wenn nicht im Motorola Modus +Option33 = 33: Nach Spannungswiederkehr Gleisspannungsmodus wiederherstellen +Option34 = 34: Nach Spannungswiederkehr automatische Gleisspannung zulassen +Option35 = 35: Lok Reset Knopf ausschalten +Option36 = 36: Alle Informationen von Loks und Mehrfachtraktionen in DCS210 l\u00f6schen +Option37 = 37: Alle Weichenstra\u00dfen in DCS210 l\u00f6schen +Option38 = 38: Lokinfo in DCS210 l\u00f6schen +Option39 = 39: Gesamtspeicher in DCS210 l\u00f6schen +Option40=40: Eingaben f\u00fcr Decoder, Strecken u. Voltage Trim nach Werkseinstellungen zur\u00fcckstellen +Option41 = 41: Diagnoseton bei jedem erhaltenen LocoNet Befehl +Option42 = 42: Dreifachton beim L\u00f6schen einer Lokadresse ausschalten +Option43 = 43: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten +Option45 = 45: Antworten auf Weichenpositionsanfragen ausschalten +Option47 = 47: Programmiergleis ist zugleich Bremsweginitiator diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options_nl.properties new file mode 100644 index 00000000000..72becb18af7 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS210options_nl.properties @@ -0,0 +1,44 @@ +# DCS210options_nl.properties +# +# Dutch command station options for the DCS210 "Evolution" command station + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS210 Configuratie + +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option6 = 6: Controleer decoder niet voor start programmeren +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +# next line has a special meaning in the DCS210 +Option25 = 25: Route-echo op het LocoNet uitgeschakeld +Option26 = 26: Wisselstraten actief +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option31 = 31: Snelle Wisselstraten/Wissels tenzij in Motorola Modus +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option35 = 35: Schakel Loc Reset knop uit +Option36 = 36: Alle info over locs en tracties wissen in DCS210 +Option37 = 37: Alle Wisselstaten in DCS210 wissen +Option38 = 38: Locinfo in DCS210 wissen +Option39 = 39: Alle geheugens DCS210 wissen (reset fabrieksinstelling) +Option40 = 40: Alle instellingen voor locdecoders, tractie, Vmax etc. terugzetten op standaardinstellingen +Option41 = 41: Diagnoseklik bij elk ontvangen LocoNet-bericht +Option42 = 42: Twee tonen bij wissen van Locadres uitschakelen +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option47 = 47: Programmeerspoor werkt als rembaanvak diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options.properties index 1aa4e9fb7c7..0028b2efd5c 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options.properties @@ -10,16 +10,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS240 Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved -HeadingText = Items describe effect on system operation when set "closed" - -Option2 = 2: Make DCS240 a booster only, not a command station +Option2 = 2: Run DCS240 as Booster only, not a Command Station Option3 = 3: Booster is autoreversing Option6 = 6: Do not check for decoder before programming Option13 = 13: Raise loco address purge time to 600 seconds @@ -39,9 +31,9 @@ Option31 = 31: Disable metering of route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state Option35 = 35: Disable Loco Reset Button -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS240 +Option37 = 37: Clear all routes in DCS240 +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 2 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_da.properties index d494437eb3b..09739151681 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_da.properties @@ -1,5 +1,4 @@ -# DCS240options.properties -# +# DCS240options_da.properties # # Danish translation by Sonny Hansen#Overrides Default command station options for the DCS240 @@ -11,16 +10,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS240 Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Viser reserverede option switches -Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt -Option2 = 2: Make DCS240 a booster only, not a command station +Option2 = 2: Run DCS240 as Booster only, not a Command Station Option3 = 3: Booster is autoreversing Option6 = 6: Do not check for decoder before programming Option13 = 13: Raise loco address purge time to 600 seconds @@ -40,9 +31,9 @@ Option31 = 31: Disable metering of route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state Option35 = 35: Disable Loco Reset Button -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS240 +Option37 = 37: Clear all routes in DCS240 +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 2 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_de.properties index 1a3107f32c1..75e4fe66563 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_de.properties @@ -1,7 +1,7 @@ -# DCS240options.properties +# DCS240options_de.properties # -# by Simon Ginsburg # German command station options for the DCS240 +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS240 Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_it.properties index 6b610873c47..04cecf70c36 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_it.properties @@ -1,8 +1,7 @@ -# DCS240options.properties +# DCS240options_it.properties # -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the DCS240 +# Italian command station options for the DCS240 +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -12,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmatore DCS240 -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option2 = 2: Programma DCS240 come Solo-Booster, non come Centrale Option3 = 3: Booster in Auto Reverse diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_ja_JP.properties index fe6ae6d1deb..8ddd1895557 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_ja_JP.properties @@ -1,4 +1,4 @@ -# DCS240options.properties +# DCS240options_ja_JP.properties # # Japanese command station options for the DCS240 # Translated by Sakae Akanuma @@ -10,17 +10,9 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 -LabelTop = DCS240 (\u30C1\u30FC\u30D5\u2122) \u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u307F\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC -CheckBoxReserved = Show reserved option switches -Reserved = \u4E88\u7D04 +LabelTop = DCS240 (\u30c1\u30fc\u30d5\u2122) \u30d7\u30ed\u30b0\u30e9\u30de\u30fc -HeadingText = Items describe effect on system operation when set "closed" - -Option2 = 2: Make DCS240 a booster only, not a command station +Option2 = 2: Run DCS240 as Booster only, not a Command Station Option3 = 3: Booster is autoreversing Option6 = 6: Do not check for decoder before programming Option13 = 13: Raise loco address purge time to 600 seconds @@ -40,9 +32,9 @@ Option31 = 31: Disable metering route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state Option35 = 35: Disable Loco Reset Button -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS240 +Option37 = 37: Clear all routes in DCS240 +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 2 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_nl.properties new file mode 100644 index 00000000000..4ce004e57e0 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS240options_nl.properties @@ -0,0 +1,44 @@ +# DCS240options_nl.properties +# +# Dutch command station options for the DCS240 +# Translation by Egbert Broerse + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS240 Configuratie + +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option6 = 6: Controleer decoder niet voor start programmeren +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option25 = 25: Doorverwijzen uitgeschakeld +Option26 = 26: Wisselstraten actief +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option31 = 31: Meet Wisselstraten/Wissels tenzij in Motorola Modus +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option35 = 35: Schakel Loc Reset knop uit +Option36 = 36: Alle info over locs en tracties wissen in DCS240 +Option37 = 37: Alle Wisselstaten in DCS240 wissen +Option38 = 38: Locinfo in DCS240 wissen +Option39 = 39: Alle geheugens DCS240 wissen (reset fabrieksinstelling) +Option41 = 41: Diagnoseklik bij elk ontvangen LocoNet-bericht +Option42 = 42: Twee tonen bij wissen van Locadres uitschakelen +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option44 = 44: Locadresopslag 120 slots (i.p.v. 400) +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option47 = 47: Programmeerspoor werkt als rembaanvak diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options.properties index a67171c5b40..515fe7ab111 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options.properties @@ -1,6 +1,5 @@ # DCS50options.properties # -# # Default command station options for the DCS50 (Zephyr) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -11,17 +10,9 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS50 (Zephyr) Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" -Option1 = 1: One jump port (normally two) -Option2 = 2: Booster/Throttle, not command station +Option1 = 1: One Jump port (t = two Jump ports) +Option2 = 2: Run as Booster/Throttle, not Command Station Option3 = 3: Booster is autoreversing Option5 = 5: No change allowed for throttle ID, Vmax or brake rate Option6 = 6: Function 3 is non-latching @@ -39,8 +30,7 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS50 +Option39 = 39: Clear all internal memory states Option43 = 43: Disable LocoNet update of track status Option45 = 45: Disable reply for switch state request - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_da.properties index 29b1a9951da..fec990edcb2 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_da.properties @@ -1,7 +1,6 @@ -# DCS50options.properties +# DCS50options_da.properties # -# -# Default command station options for the DCS50 (Zephyr) +# Danish command station options for the DCS50 (Zephyr) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,17 +10,9 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS50 (Zephyr) Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Viser reserverede option switches -Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt -Option1 = 1: One jump port (normally two) -Option2 = 2: Booster/Throttle, not command station +Option1 = 1: One Jump port (t = two Jump ports) +Option2 = 2: Run as Booster/Throttle, not Command Station Option3 = 3: Booster is autoreversing Option5 = 5: No change allowed for throttle ID, Vmax or brake rate Option6 = 6: Function 3 is non-latching @@ -39,8 +30,7 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS50 +Option39 = 39: Clear all internal memory states Option43 = 43: Disable LocoNet update of track status Option45 = 45: Disable reply for switch state request - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_de.properties index cf4f6f6649c..42666aec31a 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_de.properties @@ -1,7 +1,7 @@ -# DCS50options.properties +# DCS50options_de.properties # -# by Simon Ginsburg # German command station options for the DCS50 (Zephyr) +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,36 +11,27 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS50 (Zephyr) Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen - -Option1 = 1\: Ein (statt zwei) Regleranschl\u00fcsse -Option2 = 2\: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion -Option3 = 3\: Verst\u00e4rker mit Kehrschleifenautomatik -Option5 = 5\: Zentraleinheitenmodus -Option6 = 6\: Funktion 3 ist nicht selbsthaltend -Option7 = 7\: H\u00f6here Leistung f\u00fcr Audiodecoder auf dem Programmiergleis -Option13 = 13\: Lokadressl\u00f6schen erst nach 600 Sekunden -Option14 = 14\: Kein Lokadressl\u00f6schen -Option15 = 15\: Lokadressl\u00f6schen erst nach dem Senden eines Stillstandssignals -Option17 = 17\: Automatisches Ezeugen von Decoderbasierter Mehrlokkompositionen ausgeschaltet -Option18 = 18\: Kurzschlussdetektionszeit des Verst\u00e4rkers auf 1/2 Sekunden verl\u00e4ngert -Option20 = 20\: Analogbetriebsadresse 0 ausgeschaltet -Option21 = 21\: Vorgabewert f\u00fcr neue Lok\: FX -Option22 = 22\: Vorgabewert f\u00fcr neue Lok\: 28 Stufen -Option23 = 23\: Vorgabewert f\u00fcr neue Lok\: 14 Stufen -Option27 = 27\: Normale Weichenschaltung ausgeschaltet (Bushby Bit) -Option28 = 28\: Abfrage der DS54 beim Aufstarten ausgeschaltet -Option33 = 33\: Nach Spannungswiederkehr Gleisspannungsmodus wiederherstellen -Option34 = 34\: Nach Spannungswiederkehr automatische Gleisspannung zulassen -Option36 = 36\: Alle Informationen von Loks und Mehrfachtraktionen l\u00f6schen -Option39 = 39\: Gesamtspeicher l\u00f6schen -Option43 = 43\: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten -Option45 = 45\: Antworten auf Weichenpositionsanfragen ausschalten +Option1 = 1: Ein (statt t = zwei) Regleranschl\u00fcsse +Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion +Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik +Option5 = 5: Zentraleinheitenmodus +Option6 = 6: Funktion 3 ist nicht selbsthaltend +Option7 = 7: H\u00f6here Leistung f\u00fcr Audiodecoder auf dem Programmiergleis +Option13 = 13: Lokadressl\u00f6schen erst nach 600 Sekunden +Option14 = 14: Kein Lokadressl\u00f6schen +Option15 = 15: Lokadressl\u00f6schen erst nach dem Senden eines Stillstandssignals +Option17 = 17: Automatisches Ezeugen von Decoderbasierter Mehrlokkompositionen ausgeschaltet +Option18 = 18: Kurzschlussdetektionszeit des Verst\u00e4rkers auf 1/2 Sekunden verl\u00e4ngert +Option20 = 20: Analogbetriebsadresse 0 ausgeschaltet +Option21 = 21: Vorgabewert f\u00fcr neue Lok: FX +Option22 = 22: Vorgabewert f\u00fcr neue Lok: 28 Stufen +Option23 = 23: Vorgabewert f\u00fcr neue Lok: 14 Stufen +Option27 = 27: Normale Weichenschaltung ausgeschaltet (Bushby Bit) +Option28 = 28: Abfrage der DS54 beim Aufstarten ausgeschaltet +Option33 = 33: Nach Spannungswiederkehr Gleisspannungsmodus wiederherstellen +Option34 = 34: Nach Spannungswiederkehr automatische Gleisspannung zulassen +Option36 = 36: Alle Informationen von Loks und Mehrfachtraktionen l\u00f6schen +Option39 = 39: Gesamtspeicher l\u00f6schen +Option43 = 43: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten +Option45 = 45: Antworten auf Weichenpositionsanfragen ausschalten diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_fr.properties index 2b1450f6749..a9492286ae6 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_fr.properties @@ -1,7 +1,6 @@ -# DCS50options.properties +# DCS50options_fr.properties # -# -# Default command station options for the DCS50 (Zephyr) +# French command station options for the DCS50 (Zephyr) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -10,38 +9,28 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 - LabelTop = Programmateur DCS50 (Zephyr) -LabelC -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" - -Option1 = 1: Un port à un cavalier (normalement deux) -Option2 = 2: Booster/Régulateur, pas centrale -Option3 = 3: Booster est autoreverse -Option5 = 5: Pas de changement autorisé pour ID Régulateur, Vmax ou taux de freinage -Option6 = 6: La fonction 3 est non verrouillée -Option7 = 7: Programmation en mode Blast pour décodeurs sonores -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option17 = 17: la fonction Couplage Automatique avancé est désactivée -Option18 = 18: Étendre l'arrêt du booster à 1/2 seconde -Option20 = 20: Désactive l'adresse 0 pour une exploitaion analogique -Option21 = 21: Réglage par défaut pour une nouvelle loco: FX -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans -Option27 = 27: Désactiver les commandes de commutation normale(Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option36 = 36: Effacer toutes les informations du décodeur mobile et des couplages -Option39 = 39: Effacer toute la mémoire interne -Option43 = 43: Désactive Mise à jour LocoNet de l'état de la voie -Option45 = 45: Désactiver la réponse quand l'état des commutateurs est demandé +Option1 = 1: Un port \u00e1 un cavalier (normalement deux) +Option2 = 2: Booster/R\u00e9gulateur, pas centrale +Option3 = 3: Booster est autoreverse +Option5 = 5: Pas de changement autoris\u00e9 pour ID R\u00e9gulateur, Vmax ou Taux de freinage +Option6 = 6: La fonction 3 est non verrouill\u00e9e +Option7 = 7: Programmation en mode Blast pour d\u00e9codeurs sonores +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option17 = 17: la fonction Couplage Automatique avanc\u00e9 est d\u00e9sactiv\u00e9e +Option18 = 18: \u00c9tendre l'arr\u00eat du booster \u00e1 1/2 seconde +Option20 = 20: D\u00e9sactive l'adresse 0 pour une exploitaion analogique +Option21 = 21: R\u00e9glage par d\u00e9faut pour une nouvelle loco: FX +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans +Option27 = 27: D\u00e9sactiver les commandes de commutation normale (Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option36 = 36: Effacer toutes les informations du d\u00e9codeur mobile et des couplages +Option39 = 39: Effacer toute la m\u00e9moire interne +Option43 = 43: D\u00e9sactive Mise \u00e1 jour LocoNet de l'\u00e9tat de la voie +Option45 = 45: D\u00e9sactiver la r\u00e9ponse quand l'\u00e9tat des commutateurs est demand\u00e9 diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_it.properties index 70831d2ab29..4998525bbca 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_it.properties @@ -1,9 +1,7 @@ -# DCS50options.properties +# DCS50options_it.properties # -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the DCS50 (Zephyr) +# Italian command station options for the DCS50 (Zephyr) +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -13,24 +11,16 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmatore DCS50 (Zephyr) -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option1 = 1: Una porta jump (normalmente 2) Option2 = 2: Programma come Solo-Booster, non come Centrale Option3 = 3: Booster in Auto Reverse Option5 = 5: Nessuna modifica permessa al ID del throttle, Vmax o frequenza Frenata -Option6 = 6: Functione 3 \u00E8 momentanea +Option6 = 6: Functione 3 \u00e8 momentanea Option7 = 7: Modo programmazione Blast per decoders sonori Option13 = 13: Incrementa tempo cancellazione indirizzo loco a 600 secondi Option14 = 14: Disabilita cancellazione indirizzo loco -Option15 = 15: Cancellazione forzer\u00E0 loco a velocit\u00E0 zero +Option15 = 15: Cancellazione forzer\u00e0 loco a velocit\u00e0 zero Option17 = 17: Consist Automatico Advanzato disabilitato Option18 = 18: Estendi interruzione alim. booster per cortcirc. a 1/2 secondo Option20 = 20: Disabilita indirizzo 0 (analogico) diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_ja_JP.properties index 04cbd1f59c4..9612b9b689e 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_ja_JP.properties @@ -1,7 +1,6 @@ -# DCS50options.properties +# DCS50options_ja_JP.properties # -# -# Default command station options for the DCS50 (Zephyr) +# Japanese command station options for the DCS50 (Zephyr) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -10,19 +9,11 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 -LabelTop = DCS50 (\u30BC\u30D5\u30A1\u30FC\u2122) \u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u307F\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC -CheckBoxReserved = \u4E88\u7D04\u6E08\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u30B9\u30A4\u30C3\u30C1\u3082\u8868\u793A -Reserved = \u30EA\u30B6\u30FC\u30D6 - -HeadingText = Items describe effect on system operation when set "\u9589" +LabelTop = DCS50 (\u30bc\u30d5\u30a1\u30fc\u2122) \u30d7\u30ed\u30b0\u30e9\u30de\u30fc -Option1 = 1: One jump port (\u901A\u5E38\u306F\uFF12) -Option2 = 2: \u30B3\u30DE\u30F3\u30C9\u30B9\u30C6\u30FC\u30B7\u30E7\u30F3\u3067\u306A\u304F\u30D6\u30FC\u30B9\u30BF\u30FC/\u30B9\u30ED\u30C3\u30C8\u30EB, -Option3 = 3: \u30D6\u30FC\u30B9\u30BF\u30FC\u306F\u30AA\u30FC\u30C8\u30EA\u30D0\u30FC\u30B9\u30E2\u30FC\u30C9 +Option1 = 1: One Jump port (t = \u901a\u5e38\u306f\uff12) +Option2 = 2: \u30b3\u30de\u30f3\u30c9\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u306a\u304f\u30d6\u30fc\u30b9\u30bf\u30fc/\u30b9\u30ed\u30c3\u30c8\u30eb, +Option3 = 3: \u30d6\u30fc\u30b9\u30bf\u30fc\u306f\u30aa\u30fc\u30c8\u30ea\u30d0\u30fc\u30b9\u30e2\u30fc\u30c9 Option5 = 5: No change allowed for throttle ID, Vmax or brake rate Option6 = 6: Function 3 is non-latching Option7 = 7: Blast-mode programming for sound decoders @@ -39,8 +30,7 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option39 = 39: Clear all internal memory +Option36 = 36: Clear all mobile decoder info and consists in DCS50 +Option39 = 39: Clear all internal memory states Option43 = 43: Disable LocoNet update of track status Option45 = 45: Disable reply for switch state request - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_nl.properties new file mode 100644 index 00000000000..75dd596dab8 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS50options_nl.properties @@ -0,0 +1,37 @@ +# DCS50options_nl.properties +# +# Dutch command station options for the DCS50 (Zephyr) +# Translation by Egbert Broerse + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS50 (Zephyr) Configuratie + +Option1 = 1: E\u00e9n Handregelaar jumper (t = 2 jumpers) +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option5 = 5: Stel in als Centrale +Option6 = 6: Funktie 3 momentcontact (t = continu) +Option7 = 7: Blast-mode voor Sound-decoders op Programmeerspoor +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in DCS50 +Option39 = 39: Alle geheugens DCS50 wissen (reset fabrieksinstelling) +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options.properties index b68f3a8e802..d5a379a1b26 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options.properties @@ -1,6 +1,5 @@ # DCS51options.properties # -# # Default command station options for the DCS51 (Zephyr Xtra) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -11,17 +10,9 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS51 (Zephyr Xtra) Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" -Option1 = 1: One jump port (normally two) -Option2 = 2: Booster/Throttle, not command station +Option1 = 1: One Jump port (t = two Jump ports) +Option2 = 2: Run as Booster/Throttle, not Command Station Option3 = 3: Booster is autoreversing Option5 = 5: No change allowed for throttle ID, Vmax or brake rate Option6 = 6: Function 3 is non-latching @@ -41,7 +32,6 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option43 = 43: Disable LocoNet update of track status Option45 = 45: Disable reply for switch state request - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_da.properties index 497fa0e23d0..c5b8396ebd1 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_da.properties @@ -1,7 +1,6 @@ -# DCS51options.properties +# DCS51options_da.properties # -# -# Default command station options for the DCS51 (Zephyr Xtra) +# Danish command station options for the DCS51 (Zephyr Xtra) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,17 +10,9 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = DCS51 (Zephyr Xtra) Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Viser reserverede option switches -Reserved = Reserveret, OBS! M\u00e5 ikke \u00e6ndres - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt -Option1 = 1: One jump port (normally two) -Option2 = 2: Booster/Throttle, not command station +Option1 = 1: One Jump port (t = two Jump ports) +Option2 = 2: Run as Booster/Throttle, not Command Station Option3 = 3: Booster is autoreversing Option5 = 5: No change allowed for throttle ID, Vmax or brake rate Option6 = 6: Function 3 is non-latching @@ -41,7 +32,6 @@ Option27 = 27: Disable normal switch commands (Bushby bit) Option28 = 28: Disable DS54 interrogate at power on Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option43 = 43: Disable LocoNet update of track status Option45 = 45: Disable reply for switch state request - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_de.properties index e69de29bb2d..3719d7a0fbb 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_de.properties @@ -0,0 +1,38 @@ +# DCS51options_de.properties +# +# German command station options for the DCS51 (Zephyr Xtra) + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS51 (Zephyr Xtra) Programmer + +Option1 = 1: Ein (statt zwei) Regleranschl\u00fcsse +Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion +Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik +Option5 = 5: Zentraleinheitenmodus +Option6 = 6: Funktion 3 ist nicht selbsthaltend +Option7 = 7: H\u00f6here Leistung f\u00fcr Audiodecoder auf dem Programmiergleis +Option10 = 10: Recall Tiefe 4 +Option11 = 11: Recall Tiefe 8 +Option13 = 13: Lokadressl\u00f6schen erst nach 600 Sekunden +Option14 = 14: Kein Lokadressl\u00f6schen +Option15 = 15: Lokadressl\u00f6schen erst nach dem Senden eines Stillstandssignals +Option17 = 17: Automatisches Ezeugen von Decoderbasierter Mehrlokkompositionen ausgeschaltet +Option18 = 18: Kurzschlussdetektionszeit des Verst\u00e4rkers auf 1/2 Sekunden verl\u00e4ngert +Option20 = 20: Analogbetriebsadresse 0 ausgeschaltet +Option21 = 21: Vorgabewert f\u00fcr neue Lok: FX +Option22 = 22: Vorgabewert f\u00fcr neue Lok: 28 Stufen +Option23 = 23: Vorgabewert f\u00fcr neue Lok: 14 Stufen +Option27 = 27: Normale Weichenschaltung ausgeschaltet (Bushby Bit) +Option28 = 28: Abfrage der DS54 beim Aufstarten ausgeschaltet +Option33 = 33: Nach Spannungswiederkehr Gleisspannungsmodus wiederherstellen +Option34 = 34: Nach Spannungswiederkehr automatische Gleisspannung zulassen +Option36 = 36: Alle Informationen von Loks und Mehrfachtraktionen l\u00f6schen +Option39 = 39: Gesamtspeicher l\u00f6schen +Option43 = 43: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten +Option45 = 45: Antworten auf Weichenpositionsanfragen ausschalten diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_fr.properties index 853cc8e3ace..d1bb5d0a826 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_fr.properties @@ -1,5 +1,4 @@ -# DCS51options.properties -# +# DCS51options_fr.properties # # Default command station options for the DCS51 (Zephyr Xtra) @@ -11,38 +10,28 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop =Programmateur DCS51 P(Zephyr) -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position Option1 = 1: Un port cavalier (normalement deuxo) -Option2 = 2: Booster/Régulateur, pas une centrale +Option2 = 2: Booster/R\u00e9gulateur, pas une Centrale Option3 = 3: Booster est autoreverse -Option5 = 5: Pas de changement pour l'ID Régulateur, Vmax et taux de freinage -Option6 = 6: Fonction 3 est verrouillée -Option7 = 7: Programmation en mode Blast pour les décodeurs sons +Option5 = 5: Pas de changement pour l'ID R\u00e9gulateur, Vmax et Taux de freinage +Option6 = 6: Fonction 3 est verrouill\u00e9e +Option7 = 7: Programmation en mode Blast pour les d\u00e9codeurs sons Option10 = 10: Rappel Profondeur 4 Option11 = 11: Rappel Profondeur 8 -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option17 = 17: la fonction Couplage Automatique avancé est désactivée -Option18 = 18: Étendre l'arrêt du booster à 1/2 seconde -Option20 = 20: Désactive l'adresse 0 pour une exploitaion analogique -Option21 = 21: Réglage par défaut pour une nouvelle loco: FX -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans -Option27 = 27: Désactiver les commandes de commutation normale (Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option39 = 39: Effacer toute la mémoire interne -Option43 = 43: Désactive Mise à jour LocoNet de l'état de la voie -Option45 = 45: Désactiver la réponse quand l'état des commutateurs est demandé - - +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option17 = 17: la fonction Couplage Automatique avanc\u00e9 est d\u00e9sactiv\u00e9e +Option18 = 18: \u00c9tendre l'arr\u00eat du booster \u00e1 1/2 seconde +Option20 = 20: D\u00e9sactive l'adresse 0 pour une exploitaion analogique +Option21 = 21: R\u00e9glage par d\u00e9faut pour une nouvelle loco: FX +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans +Option27 = 27: D\u00e9sactiver les commandes de commutation normale (Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option39 = 39: Effacer toute la m\u00e9moire interne +Option43 = 43: D\u00e9sactive Mise \u00e1 jour LocoNet de l'\u00e9tat de la voie +Option45 = 45: D\u00e9sactiver la r\u00e9ponse quand l'\u00e9tat des commutateurs est demand\u00e9 diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_it.properties index 1ed69dbaa03..6bfc3f0dd3f 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_it.properties @@ -1,9 +1,7 @@ -# DCS51options.properties +# DCS51options_it.properties # -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the DCS51 (Zephyr Xtra) +# Italian command station options for the DCS51 (Zephyr Xtra) +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -13,16 +11,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmatore DCS51 (Zephyr Xtra) -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" -Option1 = 1: One jump port (normally two) +Option1 = 1: One Jump port (t = two Jump ports) Option2 = 2: Programma come Solo-Booster, non come Centrale Option3 = 3: Booster in Auto Reverse Option5 = 5: Nessuna modifica permessa al ID del throttle, Vmax o frequenza Frenata diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_nl.properties new file mode 100644 index 00000000000..a7b75776f94 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/DCS51options_nl.properties @@ -0,0 +1,39 @@ +# DCS50options_nl.properties +# +# Dutch command station options for the DCS50 (Zephyr) +# Translation by Egbert Broerse + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = DCS50 (Zephyr) Configuratie + +Option1 = 1: E\u00e9n Handregelaar jumper (t = 2 jumpers) +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option5 = 5: Stel in als Centrale +Option6 = 6: Funktie 3 momentcontact (t = continu) +Option7 = 7: Blast-mode voor Sound-decoders op Programmeerspoor +Option10 = 10: Recall-diepte 4 +Option11 = 11: Recall-diepte 8 +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatisch Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in DCS51 +Option39 = 39: Alle geheugens DCS51 wissen (reset fabrieksinstelling) +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions.properties index a2381dacf53..568f782cb2c 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions.properties @@ -1,8 +1,7 @@ # Defaultoptions.properties # -# # Default command station options for when the command -# station isn't recognized. These are the same as the Chief (DCS100) +# station isn't recognized. These are the same as the Chief (DCS100) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -12,16 +11,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Command Station Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" -Option2 = 2: Set unit to be booster only, not command station +Option2 = 2: Run unit as Booster only, not Command Station Option3 = 3: Booster is autoreversing Option5 = 5: Command station master mode Option9 = 9: Allow Motorola trinary echo for 1-256 @@ -44,14 +35,13 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in CS +Option37 = 37: Clear all routes in Command Station Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status Option44 = 44: Expand slots to 120 Option45 = 45: Disable reply for switch state request Option47 = 47: Program track is brake generator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_da.properties index a2381dacf53..9b28d313061 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_da.properties @@ -1,7 +1,6 @@ -# Defaultoptions.properties +# Defaultoptions_da.properties # -# -# Default command station options for when the command +# Danish default command station options for when the command # station isn't recognized. These are the same as the Chief (DCS100) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -12,16 +11,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Command Station Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" -Option2 = 2: Set unit to be booster only, not command station +Option2 = 2: Set unit to be Booster only, not Command Station Option3 = 3: Booster is autoreversing Option5 = 5: Command station master mode Option9 = 9: Allow Motorola trinary echo for 1-256 @@ -44,14 +35,13 @@ Option28 = 28: Disable DS54 interrogate at power on Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37: Clear all routes +Option36 = 36: Clear all mobile decoder info and consists in CS +Option37 = 37: Clear all routes in Command Station Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option41 = 41: Diagnostic click when LocoNet command received Option42 = 42: Disable 3 beeps when loco address purged Option43 = 43: Disable LocoNet update of track status Option44 = 44: Expand slots to 120 Option45 = 45: Disable reply for switch state request Option47 = 47: Program track is brake generator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_de.properties index 3bb942e71a1..c02f3b0a996 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_de.properties @@ -1,8 +1,8 @@ -# Defaultoptions.properties +# Defaultoption_de.properties # -# by Simon Ginsburg # German command station options for when the command # station isn't recognized. These are the same as the Chief (DCS100) +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -12,14 +12,6 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Basis Zentraleinheits Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen Option2 = 2: Verst\u00e4rkermodus, keine Zentraleinheitsfunktion Option3 = 3: Verst\u00e4rker mit Kehrschleifenautomatik @@ -54,4 +46,3 @@ Option43 = 43: Aktualisierung des Gleisstatus \u00fcber LocoNet ausschalten Option44 = 44: Lokadressspeicher auf 120 erweitern Option45 = 45: Antworten auf Weichenpositionsanfragen ausschalten Option47 = 47: Programmiergleis ist zugleich Bremsweginitiator - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_fr.properties index 0f55bdf5644..305792447f4 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_fr.properties @@ -1,7 +1,6 @@ -# Defaultoptions.properties +# Defaultoptions_fr.properties # -# -# Default command station options for when the command +# French default command station options for when the command # station isn't recognized. These are the same as the Chief (DCS100) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -12,46 +11,37 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmateur de Centrale de Commande -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" -Option2 = 2: Configurer l'unité pour être seulement un booster, pas une central -Option3 = 3: Booster est autoreverse -Option5 = 5: Centrale en mode Maitre -Option9 = 9: Autoriser l'écho ternaire de Motorola pour 1-256 -Option10 = 10: Étend l'écho des Commutateurs ternaires +Option2 = 2: Configurer l'unit\u00e9 pour \u00eatre seulement un booster, pas une Centrale +Option3 = 3: Booster est autoreverse +Option5 = 5: Centrale en mode Maitre +Option9 = 9: Autoriser l'\u00e9cho ternaire de Motorola pour 1-256 +Option10 = 10: \u00c9tend l'\u00e9cho des Commutateurs ternaires Option11 = 11: Make certain trinary switches long duration -Option12 = 12: Adresses ternaires 1-80 autorisées -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option17 = 17: la fonction Couplage Automatique avancé est désactivée -Option18 = 18: Étendre l'arrêt du booster à 1/2 seconde -Option20 = 20: Désactive l'adresse 0 pour une exploitaion analogique -Option21 = 21: Réglage par défaut pour une nouvelle loco: FX -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans +Option12 = 12: Adresses ternaires 1-80 autoris\u00e9es +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option17 = 17: la fonction Couplage Automatique avanc\u00e9 est d\u00e9sactiv\u00e9e +Option18 = 18: \u00c9tendre l'arr\u00eat du booster \u00e1 1/2 seconde +Option20 = 20: D\u00e9sactive l'adresse 0 pour une exploitaion analogique +Option21 = 21: R\u00e9glage par d\u00e9faut pour une nouvelle loco: FX +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans Option25 = 25: Disable aliasing -Option26 = 26: Activer Itinéraires -Option27 = 27: Désactiver les commandes de commutation normale(Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension -Option31 = 31: Compteur d'itinéraire/switch output when not in trinary -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option36 = 36: Effacer toutes les informations du décodeur mobile et des couplages -Option37 = 37: Effacer tous les itinéraires +Option26 = 26: Activer Itin\u00e9raires +Option27 = 27: D\u00e9sactiver les commandes de commutation normale (Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension +Option31 = 31: Compteur d'itin\u00e9raire/switch output when not in trinary +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option36 = 36: Effacer toutes les informations du d\u00e9codeur mobile et des couplages +Option37 = 37: Effacer tous les itin\u00e9raires Option38 = 38: Effacer l'inventaire Loco -Option39 = 39: Effacer toute la mémoire interne -Option41 = 41: Clic de Diagnostice quand la commande LocoNet est reçue -Option42 = 42: Désactiver 3 beeps quand l'adresse loc est purgée -Option43 = 43: Désactive Mise à jour LocoNet de l'état de la voie -Option44 = 44: Étendre les emplacements à 120 -Option45 = 45: Désactiver la réponse quand l'état des commutateurs est demandé -Option47 = 47: Le programme de la voie est générateur de freinage - +Option39 = 39: Effacer toute la m\u00e9moire interne +Option41 = 41: Clic de Diagnostice quand la commande LocoNet est re\u00e7ue +Option42 = 42: D\u00e9sactiver 3 beeps quand l'adresse loc est purg\u00e9e +Option43 = 43: D\u00e9sactive Mise \u00e1 jour LocoNet de l'\u00e9tat de la voie +Option44 = 44: \u00c9tendre les emplacements \u00e1 120 +Option45 = 45: D\u00e9sactiver la r\u00e9ponse quand l'\u00e9tat des commutateurs est demand\u00e9 +Option47 = 47: Le programme de la voie est g\u00e9n\u00e9rateur de freinage diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_it.properties index c6f8a95f6c8..97f867c20fe 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_it.properties @@ -1,10 +1,8 @@ -# Defaultoptions.properties +# Defaultoptions_it.properties # -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for when the command +# Italian default command station options for when the command # station isn't recognized. These are the same as the Chief (DCS100) +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -14,16 +12,8 @@ MIN_OPTION = 1 MAX_OPTION = 49 LabelTop = Programmatore in Centrale -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" - -Option2 = 2: Programma l'unit\u00E0 come Solo-Booster, non come Centrale +Option2 = 2: Programma l'unit\u00e0 come Solo-Booster, non come Centrale Option3 = 3: Booster in Auto Reverse Option5 = 5: Centrale in Modo Master Option9 = 9: Permetti eco ternari Motorola per 1-256 @@ -32,7 +22,7 @@ Option11 = 11: Rendi a lunga durata alcuni switches ternari Option12 = 12: Indirizzi ternari 1-80 permessi Option13 = 13: Incrementa tempo cancellazione indirizzo loco a 600 secondi Option14 = 14: Disabilita cancellazione indirizzo loco -Option15 = 15: Cancellazione forzer\u00E0 loco a velocit\u00E0 zero +Option15 = 15: Cancellazione forzer\u00e0 loco a velocit\u00e0 zero Option17 = 17: Consist Automatico Advanzato disabilitato Option18 = 18: Estendi interruzione alim. booster per cortcirc. a 1/2 secondo Option20 = 20: Disabilita indirizzo 0 (analogico) @@ -56,4 +46,3 @@ Option43 = 43: Disabilita Aggiornamento Stato Binari LocoNet Option44 = 44: Expandi slots a 120 Option45 = 45: Disabilita risposta per richiesta stato switch Option47 = 47: Binario Programmazione genera Frenata - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_ja_JP.properties index a29dff001ef..7dfdec088b9 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_ja_JP.properties @@ -1,7 +1,6 @@ -# Defaultoptions.properties +# Defaultoptions_ja_JP.properties # -# -# Default command station options for when the command +# Japanese default command station options for when the command # station isn't recognized. These are the same as the Chief (DCS100) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -11,46 +10,38 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 49 -LabelTop = \u30B3\u30DE\u30F3\u30C9\u30B9\u30C6\u30FC\u30B7\u30E7\u30F3\u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u307F\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC -CheckBoxReserved = \u4E88\u7D04\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u30B9\u30A4\u30C3\u30C1\u3082\u8868\u793A -Reserved = \u4E88\u7D04 - -HeadingText = Items describe effect on system operation when set "closed" +LabelTop = \u30b3\u30de\u30f3\u30c9\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u30d7\u30ed\u30b0\u30e9\u30de\u30fc -Option2 = 2: Set unit to be booster only, not command station -Option3 = 3: \u30D6\u30FC\u30B9\u30BF\u30FC\u306F\u30AA\u30FC\u30C8\u30EA\u30D0\u30FC\u30B9\u30E2\u30FC\u30C9\u3067\u52D5\u4F5C\u3059\u308B -Option5 = 5: \u30B3\u30DE\u30F3\u30C9\u30B9\u30C6\u30FC\u30B7\u30E7\u30F3\u30DE\u30B9\u30BF\u30FC\u30E2\u30FC\u30C9 -Option9 = 9:\u30E2\u30C8\u30ED\u30FC\u30E9\u306E\u4E09\u3064\u7D44\u307F\u30A8\u30B3\u30FC\u3092 1-256\u306B\u5BFE\u3057\u3066\u8A31\u53EF\u3059\u308B +Option2 = 2: Set unit to be Booster only, not Command Station +Option3 = 3: \u30d6\u30fc\u30b9\u30bf\u30fc\u306f\u30aa\u30fc\u30c8\u30ea\u30d0\u30fc\u30b9\u30e2\u30fc\u30c9\u3067\u52d5\u4f5c\u3059\u308b +Option5 = 5: \u30b3\u30de\u30f3\u30c9\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u30de\u30b9\u30bf\u30fc\u30e2\u30fc\u30c9 +Option9 = 9:\u30e2\u30c8\u30ed\u30fc\u30e9\u306e\u4e09\u3064\u7d44\u307f\u30a8\u30b3\u30fc\u3092 1-256\u306b\u5bfe\u3057\u3066\u8a31\u53ef\u3059\u308b Option10 = 10: Expand trinary switch echo Option11 = 11: Make certain trinary switches long duration Option12 = 12: Trinary addresses 1-80 allowed Option13 = 13: Raise loco address purge time to 600 seconds -Option14 = 14:\u8ECA\u4E21\u306E\u30A2\u30C9\u30EC\u30B9\u3092\u958B\u653E\u3057\u306A\u3044 -Option15 = 15:\u30A2\u30C9\u30EC\u30B9\u3092\u958B\u653E\u3057\u305F\u52D5\u529B\u8ECA\u306E\u901F\u5EA6\u3092\uFF10\u306B\u521D\u671F\u5316\u3059\u308B\u3002 -Option17 = 17:\u81EA\u52D5\u30A2\u30C9\u30D0\u30F3\u30B9\u30B3\u30F3\u30B7\u30B9\u30C8\u6A5F\u80FD\u3092\u4F7F\u7528\u3057\u306A\u3044 -Option18 = 18:\u56DE\u8DEF\u306E\u77ED\u7D61\u3092\u8A31\u5BB9\u3059\u308B\u6642\u9593\u30920.5\u79D2\u306B\u5EF6\u9577\u3059\u308B\u3002 -Option20 = 20:\u30A2\u30C9\u30EC\u30B90\u3067\u30A2\u30CA\u30ED\u30B0\u52D5\u529B\u3092\u5236\u5FA1\u3059\u308B\u6A5F\u80FD\u3092\u505C\u6B62\u3059\u308B +Option14 = 14:\u8eca\u4e21\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u958b\u653e\u3057\u306a\u3044 +Option15 = 15:\u30a2\u30c9\u30ec\u30b9\u3092\u958b\u653e\u3057\u305f\u52d5\u529b\u8eca\u306e\u901f\u5ea6\u3092\uff10\u306b\u521d\u671f\u5316\u3059\u308b\u3002 +Option17 = 17:\u81ea\u52d5\u30a2\u30c9\u30d0\u30f3\u30b9\u30b3\u30f3\u30b7\u30b9\u30c8\u6a5f\u80fd\u3092\u4f7f\u7528\u3057\u306a\u3044 +Option18 = 18:\u56de\u8def\u306e\u77ed\u7d61\u3092\u8a31\u5bb9\u3059\u308b\u6642\u9593\u30920.5\u79d2\u306b\u5ef6\u9577\u3059\u308b\u3002 +Option20 = 20:\u30a2\u30c9\u30ec\u30b90\u3067\u30a2\u30ca\u30ed\u30b0\u52d5\u529b\u3092\u5236\u5fa1\u3059\u308b\u6a5f\u80fd\u3092\u505c\u6b62\u3059\u308b Option21 = 21: Global default for new loco: FX Option22 = 22: Global default for new loco: 28 step -Option23 = 23:\u672A\u6307\u5B9A\u6642\u306B\u65B0\u898F\u52D5\u529B\u8ECA\u309214\u30B9\u30C6\u30C3\u30D7\u30E2\u30FC\u30C9\u306B\u3059\u308B +Option23 = 23:\u672a\u6307\u5b9a\u6642\u306b\u65b0\u898f\u52d5\u529b\u8eca\u309214\u30b9\u30c6\u30c3\u30d7\u30e2\u30fc\u30c9\u306b\u3059\u308b Option25 = 25: Disable aliasing -Option26 = 26:\u30EB\u30FC\u30C8\u6A5F\u80FD\u3092\u6709\u52B9\u306B\u3059\u308B +Option26 = 26:\u30eb\u30fc\u30c8\u6a5f\u80fd\u3092\u6709\u52b9\u306b\u3059\u308b Option27 = 27: Disable normal switch commands (Bushby bit) -Option28 = 28: \u96FB\u6E90\u6295\u5165\u6642\u306BDS54 interrogate\u3092\u7981\u6B62\u3059\u308B +Option28 = 28: \u96fb\u6e90\u6295\u5165\u6642\u306bDS54 interrogate\u3092\u7981\u6b62\u3059\u308b Option31 = 31: Meter route/switch output when not in trinary Option33 = 33: Restore track power to prior state at power on -Option34 = 34:\u96FB\u6E90\u6295\u5165\u6642\u306B\u7DDA\u8DEF\u96FB\u6E90\u3082\u8D70\u884C\u72B6\u614B\u306B\u3059\u308B\u3002 -Option36 = 36: Clear all mobile decoder info and consists -Option37 = 37:\u3059\u3079\u3066\u306E\u30EB\u30FC\u30C8\u3092\u6D88\u53BB\u3059\u308B -Option38 = 38:\u8ECA\u4E21\u306E\u30ED\u30FC\u30B9\u30BF\u30FC\u3092\u521D\u671F\u5316\u3059\u308B -Option39 = 39:\u3059\u3079\u3066\u306E\u5185\u90E8\u30E1\u30E2\u30EA\u30FC\u3092\u521D\u671F\u5316\u3059\u308B +Option34 = 34:\u96fb\u6e90\u6295\u5165\u6642\u306b\u7dda\u8def\u96fb\u6e90\u3082\u8d70\u884c\u72b6\u614b\u306b\u3059\u308b\u3002 +Option36 = 36: Clear all mobile decoder info and consists in CS +Option37 = 37:\u3059\u3079\u3066\u306e\u30eb\u30fc\u30c8\u3092\u6d88\u53bb\u3059\u308b +Option38 = 38:\u8eca\u4e21\u306e\u30ed\u30fc\u30b9\u30bf\u30fc\u3092\u521d\u671f\u5316\u3059\u308b +Option39 = 39:\u3059\u3079\u3066\u306e\u5185\u90e8\u30e1\u30e2\u30ea\u30fc\u3092\u521d\u671f\u5316\u3059\u308b Option41 = 41: Diagnostic click when LocoNet command received -Option42 = 42:\u8ECA\u4E21\u306E\u30A2\u30C9\u30EC\u30B9\u304C\u958B\u653E\u3055\u308C\u305F\u3068\u304D\u306B3\u56DE\u30D6\u30B6\u30FC\u3092\u9CF4\u3089\u3059\u6A5F\u80FD\u3092\u505C\u6B62\u3059\u308B +Option42 = 42:\u8eca\u4e21\u306e\u30a2\u30c9\u30ec\u30b9\u304c\u958b\u653e\u3055\u308c\u305f\u3068\u304d\u306b3\u56de\u30d6\u30b6\u30fc\u3092\u9cf4\u3089\u3059\u6a5f\u80fd\u3092\u505c\u6b62\u3059\u308b Option43 = 43: Disable LocoNet update of track status -Option44 = 44: \u30B9\u30ED\u30C3\u30C8\u3092120\u307E\u3067\u62E1\u5F35\u3059\u308B -Option45 = 45:\u30B9\u30A4\u30C3\u30C1\u72B6\u614B\u53D6\u5F97\u8981\u6C42\u306B\u5FDC\u7B54\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B -Option47 = 47: \u30D7\u30ED\u30B0\u30E9\u30E0\u30C8\u30E9\u30C3\u30AF\u306F\u30D6\u30EC\u30FC\u30AD\u3092\u751F\u6210\u3059\u308B\u3002 +Option44 = 44: \u30b9\u30ed\u30c3\u30c8\u3092120\u307e\u3067\u62e1\u5f35\u3059\u308b +Option45 = 45:\u30b9\u30a4\u30c3\u30c1\u72b6\u614b\u53d6\u5f97\u8981\u6c42\u306b\u5fdc\u7b54\u3057\u306a\u3044\u3088\u3046\u306b\u3059\u308b +Option47 = 47: \u30d7\u30ed\u30b0\u30e9\u30e0\u30c8\u30e9\u30c3\u30af\u306f\u30d6\u30ec\u30fc\u30ad\u3092\u751f\u6210\u3059\u308b\u3002 diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_nl.properties new file mode 100644 index 00000000000..1dc4f7fee36 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Defaultoptions_nl.properties @@ -0,0 +1,47 @@ +# Defaultoptions_nl.properties +# +# Dutch command station options +# Translation by Egbert Broerse + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 49 + +LabelTop = Centrale Configureren + +Option2 = 2: Boostermodus, geen Centrale +Option3 = 3: Booster met Keerlusfunctie +Option5 = 5: Stel in als Centrale +Option9 = 9: Motorola Trinary Echo voor adressen 1-64 aan +Option10 = 10: Motorola Trinary wissel-echo uitbreiden tot 256 +Option11 = 11: M Trinary wissels 57-64 met langere schakeltijd +Option12 = 12: Motorola Trinary adressen 1-80 actief +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option17 = 17: Automatische Geavanceerde Multitractie uitgeschakeld +Option18 = 18: Keerlusmelding van Booster verlengen tot 0,5 s +Option20 = 20: Analoog rijden (adres 0) uitgeschakeld +Option21 = 21: Standaardwaarde nieuwe lok: FX +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option25 = 25: Doorverwijzen uitgeschakeld +Option26 = 26: Wisselstraten actief +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option31 = 31: Snelle Wisselstraten/Wissels tenzij in Motorola Modus +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in Centrale +Option37 = 37: Alle Wisselstaten in Centrale wissen +Option38 = 38: Locinfo in Centrale wissen +Option39 = 39: Alle geheugens in Centrale wissen (reset fabrieksinstelling) +Option41 = 41: Diagnoseklik bij elk ontvangen LocoNet-bericht +Option42 = 42: Drie tonen bij wissen van Locadres uitschakelen +Option43 = 43: Aanpassen baanspanning via LocoNet uitschakelen +Option44 = 44: Locadresopslag uitbreiden tot 120 slots +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option47 = 47: Programmeerspoor werkt als rembaanvak diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions.properties new file mode 100644 index 00000000000..588af3dcc1f --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-II Programmer +Option1=Note: The Intellibox-II is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_da.properties new file mode 100644 index 00000000000..9c2412fad01 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_da.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions_da.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-II Programmer +Option1=Note: The Intellibox-II is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_de.properties new file mode 100644 index 00000000000..9aa5c18f355 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_de.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions_de.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-II Konfigurator +Option1=Achtung: Der Intellibox-II ist nicht konfigurierbar von JMRI. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_fr.properties new file mode 100644 index 00000000000..3d3707ad747 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_fr.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions_fr.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Programmateur Intellibox-II +Option1=Note: The Intellibox-II is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_it.properties new file mode 100644 index 00000000000..fdaa10d8143 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_it.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions_it.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Programmatore Intellibox-II +Option1=Note: The Intellibox-II is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_ja_JP.properties new file mode 100644 index 00000000000..c0b1b59be16 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_ja_JP.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions_ja_JP.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = \u30a4\u30f3\u30c6\u30ea\u30dc\u30c3\u30af\u30b9\u30d7\u30ed\u30b0\u30e9\u30de\u30fcII +Option1=Note: The Intellibox-II is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_nl.properties new file mode 100644 index 00000000000..00aab49217a --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-IIoptions_nl.properties @@ -0,0 +1,15 @@ +# Intellibox-IIoptions_nl.properties +# +# Default command station options for the Intellibox-II. +# As the IB-II is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-II +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-II Configuratie +Option1=De Intellibox-II is niet configureerbaar vanuit JMRI. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions.properties new file mode 100644 index 00000000000..afde6cf39de --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 1 + +LabelTop = Intellibox-I Programmer +Option1=Note: The Intellibox-I is not configurable using this tool. \ No newline at end of file diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_da.properties new file mode 100644 index 00000000000..ed757fa0350 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_da.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions_da.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-I Programmer +Option1=Note: The Intellibox-I is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_de.properties new file mode 100644 index 00000000000..02490d7b4bb --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_de.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions_de.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-I Konfigurator +Option1=Achtung: Der Intellibox-I ist nicht konfigurierbar von JMRI. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_fr.properties new file mode 100644 index 00000000000..133d26707ed --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_fr.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions_fr.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Programmateur Intellibox-I +Option1=Note: The Intellibox-I is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_it.properties new file mode 100644 index 00000000000..4c89ab01900 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_it.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions_it.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Programmatore Intellibox-I +Option1=Note: The Intellibox-I is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_ja_JP.properties new file mode 100644 index 00000000000..04aa60d7f95 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_ja_JP.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions_ja_JP.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = \u30a4\u30f3\u30c6\u30ea\u30dc\u30c3\u30af\u30b9\u30d7\u30ed\u30b0\u30e9\u30de\u30fc +Option1=Note: The Intellibox-I is not configurable using this tool. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_nl.properties new file mode 100644 index 00000000000..cdfd525e044 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intellibox-Ioptions_nl.properties @@ -0,0 +1,15 @@ +# Intellibox-Ioptions_nl.properties +# +# Default command station options for the Intellibox-I. +# As the IB-I is not configurable over the LocoNet connection, +# only shows a hint on a blank Configure CS pane. + +# CONFIG_SLOT is disabled for Intellibox-I +CONFIG_SLOT = -1 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION=1 + +LabelTop = Intellibox-I Configuratie +Option1=De Intellibox-I is niet configureerbaar vanuit JMRI. diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions.properties deleted file mode 100644 index c0a1581af42..00000000000 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Intelliboxoptions.properties -# -# -# Default command station options for the Intellibox. -# These were actually taken from the DCS100, and it's -# not at all clear what if anything should be here. - -# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 -CONFIG_SLOT = 127 -MIN_OPTION = 1 - -# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 -MAX_OPTION = 49 - -LabelTop = Intellibox Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_da.properties deleted file mode 100644 index c0a1581af42..00000000000 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_da.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Intelliboxoptions.properties -# -# -# Default command station options for the Intellibox. -# These were actually taken from the DCS100, and it's -# not at all clear what if anything should be here. - -# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 -CONFIG_SLOT = 127 -MIN_OPTION = 1 - -# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 -MAX_OPTION = 49 - -LabelTop = Intellibox Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_de.properties deleted file mode 100644 index ea3024c4701..00000000000 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_de.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Intelliboxoptions.properties -# -# by Simon Ginsburg -# German command station options for the Intellibox. -# These were actually taken from the DCS100, and it's -# not at all clear what if anything should be here. - -# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 -CONFIG_SLOT = 127 -MIN_OPTION = 1 - -# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 -MAX_OPTION = 49 - -LabelTop = Intellibox Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_fr.properties deleted file mode 100644 index 828b84fddba..00000000000 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_fr.properties +++ /dev/null @@ -1,23 +0,0 @@ -# Intelliboxoptions.properties -# -# -# Default command station options for the Intellibox. -# These were actually taken from the DCS100, and it's -# not at all clear what if anything should be here. - -# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 -CONFIG_SLOT = 127 -MIN_OPTION = 1 - -# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 -MAX_OPTION = 49 - -LabelTop = Programmateur Intellibox -LabelC = C -LabelT = T -ButtonRead = Lire -ButtonWrite =Écrire -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_it.properties deleted file mode 100644 index 80c23386bd0..00000000000 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_it.properties +++ /dev/null @@ -1,25 +0,0 @@ -# Intelliboxoptions.properties -# -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the Intellibox. -# These were actually taken from the DCS100, and it's -# not at all clear what if anything should be here. - -# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 -CONFIG_SLOT = 127 -MIN_OPTION = 1 - -# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 -MAX_OPTION = 49 - -LabelTop = Programmatore Intellibox -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_ja_JP.properties deleted file mode 100644 index e6c5e33af5c..00000000000 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Intelliboxoptions_ja_JP.properties +++ /dev/null @@ -1,24 +0,0 @@ -# Intelliboxoptions.properties -# -# -# Default command station options for the Intellibox. -# These were actually taken from the DCS100, and it's -# not at all clear what if anything should be here. -# Japanese translated by Sakae Akanuma - -# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 -CONFIG_SLOT = 127 -MIN_OPTION = 1 - -# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 -MAX_OPTION = 49 - -LabelTop = \u30A4\u30F3\u30C6\u30EA\u30DC\u30C3\u30AF\u30B9\u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u307F\u8FBC\u307F -ButtonWrite = \u66F8\u304D\u51FA\u3057 -CheckBoxReserved = \u4E88\u7D04\u30AA\u30D7\u30B7\u30E7\u30F3\u30B9\u30A4\u30C3\u30C1\u3092\u8868\u793A\u3059\u308B -Reserved = \u4E88\u7D04 - -HeadingText = Items describe effect on system operation when set "\u9589" diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions.properties index fe4de714fdb..8ea46df5532 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions.properties @@ -1,6 +1,5 @@ # LocoBufferoptions.properties # -# # Default command station options for the LocoBuffer-PS (Programming Station) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 @@ -11,21 +10,12 @@ MIN_OPTION = 1 MAX_OPTION = 41 LabelTop = LocoBuffer-PS (Programming Station) Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" Option4 = 4: Programmer mode only -Option5 = 5: Command station master mode +Option5 = 5: Command Station master mode Option13 = 13: Raise loco address purge time to 600 seconds Option14 = 14: Disable loco address purging Option22 = 22: Global default for new loco: 28 step Option23 = 23: Global default for new loco: 14 step Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_da.properties index fe4de714fdb..86f3fa56610 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_da.properties @@ -1,7 +1,6 @@ -# LocoBufferoptions.properties +# LocoBufferoptions_da.properties # -# -# Default command station options for the LocoBuffer-PS (Programming Station) +# Danish command station options for the LocoBuffer-PS (Programming Station) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,21 +10,12 @@ MIN_OPTION = 1 MAX_OPTION = 41 LabelTop = LocoBuffer-PS (Programming Station) Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" Option4 = 4: Programmer mode only -Option5 = 5: Command station master mode +Option5 = 5: Command Station master mode Option13 = 13: Raise loco address purge time to 600 seconds Option14 = 14: Disable loco address purging Option22 = 22: Global default for new loco: 28 step Option23 = 23: Global default for new loco: 14 step Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_de.properties index 315d50a3d53..07779517a72 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_de.properties @@ -1,7 +1,7 @@ # LocoBufferoptions_de.properties # -# by Simon Ginsburg # German command station options for the DB150 (Empire Builder) +# Translation by Simon Ginsburg # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 41 LabelTop = LocoBuffer-PS (ProgrammierenStation) Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen Option4 = 4: Nur Programmierermodus Option5 = 5: Zentraleinheitenmodus diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_fr.properties index 680ec966420..0359b01cdc0 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_fr.properties @@ -1,7 +1,6 @@ -# LocoBufferoptions.properties +# LocoBufferoptions_fr.properties # -# -# Default command station options for the LocoBuffer-PS (Programming Station) +# French command station options for the LocoBuffer-PS (Programming Station) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,21 +10,12 @@ MIN_OPTION = 1 MAX_OPTION = 41 LabelTop = Programmateur LocoBuffer-PS (Centrale de Programmation) -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé - -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" Option4 = 4: Mode Programmateur seulement -Option5 = 5: Centrale en mode Maitre -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans -Option33 = 33: Restaurer la puissance de la voie à l'état antérieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation - +Option5 = 5: Centrale en mode Maitre +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans +Option33 = 33: Restaurer la puissance de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_it.properties index c6516fbde3c..09271cad362 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_it.properties @@ -1,10 +1,7 @@ -# LocoBufferoptions.properties +# LocoBufferoptions_it.properties # -# -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) -# -# Default command station options for the LocoBuffer-PS (Programming Station) +# Italian command station options for the LocoBuffer-PS (Programming Station) +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -14,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 41 LabelTop = LocoBuffer-Programmatore PS (Stazione programmazione) -LabelC = C -LabelT = T -ButtonRead = Leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option4 = 4: Modo solo Programmatore Option5 = 5: Centralina in modo "master" @@ -31,4 +20,3 @@ Option22 = 22: Default Globale per nuova loco: 28 step Option23 = 23: Default Globale per nuova loco: 14 step Option33 = 33: Ripristina alimentazione rotaie alla accensione allo stato precedente Option34 = 34: Abilita alimentazione rotaie in stato di marcia - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_ja_JP.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_ja_JP.properties index a17eda38441..61445a0c89f 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_ja_JP.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_ja_JP.properties @@ -1,5 +1,4 @@ -# LocoBufferoptions.properties -# +# LocoBufferoptions_ja_JP.properties # # Japanese command station options for the LocoBuffer-PS (Programming Station) # Translated by Sakae Akanuma @@ -11,22 +10,13 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 41 -LabelTop = LocoBuffer-PS (\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u30B9\u30C6\u30FC\u30B7\u30E7\u30F3) \u30D7\u30ED\u30B0\u30E9\u30DE\u30FC -LabelC = C -LabelT = T -ButtonRead = \u8AAD\u51FA\u3057 -ButtonWrite = \u66F8\u8FBC -CheckBoxReserved = \u30EA\u30B6\u30FC\u30D6\u30C9\u30AA\u30D7\u30B7\u30E7\u30F3\u30B9\u30A4\u30C3\u30C1\u3092\u8868\u793A\u3059\u308B -Reserved = \u30EA\u30B6\u30FC\u30D6 - -HeadingText = \u8A18\u8F09\u3055\u308C\u305F\u9805\u76EE\u306F\u3001"\u9589"\u3067\u6709\u52B9\u3067\u3059\u3002 +LabelTop = LocoBuffer-PS (\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3) \u30d7\u30ed\u30b0\u30e9\u30de\u30fc -Option4 = 4: \u30D7\u30ED\u30B0\u30E9\u30DE\u30FC\u30E2\u30FC\u30C9\u306E\u307F -Option5 = 5: \u30B3\u30DE\u30F3\u30C9\u30B9\u30C6\u30FC\u30B7\u30E7\u30F3\u30DE\u30B9\u30BF\u30FC\u30E2\u30FC\u30C9 -Option13 = 13: 600\u79D2\u6BCE\u306B\u52D5\u529B\u8ECA\u306E\u30A2\u30C9\u30EC\u30B9\u3092\u958B\u653E\u3059\u308B -Option14 = 14: \u52D5\u529B\u8ECA\u306E\u30A2\u30C9\u30EC\u30B9\u958B\u653E\u3092\u3057\u306A\u3044\u3002 -Option22 = 22: \u65B0\u898F\u52D5\u529B\u8ECA\u306E\u898F\u5B9A\u306E\u901F\u5EA6\u5236\u5FA1\u309228\u30B9\u30C6\u30C3\u30D7\u30E2\u30FC\u30C9\u306B\u3059\u308B\u3002 -Option23 = 23: \u65B0\u898F\u52D5\u529B\u8ECA\u306E\u898F\u5B9A\u306E\u901F\u5EA6\u5236\u5FA1\u309214\u30B9\u30C6\u30C3\u30D7\u30E2\u30FC\u30C9\u306B\u3059\u308B\u3002 -Option33 = 33: \u96FB\u6E90\u6295\u5165\u6642\u306B\u7DDA\u8DEF\u96FB\u6E90\u306E\u72B6\u614B\u3092\u5FA9\u5E30\u3059\u308B +Option4 = 4: \u30d7\u30ed\u30b0\u30e9\u30de\u30fc\u30e2\u30fc\u30c9\u306e\u307f +Option5 = 5: \u30b3\u30de\u30f3\u30c9\u30b9\u30c6\u30fc\u30b7\u30e7\u30f3\u30de\u30b9\u30bf\u30fc\u30e2\u30fc\u30c9 +Option13 = 13: 600\u79d2\u6bce\u306b\u52d5\u529b\u8eca\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u958b\u653e\u3059\u308b +Option14 = 14: \u52d5\u529b\u8eca\u306e\u30a2\u30c9\u30ec\u30b9\u958b\u653e\u3092\u3057\u306a\u3044\u3002 +Option22 = 22: \u65b0\u898f\u52d5\u529b\u8eca\u306e\u898f\u5b9a\u306e\u901f\u5ea6\u5236\u5fa1\u309228\u30b9\u30c6\u30c3\u30d7\u30e2\u30fc\u30c9\u306b\u3059\u308b\u3002 +Option23 = 23: \u65b0\u898f\u52d5\u529b\u8eca\u306e\u898f\u5b9a\u306e\u901f\u5ea6\u5236\u5fa1\u309214\u30b9\u30c6\u30c3\u30d7\u30e2\u30fc\u30c9\u306b\u3059\u308b\u3002 +Option33 = 33: \u96fb\u6e90\u6295\u5165\u6642\u306b\u7dda\u8def\u96fb\u6e90\u306e\u72b6\u614b\u3092\u5fa9\u5e30\u3059\u308b Option34 = 34: Allow track to power up to run state - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_nl.properties new file mode 100644 index 00000000000..8a100c60bd7 --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/LocoBufferoptions_nl.properties @@ -0,0 +1,21 @@ +# LocoBufferoptions_nl.properties +# +# Dutch command station options for the LocoBuffer-PS (Programming Station) + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 41 + +LabelTop = LocoBuffer-PS (Programming Station) Configuratie + +Option4 = 4: Alleen Programmer-modus +Option5 = 5: Command station master mode +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions.properties index 33374a9167f..f8c043af19f 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions.properties @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 57 LabelTop = Mix-Master Programmer -LabelC = C -LabelT = T -ButtonRead = Read -ButtonWrite = Write -CheckBoxReserved = Show reserved option switches -Reserved = Reserved - -HeadingText = Items describe effect on system operation when set "closed" Option5 = 5: Command station master mode Option7 = 7: Enable Service-Mode programming @@ -32,9 +24,9 @@ Option28 = 28: Disable DS54 interrogate at power on Option30 = 30: Disable cyclic refresh of loco functions F5-F12 Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists +Option36 = 36: Clear all mobile decoder info and consists in CS Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option45 = 45: Disable reply for switch state request Option46 = 46: Brake generator half-speed (default zero-speed) Option47 = 47: Enable DCC output as brake speed generator diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_da.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_da.properties index b14e0a382fb..d870b22fea1 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_da.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_da.properties @@ -1,7 +1,7 @@ # Mix-Masteroptions_da.properties # -# by Dick Bronson -# Danish translation by Sonny Hansen# Overrides some Default command station options for the Mix-Master +# Danish translation by Sonny Hansen +# Overrides some Default command station options for the Mix-Master # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 57 LabelTop = Mix-Master Programmer -LabelC = C -LabelT = T -ButtonRead = L\u00e6s -ButtonWrite = Skriv -CheckBoxReserved = Vis reserverede option switches -Reserved = Reserveret - -HeadingText = Teksten beskriver effekten p\u00e5 systemet n\u00e5r C "Closed" bliver valgt Option5 = 5: Command station master mode Option7 = 7: Enable Service-Mode programming @@ -32,9 +24,9 @@ Option28 = 28: Disable DS54 interrogate at power on Option30 = 30: Disable cyclic refresh of loco functions F5-F12 Option33 = 33: Restore track power to prior state at power on Option34 = 34: Allow track to power up to run state -Option36 = 36: Clear all mobile decoder info and consists +Option36 = 36: Clear all mobile decoder info and consists in CS Option38 = 38: Clear the loco roster -Option39 = 39: Clear all internal memory +Option39 = 39: Clear all internal memory states Option45 = 45: Disable reply for switch state request Option46 = 46: Brake generator half-speed (default zero-speed) Option47 = 47: Enable DCC output as brake speed generator diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_de.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_de.properties index 048c0520215..eb105f29eb0 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_de.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_de.properties @@ -1,7 +1,7 @@ -# Mix-Masteroptions.properties +# Mix-Masteroptions_de.properties # -# by Rob Heikens # Default command station options for the Mix-Master +# Translation by Rob Heikens # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -11,14 +11,6 @@ MIN_OPTION = 1 MAX_OPTION = 57 LabelTop = Mischen-Meister Konfigurator -LabelC = G -LabelT = O -ButtonRead = Lesen -ButtonWrite = Schreiben -CheckBoxReserved = Zeige reservierte Optionen -Reserved = Reserviert - -HeadingText = Optionen zeigen Zustand wenn "G"eschlossen Option5 = 5\: Zentraleinheiten-Modus eingeschaltet Option7 = 7\: Service-Modus Programmierung zulassen @@ -38,4 +30,3 @@ Option39 = 39\: Gesamtspeicher l\u00f6schen Option45 = 45\: Antworten auf Weichenpositionsanfragen ausschalten Option46 = 46\: Halbe Geschwindigkeit des Bremsgenerators (Grundzustand Nullgeschwindigkeit) Option47 = 47\: DCC-Bremsgeschwindigkeitsgenerator eingeschaltet - diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_fr.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_fr.properties index 792abc2b377..7e08a0cd28c 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_fr.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_fr.properties @@ -1,7 +1,6 @@ -# Mix-Masteroptions.properties +# Mix-Masteroptions_fr.properties # -# by Dick Bronson -# Default command station options for the Mix-Master +# French command station options for the Mix-Master # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 @@ -10,31 +9,23 @@ MIN_OPTION = 1 # MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 MAX_OPTION = 57 -LabelTop = Programmateur Mix-Master -LabelC = C -LabelT = T -ButtonRead = Écriture -ButtonWrite = Lecture -CheckBoxReserved = Montrer les commutateurs d'options réservées -Reserved = Réservé +LabelTop = Programmateur Mix-Master -HeadingText = Les éléments décrivent l'effet sur le système en position "fermé" - -Option5 = 5: Centrale en mode Maitre +Option5 = 5: Centrale en mode Maitre Option7 = 7: Activer la programmation en Mode-Service -Option13 = 13: Augmenter le temps de purge de l'adresse de la loco à 600 secondes -Option14 = 14: Désactiver la purge de l'adresse de la loco -Option15 = 15: La purge force la loco à une vitesse nulle -Option22 = 22: Réglage par défaut pour une nouvelle loco: 28 crans -Option23 = 23: Réglage par défaut pour une nouvelle loco: 14 crans -Option27 = 27: Désactiver les commandes de commutation normale(Bushby bit) -Option28 = 28: Désactiver interroger DS54 à la mise sous tension -Option30 = 30: Désactiver le rafraichissement cyclique des fonctions F5-F12 de la loco -Option33 = 33: Restaurer l'alimentation de la voie à l'état antèrieur lors de la mise sous tension -Option34 = 34: Autoriser la voie à se mettre en exploitation -Option36 = 36: Effacer toutes les informations du décodeur mobile et des couplages +Option13 = 13: Augmenter le temps de purge de l'adresse de la loco \u00e1 600 secondes +Option14 = 14: D\u00e9sactiver la purge de l'adresse de la loco +Option15 = 15: La purge force la loco \u00e1 une vitesse nulle +Option22 = 22: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 28 crans +Option23 = 23: R\u00e9glage par d\u00e9faut pour une nouvelle loco: 14 crans +Option27 = 27: D\u00e9sactiver les commandes de commutation normale(Bushby bit) +Option28 = 28: D\u00e9sactiver interroger DS54 \u00e1 la mise sous tension +Option30 = 30: D\u00e9sactiver le rafraichissement cyclique des fonctions F5-F12 de la loco +Option33 = 33: Restaurer l'alimentation de la voie \u00e1 l'\u00e9tat ant\u00e9rieur lors de la mise sous tension +Option34 = 34: Autoriser la voie \u00e1 se mettre en exploitation +Option36 = 36: Effacer toutes les informations du d\u00e9codeur mobile et des couplages Option38 = 38: Effacer l'inventaire Loco -Option39 = 39: Effacer toute la mémoire interne -Option45 = 45: Désactiver la réponse quand l'état des commutateurs est demandé -Option46 = 46: Générateur de freinage à mi-vitesse (vitesse 0 par défaut) -Option47 = 47: Le programme de la voie est générateur de freinage +Option39 = 39: Effacer toute la m\u00e9moire interne +Option45 = 45: D\u00e9sactiver la r\u00e9ponse quand l'\u00e9tat des commutateurs est demand\u00e9 +Option46 = 46: G\u00e9n\u00e9rateur de freinage \u00e1 mi-vitesse (vitesse 0 par d\u00e9faut) +Option47 = 47: Le programme de la voie est g\u00e9n\u00e9rateur de freinage diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_it.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_it.properties index 1cb22df5f5e..4a2f02e724e 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_it.properties +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_it.properties @@ -1,10 +1,8 @@ -# Mix-Masteroptions.properties -# -# by Dick Bronson -# Default command station options for the Mix-Master -# -# Italian translation: Enzo Fortuna (babbo_enzo@yahoo.com ) +# Mix-Masteroptions_it.properties # +# Italian command station options for the Mix-Master +# Translation: Enzo Fortuna (babbo_enzo@yahoo.com ) + # Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 CONFIG_SLOT = 127 MIN_OPTION = 1 @@ -13,20 +11,12 @@ MIN_OPTION = 1 MAX_OPTION = 57 LabelTop = Mix-Master Programmer -LabelC = C -LabelT = T -ButtonRead = leggi -ButtonWrite = Scrivi -CheckBoxReserved = Visualizza opzioni riservate -Reserved = Riservato - -HeadingText = Oggetti che hanno effetto sul sistema quando configurati "chiusi" Option5 = 5: Centralina in modo "master" Option7 = 7: Abilita programmazione in modo "Servizio" Option13 = 13: Aumenta tempo di cancellazione loco a 600 secondi Option14 = 14: Disabilita cancellazione indirizzo loco -Option15 = 15: Cancellazione forzer\u00E0 la loco a velocit\u00E0 zero +Option15 = 15: Cancellazione forzer\u00e0 la loco a velocit\u00e0 zero Option22 = 22: Default Globale per nuova loco: 28 step Option23 = 23: Default Globale per nuova loco: 14 step Option27 = 27: Disabilita switch Comandi normale (Bushby bit) @@ -38,5 +28,5 @@ Option36 = 36: Cancella dati di tutti i decoder loco e consists Option38 = 38: Cancella l'elenco loco Option39 = 39: Cancella tutta la memoria interna Option45 = 45: Disabilita risposta su richiesta cambio di stato -Option46 = 46: Genera Frenata a velocit\u00E0 media (default=velocit\u00E0 zero) +Option46 = 46: Genera Frenata a velocit\u00e0 media (default=velocit\u00e0 zero) Option47 = 47: Abilita uscita DCC output come generatore frenata diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_nl.properties b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_nl.properties new file mode 100644 index 00000000000..2b8ae1bd86f --- /dev/null +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/Mix-Masteroptions_nl.properties @@ -0,0 +1,33 @@ +# Mix-Masteroptions_nl.properties +# +# Dutch command station options for the Mix-Master +# Translation by Egbert Broerse + +# Generally, CONFIG_SLOT is 127 and MIN_OPTION is 1 +CONFIG_SLOT = 127 +MIN_OPTION = 1 + +# MAX_OPTION-MIN_OPTION+1 must be a multiple of 8 +MAX_OPTION = 57 + +LabelTop = Mix-Master Configuratie + + +Option5 = 5: Stel in als Centrale +Option7 = 7: Service-Mode programming (POM) actief +Option13 = 13: Locadressen pas wissen na 600 secondes +Option14 = 14: Locadressen nooit wissen +Option15 = 15: Locadressen pas wissen na stilstand +Option22 = 22: Standaardwaarde nieuwe lok: 28 staps +Option23 = 23: Standaardwaarde nieuwe lok: 14 staps +Option27 = 27: Normale Wisselbesturing uitgeschakeld (Bushby Bit) +Option28 = 28: Opvragen status DS54 na opstarten uitgeschakeld +Option30 = 30: Herhalen van locfuncties F5-F12 uitgeschakeld +Option33 = 33: Na inschakelen baanspanning herstellen +Option34 = 34: Na inschakelen baanspanning en snelheid herstellen +Option36 = 36: Alle info over locs en tracties wissen in Centrale +Option38 = 38: Locinfo in Centrale wissen +Option39 = 39: Alle geheugens in Centrale wissen (reset fabrieksinstelling) +Option45 = 45: Antwoorden op wisselstandaanvraag uitschakelen +Option46 = 46: Remgenerator tot halve snelheid (t = naar 0) +Option47 = 47: DCC aansluiting werkt als rembaanvak diff --git a/java/src/jmri/jmrix/loconet/cmdstnconfig/XmlConfig.java b/java/src/jmri/jmrix/loconet/cmdstnconfig/XmlConfig.java index 8d029cce421..d4e16dc39e6 100644 --- a/java/src/jmri/jmrix/loconet/cmdstnconfig/XmlConfig.java +++ b/java/src/jmri/jmrix/loconet/cmdstnconfig/XmlConfig.java @@ -6,14 +6,12 @@ import org.jdom2.Element; /** - * - *
                * This file is part of JMRI. - *

                + *

                * JMRI is free software; you can redistribute it and/or modify it under the * terms of version 2 of the GNU General Public License as published by the Free * Software Foundation. See the "COPYING" file for a copy of this license. - *

                + *

                * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -54,4 +52,5 @@ static void dumpNode(Element node, int depth) { // initialize logging //private final static Logger log = LoggerFactory.getLogger(XmlConfig.class); + } diff --git a/java/src/jmri/jmrix/loconet/hexfile/LnHexFilePort.java b/java/src/jmri/jmrix/loconet/hexfile/LnHexFilePort.java index 8bd86258b18..786f9dcbe41 100644 --- a/java/src/jmri/jmrix/loconet/hexfile/LnHexFilePort.java +++ b/java/src/jmri/jmrix/loconet/hexfile/LnHexFilePort.java @@ -230,7 +230,7 @@ public String[] validBaudRates() { * @return the options */ public String[] validOption3() { - return new String[]{"Normal", "Spread", "One Only", "Both"}; + return new String[]{"Normal", "Spread", "One Only", "Both"}; // TODO I18N } /** diff --git a/java/src/jmri/jmrix/loconet/locobuffer/LocoBufferAdapter.java b/java/src/jmri/jmrix/loconet/locobuffer/LocoBufferAdapter.java index 10cdc46c12c..4466bbd4ea3 100644 --- a/java/src/jmri/jmrix/loconet/locobuffer/LocoBufferAdapter.java +++ b/java/src/jmri/jmrix/loconet/locobuffer/LocoBufferAdapter.java @@ -40,9 +40,9 @@ public LocoBufferAdapter(LocoNetSystemConnectionMemo adapterMemo) { option1Name = "FlowControl"; // NOI18N option2Name = "CommandStation"; // NOI18N option3Name = "TurnoutHandle"; // NOI18N - options.put(option1Name, new Option("Connection uses:", validOption1)); - options.put(option2Name, new Option("Command station type:", getCommandStationListWithStandaloneLN(), false)); - options.put(option3Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); + options.put(option1Name, new Option(Bundle.getMessage("XconnectionUsesLabel", Bundle.getMessage("TypeSerial")), validOption1)); + options.put(option2Name, new Option(Bundle.getMessage("CommandStationTypeLabel"), getCommandStationListWithStandaloneLN(), false)); + options.put(option3Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); // TODO I18N } /** diff --git a/java/src/jmri/jmrix/loconet/locobufferii/LocoBufferIIAdapter.java b/java/src/jmri/jmrix/loconet/locobufferii/LocoBufferIIAdapter.java index bf6fc92ee15..3fcb1b27e81 100644 --- a/java/src/jmri/jmrix/loconet/locobufferii/LocoBufferIIAdapter.java +++ b/java/src/jmri/jmrix/loconet/locobufferii/LocoBufferIIAdapter.java @@ -26,6 +26,6 @@ public String[] validBaudRates() { } public String option1Name() { - return "LocoBuffer-II connection uses "; + return Bundle.getMessage("XconnectionUsesLabel", "LocoBuffer-II"); } } diff --git a/java/src/jmri/jmrix/loconet/loconetovertcp/LnTcpDriverAdapter.java b/java/src/jmri/jmrix/loconet/loconetovertcp/LnTcpDriverAdapter.java index 1014e260796..bbe549a1ba1 100644 --- a/java/src/jmri/jmrix/loconet/loconetovertcp/LnTcpDriverAdapter.java +++ b/java/src/jmri/jmrix/loconet/loconetovertcp/LnTcpDriverAdapter.java @@ -21,8 +21,8 @@ public LnTcpDriverAdapter() { super(new LocoNetSystemConnectionMemo()); option2Name = "CommandStation"; option3Name = "TurnoutHandle"; - options.put(option2Name, new Option("Command station type:", commandStationNames, false)); // TODO I18N - options.put(option3Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); + options.put(option2Name, new Option(Bundle.getMessage("CommandStationTypeLabel"), commandStationNames, false)); + options.put(option3Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); // TODO I18N } /** diff --git a/java/src/jmri/jmrix/loconet/ms100/MS100Adapter.java b/java/src/jmri/jmrix/loconet/ms100/MS100Adapter.java index 38f804d687b..7a465cdc046 100644 --- a/java/src/jmri/jmrix/loconet/ms100/MS100Adapter.java +++ b/java/src/jmri/jmrix/loconet/ms100/MS100Adapter.java @@ -34,8 +34,8 @@ public MS100Adapter() { super(new LocoNetSystemConnectionMemo()); option2Name = "CommandStation"; // NOI18N option3Name = "TurnoutHandle"; // NOI18N - options.put(option2Name, new Option("Command station type:", commandStationNames, false)); - options.put(option3Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); + options.put(option2Name, new Option(Bundle.getMessage("CommandStationTypeLabel"), commandStationNames, false)); + options.put(option3Name, new Option("Turnout command handling:", new String[]{"Normal", "Spread", "One Only", "Both"})); // TODO I18N } Vector portNameVector = null; diff --git a/java/src/jmri/jmrix/loconet/pr2/PR2Adapter.java b/java/src/jmri/jmrix/loconet/pr2/PR2Adapter.java index 5a9be867dc3..6d303caeacc 100644 --- a/java/src/jmri/jmrix/loconet/pr2/PR2Adapter.java +++ b/java/src/jmri/jmrix/loconet/pr2/PR2Adapter.java @@ -18,7 +18,7 @@ public PR2Adapter() { super(new PR2SystemConnectionMemo()); options.remove(option2Name); - options.put(option2Name, new Option("Command station type:", commandStationOptions(), false)); + options.put(option2Name, new Option(Bundle.getMessage("CommandStationTypeLabel"), commandStationOptions(), false)); } /** diff --git a/java/src/jmri/jmrix/loconet/pr2/PR2SystemConnectionMemo.java b/java/src/jmri/jmrix/loconet/pr2/PR2SystemConnectionMemo.java index 5f05b5ae8ec..1b50eb5d979 100644 --- a/java/src/jmri/jmrix/loconet/pr2/PR2SystemConnectionMemo.java +++ b/java/src/jmri/jmrix/loconet/pr2/PR2SystemConnectionMemo.java @@ -89,8 +89,10 @@ public T get(Class type) { if (type.equals(jmri.AddressedProgrammerManager.class)) { return (T) getProgrammerManager(); } - - return super.get(type); + if(type.equals(jmri.ConsistManager.class)){ + return (T) getConsistManager(); + } + return null; } @Override @@ -110,8 +112,10 @@ public boolean provides(Class type) { if (type.equals(jmri.AddressedProgrammerManager.class)) { return getProgrammerManager().isAddressedModePossible(); } - - return super.provides(type); + if(type.equals(jmri.ConsistManager.class)){ + return(getConsistManager()!=null); + } + return false; } @Override diff --git a/java/src/jmri/jmrix/loconet/pr3/PR3SystemConnectionMemo.java b/java/src/jmri/jmrix/loconet/pr3/PR3SystemConnectionMemo.java index 9c140295a85..ab9a88873a2 100644 --- a/java/src/jmri/jmrix/loconet/pr3/PR3SystemConnectionMemo.java +++ b/java/src/jmri/jmrix/loconet/pr3/PR3SystemConnectionMemo.java @@ -53,7 +53,10 @@ public T get(Class T) { if (T.equals(jmri.PowerManager.class)) { return (T) getPowerManager(); } - return super.get(T); + if(T.equals(jmri.ConsistManager.class)){ + return (T) getConsistManager(); + } + return null; } final static int PR3MODE = 0x00; @@ -149,7 +152,10 @@ public boolean provides(Class type) { if (type.equals(jmri.PowerManager.class)) { return true; } - return super.provides(type); + if(type.equals(jmri.ConsistManager.class)){ + return(getConsistManager()!=null); + } + return false; } //private jmri.jmrix.loconet.pr2.LnPr2PowerManager powerManager; diff --git a/java/src/jmri/jmrix/loconet/uhlenbrock/ConnectionConfig.java b/java/src/jmri/jmrix/loconet/uhlenbrock/ConnectionConfig.java index f7ba7869515..83cbc9ecea2 100644 --- a/java/src/jmri/jmrix/loconet/uhlenbrock/ConnectionConfig.java +++ b/java/src/jmri/jmrix/loconet/uhlenbrock/ConnectionConfig.java @@ -25,7 +25,7 @@ public ConnectionConfig() { @Override public String name() { - return "Intellibox-II/IB-Com (USB)"; + return "Intellibox-II (USB)"; } // NOI18N @Override @@ -34,4 +34,5 @@ protected void setInstance() { adapter = new UhlenbrockAdapter(); } } + } diff --git a/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockAdapter.java b/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockAdapter.java index 04a059d13aa..311e588e761 100644 --- a/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockAdapter.java +++ b/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockAdapter.java @@ -33,7 +33,7 @@ public UhlenbrockAdapter() { validSpeeds = new String[]{Bundle.getMessage("Baud19200"), Bundle.getMessage("Baud38400"), Bundle.getMessage("Baud57600"), Bundle.getMessage("Baud115200")}; validSpeedValues = new int[]{19200, 38400, 57600, 115200}; - configureBaudRate("Baud115200"); //Set the default baud rate (localized) + configureBaudRate("Baud115200"); // Set the default baud rate (localized) } /** @@ -67,6 +67,7 @@ public String[] validBaudRates() { /** * Get an array of valid baud rates as integers. + * * @return list of value baud rates */ @Override @@ -80,7 +81,7 @@ public boolean okToSend() { } /** - * Local method to do specific configuration, overridden in class + * Local method to do specific configuration, overridden in class. */ @Override protected void setSerialPort(SerialPort activeSerialPort) throws UnsupportedCommOperationException { @@ -97,7 +98,7 @@ protected void setSerialPort(SerialPort activeSerialPort) throws UnsupportedComm } /** - * Provide just one valid command station value + * Provide just one valid command station value. */ public String[] commandStationOptions() { String[] retval = { diff --git a/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockConnectionTypeList.java b/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockConnectionTypeList.java index 26903163eb0..27bcfce20aa 100644 --- a/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockConnectionTypeList.java +++ b/java/src/jmri/jmrix/loconet/uhlenbrock/UhlenbrockConnectionTypeList.java @@ -4,8 +4,8 @@ import org.openide.util.lookup.ServiceProvider; /** - * Returns a list of valid Uhlenbrock Connection Types - *

                + * Returns a list of valid Uhlenbrock Connection Types. + * * @author Bob Jacobsen Copyright (C) 2010, 2014 * @author Kevin Dickerson Copyright (C) 2010 * @@ -28,4 +28,5 @@ public String[] getAvailableProtocolClasses() { public String[] getManufacturers() { return new String[]{UHLEN}; } + } diff --git a/java/src/jmri/jmrix/marklin/MarklinReply.java b/java/src/jmri/jmrix/marklin/MarklinReply.java index 773e0c454a4..0816c0a6558 100644 --- a/java/src/jmri/jmrix/marklin/MarklinReply.java +++ b/java/src/jmri/jmrix/marklin/MarklinReply.java @@ -1,13 +1,12 @@ package jmri.jmrix.marklin; - /** * Carries the reply to an MarklinMessage. *

                * * @author Bob Jacobsen Copyright (C) 2001, 2008 * @author Kevin Dickerson Copyright (C) 2007 - * + * */ public class MarklinReply extends jmri.jmrix.AbstractMRReply { @@ -29,9 +28,7 @@ public MarklinReply(int[] d) { //this(header); this(); _nDataChars = d.length; - for (int i = 0; i < d.length; i++) { - _dataChars[i] = d[i]; - } + System.arraycopy(d, 0, _dataChars, 0, d.length); } //Maximum size of a reply packet is 13 bytes. @@ -60,9 +57,6 @@ public int getElement(int n) { return super.getElement(n) & 0xff; } - //knowing where the end is we can then determine the error code - int endAtElement = -1; - //An event message is Unsolicited @Override public boolean isUnsolicited() { @@ -70,23 +64,22 @@ public boolean isUnsolicited() { } /** - * Returns a hex string representation of this MarklinReply + * Get a hex string representation of this MarklinReply. + * + * @return the hex string */ public String toHexString() { - StringBuffer buf = new StringBuffer(); - buf.append("0x" + Integer.toHexString(_dataChars[0])); + StringBuilder buf = new StringBuilder(); + buf.append("0x").append(Integer.toHexString(_dataChars[0])); for (int i = 1; i < _nDataChars; i++) { - buf.append(", 0x" + Integer.toHexString(_dataChars[i])); + buf.append(", 0x").append(Integer.toHexString(_dataChars[i])); } return buf.toString(); } public boolean isResponse() { - if ((getElement(1) & 0x01) == 0x01) { - return true; - } - return false; + return (getElement(1) & 0x01) == 0x01; } public int getCanDataLength() { diff --git a/java/src/jmri/jmrix/nce/ActiveFlag.java b/java/src/jmri/jmrix/nce/ActiveFlag.java deleted file mode 100644 index 25a4ffbaa95..00000000000 --- a/java/src/jmri/jmrix/nce/ActiveFlag.java +++ /dev/null @@ -1,27 +0,0 @@ -package jmri.jmrix.nce; - -/** - * Provide a flag to indicate that the system provided by this package is - * active. - *

                - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loadings. - * - * @author Bob Jacobsen Copyright (C) 2003 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlag { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } -} - - diff --git a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle.properties b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle.properties index d386666377a..7e7a5896eec 100644 --- a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle.properties +++ b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle.properties @@ -47,9 +47,9 @@ Display2 = Line 2 Cab Text TypeAIU = AIU TypeProCab = ProCab TypeCab04 = Cab04/06 -TypeUSB = USB +#TypeSerial = Serial < moved to jmri.jmrix.JmrixBundle +#TypeUSB = USB TypeUnknownCab = UNK TYPE -TypeSerial = Serial DirForward = FWD DirReverse = REV diff --git a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_da.properties b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_da.properties index 3d23a39eaa0..db25d56b5f9 100644 --- a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_da.properties +++ b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_da.properties @@ -46,7 +46,7 @@ Display2 = Line 2 Cab Text TypeAIU = AIU TypeProCab = ProCab TypeCab04 = Cab04/06 -TypeUSB = USB +#TypeUSB = USB < moved to jmri.jmrix.JmrixBundle TypeUnknownCab = UNK TYPE DirForward = FWD diff --git a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_fr.properties b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_fr.properties index 9504105bb8c..45e0fbdd804 100644 --- a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_fr.properties +++ b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_fr.properties @@ -47,12 +47,12 @@ UnknownCabId = UNK CAB Display1 = Ligne 1 texte Cab Display2 = Ligne 2 texte Cab -TypeAIU = AIU -TypeProCab = ProCab -TypeCab04 = Cab04/06 -TypeUSB = USB -TypeUnknownCab = UNK TYPE -TypeSerial = S\u00e9rie +TypeAIU = AIU +TypeProCab = ProCab +TypeCab04 = Cab04/06 +TypeUnknownCab = UNK TYPE +#TypeSerial = S\u00e9rie < moved to jmri.jmrix.JmrixBundle +#TypeUSB = USB DirForward = AV DirReverse = AR diff --git a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_it.properties b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_it.properties index 255141941dd..b09f2e3c480 100644 --- a/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_it.properties +++ b/java/src/jmri/jmrix/nce/cab/NceShowCabBundle_it.properties @@ -13,7 +13,7 @@ Number = Numero Type = Tipo AddrType = L/S Loco = Locomotiva -Speed = Velocit\u00E0 +Speed = Velocit\u00e0 Consist = Consist Functions = Funzioni Reply = Risposta: @@ -48,7 +48,7 @@ Display2 = Linea 2 testo Cab TypeAIU = AIU TypeProCab = ProCab TypeCab04 = Cab04/06 -TypeUSB = USB +#TypeUSB = USB < moved to jmri.jmrix.JmrixBundle TypeUnknownCab = Tipo Sconosciuto DirForward = AVANTI diff --git a/java/src/jmri/jmrix/nce/networkdriver/NetworkDriverAdapter.java b/java/src/jmri/jmrix/nce/networkdriver/NetworkDriverAdapter.java index dca125829e8..a2d21328f66 100644 --- a/java/src/jmri/jmrix/nce/networkdriver/NetworkDriverAdapter.java +++ b/java/src/jmri/jmrix/nce/networkdriver/NetworkDriverAdapter.java @@ -46,8 +46,6 @@ public void configure() { tc.connectPort(this); this.getSystemConnectionMemo().configureManagers(); - - jmri.jmrix.nce.ActiveFlag.setActive(); } } diff --git a/java/src/jmri/jmrix/nce/serialdriver/SerialDriverAdapter.java b/java/src/jmri/jmrix/nce/serialdriver/SerialDriverAdapter.java index 15a3bf90ee9..c0b9914f4a2 100644 --- a/java/src/jmri/jmrix/nce/serialdriver/SerialDriverAdapter.java +++ b/java/src/jmri/jmrix/nce/serialdriver/SerialDriverAdapter.java @@ -122,9 +122,6 @@ public void configure() { tc.connectPort(this); this.getSystemConnectionMemo().configureManagers(); - - jmri.jmrix.nce.ActiveFlag.setActive(); - } // base class methods for the NcePortController interface diff --git a/java/src/jmri/jmrix/nce/simulator/SimulatorAdapter.java b/java/src/jmri/jmrix/nce/simulator/SimulatorAdapter.java index 07ef931ed22..73fbf339fec 100644 --- a/java/src/jmri/jmrix/nce/simulator/SimulatorAdapter.java +++ b/java/src/jmri/jmrix/nce/simulator/SimulatorAdapter.java @@ -164,8 +164,6 @@ public void configure() { this.getSystemConnectionMemo().configureManagers(); - jmri.jmrix.nce.ActiveFlag.setActive(); - // start the simulator sourceThread = new Thread(this); sourceThread.setName("Nce Simulator"); diff --git a/java/src/jmri/jmrix/nce/usbdriver/UsbDriverAdapter.java b/java/src/jmri/jmrix/nce/usbdriver/UsbDriverAdapter.java index 812216a8b71..12e1c0ec070 100644 --- a/java/src/jmri/jmrix/nce/usbdriver/UsbDriverAdapter.java +++ b/java/src/jmri/jmrix/nce/usbdriver/UsbDriverAdapter.java @@ -202,8 +202,6 @@ public void configure() { tc.connectPort(this); this.getSystemConnectionMemo().configureManagers(); - - jmri.jmrix.nce.ActiveFlag.setActive(); } // base class methods for the NcePortController interface diff --git a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle.properties b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle.properties index 848426c7342..acf25264725 100644 --- a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle.properties +++ b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle.properties @@ -6,8 +6,8 @@ # in various forms in advanced preferences -jmri.jmrix.openlcb.swing.monitor.MonitorPane$Default = Open OpenLCB Monitor -jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane$Default = Open OpenLCB Console -jmri.jmrix.openlcb.swing.networktree.NetworkTreePane$Default = Open OpenLCB Network Config -jmri.jmrix.openlcb.swing.hub.HubPane$Default = Start OpenLCB Hub +jmri.jmrix.openlcb.swing.monitor.MonitorAction=Open OpenLCB Monitor +jmri.jmrix.openlcb.swing.send.OpenLcbCanSendAction=Open OpenLCB Console +jmri.jmrix.openlcb.swing.networktree.NetworkTreeAction=Open OpenLCB Network Config +jmri.jmrix.openlcb.swing.hub.HubAction=Start OpenLCB Hub diff --git a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_ca.properties b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_ca.properties index 7680bdab099..c10f085e9e1 100644 --- a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_ca.properties +++ b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_ca.properties @@ -6,8 +6,8 @@ # in various forms in advanced preferences -jmri.jmrix.openlcb.swing.monitor.MonitorPane$Default = Obre el Monitor de OpenLCB -jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane$Default = Obre la Consola de OpenLCB -jmri.jmrix.openlcb.swing.networktree.NetworkTreePane$Default = Obe la Configuraci\u00f3 de xarxa de OpenLCB -jmri.jmrix.openlcb.swing.hub.HubPane$Default = Inicia HUB OpenLCB +jmri.jmrix.openlcb.swing.monitor.MonitorAction=Obre el Monitor de OpenLCB +jmri.jmrix.openlcb.swing.send.OpenLcbCanSendAction=Obre la Consola de OpenLCB +jmri.jmrix.openlcb.swing.networktree.NetworkTreeAction=Obe la Configuraci\u00f3 de xarxa de OpenLCB +jmri.jmrix.openlcb.swing.hub.HubAction=Inicia HUB OpenLCB diff --git a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_cs.properties b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_cs.properties index 58836717f37..c13e8552f43 100644 --- a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_cs.properties +++ b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_cs.properties @@ -6,8 +6,8 @@ # in various forms in advanced preferences -jmri.jmrix.openlcb.swing.monitor.MonitorPane$Default = Otev\u0159\u00edt OpenLCB monitor -jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane$Default = Otev\u0159\u00edt OpenLCB konsole -jmri.jmrix.openlcb.swing.networktree.NetworkTreePane$Default = Otev\u0159\u00edt OpenLCB konfigurace s\u00edt\u011b -jmri.jmrix.openlcb.swing.hub.HubPane$Default = Start OpenLCB rozbo\u010dova\u010d +jmri.jmrix.openlcb.swing.monitor.MonitorAction=Otev\u0159\u00edt OpenLCB monitor +jmri.jmrix.openlcb.swing.send.OpenLcbCanSendAction=Otev\u0159\u00edt OpenLCB konsole +jmri.jmrix.openlcb.swing.networktree.NetworkTreeAction=Otev\u0159\u00edt OpenLCB konfigurace s\u00edt\u011b +jmri.jmrix.openlcb.swing.hub.HubAction=Start OpenLCB rozbo\u010dova\u010d diff --git a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_da.properties b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_da.properties index 848426c7342..acf25264725 100644 --- a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_da.properties +++ b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_da.properties @@ -6,8 +6,8 @@ # in various forms in advanced preferences -jmri.jmrix.openlcb.swing.monitor.MonitorPane$Default = Open OpenLCB Monitor -jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane$Default = Open OpenLCB Console -jmri.jmrix.openlcb.swing.networktree.NetworkTreePane$Default = Open OpenLCB Network Config -jmri.jmrix.openlcb.swing.hub.HubPane$Default = Start OpenLCB Hub +jmri.jmrix.openlcb.swing.monitor.MonitorAction=Open OpenLCB Monitor +jmri.jmrix.openlcb.swing.send.OpenLcbCanSendAction=Open OpenLCB Console +jmri.jmrix.openlcb.swing.networktree.NetworkTreeAction=Open OpenLCB Network Config +jmri.jmrix.openlcb.swing.hub.HubAction=Start OpenLCB Hub diff --git a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_fr.properties b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_fr.properties index 980e90cb8a0..48a29cd96c3 100644 --- a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_fr.properties +++ b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_fr.properties @@ -8,7 +8,7 @@ # Translated by Herv\u00e9 BLOREC le 2013-8-27 -jmri.jmrix.openlcb.swing.monitor.MonitorPane$Default = Ouvrir Moniteur OpenLCB -jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane$Default = Ouvrir Console OpenLCB -jmri.jmrix.openlcb.swing.networktree.NetworkTreePane$Default = Ouvrir Config R\u00e9seau OpenLCB -jmri.jmrix.openlcb.swing.hub.HubPane$Default = D\u00e9marrer le Concentrateur OpenLCB +jmri.jmrix.openlcb.swing.monitor.MonitorAction=Ouvrir Moniteur OpenLCB +jmri.jmrix.openlcb.swing.send.OpenLcbCanSendAction=Ouvrir Console OpenLCB +jmri.jmrix.openlcb.swing.networktree.NetworkTreeAction=Ouvrir Config R\u00e9seau OpenLCB +jmri.jmrix.openlcb.swing.hub.HubAction=D\u00e9marrer le Concentrateur OpenLCB diff --git a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_it.properties b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_it.properties index 63bc8e7a8f1..8efda85a3b7 100644 --- a/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_it.properties +++ b/java/src/jmri/jmrix/openlcb/OlcbActionListBundle_it.properties @@ -6,7 +6,7 @@ # Properties listing names for "Action" classes that can appear # in various forms in advanced preferences -jmri.jmrix.openlcb.swing.monitor.MonitorPane$Default = Apri Monitor OpenLCB -jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane$Default = Apri Consolle OpenLCB -jmri.jmrix.openlcb.swing.networktree.NetworkTreePane$Default = Apri Cofigurazione Rete OpenLCB -jmri.jmrix.openlcb.swing.hub.HubPane$Default = Lancia Hub OpenLCB +jmri.jmrix.openlcb.swing.monitor.MonitorAction=Apri Monitor OpenLCB +jmri.jmrix.openlcb.swing.send.OpenLcbCanSendAction=Apri Consolle OpenLCB +jmri.jmrix.openlcb.swing.networktree.NetworkTreeAction=Apri Cofigurazione Rete OpenLCB +jmri.jmrix.openlcb.swing.hub.HubAction=Lancia Hub OpenLCB diff --git a/java/src/jmri/jmrix/openlcb/swing/hub/HubAction.java b/java/src/jmri/jmrix/openlcb/swing/hub/HubAction.java new file mode 100644 index 00000000000..f8c3d429258 --- /dev/null +++ b/java/src/jmri/jmrix/openlcb/swing/hub/HubAction.java @@ -0,0 +1,14 @@ +package jmri.jmrix.openlcb.swing.hub; + +import jmri.jmrix.can.CanSystemConnectionMemo; + +public class HubAction extends jmri.jmrix.can.swing.CanNamedPaneAction { + + public HubAction() { + super("Openlcb Hub Control", + new jmri.util.swing.sdi.JmriJFrameInterface(), + HubPane.class.getName(), + jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); + } + +} diff --git a/java/src/jmri/jmrix/openlcb/swing/hub/HubPane.java b/java/src/jmri/jmrix/openlcb/swing/hub/HubPane.java index f9eed74e6cf..51cebebcf0a 100644 --- a/java/src/jmri/jmrix/openlcb/swing/hub/HubPane.java +++ b/java/src/jmri/jmrix/openlcb/swing/hub/HubPane.java @@ -176,19 +176,6 @@ public synchronized void reply(CanReply reply) { } } - /** - * Nested class to create one of these using old-style defaults - */ - static public class Default extends jmri.jmrix.can.swing.CanNamedPaneAction { - - public Default() { - super("Openlcb Hub Control", - new jmri.util.swing.sdi.JmriJFrameInterface(), - HubPane.class.getName(), - jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); - } - } - private final static Logger log = LoggerFactory.getLogger(HubPane.class); } diff --git a/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorAction.java b/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorAction.java index 39657c81e1f..c4a8d77571c 100644 --- a/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorAction.java +++ b/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorAction.java @@ -1,10 +1,18 @@ package jmri.jmrix.openlcb.swing.monitor; +import jmri.jmrix.can.CanSystemConnectionMemo; + /** * Swing action to create and register a MonitorFrame object * * @author Bob Jacobsen Copyright (C) 2009, 2010 - */ -public class MonitorAction extends MonitorPane.Default { + */ +public class MonitorAction extends jmri.jmrix.can.swing.CanNamedPaneAction { + public MonitorAction() { + super(Bundle.getMessage("MonitorTitle"), + new jmri.util.swing.sdi.JmriJFrameInterface(), + MonitorPane.class.getName(), + jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); + } } diff --git a/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorPane.java b/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorPane.java index 2fb76ab73ab..087749d0bed 100644 --- a/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorPane.java +++ b/java/src/jmri/jmrix/openlcb/swing/monitor/MonitorPane.java @@ -95,11 +95,11 @@ java.util.List frameToMessages(int header, int len, int[] content) { void format(String prefix, boolean extended, int header, int len, int[] content) { String raw = formatFrame(extended, header, len, content); - String formatted = prefix + ": Unknown frame " + raw; + String formatted; if (extended && (header & 0x08000000) != 0) { // is a message type java.util.List list = frameToMessages(header, len, content); - if (list == null || list.size() == 0) { + if (list == null || list.isEmpty()) { // didn't format, check for partial datagram if ((header & 0x0F000000) == 0x0B000000) { formatted = prefix + ": (Start of Datagram)"; @@ -107,14 +107,19 @@ void format(String prefix, boolean extended, int header, int len, int[] content) formatted = prefix + ": (Middle of Datagram)"; } else if (((header & 0x0FFFF000) == 0x09A08000) && (content.length > 0)) { // SNIP multi frame reply - if ((content[0] & 0xF0) == 0x10) { - formatted = prefix + ": SNIP Reply 1st frame"; - } else if ((content[0] & 0xF0) == 0x20) { - formatted = prefix + ": SNIP Reply last frame"; - } else if ((content[0] & 0xF0) == 0x30) { - formatted = prefix + ": SNIP Reply middle frame"; - } else { - formatted = prefix + ": SNIP Reply unknown"; + switch (content[0] & 0xF0) { + case 0x10: + formatted = prefix + ": SNIP Reply 1st frame"; + break; + case 0x20: + formatted = prefix + ": SNIP Reply last frame"; + break; + case 0x30: + formatted = prefix + ": SNIP Reply middle frame"; + break; + default: + formatted = prefix + ": SNIP Reply unknown"; + break; } } else { formatted = prefix + ": Unknown message " + raw; @@ -154,33 +159,16 @@ void format(String prefix, boolean extended, int header, int len, int[] content) @Override public synchronized void message(CanMessage l) { // receive a message and log it - if (log.isDebugEnabled()) { - log.debug("Message: " + l.toString()); - } + log.debug("Message: {}", l); format("S", l.isExtended(), l.getHeader(), l.getNumDataElements(), l.getData()); } @Override public synchronized void reply(CanReply l) { // receive a reply and log it - if (log.isDebugEnabled()) { - log.debug("Reply: " + l.toString()); - } + log.debug("Reply: {}", l); format("R", l.isExtended(), l.getHeader(), l.getNumDataElements(), l.getData()); } - /** - * Nested class to create one of these using old-style defaults - */ - static public class Default extends jmri.jmrix.can.swing.CanNamedPaneAction { - - public Default() { - super(Bundle.getMessage("MonitorTitle"), - new jmri.util.swing.sdi.JmriJFrameInterface(), - MonitorPane.class.getName(), - jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); - } - } - private final static Logger log = LoggerFactory.getLogger(MonitorPane.class); } diff --git a/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreeAction.java b/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreeAction.java index 62042fd38bd..a50e4f505d7 100644 --- a/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreeAction.java +++ b/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreeAction.java @@ -1,9 +1,18 @@ package jmri.jmrix.openlcb.swing.networktree; +import jmri.jmrix.can.CanSystemConnectionMemo; + /** * Swing action to create and register a MonitorFrame object * * @author Bob Jacobsen Copyright (C) 2009, 2010, 2012 - */ -public class NetworkTreeAction extends NetworkTreePane.Default { + */ +public class NetworkTreeAction extends jmri.jmrix.can.swing.CanNamedPaneAction { + + public NetworkTreeAction() { + super("Openlcb Network Tree", + new jmri.util.swing.sdi.JmriJFrameInterface(), + NetworkTreePane.class.getName(), + jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); + } } diff --git a/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreePane.java b/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreePane.java index 4dc3a2f4826..1f4a82e86ac 100644 --- a/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreePane.java +++ b/java/src/jmri/jmrix/openlcb/swing/networktree/NetworkTreePane.java @@ -3,7 +3,6 @@ import java.awt.Dimension; import javax.swing.JTree; import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import jmri.jmrix.can.CanListener; import jmri.jmrix.can.CanMessage; @@ -26,7 +25,7 @@ import org.slf4j.LoggerFactory; /** - * Frame displaying tree of OpenLCB nodes + * Frame displaying tree of OpenLCB nodes. * * @author Bob Jacobsen Copyright (C) 2009, 2010, 2012 */ @@ -36,7 +35,7 @@ public NetworkTreePane() { super(); } - CanSystemConnectionMemo memo; + private transient CanSystemConnectionMemo memo; @Override public void initContext(Object context) { @@ -65,19 +64,16 @@ public void initComponents(CanSystemConnectionMemo memo) { ); add(treePane); - treePane.addTreeSelectionListener(new TreeSelectionListener() { - @Override - public void valueChanged(TreeSelectionEvent e) { - JTree tree = (JTree) e.getSource(); - DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); + treePane.addTreeSelectionListener((TreeSelectionEvent e) -> { + JTree tree = (JTree) e.getSource(); + DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); - if (node == null) { - return; - } + if (node == null) { + return; + } - if (node.getUserObject() instanceof NodeTreeRep.SelectionKey) { - ((NodeTreeRep.SelectionKey) node.getUserObject()).select(node); - } + if (node.getUserObject() instanceof NodeTreeRep.SelectionKey) { + ((NodeTreeRep.SelectionKey) node.getUserObject()).select(node); } }); } @@ -105,35 +101,22 @@ public synchronized void message(CanMessage l) { // receive a message and log i public synchronized void reply(CanReply l) { // receive a reply and log it } - /** - * Nested class to create one of these using old-style defaults - */ - static public class Default extends jmri.jmrix.can.swing.CanNamedPaneAction { - - public Default() { - super("Openlcb Network Tree", - new jmri.util.swing.sdi.JmriJFrameInterface(), - NetworkTreePane.class.getName(), - jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); - } - } - @SuppressWarnings("unused") private final static Logger log = LoggerFactory.getLogger(NetworkTreePane.class); /** - * Nested class to open specific windows when proper tree element is picked + * Nested class to open specific windows when proper tree element is picked. */ - class ActionLoader extends NodeTreeRep.SelectionKeyLoader { + private class ActionLoader extends NodeTreeRep.SelectionKeyLoader { + private final ClientActions actions; + ActionLoader(OlcbInterface iface) { - this.iface = iface; actions = new ClientActions(iface); this.store = iface.getNodeStore(); this.mcs = iface.getMemoryConfigurationService(); } - OlcbInterface iface; MimicNodeStore store; MemoryConfigurationService mcs; @@ -149,7 +132,9 @@ public void select(DefaultMutableTreeNode rep) { description.append(ident.getUserName()); } if (ident.getUserDesc() != null && ident.getUserDesc().length() > 0) { - if (description.length() > 0) description.append(" - "); + if (description.length() > 0) { + description.append(" - "); + } description.append(ident.getUserDesc()); } if (description.length() == 0) { @@ -157,7 +142,9 @@ public void select(DefaultMutableTreeNode rep) { description.append(ident.getMfgName()); } if (ident.getModelName() != null && ident.getModelName().length() > 0) { - if (description.length() > 0) description.append(" - "); + if (description.length() > 0) { + description.append(" - "); + } description.append(ident.getModelName()); } } diff --git a/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendAction.java b/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendAction.java index 110f3effea9..97cfe4eeba8 100644 --- a/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendAction.java +++ b/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendAction.java @@ -1,9 +1,18 @@ package jmri.jmrix.openlcb.swing.send; +import jmri.jmrix.can.CanSystemConnectionMemo; + /** * Create and register a tool to send OpenLCB CAN frames. * * @author Bob Jacobsen Copyright (C) 2010 */ -public class OpenLcbCanSendAction extends OpenLcbCanSendPane.Default { +public class OpenLcbCanSendAction extends jmri.jmrix.can.swing.CanNamedPaneAction { + + public OpenLcbCanSendAction() { + super("Send CAN Frames and OpenLCB Messages", + new jmri.util.swing.sdi.JmriJFrameInterface(), + OpenLcbCanSendPane.class.getName(), + jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); + } } diff --git a/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendPane.java b/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendPane.java index dea0e057b9a..d1427ce7eb1 100644 --- a/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendPane.java +++ b/java/src/jmri/jmrix/openlcb/swing/send/OpenLcbCanSendPane.java @@ -50,7 +50,7 @@ *

              * * @author Bob Jacobsen Copyright (C) 2008, 2012 - * + * */ public class OpenLcbCanSendPane extends jmri.jmrix.can.swing.CanPanel implements CanListener { @@ -641,16 +641,6 @@ public void dispose() { super.dispose(); } - static public class Default extends jmri.jmrix.can.swing.CanNamedPaneAction { - - public Default() { - super("Send CAN Frames and OpenLCB Messages", - new jmri.util.swing.sdi.JmriJFrameInterface(), - OpenLcbCanSendPane.class.getName(), - jmri.InstanceManager.getDefault(CanSystemConnectionMemo.class)); - } - } - // private data private TrafficController tc = null; //was CanInterface private final static Logger log = LoggerFactory.getLogger(OpenLcbCanSendPane.class); diff --git a/java/src/jmri/jmrix/powerline/SerialSensor.java b/java/src/jmri/jmrix/powerline/SerialSensor.java index 0788e54a6ca..47aaba73e01 100644 --- a/java/src/jmri/jmrix/powerline/SerialSensor.java +++ b/java/src/jmri/jmrix/powerline/SerialSensor.java @@ -13,18 +13,14 @@ public class SerialSensor extends AbstractSensor { public SerialSensor(String systemName, SerialTrafficController tc) { super(systemName); - this.tc = tc; _knownState = UNKNOWN; } public SerialSensor(String systemName, SerialTrafficController tc, String userName) { super(systemName, userName); - this.tc = tc; _knownState = UNKNOWN; } - SerialTrafficController tc = null; - /** * Request an update on status. *

              diff --git a/java/src/jmri/jmrix/powerline/SerialTrafficController.java b/java/src/jmri/jmrix/powerline/SerialTrafficController.java index e4b3663175c..23e8dad7d77 100644 --- a/java/src/jmri/jmrix/powerline/SerialTrafficController.java +++ b/java/src/jmri/jmrix/powerline/SerialTrafficController.java @@ -204,7 +204,7 @@ public SerialSystemConnectionMemo getAdapterMemo() { return memo; } - private SerialSystemConnectionMemo memo = null; + protected SerialSystemConnectionMemo memo = null; SerialTrafficController self = null; boolean sendInterlock = false; // send the 00 interlock when CRC received diff --git a/java/src/jmri/jmrix/powerline/cm11/SpecificLight.java b/java/src/jmri/jmrix/powerline/cm11/SpecificLight.java index d7007c983c8..9fe99ac06c3 100644 --- a/java/src/jmri/jmrix/powerline/cm11/SpecificLight.java +++ b/java/src/jmri/jmrix/powerline/cm11/SpecificLight.java @@ -15,9 +15,6 @@ *

              * Keeps track of the controller's "dim count", and if not certain forces it to * zero to be sure. - *

              - * - * * * @author Dave Duchamp Copyright (C) 2004 * @author Bob Jacobsen Copyright (C) 2006, 2007, 2008, 2009, 2010 @@ -30,26 +27,25 @@ public class SpecificLight extends jmri.jmrix.powerline.SerialX10Light { * Create a Light object, with only system name. *

              * 'systemName' was previously validated in SerialLightManager + * * @param systemName systemName for light * @param tc tc for connection */ public SpecificLight(String systemName, SerialTrafficController tc) { super(systemName, tc); - this.tc = tc; } /** * Create a Light object, with both system and user names. *

              * 'systemName' was previously validated in SerialLightManager + * * @param systemName systemName for light * @param tc tc for connection * @param userName userName for light */ public SpecificLight(String systemName, SerialTrafficController tc, String userName) { super(systemName, tc, userName); - this.tc = tc; } - SerialTrafficController tc = null; } diff --git a/java/src/jmri/jmrix/powerline/cm11/SpecificReply.java b/java/src/jmri/jmrix/powerline/cm11/SpecificReply.java index 006208346d3..1caaeea6eb5 100644 --- a/java/src/jmri/jmrix/powerline/cm11/SpecificReply.java +++ b/java/src/jmri/jmrix/powerline/cm11/SpecificReply.java @@ -18,28 +18,23 @@ public class SpecificReply extends SerialReply { // create a new one public SpecificReply(SerialTrafficController tc) { super(tc); - this.tc = tc; setBinary(true); } public SpecificReply(String s, SerialTrafficController tc) { super(tc, s); - this.tc = tc; setBinary(true); } public SpecificReply(SerialReply l, SerialTrafficController tc) { super(tc, l); - this.tc = tc; setBinary(true); } - SerialTrafficController tc = null; - @Override public String toMonitorString() { // check for valid length - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (getNumDataElements() == 1) { int msg = getElement(0); switch (msg & 0xFF) { @@ -106,7 +101,7 @@ public String toMonitorString() { sb.append("Unknown reply of length "); sb.append(getNumDataElements()); sb.append(" "); - sb.append(toString() + "\n"); + sb.append(toString()).append("\n"); sb.append("\n"); return sb.toString(); } diff --git a/java/src/jmri/jmrix/powerline/cm11/SpecificTrafficController.java b/java/src/jmri/jmrix/powerline/cm11/SpecificTrafficController.java index aa308c7a2cb..57bd48504c2 100644 --- a/java/src/jmri/jmrix/powerline/cm11/SpecificTrafficController.java +++ b/java/src/jmri/jmrix/powerline/cm11/SpecificTrafficController.java @@ -39,8 +39,6 @@ public SpecificTrafficController(SerialSystemConnectionMemo memo) { } - SerialSystemConnectionMemo memo = null; - /** * Send a sequence of X10 messages *

              diff --git a/java/src/jmri/jmrix/powerline/cp290/SpecificTrafficController.java b/java/src/jmri/jmrix/powerline/cp290/SpecificTrafficController.java index 4e172bd9164..fe88d6a9bb7 100644 --- a/java/src/jmri/jmrix/powerline/cp290/SpecificTrafficController.java +++ b/java/src/jmri/jmrix/powerline/cp290/SpecificTrafficController.java @@ -41,8 +41,6 @@ public SpecificTrafficController(SerialSystemConnectionMemo memo) { } - SerialSystemConnectionMemo memo = null; - /** * Send a sequence of X10 messages *

              diff --git a/java/src/jmri/jmrix/powerline/insteon2412s/SpecificTrafficController.java b/java/src/jmri/jmrix/powerline/insteon2412s/SpecificTrafficController.java index b453912b450..037bb96db1e 100644 --- a/java/src/jmri/jmrix/powerline/insteon2412s/SpecificTrafficController.java +++ b/java/src/jmri/jmrix/powerline/insteon2412s/SpecificTrafficController.java @@ -41,8 +41,6 @@ public SpecificTrafficController(SerialSystemConnectionMemo memo) { } - SerialSystemConnectionMemo memo = null; - /** * Send a sequence of X10 messages *

              diff --git a/java/src/jmri/jmrix/powerline/simulator/SpecificTrafficController.java b/java/src/jmri/jmrix/powerline/simulator/SpecificTrafficController.java index aa355a9b456..52db21d3359 100644 --- a/java/src/jmri/jmrix/powerline/simulator/SpecificTrafficController.java +++ b/java/src/jmri/jmrix/powerline/simulator/SpecificTrafficController.java @@ -40,8 +40,6 @@ public SpecificTrafficController(SerialSystemConnectionMemo memo) { mWaitBeforePoll = 1000; // can take a long time to send } - SerialSystemConnectionMemo memo = null; - /** * Send a sequence of X10 messages. *

              diff --git a/java/src/jmri/jmrix/qsi/ActiveFlag.java b/java/src/jmri/jmrix/qsi/ActiveFlag.java deleted file mode 100644 index 6c04d47fae6..00000000000 --- a/java/src/jmri/jmrix/qsi/ActiveFlag.java +++ /dev/null @@ -1,28 +0,0 @@ -package jmri.jmrix.qsi; - -/** - * Provide a flag to indicate that the system provided by this package is - * active. - *

              - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loadings. - * - * @author Bob Jacobsen Copyright (C) 2007 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlag { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } -} - - - diff --git a/java/src/jmri/jmrix/qsi/serialdriver/SerialDriverAdapter.java b/java/src/jmri/jmrix/qsi/serialdriver/SerialDriverAdapter.java index 6b61f324bf1..765a77ab632 100644 --- a/java/src/jmri/jmrix/qsi/serialdriver/SerialDriverAdapter.java +++ b/java/src/jmri/jmrix/qsi/serialdriver/SerialDriverAdapter.java @@ -123,8 +123,6 @@ public void configure() { sinkThread.start(); // jmri.InstanceManager.setThrottleManager(new jmri.jmrix.qsi.QsiThrottleManager()); - jmri.jmrix.qsi.ActiveFlag.setActive(); - } private Thread sinkThread; diff --git a/java/src/jmri/jmrix/roco/z21/Z21Message.java b/java/src/jmri/jmrix/roco/z21/Z21Message.java index 91f9e0d8e41..978c59f92ec 100644 --- a/java/src/jmri/jmrix/roco/z21/Z21Message.java +++ b/java/src/jmri/jmrix/roco/z21/Z21Message.java @@ -224,6 +224,17 @@ public static Z21Message getLanRailComGetDataRequestMessage() { return retval; } + /** + * @return z21 message for LAN_SYSTEMSTATE_GETDATA + */ + public static Z21Message getLanSystemStateDataChangedRequestMessage(){ + Z21Message retval = new Z21Message(4); + retval.setElement(0, 0x04); + retval.setElement(1, 0x00); + retval.setElement(2, 0x85); + retval.setElement(3, 0x00); + return retval; + } public String toMonitorString() { switch(getOpCode()){ diff --git a/java/src/jmri/jmrix/roco/z21/Z21MultiMeter.java b/java/src/jmri/jmrix/roco/z21/Z21MultiMeter.java new file mode 100644 index 00000000000..727cfa5066e --- /dev/null +++ b/java/src/jmri/jmrix/roco/z21/Z21MultiMeter.java @@ -0,0 +1,98 @@ +package jmri.jmrix.roco.z21; + +import jmri.MultiMeter; +import jmri.beans.Bean; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Provide access to voltage and current readings from the Roco Z21 + * + * @author Mark Underwood (C) 2015 + * @author Paul Bender (C) 2017 + */ +public class Z21MultiMeter extends jmri.implementation.AbstractMultiMeter implements Z21Listener { + + private Z21TrafficController tc = null; + private Z21SystemConnectionMemo _memo = null; + + public Z21MultiMeter(Z21SystemConnectionMemo memo) { + super(0); // no timer, hardware automatically sends + // updates when changes detected. + _memo = memo; + tc = _memo.getTrafficController(); + + tc.addz21Listener(this); + + //initTimer(); + initializeHardwareMeter(); + + log.debug("Z21MultiMeter constructor called"); + + } + + public void setZ21TrafficController(Z21TrafficController controller) { + tc = controller; + } + + @Override + public void enable(){ + } + + @Override + public void disable(){ + } + + @Override + public void message(Z21Message m) { + } + + @Override + public void reply(Z21Reply r) { + log.debug("Z21MultiMeter received reply: {}", r.toString()); + if (r.isSystemDataChangedReply()) { + setCurrent(r.getSystemDataMainCurrent() * 1.0f); + setVoltage(r.getSystemDataVCCVoltage() * 1.0f); + } + + } + + @Override + protected void requestUpdateFromLayout() { + tc.sendz21Message(Z21Message.getLanSystemStateDataChangedRequestMessage(), this); + } + + @Override + public void initializeHardwareMeter() { + RocoZ21CommandStation cs = _memo.getRocoZ21CommandStation(); + cs.setSystemStatusMessagesFlag(true); + tc.sendz21Message(Z21Message.getLanSetBroadcastFlagsRequestMessage(cs.getZ21BroadcastFlags()),this); + } + + @Override + // Handle a timeout notification + public String getHardwareMeterName() { + return (_memo.getUserName()); + } + + @Override + public boolean hasCurrent() { + return true; + } + + @Override + public boolean hasVoltage() { + return true; + } + + /** + * Remove references to and from this object, so that it can eventually be + * garbage-collected. + */ + @Override + public void dispose() { + } + + private final static Logger log = LoggerFactory.getLogger(Z21MultiMeter.class); + +} diff --git a/java/src/jmri/jmrix/roco/z21/Z21Reply.java b/java/src/jmri/jmrix/roco/z21/Z21Reply.java index d8aaaf4d058..4ce4c586bdb 100644 --- a/java/src/jmri/jmrix/roco/z21/Z21Reply.java +++ b/java/src/jmri/jmrix/roco/z21/Z21Reply.java @@ -155,7 +155,7 @@ int getNumRailComDataEntries(){ */ jmri.DccLocoAddress getRailComLocoAddress(int n){ int offset = 4+(n*13); - int address = ((0xff&getElement(offset))<<8)+(0xff&(getElement(offset+1))); + int address = ((0xff&getElement(offset+1))<<8)+(0xff&(getElement(offset))); return new jmri.DccLocoAddress(address,address>=100); } @@ -167,10 +167,10 @@ jmri.DccLocoAddress getRailComLocoAddress(int n){ */ int getRailComRcvCount(int n){ int offset = 6+(n*13); // +2 to get past the address. - int rcvcount = ((0xff&getElement(offset))<<24) + - ((0xff&(getElement(offset+1))<<16) + - ((0xff&getElement(offset+2))<<8) + - (0xff&(getElement(offset+3)))); + int rcvcount = ((0xff&getElement(offset+3))<<24) + + ((0xff&(getElement(offset+2))<<16) + + ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset)))); return rcvcount; } @@ -182,10 +182,10 @@ int getRailComRcvCount(int n){ */ int getRailComErrCount(int n){ int offset = 10+(n*13); // +6 to get past the address and rcv count. - int errorcount = ((0xff&getElement(offset))<<24) + - ((0xff&(getElement(offset+1))<<16) + - ((0xff&getElement(offset+2))<<8) + - (0xff&(getElement(offset+3)))); + int errorcount = ((0xff&getElement(offset+3))<<24) + + ((0xff&(getElement(offset+2))<<16) + + ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset)))); return errorcount; } @@ -222,4 +222,105 @@ int getRailComTemp(int n){ return (0xff&(getElement(offset))); } + // handle System data replies + boolean isSystemDataChangedReply(){ + return (getOpCode() == 0x0085); + } + + /** + * Get the Main Track Current from the SystemStateDataChanged + * message. + * + * @return the current in mA. + */ + int getSystemDataMainCurrent(){ + if(!isSystemDataChangedReply()){ + throw new IllegalArgumentException("Wrong Reply Type"); + } + int offset = 4; //skip the headers + int current = ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset))); + return current; + } + + /** + * Get the Programming Track Current from the SystemStateDataChanged + * message. + * + * @return the current in mA. + */ + int getSystemDataProgCurrent(){ + if(!isSystemDataChangedReply()){ + throw new IllegalArgumentException("Wrong Reply Type"); + } + int offset = 6; //skip the headers + int current = ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset))); + return current; + } + + /** + * Get the Filtered Main Track Current from the SystemStateDataChanged + * message. + * + * @return the current in mA. + */ + int getSystemDataFilteredMainCurrent(){ + if(!isSystemDataChangedReply()){ + throw new IllegalArgumentException("Wrong Reply Type"); + } + int offset = 8; //skip the headers + int current = ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset))); + return current; + } + + /** + * Get the Temperature from the SystemStateDataChanged + * message. + * + * @return the current in degrees C. + */ + int getSystemDataTemperature(){ + if(!isSystemDataChangedReply()){ + throw new IllegalArgumentException("Wrong Reply Type"); + } + int offset = 10; //skip the headers + int current = ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset))); + return current; + } + + /** + * Get the Supply Voltage from the SystemStateDataChanged + * message. + * + * @return the current in mV. + */ + int getSystemDataSupplyVoltage(){ + if(!isSystemDataChangedReply()){ + throw new IllegalArgumentException("Wrong Reply Type"); + } + int offset = 12; //skip the headers + int current = ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset))); + return current; + } + + /** + * Get the VCC (and track) Voltage from the SystemStateDataChanged + * message. + * + * @return the current in mV. + */ + int getSystemDataVCCVoltage(){ + if(!isSystemDataChangedReply()){ + throw new IllegalArgumentException("Wrong Reply Type"); + } + int offset = 14; //skip the headers + int current = ((0xff&getElement(offset+1))<<8) + + (0xff&(getElement(offset))); + return current; + } + } diff --git a/java/src/jmri/jmrix/roco/z21/Z21SystemConnectionMemo.java b/java/src/jmri/jmrix/roco/z21/Z21SystemConnectionMemo.java index 94916c3b6ae..d57c1061a54 100644 --- a/java/src/jmri/jmrix/roco/z21/Z21SystemConnectionMemo.java +++ b/java/src/jmri/jmrix/roco/z21/Z21SystemConnectionMemo.java @@ -93,6 +93,9 @@ public boolean provides(Class type) { if (type.equals(jmri.ReporterManager.class)){ return true; } + if (type.equals(jmri.MultiMeter.class)){ + return true; + } if (_xnettunnel!=null) { // delegate to the XPressNet tunnel. return _xnettunnel.getStreamPortController().getSystemConnectionMemo().provides(type); @@ -112,6 +115,9 @@ public T get(Class T) { if(T.equals(jmri.ReporterManager.class)){ return (T) getReporterManager(); } + if(T.equals(jmri.MultiMeter.class)){ + return (T) getMultiMeter(); + } if (_xnettunnel!=null) { // delegate to the XPressNet tunnel. return _xnettunnel.getStreamPortController().getSystemConnectionMemo().get(T); @@ -147,6 +153,9 @@ public void configureManagers() { jmri.InstanceManager.store(getReporterManager(),jmri.ReporterManager.class); } + // setup the MultiMeter + getMultiMeter(); + } @Override @@ -185,6 +194,23 @@ public void setRocoZ21CommandStation(RocoZ21CommandStation c) { private RocoZ21CommandStation z21CommandStation = null; + /** + * Provide access to the Roco Z21 MultiMeter for this particular + * connection. + *

              + * NOTE: MultiMeter defaults to NULL + */ + public jmri.MultiMeter getMultiMeter() { + if(meter == null){ + meter = new Z21MultiMeter(this); + jmri.InstanceManager.store(meter,jmri.MultiMeter.class); + } + return meter; + } + + private Z21MultiMeter meter = null; + + void shutdownTunnel(){ if (_xnettunnel!=null) { _xnettunnel.dispose(); diff --git a/java/src/jmri/jmrix/rps/Transform.java b/java/src/jmri/jmrix/rps/Transform.java deleted file mode 100644 index be0e57b0c6c..00000000000 --- a/java/src/jmri/jmrix/rps/Transform.java +++ /dev/null @@ -1,12 +0,0 @@ -package jmri.jmrix.rps; - - -/** - * Tools for geometric transformations for RPS. - * - * @author Bob Jacobsen Copyright (C) 2007 - */ -public class Transform { -} - - diff --git a/java/src/jmri/jmrix/sprog/ActiveFlag.java b/java/src/jmri/jmrix/sprog/ActiveFlag.java deleted file mode 100644 index 97ac1191471..00000000000 --- a/java/src/jmri/jmrix/sprog/ActiveFlag.java +++ /dev/null @@ -1,30 +0,0 @@ -package jmri.jmrix.sprog; - - -/** - * Provide a flag to indicate that the subsystem provided by this package is - * active. - *

              - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loadings. - * - * @author Bob Jacobsen Copyright (C) 2003 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlag { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } - -} - - - diff --git a/java/src/jmri/jmrix/sprog/ActiveFlagCS.java b/java/src/jmri/jmrix/sprog/ActiveFlagCS.java deleted file mode 100644 index bd1fe9815a4..00000000000 --- a/java/src/jmri/jmrix/sprog/ActiveFlagCS.java +++ /dev/null @@ -1,30 +0,0 @@ -package jmri.jmrix.sprog; - - -/** - * Provide a flag to indicate that the subsystem provided by this package is - * active. - *

              - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loading. - * - * @author Andrew Crosland Copyright (C) 2006 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlagCS { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } - -} - - - diff --git a/java/src/jmri/jmrix/sprog/serialdriver/SerialDriverAdapter.java b/java/src/jmri/jmrix/sprog/serialdriver/SerialDriverAdapter.java index 0d862d7016e..e709e38b45f 100644 --- a/java/src/jmri/jmrix/sprog/serialdriver/SerialDriverAdapter.java +++ b/java/src/jmri/jmrix/sprog/serialdriver/SerialDriverAdapter.java @@ -207,12 +207,6 @@ public void configure() { this.getSystemConnectionMemo().configureCommandStation(); this.getSystemConnectionMemo().configureManagers(); - if (this.getSystemConnectionMemo().getSprogMode() == SprogMode.OPS) { - jmri.jmrix.sprog.ActiveFlagCS.setActive(); - } else { - jmri.jmrix.sprog.ActiveFlag.setActive(); - } - if (getOptionState("TrackPowerState") != null && getOptionState("TrackPowerState").equals(Bundle.getMessage("PowerStateOn"))) { try { this.getSystemConnectionMemo().getPowerManager().setPower(jmri.PowerManager.ON); diff --git a/java/src/jmri/jmrix/srcp/ActiveFlag.java b/java/src/jmri/jmrix/srcp/ActiveFlag.java deleted file mode 100644 index 7e5c268eaab..00000000000 --- a/java/src/jmri/jmrix/srcp/ActiveFlag.java +++ /dev/null @@ -1,28 +0,0 @@ -package jmri.jmrix.srcp; - -/** - * Provide a flag to indicate that the system provided by this package is - * active. - *

              - * This is a very light-weight class, carrying only the flag, so as to limit the - * number of unneeded class loadings. - * - * @author Bob Jacobsen Copyright (C) 2003 - * @deprecated since 4.5.1 - */ -@Deprecated -abstract public class ActiveFlag { - - static private boolean flag = false; - - static public void setActive() { - flag = true; - } - - static public boolean isActive() { - return flag; - } -} - - - diff --git a/java/src/jmri/jmrix/srcp/networkdriver/NetworkDriverAdapter.java b/java/src/jmri/jmrix/srcp/networkdriver/NetworkDriverAdapter.java index 56bb76b8627..a1eb41c12e0 100644 --- a/java/src/jmri/jmrix/srcp/networkdriver/NetworkDriverAdapter.java +++ b/java/src/jmri/jmrix/srcp/networkdriver/NetworkDriverAdapter.java @@ -32,9 +32,6 @@ public void configure() { this.getSystemConnectionMemo().setTrafficController(control); this.getSystemConnectionMemo().configureManagers(); this.getSystemConnectionMemo().configureCommandStation(); - - // mark OK for menus - jmri.jmrix.srcp.ActiveFlag.setActive(); } @Override diff --git a/java/src/jmri/jmrix/tams/TamsSensorManager.java b/java/src/jmri/jmrix/tams/TamsSensorManager.java index 29c26ddb052..78c23edae2f 100644 --- a/java/src/jmri/jmrix/tams/TamsSensorManager.java +++ b/java/src/jmri/jmrix/tams/TamsSensorManager.java @@ -18,20 +18,19 @@ * * @author Kevin Dickerson Copyright (C) 2009 * @author Jan Boen and Sergiu Costan - * - * Rework Poll for status using binary commands send xEvtSen (78 CB)h - * this returns multiple bytes first byte address of the S88 sensor, - * second and third bytes = values of that sensor this repeats for each - * sensor with changes the last byte contains 00h this means all - * reports have been received - * - * xEvtSen reports sensor changes + * + * Rework Poll for status using binary commands send xEvtSen (78 CB)h this + * returns multiple bytes first byte address of the S88 sensor, second and third + * bytes = values of that sensor this repeats for each sensor with changes the + * last byte contains 00h this means all reports have been received + * + * xEvtSen reports sensor changes */ public class TamsSensorManager extends jmri.managers.AbstractSensorManager implements TamsListener { //Create a local TamsMessage Queue which we will use in combination with TamsReplies - private Queue tmq = new LinkedList(); - + private final Queue tmq = new LinkedList<>(); + //This dummy message is used in case we expect a reply from polling static private TamsMessage myDummy() { //log.info("*** myDummy ***"); @@ -43,6 +42,7 @@ static private TamsMessage myDummy() { m.setReplyType('S'); return m; } + static private TamsMessage xSR() { //log.info("*** xSR ***"); TamsMessage m = new TamsMessage("xSR 1"); @@ -78,7 +78,7 @@ public TamsSensorManager(TamsSystemConnectionMemo memo) { TamsSystemConnectionMemo memo; TamsTrafficController tc; //The hash table simply holds the object number against the TamsSensor ref. - private Hashtable> _ttams = new Hashtable>(); // stores known Tams Obj + private Hashtable> _ttams = new Hashtable<>(); // stores known Tams Obj @Override public String getSystemPrefix() { @@ -94,12 +94,12 @@ public Sensor createNewSensor(String systemName, String userName) { int channel = 0; String curAddress = systemName.substring(getSystemPrefix().length() + 1, systemName.length()); - int seperator = curAddress.indexOf(":"); + int seperator = curAddress.indexOf(':'); try { - board = Integer.valueOf(curAddress.substring(0, seperator)).intValue(); + board = Integer.parseInt(curAddress.substring(0, seperator)); //log.info("Creating new TamsSensor with board: " + board); if (!_ttams.containsKey(board)) { - _ttams.put(board, new Hashtable()); + _ttams.put(board, new Hashtable<>()); //log.info("_ttams: " + _ttams.toString()); /*if (_ttams.size() == 1) { synchronized (pollHandler) { @@ -113,7 +113,7 @@ public Sensor createNewSensor(String systemName, String userName) { } Hashtable sensorList = _ttams.get(board); try { - channel = Integer.valueOf(curAddress.substring(seperator + 1)).intValue(); + channel = Integer.parseInt(curAddress.substring(seperator + 1)); if (!sensorList.containsKey(channel)) { sensorList.put(channel, s); } @@ -147,15 +147,15 @@ public String createSystemName(String curAddress, String prefix) throws JmriExce } //Address format passed is in the form of board:channel or T:turnout address - int seperator = curAddress.indexOf(":"); + int seperator = curAddress.indexOf(':'); try { - board = Integer.valueOf(curAddress.substring(0, seperator)).intValue(); + board = Integer.parseInt(curAddress.substring(0, seperator)); } catch (NumberFormatException ex) { log.error("First part of {} in front of : should be a number", curAddress); throw new JmriException("Module Address passed should be a number"); } try { - port = Integer.valueOf(curAddress.substring(seperator + 1)).intValue(); + port = Integer.parseInt(curAddress.substring(seperator + 1)); } catch (NumberFormatException ex) { log.error("Second part of {} after : should be a number", curAddress); throw new JmriException("Port Address passed should be a number"); @@ -184,7 +184,7 @@ public String createSystemName(String curAddress, String prefix) throws JmriExce @Override public String getNextValidAddress(String curAddress, String prefix) { - String tmpSName = ""; + String tmpSName; try { tmpSName = createSystemName(curAddress, prefix); @@ -203,7 +203,7 @@ public String getNextValidAddress(String curAddress, String prefix) { try { tmpSName = createSystemName(board + ":" + port, prefix); } catch (JmriException e) { - log.error("Error creating system name for " + board + ":" + port); + log.error("Error creating system name for {}:{}", board, port); } s = getBySystemName(tmpSName); if (s == null) { @@ -235,9 +235,11 @@ void padPortNumber(int portNo, StringBuilder sb) { } /** - * Determine if it is possible to add a range of sensors in - * numerical order eg 1 to 16, primarily used to enable/disable the add - * range box in the add sensor panel + * Determine if it is possible to add a range of sensors in numerical order + * eg 1 to 16, primarily used to enable/disable the add range box in the add + * sensor panel. + * + * @return true */ @Override public boolean allowMultipleAdditions(String systemName) { @@ -248,20 +250,19 @@ public boolean allowMultipleAdditions(String systemName) { @Override public void reply(TamsReply r) { //log.info("*** TamsReply ***"); - if(tmq.isEmpty()){ + if (tmq.isEmpty()) { tm = myDummy(); - } else - { + } else { tm = tmq.poll(); } //log.info("ReplyType = " + tm.getReplyType() + ", Binary? = " + tm.isBinary()+ ", OneByteReply = " + tm.getReplyOneByte()); - if (tm.getReplyType() == 'S'){//Only handle Sensor events - if (tm.isBinary() == true){//Typical polling message - if ((r.getNumDataElements() > 1) && (r.getElement(0) > 0x00)){ + if (tm.getReplyType() == 'S') {//Only handle Sensor events + if (tm.isBinary() == true) {//Typical polling message + if ((r.getNumDataElements() > 1) && (r.getElement(0) > 0x00)) { //Here we break up a long sensor related TamsReply into individual S88 module status' int numberOfReplies = r.getNumDataElements() / 3; //log.info("Incoming Reply = "); - for (int i = 0; i < r.getNumDataElements(); i++){ + for (int i = 0; i < r.getNumDataElements(); i++) { //log.info("Byte " + i + " = " + jmri.util.StringUtil.appendTwoHexFromInt(r.getElement(i) & 0xFF, "")); } //log.info("length of reply = " + r.getNumDataElements() + " & number of replies = " + numberOfReplies); @@ -309,10 +310,7 @@ protected void startPolling() { static class PollHandler implements Runnable {//Why do we need this? - TamsSensorManager sm = null; - PollHandler(TamsSensorManager tsm) { - sm = tsm; } @Override diff --git a/java/src/jmri/jmrix/zimo/Mx1ProgrammerManager.java b/java/src/jmri/jmrix/zimo/Mx1ProgrammerManager.java index 625b469d39e..267a535a09d 100644 --- a/java/src/jmri/jmrix/zimo/Mx1ProgrammerManager.java +++ b/java/src/jmri/jmrix/zimo/Mx1ProgrammerManager.java @@ -6,22 +6,19 @@ import jmri.managers.DefaultProgrammerManager; /** - * Extend DefaultProgrammerManager to provide ops mode programmers for MRC - * systems + * Extend DefaultProgrammerManager to provide ops mode programmers for Zimo + * systems. * * @see jmri.managers.DefaultProgrammerManager - * @author Bob Jacobsen Copyright (C) 2002 - * @author Ken Cameron Copyright (C) 2014 + * @author Bob Jacobsen Copyright (C) 2002 + * @author Ken Cameron Copyright (C) 2014 * @author Kevin Dickerson Copyright (C) 2014 * */ public class Mx1ProgrammerManager extends DefaultProgrammerManager { - Mx1TrafficController tc; - public Mx1ProgrammerManager(Programmer serviceModeProgrammer, Mx1SystemConnectionMemo memo) { super(serviceModeProgrammer, memo); - this.tc = memo.getMx1TrafficController(); } /** @@ -41,7 +38,6 @@ public boolean isGlobalProgrammerAvailable() { @Override public AddressedProgrammer getAddressedProgrammer(boolean pLongAddress, int pAddress) { - //return new MrcOpsModeProgrammer(tc, pAddress, pLongAddress); return null; } diff --git a/java/src/jmri/managers/AbstractLightManager.java b/java/src/jmri/managers/AbstractLightManager.java index bb1b7d65635..c7f15ade37f 100644 --- a/java/src/jmri/managers/AbstractLightManager.java +++ b/java/src/jmri/managers/AbstractLightManager.java @@ -1,5 +1,7 @@ package jmri.managers; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; import jmri.Light; import jmri.LightManager; import jmri.Manager; @@ -16,17 +18,25 @@ public abstract class AbstractLightManager extends AbstractManager implements LightManager, java.beans.PropertyChangeListener { + /** + * constructor + */ public AbstractLightManager() { super(); } + /** + * get XML order + * + * @return the XML order + */ @Override public int getXMLOrder() { return Manager.LIGHTS; } /** - * Returns the type letter in the system name for a Light + * {@inheritDoc} */ @Override public char typeLetter() { @@ -34,86 +44,63 @@ public char typeLetter() { } /** - * Locate via user name, then system name if needed. If that fails, create a - * new Light: If the name is a valid system name, it will be used for the - * new Light. Otherwise, the makeSystemName method will attempt to turn it - * into a valid system name. - * - * @return Never null unless valid systemName cannot be found + * {@inheritDoc} */ @Override - public Light provideLight(String name) { + @Nonnull + public Light provideLight(@Nonnull String name) { Light t = getLight(name); - if (t != null) { - return t; - } - if (name.startsWith(getSystemPrefix() + typeLetter())) { - return newLight(name, null); - } else if (name.length() > 0) { - return newLight(makeSystemName(name), null); - } else { - throw new IllegalArgumentException("\""+name+"\" is invalid"); + if (t == null) { + if (name.startsWith(getSystemPrefix() + typeLetter())) { + return newLight(name, null); + } else if (name.length() > 0) { + return newLight(makeSystemName(name), null); + } else { + throw new IllegalArgumentException("\"" + name + "\" is invalid"); + } } + return t; } /** - * Locate via user name, then system name if needed. Does not create a new - * one if nothing found - * - * @return null if no match found + * {@inheritDoc} */ @Override - public Light getLight(String name) { - Light t = getByUserName(name); - if (t != null) { - return t; + @CheckForNull + public Light getLight(@Nonnull String name) { + Light result = getByUserName(name); + if (result == null) { + result = getBySystemName(name); } - - return getBySystemName(name); + return result; } /** - * Locate a Light by its system name + * {@inheritDoc} */ @Override - public Light getBySystemName(String name) { + @CheckForNull + public Light getBySystemName(@Nonnull String name + ) { return _tsys.get(name); } /** - * Locate a Light by its user name + * {@inheritDoc} */ @Override - public Light getByUserName(String key) { + @CheckForNull + public Light getByUserName(@Nonnull String key + ) { return _tuser.get(key); } /** - * Return an instance with the specified system and user names. Note that - * two calls with the same arguments will get the same instance; there is - * only one Light object representing a given physical Light and therefore - * only one with a specific system or user name. - *

              - * This will always return a valid object reference; a new object will be - * created if necessary. In that case: - *

                - *
              • If a null reference is given for user name, no user name will be - * associated with the Light object created; a valid system name must be - * provided - *
              • If both names are provided, the system name defines the hardware - * access of the desired sensor, and the user address is associated with it. - * The system name must be valid. - *
              - * Note that it is possible to make an inconsistent request if both - * addresses are provided, but the given values are associated with - * different objects. This is a problem, and we don't have a good solution - * except to issue warnings. This will mostly happen if you're creating - * Lights when you should be looking them up. - * - * @return requested Light object (never null) + * {@inheritDoc} */ @Override - public Light newLight(String systemName, String userName) { + @Nonnull + public Light newLight(@Nonnull String systemName, @CheckForNull String userName) { if (log.isDebugEnabled()) { log.debug("newLight:" + ((systemName == null) ? "null" : systemName) @@ -122,7 +109,7 @@ public Light newLight(String systemName, String userName) { // is system name in correct format? if (validSystemNameFormat(systemName) != NameValidity.VALID) { log.error("Invalid system name for newLight: {}", systemName); - throw new IllegalArgumentException("\""+systemName+"\" is invalid"); + throw new IllegalArgumentException("\"" + systemName + "\" is invalid"); } // return existing if there is one @@ -162,15 +149,17 @@ public Light newLight(String systemName, String userName) { * Internal method to invoke the factory, after all the logic for returning * an existing method has been invoked. * - * @return new null + * @param systemName the system name to use for this light + * @param userName the user name to use for this light + * @return the new light */ - abstract protected Light createNewLight(String systemName, String userName); + @CheckForNull + abstract protected Light createNewLight( + @Nonnull String systemName, + @Nonnull String userName); /** - * Activate the control mechanism for each Light controlled by this - * LightManager. Note that some Lights don't require any activation. The - * activateLight method in AbstractLight.java determines what needs to be - * done for each Light. + * {@inheritDoc} */ @Override public void activateAllLights() { @@ -194,68 +183,59 @@ public void activateAllLights() { } /** - * Normalize the system name - *

              - * If a system implementation has names that could be normalized, the - * system-specific Light Manager should override this routine and supply a - * normalized system name. + * {@inheritDoc} */ @Override - public String normalizeSystemName(String systemName) { + @Nonnull + public String normalizeSystemName(@Nonnull String systemName) { return systemName; } /** - * Convert the system name to a normalized alternate name - *

              - * This routine is to allow testing to ensure that two Lights with alternate - * names that refer to the same output bit are not created in systems with multiple name formats. - *

              - * If a system implementation has alternate names, the system specific Light - * Manager should override this routine and supply the alternate name. + * {@inheritDoc} */ @Override - public String convertSystemNameToAlternate(String systemName) { + @Nonnull + public String convertSystemNameToAlternate(@Nonnull String systemName) { return ""; } /** - * Returns 'true' if the System can potentially support variable Lights - * Note: LightManagers for Systems that can support variable Lights should - * override this method and return 'true'. + * {@inheritDoc} */ @Override - public boolean supportsVariableLights(String systemName) { + public boolean supportsVariableLights(@Nonnull String systemName) { return false; } /** - * A method that determines if it is possible to add a range of lights in - * numerical order eg 11 thru 18, primarily used to show/not show the add - * range box in the add Light window. - * - * @param systemName configured system connection name - * @return false as default, unless overridden by implementations as supported + * {@inheritDoc} */ @Override - public boolean allowMultipleAdditions(String systemName) { + public boolean allowMultipleAdditions(@Nonnull String systemName) { return false; } + /** + * get bean type handled + * + * @return a string for the type of object handled by this manager + */ @Override public String getBeanTypeHandled() { return Bundle.getMessage("BeanNameLight"); } /** - * Provide a manager-agnostic tooltip for the Add new item beantable pane. + * {@inheritDoc} */ @Override + @CheckForNull public String getEntryToolTip() { - String entryToolTip = "Enter a number from 1 to 9999"; // Basic number format help - return entryToolTip; + return "Enter a number from 1 to 9999"; // Basic number format help } - private final static Logger log = LoggerFactory.getLogger(AbstractLightManager.class); + private final static Logger log + = LoggerFactory.getLogger(AbstractLightManager.class); } diff --git a/java/src/jmri/managers/DefaultLogixManager.java b/java/src/jmri/managers/DefaultLogixManager.java index 1a050a1d4bc..6833546d907 100644 --- a/java/src/jmri/managers/DefaultLogixManager.java +++ b/java/src/jmri/managers/DefaultLogixManager.java @@ -37,7 +37,7 @@ public DefaultLogixManager() { jmri.InstanceManager.getDefault(jmri.ConditionalManager.class).addVetoableChangeListener(this); InstanceManager.getDefault(jmri.jmrit.logix.WarrantManager.class).addVetoableChangeListener(this); InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class).addVetoableChangeListener(this); - InstanceManager.getDefault(jmri.jmrit.signalling.EntryExitPairs.class).addVetoableChangeListener(this); + InstanceManager.getDefault(jmri.jmrit.entryexit.EntryExitPairs.class).addVetoableChangeListener(this); } @Override diff --git a/java/src/jmri/managers/JmriUserPreferencesManager.java b/java/src/jmri/managers/JmriUserPreferencesManager.java index 7d150da286e..0bb13a3b83a 100644 --- a/java/src/jmri/managers/JmriUserPreferencesManager.java +++ b/java/src/jmri/managers/JmriUserPreferencesManager.java @@ -10,8 +10,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -36,7 +34,6 @@ import jmri.profile.ProfileManager; import jmri.profile.ProfileUtils; import jmri.swing.JmriJTablePersistenceManager; -import jmri.swing.JmriJTablePersistenceManager.TableColumnPreferences; import jmri.util.FileUtil; import jmri.util.JmriJFrame; import jmri.util.jdom.JDOMUtil; @@ -635,7 +632,7 @@ public void setClassDescription(String strClass) { desc = (String) method.invoke(t); classDesFound = true; } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException | ExceptionInInitializerError | NoSuchMethodException ex) { - log.debug(ex.toString()); + log.debug("Unable to call declared method \"getClassDescription\" with exception {}", ex.toString()); classDesFound = false; } if (!classDesFound) { @@ -643,7 +640,7 @@ public void setClassDescription(String strClass) { method = cl.getMethod("getClassDescription"); desc = (String) method.invoke(t); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException | ExceptionInInitializerError | NoSuchMethodException ex) { - log.debug(ex.toString()); + log.debug("Unable to call undeclared method \"getClassDescription\" with exception {}", ex.toString()); classDesFound = false; } } @@ -661,7 +658,8 @@ public void setClassDescription(String strClass) { method.invoke(t); classSetFound = true; } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException | ExceptionInInitializerError | NoSuchMethodException ex) { - log.debug(ex.toString()); // *TableAction.setMessagePreferencesDetails() method is routinely not present in multiple classes + // TableAction.setMessagePreferencesDetails() method is routinely not present in multiple classes + log.debug("Unable to call declared method \"setMessagePreferencesDetails\" with exception {}", ex.toString()); classSetFound = false; } if (!classSetFound) { @@ -669,7 +667,7 @@ public void setClassDescription(String strClass) { method = cl.getMethod("setMessagePreferencesDetails"); method.invoke(t); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NullPointerException | ExceptionInInitializerError | NoSuchMethodException ex) { - log.debug(ex.toString()); + log.debug("Unable to call undeclared method \"setMessagePreferencesDetails\" with exception {}", ex.toString()); } } @@ -824,93 +822,11 @@ public void setMultipleChoiceOption(String strClass, String choice, int value) { } @Override + @Deprecated public void setTableColumnPreferences(String table, String column, int order, int width, SortOrder sort, boolean hidden) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { + InstanceManager.getOptionalDefault(JmriJTablePersistenceManager.class).ifPresent((manager) -> { manager.setTableColumnPreferences(table, column, order, width, sort, hidden); - } - } - - @Override - public int getTableColumnOrder(String table, String column) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { - TableColumnPreferences preferences = manager.getTableColumnPreferences(table, column); - if (preferences != null) { - return preferences.getOrder(); - } - } - return -1; - } - - @Override - public int getTableColumnWidth(String table, String column) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { - TableColumnPreferences preferences = manager.getTableColumnPreferences(table, column); - if (preferences != null) { - return preferences.getWidth(); - } - } - return -1; - } - - @Override - public SortOrder getTableColumnSort(String table, String column) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { - TableColumnPreferences preferences = manager.getTableColumnPreferences(table, column); - if (preferences != null) { - return preferences.getSort(); - } - } - return SortOrder.UNSORTED; - } - - @Override - public boolean getTableColumnHidden(String table, String column) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { - TableColumnPreferences preferences = manager.getTableColumnPreferences(table, column); - if (preferences != null) { - return preferences.getHidden(); - } - } - return false; - } - - @Override - public String getTableColumnAtNum(String table, int i) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { - Map map = manager.getTableColumnPreferences(table); - for (Map.Entry entry : map.entrySet()) { - if ((entry.getValue()).getOrder() == i) { - return entry.getKey(); - } - } - } - return null; - } - - /** - * Returns an empty list, since this class does not track table state. - * - * @return an empty list - */ - @Override - public List getTablesList() { - return new ArrayList<>(); - } - - @Override - public List getTablesColumnList(String table) { - JmriJTablePersistenceManager manager = InstanceManager.getNullableDefault(JmriJTablePersistenceManager.class); - if (manager != null) { - Map map = manager.getTableColumnPreferences(table); - return new ArrayList<>(map.keySet()); - } - return new ArrayList<>(); + }); } public String getClassDescription() { @@ -1142,7 +1058,7 @@ private void saveWindowDetails() { for (Entry entry : windowDetails.entrySet()) { Element window = new Element("window"); window.setAttribute("class", entry.getKey()); - if (entry.getValue().saveLocation) { + if (entry.getValue().getSaveLocation()) { try { window.setAttribute("locX", Double.toString(entry.getValue().getLocation().getX())); window.setAttribute("locY", Double.toString(entry.getValue().getLocation().getY())); @@ -1150,7 +1066,7 @@ private void saveWindowDetails() { // Expected if the location has not been set or the window is open } } - if (entry.getValue().saveSize) { + if (entry.getValue().getSaveSize()) { try { double height = entry.getValue().getSize().getHeight(); double width = entry.getValue().getSize().getWidth(); diff --git a/java/src/jmri/managers/configurexml/DefaultUserMessagePreferencesXml.java b/java/src/jmri/managers/configurexml/DefaultUserMessagePreferencesXml.java index 2431a41d538..9add09c37e3 100644 --- a/java/src/jmri/managers/configurexml/DefaultUserMessagePreferencesXml.java +++ b/java/src/jmri/managers/configurexml/DefaultUserMessagePreferencesXml.java @@ -4,7 +4,6 @@ import java.lang.reflect.InvocationTargetException; import java.util.List; import javax.swing.SortOrder; -import jmri.util.com.sun.TableSorter; import org.jdom2.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -189,10 +188,10 @@ public boolean load(Element shared, Element perNode) { // before 4.3.5 we used "sort" save column sort state } else if (column.getChild("sort") != null) { switch (Integer.parseInt(column.getChild("sort").getText())) { - case TableSorter.ASCENDING: + case 1: // old sort scheme used 1 for ascending sort = SortOrder.ASCENDING; break; - case TableSorter.DESCENDING: + case -1: // old sort scheme used -1 for descending sort = SortOrder.DESCENDING; break; default: diff --git a/java/src/jmri/progdebugger/ProgDebugger.java b/java/src/jmri/progdebugger/ProgDebugger.java index 20cbac79f28..74930b18f83 100644 --- a/java/src/jmri/progdebugger/ProgDebugger.java +++ b/java/src/jmri/progdebugger/ProgDebugger.java @@ -135,7 +135,7 @@ public void writeCV(int CV, int val, ProgListener p) throws ProgrammerException public void run() { log.debug("write CV reply"); if (l != null) { - l.programmingOpReply(-1, 0); + l.programmingOpReply(val, 0); } } // 0 is OK status }; diff --git a/java/src/jmri/swing/JTablePersistenceManager.java b/java/src/jmri/swing/JTablePersistenceManager.java index e51d0e96a2e..baef31ac074 100644 --- a/java/src/jmri/swing/JTablePersistenceManager.java +++ b/java/src/jmri/swing/JTablePersistenceManager.java @@ -17,9 +17,8 @@ * *

              * Row sort order is only persisted for JTables that implement the - * {@link javax.swing.RowSorter} for sorting. Tables using the deprecated - * {@link jmri.util.com.sun.TableSorter} will not have row sort order persisted. - * If the RowSorter is null, the row sorting will not be persisted.

              + * {@link javax.swing.RowSorter} for sorting. If the RowSorter is null, the row + * sorting will not be persisted.

              *

              * Column attributes (order, visibility, and width) are persisted by listening * to changes in the {@link javax.swing.table.TableColumnModel} of the table. @@ -29,6 +28,10 @@ * {@link javax.swing.table.TableColumn#getIdentifier()} or * {@link javax.swing.table.TableColumn#getHeaderValue()}. *

              + * Tables against which {@link #persist(javax.swing.JTable)} is called without + * first calling {@link #resetState(javax.swing.JTable)} will not have state + * retained across application restarts. + *

              * Note: A JTable with UI state being persisted must have a * unique non-null name. * @@ -41,13 +44,43 @@ public interface JTablePersistenceManager { * {@link javax.swing.JComponent#getName()} is used to persist the table, so * ensure the name is set such that it can be retrieved by the same name in * a later JMRI execution. + *

              + * Note that the current state of the table, if not already persisted, at + * the time of this call is retained as the table state. Using this method + * is the same as calling {@link #persist(javax.swing.JTable, boolean)} with + * false for the second argument. * * @param table the table to persist * @throws IllegalArgumentException if another table instance is already * persisted by the same name * @throws NullPointerException if the table name is null */ - public void persist(@Nonnull JTable table) throws IllegalArgumentException, NullPointerException; + public default void persist(@Nonnull JTable table) throws IllegalArgumentException, NullPointerException { + this.persist(table, false); + } + + /** + * Persist the user interface state for a table. The name returned by + * {@link javax.swing.JComponent#getName()} is used to persist the table, so + * ensure the name is set such that it can be retrieved by the same name in + * a later JMRI execution. + *

              + * Note that the current state of the table, if not already persisted, at + * the time of this call is retained as the table state unless + * {@code resetState} is true. + *

              + * Using this method with {@code resetState} set to true is the same as + * {@link #resetState(javax.swing.JTable)} immediately prior to calling + * {@link #persist(javax.swing.JTable)}. + * + * @param table the table to persist + * @param resetState reset the table to the stored state if true; retain the + * current state if false + * @throws IllegalArgumentException if another table instance is already + * persisted by the same name + * @throws NullPointerException if the table name is null + */ + public void persist(@Nonnull JTable table, boolean resetState) throws IllegalArgumentException, NullPointerException; /** * Stop persisting the table. This does not clear the persistence state, but diff --git a/java/src/jmri/swing/JmriJTablePersistenceManager.java b/java/src/jmri/swing/JmriJTablePersistenceManager.java index 4fccf29df9e..8060ea621d9 100644 --- a/java/src/jmri/swing/JmriJTablePersistenceManager.java +++ b/java/src/jmri/swing/JmriJTablePersistenceManager.java @@ -12,7 +12,6 @@ import java.util.Set; import java.util.Timer; import java.util.TimerTask; -import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.swing.JTable; import javax.swing.RowSorter; @@ -26,6 +25,7 @@ import javax.swing.event.TableColumnModelListener; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import javax.swing.table.TableModel; import jmri.profile.Profile; import jmri.profile.ProfileManager; import jmri.profile.ProfileUtils; @@ -61,16 +61,21 @@ public class JmriJTablePersistenceManager extends AbstractPreferencesManager imp private final static Logger log = LoggerFactory.getLogger(JmriJTablePersistenceManager.class); /** - * {@inheritDoc} Persisting a table that is already persisted may cause the - * persistence state to be updated, but will not cause additional listeners - * to be added to the table. + * {@inheritDoc} + *

              + * Persisting a table that is already persisted may cause the persistence + * state to be updated, but will not cause additional listeners to be added + * to the table. */ @Override - public void persist(@Nonnull JTable table) throws IllegalArgumentException, NullPointerException { + public void persist(@Nonnull JTable table, boolean resetState) throws IllegalArgumentException, NullPointerException { Objects.requireNonNull(table.getName(), "Table name must be nonnull"); if (this.listeners.containsKey(table.getName()) && !this.listeners.get(table.getName()).getTable().equals(table)) { throw new IllegalArgumentException("Table name must be unique"); } + if (resetState) { + this.resetState(table); + } if (!this.listeners.containsKey(table.getName())) { JTableListener listener = new JTableListener(table, this); this.listeners.put(table.getName(), listener); @@ -78,7 +83,7 @@ public void persist(@Nonnull JTable table) throws IllegalArgumentException, Null table.addPropertyChangeListener(this); table.addPropertyChangeListener(listener); table.getColumnModel().addColumnModelListener(listener); - RowSorter sorter = table.getRowSorter(); + RowSorter sorter = table.getRowSorter(); if (sorter != null) { sorter.addRowSorterListener(listener); } @@ -104,7 +109,7 @@ public void stopPersisting(JTable table) { table.removePropertyChangeListener(this); table.removePropertyChangeListener(listener); table.getColumnModel().removeColumnModelListener(listener); - RowSorter sorter = table.getRowSorter(); + RowSorter sorter = table.getRowSorter(); if (sorter != null) { sorter.removeRowSorterListener(listener); } @@ -127,7 +132,7 @@ public void cacheState(JTable table) { Objects.requireNonNull(table.getName(), "table name must be nonnull"); TableColumnModel model = table.getColumnModel(); Objects.requireNonNull(model, "table " + table.getName() + " has a null columnModel"); - RowSorter sorter = table.getRowSorter(); + RowSorter sorter = table.getRowSorter(); boolean isXModel = model instanceof XTableColumnModel; Enumeration e = model.getColumns(); while (e.hasMoreElements()) { @@ -163,7 +168,7 @@ public void resetState(JTable table) { this.stopPersisting(table); TableColumnModel model = table.getColumnModel(); Objects.requireNonNull(model, "table " + table.getName() + " has a null columnModel"); - RowSorter sorter = table.getRowSorter(); + RowSorter sorter = table.getRowSorter(); boolean isXModel = model instanceof XTableColumnModel; Enumeration e; if (isXModel) { @@ -242,10 +247,22 @@ protected void setDirty(boolean dirty) { * * @return true if needs to be saved */ - protected boolean getDirty() { + protected boolean isDirty() { return this.dirty; } + /** + * Get dirty (needs to be saved) state. Protected so that subclasses can + * manipulate this state. + * + * @return true if needs to be saved + * @deprecated since 4.9.7; use {@link #isDirty()} instead + */ + @Deprecated + protected boolean getDirty() { + return this.isDirty(); + } + @Override public void setPaused(boolean paused) { boolean old = this.paused; @@ -316,7 +333,7 @@ public void initialize(Profile profile) throws InitializationException { }); } catch (NullPointerException ex) { log.info("Table preferences not found.\nThis is expected on the first time the \"{}\" profile is used on this computer.", - ProfileManager.getDefault().getActiveProfile().getName()); + ProfileManager.getDefault().getActiveProfileName()); } this.setInitialized(profile, true); } @@ -376,24 +393,6 @@ public Set> getProvides() { return provides; } - /** - * Transition support for the standard {@link jmri.UserPreferencesManager} - * instance (a {@link jmri.managers.JmriUserPreferencesManager}) so it does - * not need to maintain separate knowledge of table column state. - * - * @param table the requested table name - * @param column the requested column name - * @return the preferences for the column or null if none have been set - * - * @throws NullPointerException if either name is null - * @deprecated since 4.5.2 - */ - @Deprecated - @CheckForNull - public TableColumnPreferences getTableColumnPreferences(@Nonnull String table, @Nonnull String column) { - return this.getPersistedState(table, column); - } - /** * Transition support for the standard {@link jmri.UserPreferencesManager} * instance (a {@link jmri.managers.JmriUserPreferencesManager}) so it does @@ -419,47 +418,6 @@ public void setTableColumnPreferences(String table, String column, int order, in this.setPersistedState(table, column, order, width, sort, hidden); } - /** - * Transition support for the standard {@link jmri.UserPreferencesManager} - * instance (a {@link jmri.managers.JmriUserPreferencesManager}) so it does - * not need to maintain separate knowledge of table column state. - * - * @param table name of the table - * @return a map of TableColumnPreferences indexed by column name - * @throws NullPointerException if table name is null - * @deprecated since 4.5.2 - */ - @Deprecated - @Nonnull - public Map getTableColumnPreferences(@Nonnull String table) { - Objects.requireNonNull(table, "table name cannot be null"); - Map map = this.columns.get(table); - if (map != null) { - return map; - } - return new HashMap<>(); - } - - /** - * Transition support for {@link jmri.UserPreferencesManager} instances so - * they do not need to maintain separate knowledge of table column state. - * - * @param table the requested table name - * @param column the requested column name - * @throws NullPointerException if either name is null - * @return the preferences for the column or null if none have been set - */ - @CheckForNull - protected TableColumnPreferences getPersistedState(@Nonnull String table, @Nonnull String column) { - Objects.requireNonNull(table, "table name must be nonnull"); - Objects.requireNonNull(column, "column name must be nonnull"); - HashMap map = this.columns.get(table); - if (map != null) { - return map.get(column); - } - return null; - } - /** * Set the persisted state for the given column in the given table. The * persisted state is not saved until @@ -536,8 +494,8 @@ public boolean getHidden() { protected final static class JTableListener implements PropertyChangeListener, RowSorterListener, TableColumnModelListener { - private final JTable table; - private final JmriJTablePersistenceManager manager; + protected final JTable table; + protected final JmriJTablePersistenceManager manager; private Timer delay = null; public JTableListener(JTable table, JmriJTablePersistenceManager manager) { @@ -646,7 +604,7 @@ private void saveState() { @Override public void run() { JTableListener.this.manager.cacheState(JTableListener.this.table); - if (!JTableListener.this.manager.paused && JTableListener.this.manager.dirty) { + if (!JTableListener.this.manager.isPaused() && JTableListener.this.manager.isDirty()) { JTableListener.this.manager.savePreferences(ProfileManager.getDefault().getActiveProfile()); } } diff --git a/java/src/jmri/util/ColorUtil.java b/java/src/jmri/util/ColorUtil.java index 0ef98776dcf..b3c0eb3830e 100644 --- a/java/src/jmri/util/ColorUtil.java +++ b/java/src/jmri/util/ColorUtil.java @@ -15,8 +15,8 @@ */ public class ColorUtil { - /* - * Color lists for screne colors. + /* + * Color lists for screen colors. */ public final static String ColorTrack = "track"; public final static String ColorBlack = "black"; @@ -32,6 +32,10 @@ public class ColorUtil { public final static String ColorBlue = "blue"; public final static String ColorMagenta = "magenta"; public final static String ColorCyan = "cyan"; + public final static String ColorClear = "clear"; + + public final static Color clear = setAlpha(Color.BLACK, 0); + public final static Color CLEAR = clear; /** * Handles known colors plus special value for track @@ -72,78 +76,92 @@ public static String colorToColorName(@Nullable Color color) { } /** - * @param string Either a hexidecimal representation of the rgb value of a - * color or a color name defined as a constant. + * @param string Either a hexidecimal representation of the rgb value of a + * color or a color name defined as a constant. */ public static Color stringToColor(String string) { try { return Color.decode(string); - } catch(NumberFormatException nfe) { - switch(string) { - case ColorBlack: - return Color.black; - case ColorDarkGray: - return Color.darkGray; - case ColorGray: - return Color.gray; - case ColorLightGray: - return Color.lightGray; - case ColorWhite: - return Color.white; - case ColorRed: - return Color.red; - case ColorPink: - return Color.pink; - case ColorOrange: - return Color.orange; - case ColorYellow: - return Color.yellow; - case ColorGreen: - return Color.green; - case ColorBlue: - return Color.blue; - case ColorMagenta: - return Color.magenta; - case ColorCyan: - return Color.cyan; - case ColorTrack: - return null; - default: - // check translated strings, just in case there is one in a data file. - if( string.equals(Bundle.getMessage("Black"))) { - return Color.black; - } if( string.equals(Bundle.getMessage("DarkGray"))) { - return Color.darkGray; - } if( string.equals(Bundle.getMessage("Gray"))) { - return Color.gray; - } if( string.equals(Bundle.getMessage("LightGray"))) { - return Color.lightGray; - } if( string.equals(Bundle.getMessage("White"))) { - return Color.white; - } if( string.equals(Bundle.getMessage("Red"))) { - return Color.red; - } if( string.equals(Bundle.getMessage("Pink"))) { - return Color.pink; - } if( string.equals(Bundle.getMessage("Yellow"))) { - return Color.yellow; - } if( string.equals(Bundle.getMessage("Green"))) { - return Color.green; - } if( string.equals(Bundle.getMessage("Orange"))) { - return Color.orange; - } if( string.equals(Bundle.getMessage("Blue"))) { - return Color.blue; - } if( string.equals(Bundle.getMessage("Magenta"))) { - return Color.magenta; - } if( string.equals(Bundle.getMessage("Cyan"))) { - return Color.cyan; - } if( string.equals(Bundle.getMessage("ColorClear"))) { - return null; - } if( string.equals(Bundle.getMessage("None"))) { - return null; - } else { - log.error("unknown color text '" + string + "' sent to stringToColor"); - return Color.black; - } + } catch (NumberFormatException nfe) { + switch (string) { + case ColorBlack: + return Color.black; + case ColorDarkGray: + return Color.darkGray; + case ColorGray: + return Color.gray; + case ColorLightGray: + return Color.lightGray; + case ColorWhite: + return Color.white; + case ColorRed: + return Color.red; + case ColorPink: + return Color.pink; + case ColorOrange: + return Color.orange; + case ColorYellow: + return Color.yellow; + case ColorGreen: + return Color.green; + case ColorBlue: + return Color.blue; + case ColorMagenta: + return Color.magenta; + case ColorCyan: + return Color.cyan; + case ColorTrack: + return null; + default: + // check translated strings, just in case there is one in a data file. + if (string.equals(Bundle.getMessage("Black"))) { + return Color.black; + } + if (string.equals(Bundle.getMessage("DarkGray"))) { + return Color.darkGray; + } + if (string.equals(Bundle.getMessage("Gray"))) { + return Color.gray; + } + if (string.equals(Bundle.getMessage("LightGray"))) { + return Color.lightGray; + } + if (string.equals(Bundle.getMessage("White"))) { + return Color.white; + } + if (string.equals(Bundle.getMessage("Red"))) { + return Color.red; + } + if (string.equals(Bundle.getMessage("Pink"))) { + return Color.pink; + } + if (string.equals(Bundle.getMessage("Yellow"))) { + return Color.yellow; + } + if (string.equals(Bundle.getMessage("Green"))) { + return Color.green; + } + if (string.equals(Bundle.getMessage("Orange"))) { + return Color.orange; + } + if (string.equals(Bundle.getMessage("Blue"))) { + return Color.blue; + } + if (string.equals(Bundle.getMessage("Magenta"))) { + return Color.magenta; + } + if (string.equals(Bundle.getMessage("Cyan"))) { + return Color.cyan; + } + if (string.equals(Bundle.getMessage("ColorClear"))) { + return clear; + } + if (string.equals(Bundle.getMessage("None"))) { + return null; + } else { + log.error("unknown color text '" + string + "' sent to stringToColor"); + return Color.black; + } } } } @@ -209,7 +227,7 @@ private static String colorToName(@Nullable Color color) { * * @param colorA the first color * @param colorB the second color - * @param t the fraction (between 0 and 1) + * @param t the fraction (between 0 and 1) * @return the linear interpolation between a and b for t */ @CheckReturnValue @@ -243,7 +261,7 @@ public static Color setAlpha(@Nonnull Color color, int alpha) { */ @CheckReturnValue public static Color setAlpha(@Nonnull Color color, double alpha) { - return new Color(color.getRed(), color.getGreen(), color.getBlue(), + return new Color(color.getRed(), color.getGreen(), color.getBlue(), (int) (255.0 * alpha)); } diff --git a/java/src/jmri/util/JTableUtil.java b/java/src/jmri/util/JTableUtil.java deleted file mode 100644 index 9dc191ff337..00000000000 --- a/java/src/jmri/util/JTableUtil.java +++ /dev/null @@ -1,57 +0,0 @@ -package jmri.util; - -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.table.TableModel; -import jmri.util.com.sun.TableSorter; - -/** - * Common utility methods for working with JTables - *

              - * We needed a place to refactor common JTable-processing idioms in JMRI code, - * so this class was created. It's more of a library of procedures than a real - * class, as (so far) all of the operations have needed no state information. - *

              - * In particular, this is intended to provide Java 2 functionality on a Java - * 1.1.8 system, or at least try to fake it. - * - * @author Bob Jacobsen Copyright 2003 - */ -@Deprecated -public class JTableUtil { - - /** - * - * @param dataModel model for table - * @return a table - * @deprecated since 4.5.4; create a standard {@link javax.swing.JTable} and - * add a {@link javax.swing.RowSorter} to that table instead. If you need - * custom {@link javax.swing.table.TableCellEditor} selection behavior, - * provide custom TableCellEditors for the columns that need the custom - * behavior. - */ - @Deprecated - static public JTable sortableDataModel(TableModel dataModel) { - - TableSorter sorter; - - sorter = new TableSorter(dataModel); - - JTable dataTable = new JTable(sorter) { - @Override - public boolean editCellAt(int row, int column, java.util.EventObject e) { - boolean res = super.editCellAt(row, column, e); - java.awt.Component c = this.getEditorComponent(); - if (c instanceof javax.swing.JTextField) { - ((JTextField) c).selectAll(); - } - return res; - } - }; - - sorter.setTableHeader(dataTable.getTableHeader()); - return dataTable; - } - - // private final static Logger log = LoggerFactory.getLogger(JTableUtil.class); -} diff --git a/java/src/jmri/util/MathUtil.java b/java/src/jmri/util/MathUtil.java index a9a3a471024..233da868421 100644 --- a/java/src/jmri/util/MathUtil.java +++ b/java/src/jmri/util/MathUtil.java @@ -2,11 +2,12 @@ import static java.lang.Float.NEGATIVE_INFINITY; import static java.lang.Float.POSITIVE_INFINITY; +import static java.lang.Math.PI; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; -import java.awt.geom.Line2D; +import java.awt.geom.GeneralPath; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import javax.annotation.CheckReturnValue; @@ -317,6 +318,40 @@ public static Point2D rotateDEG( return rotateRAD(p, c, Math.toRadians(aDEG)); } + /** + * @param p the point + * @return the point orthogonal to this one (relative to {0, 0}) + */ + public static Point2D orthogonal(@Nonnull Point2D p) { + return new Point2D.Double(-p.getY(), p.getX()); + } + + /** + * create a vector given a direction and a magnitude + * + * @param dirDEG the direction (in degrees) + * @param magnitude the magnitude + * @return the vector with the specified direction and magnitude + */ + @CheckReturnValue + public static Point2D vectorDEG(double dirDEG, double magnitude) { + Point2D result = new Point2D.Double(magnitude, 0.0); + return rotateDEG(result, dirDEG); + } + + /** + * create a vector given a direction and a magnitude + * + * @param dirRAD the direction (in radians) + * @param magnitude the magnitude + * @return the vector with the specified direction and magnitude + */ + @CheckReturnValue + public static Point2D vectorRAD(double dirRAD, double magnitude) { + Point2D result = new Point2D.Double(magnitude, 0.0); + return rotateRAD(result, dirRAD); + } + /** * dot product of two points (vectors) * @@ -365,10 +400,22 @@ public static double distance(@Nonnull Point2D pA, @Nonnull Point2D pB) { } /** - * normalize a point + * normalize a point (vector) to a length * - * @param p the point - * @return the normalized point + * @param p the point (vector) + * @param length the length to normalize to + * @return the normalized point (vector) + */ + @CheckReturnValue + public static Point2D normalize(@Nonnull Point2D p, double length) { + return multiply(normalize(p), length); + } + + /** + * normalize a point (vector) + * + * @param p the point (vector) + * @return the normalized point (vector) */ @CheckReturnValue public static Point2D normalize(@Nonnull Point2D p) { @@ -380,6 +427,28 @@ public static Point2D normalize(@Nonnull Point2D p) { return result; } + /** + * compute the angle (direction in radians) for a vector + * + * @param p the vector (point relative to zeroPoint2D) + * @return the angle in radians + */ + @CheckReturnValue + public static double computeAngleRAD(@Nonnull Point2D p) { + return Math.atan2(p.getX(), p.getY()); + } + + /** + * compute the angle (direction in degrees) for a vector + * + * @param p the vector (point relative to zeroPoint2D) + * @return the angle in degrees + */ + @CheckReturnValue + public static double computeAngleDEG(@Nonnull Point2D p) { + return Math.toDegrees(computeAngleRAD(p)); + } + /** * compute the angle (direction in radians) from point 1 to point 2 * @@ -389,8 +458,7 @@ public static Point2D normalize(@Nonnull Point2D p) { */ @CheckReturnValue public static double computeAngleRAD(@Nonnull Point2D p1, @Nonnull Point2D p2) { - Point2D delta = subtract(p1, p2); - return Math.atan2(delta.getX(), delta.getY()); + return computeAngleRAD(subtract(p1, p2)); } /** @@ -402,7 +470,7 @@ public static double computeAngleRAD(@Nonnull Point2D p1, @Nonnull Point2D p2) { */ @CheckReturnValue public static double computeAngleDEG(@Nonnull Point2D p1, @Nonnull Point2D p2) { - return Math.toDegrees(computeAngleRAD(p1, p2)); + return Math.toDegrees(computeAngleRAD(subtract(p1, p2))); } /** @@ -528,8 +596,8 @@ public static Point2D oneThirdPoint(@Nonnull Point2D pA, @Nonnull Point2D pB) { * @return the point two thirds of the way from pA to pB */ @CheckReturnValue - public static Point2D twoThirdPoint(@Nonnull Point2D pA, @Nonnull Point2D pB) { - return lerp(pA, pB, 1.0 / 3.0); + public static Point2D twoThirdsPoint(@Nonnull Point2D pA, @Nonnull Point2D pB) { + return lerp(pA, pB, 2.0 / 3.0); } /** @@ -637,7 +705,7 @@ public static double normalizeAngleDEG(double a) { * * @param a the first angle * @param b the second angle - * @return the relative difference between the two angles + * @return the relative difference between the two angles (in degrees) */ @CheckReturnValue public static double diffAngleDEG(double a, double b) { @@ -649,13 +717,51 @@ public static double diffAngleDEG(double a, double b) { * * @param a the first angle * @param b the second angle - * @return the absolute difference between the two angles + * @return the absolute difference between the two angles (in degrees) */ @CheckReturnValue public static double absDiffAngleDEG(double a, double b) { return Math.abs(diffAngleDEG(a, b)); } + /** + * calculate the relative difference (+/-PI) between two angles + * + * @param a the first angle + * @param b the second angle + * @return the relative difference between the two angles (in radians) + */ + @CheckReturnValue + public static double diffAngleRAD(double a, double b) { + return wrap(a - b, -PI, +PI); + + } + + /** + * calculate the absolute difference (0-PI) between two angles + * + * @param a the first angle + * @param b the second angle + * @return the absolute difference between the two angles (in radians) + */ + @CheckReturnValue + public static double absDiffAngleRAD(double a, double b) { + return Math.abs(diffAngleRAD(a, b)); + } + + /** + * pin a value between min and max + * + * @param inValue the value + * @param inMin the min + * @param inMax the max + * @return the value pinned between the min and max values + */ + @CheckReturnValue + public static int pin(int inValue, int inMin, int inMax) { + return Math.min(Math.max(inValue, inMin), inMax); + } + /** * pin a value between min and max * @@ -829,7 +935,8 @@ public static Rectangle2D inset(@Nonnull Rectangle2D r, double i) { * inset a rectangle * * @param r the rectangle - * @param h the horzontial inset (positive make it smaller, negative, bigger) + * @param h the horzontial inset (positive make it smaller, negative, + * bigger) * @param v the vertical inset (positive make it smaller, negative, bigger) * @return the inset rectangle */ @@ -877,11 +984,16 @@ public static Rectangle2D centerRectangleOnRectangle(@Nonnull Rectangle2D r1, @N return offset(r1, subtract(center(r2), center(r1))); } - // recursive routine to draw a cubic Bezier... + // recursive routine to plot a cubic Bezier... // (also returns distance!) - private static double drawBezier(Graphics2D g2, - @Nonnull Point2D p0, @Nonnull Point2D p1, @Nonnull Point2D p2, - @Nonnull Point2D p3, int depth) { + private static double plotBezier( + GeneralPath path, + @Nonnull Point2D p0, + @Nonnull Point2D p1, + @Nonnull Point2D p2, + @Nonnull Point2D p3, + int depth, + double displacement) { double result; // calculate flatness to determine if we need to recurse... @@ -896,7 +1008,14 @@ private static double drawBezier(Graphics2D g2, // the flatness comparison value is somewhat arbitrary. // (I just kept moving it closer to 1 until I got good results. ;-) if ((depth > 12) || (flatness <= 1.001)) { - g2.draw(new Line2D.Double(p0, p3)); + Point2D vO = normalize(orthogonal(subtract(p3, p0)), displacement); + if (bezier1st) { + Point2D p0P = add(p0, vO); + path.moveTo(p0P.getX(), p0P.getY()); + bezier1st = false; + } + Point2D p3P = add(p3, vO); + path.lineTo(p3P.getX(), p3P.getY()); result = l03; } else { // first order midpoints @@ -908,13 +1027,13 @@ private static double drawBezier(Graphics2D g2, Point2D r0 = midPoint(q0, q1); Point2D r1 = midPoint(q1, q2); - // oneThirdPoint order midPoint + // third order midPoint Point2D s = midPoint(r0, r1); // draw left side Bezier - result = drawBezier(g2, p0, q0, r0, s, depth + 1); + result = MathUtil.plotBezier(path, p0, q0, r0, s, depth + 1, displacement); // draw right side Bezier - result += drawBezier(g2, s, r1, q2, p3, depth + 1); + result += MathUtil.plotBezier(path, s, r1, q2, p3, depth + 1, displacement); } return result; } @@ -927,15 +1046,29 @@ private static double drawBezier(Graphics2D g2, * @param p1 first control point * @param p2 second control point * @param p3 terminating control point + * * @return the length of the Bezier curve */ - public static double drawBezier(Graphics2D g2, @Nonnull Point2D p0, @Nonnull Point2D p1, @Nonnull Point2D p2, @Nonnull Point2D p3) { - return drawBezier(g2, p0, p1, p2, p3, 0); + public static double drawBezier( + Graphics2D g2, + @Nonnull Point2D p0, + @Nonnull Point2D p1, + @Nonnull Point2D p2, + @Nonnull Point2D p3) { + GeneralPath path = new GeneralPath(); + bezier1st = true; + double result = MathUtil.plotBezier(path, p0, p1, p2, p3, 0, 0.0); + g2.draw(path); + return result; } - // recursive routine to draw a Bezier curve... + // recursive routine to plot a Bezier curve... // (also returns distance!) - private static double drawBezier(Graphics2D g2, @Nonnull Point2D points[], int depth) { + private static double plotBezier( + GeneralPath path, + @Nonnull Point2D points[], + int depth, + double displacement) { int len = points.length, idx, jdx; double result; @@ -952,7 +1085,15 @@ private static double drawBezier(Graphics2D g2, @Nonnull Point2D points[], int d // the flatness comparison value is somewhat arbitrary. // (I just kept moving it closer to 1 until I got good results. ;-) if ((depth > 12) || (flatness <= 1.001)) { - g2.draw(new Line2D.Double(points[0], points[len - 1])); + Point2D p0 = points[0], pN = points[len - 1]; + Point2D vO = normalize(orthogonal(subtract(pN, p0)), displacement); + if (bezier1st) { + Point2D p0P = add(p0, vO); + path.moveTo(p0P.getX(), p0P.getY()); + bezier1st = false; + } + Point2D pNP = add(pN, vO); + path.lineTo(pNP.getX(), pNP.getY()); result = inner_distance; } else { // calculate (len - 1) order of points @@ -976,7 +1117,7 @@ private static double drawBezier(Graphics2D g2, @Nonnull Point2D points[], int d leftPoints[idx + 1] = nthOrderPoints[idx][0]; } // draw left side Bezier - result = drawBezier(g2, leftPoints, depth + 1); + result = plotBezier(path, leftPoints, depth + 1, displacement); // collect right points Point2D[] rightPoints = new Point2D[len]; @@ -986,7 +1127,7 @@ private static double drawBezier(Graphics2D g2, @Nonnull Point2D points[], int d rightPoints[idx] = points[len - 1]; // draw right side Bezier - result += drawBezier(g2, rightPoints, depth + 1); + result += plotBezier(path, rightPoints, depth + 1, displacement); } return result; } @@ -994,15 +1135,36 @@ private static double drawBezier(Graphics2D g2, @Nonnull Point2D points[], int d /** * Draw a Bezier curve * - * @param g2 the Graphics2D to draw to - * @param p[] control points + * @param g2 the Graphics2D to draw to + * @param p[] control points + * @param displacement right/left to draw a line parallel to the Bezier * @return the length of the Bezier curve */ - public static double drawBezier(Graphics2D g2, @Nonnull Point2D p[]) { + public static double drawBezier( + Graphics2D g2, + @Nonnull Point2D p[], + double displacement) { + double result; + GeneralPath path = new GeneralPath(); + bezier1st = true; if (p.length == 4) { // draw cubic bezier? - return drawBezier(g2, p[0], p[1], p[2], p[3], 0); + result = MathUtil.plotBezier(path, p[0], p[1], p[2], p[3], 0, displacement); } else { // (nope) - return drawBezier(g2, p, 0); + result = plotBezier(path, p, 0, displacement); } + g2.draw(path); + return result; + } + + /** + * Draw a Bezier curve + * + * @param g2 the Graphics2D to draw to + * @param p[] control points + * @return the length of the Bezier curve + */ + public static double drawBezier(Graphics2D g2, @Nonnull Point2D p[]) { + return drawBezier(g2, p, 0.0); } + private static boolean bezier1st = false; } diff --git a/java/src/jmri/util/UtilBundle.properties b/java/src/jmri/util/UtilBundle.properties index 68b9ebd05f6..88fca878935 100644 --- a/java/src/jmri/util/UtilBundle.properties +++ b/java/src/jmri/util/UtilBundle.properties @@ -17,7 +17,7 @@ VkKeyWindowClose = W # used in DavidFlanagan.HardcopyWriter ButtonPreviousPage = Previous Page ButtonNextPage = Next Page -HeaderPageNum = Page +HeaderPageNum = Page {0} / {1} # interface colors Color = Color diff --git a/java/src/jmri/util/UtilBundle_da.properties b/java/src/jmri/util/UtilBundle_da.properties index 4a3a73144d2..4183e7853a6 100644 --- a/java/src/jmri/util/UtilBundle_da.properties +++ b/java/src/jmri/util/UtilBundle_da.properties @@ -17,7 +17,7 @@ VkKeyWindowClose = W # used in DavidFlanagan.HardcopyWriter ButtonPreviousPage = Forrige Side ButtonNextPage = N\u00e6ste Side -HeaderPageNum = Side +HeaderPageNum = Side {0} / {1} # interface colors Color = Farve diff --git a/java/src/jmri/util/UtilBundle_de.properties b/java/src/jmri/util/UtilBundle_de.properties index 8f3486157d9..ec512f6ed19 100644 --- a/java/src/jmri/util/UtilBundle_de.properties +++ b/java/src/jmri/util/UtilBundle_de.properties @@ -15,7 +15,7 @@ VkKeyWindowClose=W # used in DavidFlanagan.HardcopyWriter ButtonPreviousPage = Vorherige ButtonNextPage = N\u00e4chste -HeaderPageNum = Seite +HeaderPageNum = Seite {0} / {1} # interface colors Color=Farbe diff --git a/java/src/jmri/util/UtilBundle_nl.properties b/java/src/jmri/util/UtilBundle_nl.properties index dc5b9467513..ad50c5f3bd0 100644 --- a/java/src/jmri/util/UtilBundle_nl.properties +++ b/java/src/jmri/util/UtilBundle_nl.properties @@ -17,4 +17,4 @@ VkKeyWindowClose = W # used in DavidFlanagan.HardcopyWriter ButtonPreviousPage = Vorige ButtonNextPage = Volgende -HeaderPageNum = Pag. +HeaderPageNum = Pag. {0} / {1} diff --git a/java/src/jmri/util/com/sun/TableSorter.java b/java/src/jmri/util/com/sun/TableSorter.java deleted file mode 100644 index b1448ab9bd1..00000000000 --- a/java/src/jmri/util/com/sun/TableSorter.java +++ /dev/null @@ -1,569 +0,0 @@ -// This class comes from the Java Swing tutorial at -// http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting -package jmri.util.com.sun; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import javax.swing.Icon; -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.SortOrder; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumnModel; -import javax.swing.table.TableModel; - -/** - * TableSorter is a decorator for TableModels; adding sorting functionality to a - * supplied TableModel. TableSorter does not store or copy the data in its - * TableModel; instead it maintains a map from the row indexes of the view to - * the row indexes of the model. As requests are made of the sorter (like - * getValueAt(row, col)) they are passed to the underlying model after the row - * numbers have been translated via the internal mapping array. This way, the - * TableSorter appears to hold another copy of the table with the rows in a - * different order. - *

              - * TableSorter registers itself as a listener to the underlying model, just as - * the JTable itself would. Events received from the model are examined, - * sometimes manipulated (typically widened), and then passed on to the - * TableSorter's listeners (typically the JTable). If a change to the model has - * invalidated the order of TableSorter's rows, a note of this is made and the - * sorter will resort the rows the next time a value is requested. - *

              - * When the tableHeader property is set, either by using the setTableHeader() - * method or the two argument constructor, the table header may be used as a - * complete UI for TableSorter. The default renderer of the tableHeader is - * decorated with a renderer that indicates the sorting status of each column. - * In addition, a mouse listener is installed with the following behavior: - *

                - *
              • - * Mouse-click: Clears the sorting status of all other columns and advances the - * sorting status of that column through three values: {NOT_SORTED, ASCENDING, - * DESCENDING} (then back to NOT_SORTED again). - *
              • - * SHIFT-mouse-click: Clears the sorting status of all other columns and cycles - * the sorting status of the column through the same three values, in the - * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. - *
              • - * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that the - * changes to the column do not cancel the statuses of columns that are already - * sorting - giving a way to initiate a compound sort. - *
              - *

              - * This is a long overdue rewrite of a class of the same name that first - * appeared in the swing table demos in 1997. - * - * @author Philip Milne - * @author Brendon McLean - * @author Dan van Enckevort - * @author Parwinder Sekhon - * @author Daniel Boudreau 2009 - * @version 2.0 02/27/04 - * @deprecated Since 4.5.4; use {@link javax.swing.table.TableRowSorter} instead. - */ -@Deprecated -public class TableSorter extends AbstractTableModel { - - protected TableModel tableModel; - - public static final int DESCENDING = -1; - public static final int NOT_SORTED = 0; - public static final int ASCENDING = 1; - - private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED); - - public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() { - @SuppressWarnings("unchecked") - @Override - public int compare(Object o1, Object o2) { - return ((Comparable) o1).compareTo(o2); - } - }; - public static final Comparator LEXICAL_COMPARATOR = new Comparator() { - @Override - public int compare(Object o1, Object o2) { - return o1.toString().compareTo(o2.toString()); - } - }; - - private Row[] viewToModel; - private int[] modelToView; - private boolean clearSortingState = true; // New flag added by Boudreau - - private JTableHeader tableHeader; - private transient MouseListener mouseListener; - private transient TableModelListener tableModelListener; - private Map> columnComparators = new HashMap>(); - private List sortingColumns = new ArrayList(); - - public TableSorter() { - this.mouseListener = new MouseHandler(); - this.tableModelListener = new TableModelHandler(); - } - - public TableSorter(TableModel tableModel) { - this(); - setTableModel(tableModel); - } - - public TableSorter(TableModel tableModel, JTableHeader tableHeader) { - this(); - setTableHeader(tableHeader); - setTableModel(tableModel); - } - - private void clearSortingState() { - clearSortingState = true; - // Boudreau - //viewToModel = null; // setting viewToModel to null can cause an NPE - // see getGetViewToModel() below. - modelToView = null; - } - - public TableModel getTableModel() { - return tableModel; - } - - public void setTableModel(TableModel tableModel) { - if (this.tableModel != null) { - this.tableModel.removeTableModelListener(tableModelListener); - } - - this.tableModel = tableModel; - if (this.tableModel != null) { - this.tableModel.addTableModelListener(tableModelListener); - } - - clearSortingState(); - fireTableStructureChanged(); - } - - public JTableHeader getTableHeader() { - return tableHeader; - } - - public void setTableHeader(JTableHeader tableHeader) { - if (this.tableHeader != null) { - this.tableHeader.removeMouseListener(mouseListener); - TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer(); - if (defaultRenderer instanceof SortableHeaderRenderer) { - this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer); - } - } - this.tableHeader = tableHeader; - if (this.tableHeader != null) { - this.tableHeader.addMouseListener(mouseListener); - this.tableHeader.setDefaultRenderer( - new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer())); - } - } - - public boolean isSorting() { - return sortingColumns.size() != 0; - } - - private Directive getDirective(int column) { - for (int i = 0; i < sortingColumns.size(); i++) { - Directive directive = sortingColumns.get(i); - if (directive.column == column) { - return directive; - } - } - return EMPTY_DIRECTIVE; - } - - public int getSortingStatus(int column) { - return getDirective(column).direction; - } - - private void sortingStatusChanged() { - clearSortingState(); - fireTableDataChanged(); - if (tableHeader != null) { - tableHeader.repaint(); - } - } - - public void setSortingStatus(int column, int status) { - Directive directive = getDirective(column); - if (directive != EMPTY_DIRECTIVE) { - sortingColumns.remove(directive); - } - if (status != NOT_SORTED) { - sortingColumns.add(new Directive(column, status)); - } - sortingStatusChanged(); - } - - protected Icon getHeaderRendererIcon(int column, int size) { - Directive directive = getDirective(column); - if (directive == EMPTY_DIRECTIVE) { - return null; - } - return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive)); - } - - private void cancelSorting() { - sortingColumns.clear(); - sortingStatusChanged(); - } - - public void setColumnComparator(Class type, Comparator comparator) { - if (comparator == null) { - columnComparators.remove(type); - } else { - columnComparators.put(type, comparator); - } - } - - protected Comparator getComparator(int column) { - Class columnType = tableModel.getColumnClass(column); - Comparator comparator = columnComparators.get(columnType); - if (comparator != null) { - return comparator; - } - if (Comparable.class.isAssignableFrom(columnType)) { - return COMPARABLE_COMAPRATOR; - } - return LEXICAL_COMPARATOR; - } - - /* Original code replaced by Boudreau - private Row[] getViewToModel() { - if (viewToModel == null) { - int tableModelRowCount = tableModel.getRowCount(); - viewToModel = new Row[tableModelRowCount]; - for (int row = 0; row < tableModelRowCount; row++) { - viewToModel[row] = new Row(row); - } - - if (isSorting()) { - Arrays.sort(viewToModel); - } - } - return viewToModel; - } - */ - /* Modified code by Boudreau. Uses a flag to determine if - * viewToModel is to be reloaded. This eliminates the NPE that - * can occur by the OS asynchronously refreshing the displayed table. - */ - private Row[] getViewToModel() { - if (clearSortingState) { - clearSortingState = false; - int tableModelRowCount = tableModel.getRowCount(); - viewToModel = new Row[tableModelRowCount]; - for (int row = 0; row < tableModelRowCount; row++) { - viewToModel[row] = new Row(row); - } - - if (isSorting()) { - Arrays.sort(viewToModel); - } - } - return viewToModel; - } - - public int modelIndex(int viewIndex) { - return getViewToModel()[viewIndex].modelIndex; - } - - private int[] getModelToView() { - if (modelToView == null) { - int n = getViewToModel().length; - modelToView = new int[n]; - for (int i = 0; i < n; i++) { - modelToView[modelIndex(i)] = i; - } - } - return modelToView; - } - - // TableModel interface methods - @Override - public int getRowCount() { - return (tableModel == null) ? 0 : tableModel.getRowCount(); - } - - @Override - public int getColumnCount() { - return (tableModel == null) ? 0 : tableModel.getColumnCount(); - } - - @Override - public String getColumnName(int column) { - return tableModel.getColumnName(column); - } - - @Override - public Class getColumnClass(int column) { - return tableModel.getColumnClass(column); - } - - @Override - public boolean isCellEditable(int row, int column) { - return tableModel.isCellEditable(modelIndex(row), column); - } - - @Override - public Object getValueAt(int row, int column) { - return tableModel.getValueAt(modelIndex(row), column); - } - - @Override - public void setValueAt(Object aValue, int row, int column) { - tableModel.setValueAt(aValue, modelIndex(row), column); - } - - // Helper classes - private class Row implements Comparable { - - private int modelIndex; - - public Row(int index) { - this.modelIndex = index; - } - - @SuppressFBWarnings(value = "EQ_COMPARETO_USE_OBJECT_EQUALS") - // compareTo used for specific purpose, equals and hashCode not needed - @Override - public int compareTo(Object o) { - int row1 = modelIndex; - int row2 = ((Row) o).modelIndex; - - for (Iterator it = sortingColumns.iterator(); it.hasNext();) { - Directive directive = it.next(); - int column = directive.column; - Object o1 = tableModel.getValueAt(row1, column); - Object o2 = tableModel.getValueAt(row2, column); - - int comparison = 0; - // Define null less than everything, except null. - if (o1 == null && o2 == null) { - comparison = 0; - } else if (o1 == null) { - comparison = -1; - } else if (o2 == null) { - comparison = 1; - } else { - comparison = getComparator(column).compare(o1, o2); - } - if (comparison != 0) { - return directive.direction == DESCENDING ? -comparison : comparison; - } - } - return 0; - } - } - - private class TableModelHandler implements TableModelListener { - - @Override - public void tableChanged(TableModelEvent e) { - // If we're not sorting by anything, just pass the event along. - if (!isSorting()) { - clearSortingState(); - fireTableChanged(e); - return; - } - - // If the table structure has changed, cancel the sorting; the - // sorting columns may have been either moved or deleted from - // the model. - if (e.getFirstRow() == TableModelEvent.HEADER_ROW) { - cancelSorting(); - fireTableChanged(e); - return; - } - - // We can map a cell event through to the view without widening - // when the following conditions apply: - // - // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and, - // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and, - // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and, - // d) a reverse lookup will not trigger a sort (modelToView != null) - // - // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS. - // - // The last check, for (modelToView != null) is to see if modelToView - // is already allocated. If we don't do this check; sorting can become - // a performance bottleneck for applications where cells - // change rapidly in different parts of the table. If cells - // change alternately in the sorting column and then outside of - // it this class can end up re-sorting on alternate cell updates - - // which can be a performance problem for large tables. The last - // clause avoids this problem. - int column = e.getColumn(); - if (e.getFirstRow() == e.getLastRow() - && column != TableModelEvent.ALL_COLUMNS - && getSortingStatus(column) == NOT_SORTED - && modelToView != null) { - int viewIndex = getModelToView()[e.getFirstRow()]; - fireTableChanged(new TableModelEvent(TableSorter.this, - viewIndex, viewIndex, - column, e.getType())); - return; - } - - // Something has happened to the data that may have invalidated the row order. - clearSortingState(); - fireTableDataChanged(); - return; - } - } - - private class MouseHandler extends MouseAdapter { - - @Override - public void mouseClicked(MouseEvent e) { - JTableHeader h = (JTableHeader) e.getSource(); - TableColumnModel columnModel = h.getColumnModel(); - int viewColumn = columnModel.getColumnIndexAtX(e.getX()); - int column = columnModel.getColumn(viewColumn).getModelIndex(); - if (column != -1) { - int status = getSortingStatus(column); - if (!e.isControlDown()) { - cancelSorting(); - } - // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or - // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. - status = status + (e.isShiftDown() ? -1 : 1); - status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} - setSortingStatus(column, status); - } - } - } - - private static class Arrow implements Icon { - - private boolean descending; - private int size; - private int priority; - - public Arrow(boolean descending, int size, int priority) { - this.descending = descending; - this.size = size; - this.priority = priority; - } - - @Override - public void paintIcon(Component c, Graphics g, int x, int y) { - Color color = c == null ? Color.GRAY : c.getBackground(); - // In a compound sort, make each succesive triangle 20% - // smaller than the previous one. - int dx = (int) (size / 2. * Math.pow(0.8, priority)); - int dy = descending ? dx : -dx; - // Align icon (roughly) with font baseline. - y = y + 5 * size / 6 + (descending ? -dy : 0); - int shift = descending ? 1 : -1; - g.translate(x, y); - - // Right diagonal. - g.setColor(color.darker()); - g.drawLine(dx / 2, dy, 0, 0); - g.drawLine(dx / 2, dy + shift, 0, shift); - - // Left diagonal. - g.setColor(color.brighter()); - g.drawLine(dx / 2, dy, dx, 0); - g.drawLine(dx / 2, dy + shift, dx, shift); - - // Horizontal line. - if (descending) { - g.setColor(color.darker().darker()); - } else { - g.setColor(color.brighter().brighter()); - } - g.drawLine(dx, 0, 0, 0); - - g.setColor(color); - g.translate(-x, -y); - } - - @Override - public int getIconWidth() { - return size; - } - - @Override - public int getIconHeight() { - return size; - } - } - - private class SortableHeaderRenderer implements TableCellRenderer { - - private TableCellRenderer tableCellRenderer; - - public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) { - this.tableCellRenderer = tableCellRenderer; - } - - @Override - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - int row, - int column) { - Component c = tableCellRenderer.getTableCellRendererComponent(table, - value, isSelected, hasFocus, row, column); - if (c instanceof JLabel) { - JLabel l = (JLabel) c; - l.setHorizontalTextPosition(JLabel.LEFT); - int modelColumn = table.convertColumnIndexToModel(column); - l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize())); - } - return c; - } - } - - public static SortOrder getSortOrder(int sortStatus) { - switch (sortStatus) { - case DESCENDING: - return SortOrder.DESCENDING; - case ASCENDING: - return SortOrder.ASCENDING; - default: - return SortOrder.UNSORTED; - } - } - - public static int getSortStatus(SortOrder sortOrder) { - switch (sortOrder) { - case ASCENDING: - return ASCENDING; - case DESCENDING: - return DESCENDING; - default: - return NOT_SORTED; - } - } - - private static class Directive { - - private int column; - private int direction; - - public Directive(int column, int direction) { - this.column = column; - this.direction = direction; - } - } -} diff --git a/java/src/jmri/util/davidflanagan/HardcopyWriter.java b/java/src/jmri/util/davidflanagan/HardcopyWriter.java index 8658348f675..109b0d4bf19 100644 --- a/java/src/jmri/util/davidflanagan/HardcopyWriter.java +++ b/java/src/jmri/util/davidflanagan/HardcopyWriter.java @@ -29,6 +29,7 @@ import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.JWindow; +import javax.swing.border.EmptyBorder; import jmri.util.JmriJFrame; /** @@ -85,7 +86,6 @@ public class HardcopyWriter extends Writer { protected JButton previousButton; protected JButton closeButton; protected JLabel pageCount = new JLabel(); - protected JLabel totalPages = new JLabel(); // save state between invocations of write() private boolean last_char_was_return = false; @@ -216,11 +216,9 @@ protected void toolBarInit() { pagenum++; displayPage(); }); - previewToolBar.add(new JLabel(" " + Bundle.getMessage("HeaderPageNum"))); + pageCount = new JLabel(Bundle.getMessage("HeaderPageNum", pagenum, pageImages.size())); + pageCount.setBorder(new EmptyBorder(0, 10, 0, 10)); previewToolBar.add(pageCount); - previewToolBar.add(new JLabel(" / ")); // values don't stick to use {0} etc. variable fields - previewToolBar.add(totalPages); - closeButton = new JButton(Bundle.getMessage("ButtonClose")); previewToolBar.add(closeButton); closeButton.addActionListener((ActionEvent actionEvent) -> { @@ -262,8 +260,7 @@ protected void displayPage() { // put the label in the panel (already has a scroll pane) previewPanel.add(previewLabel); // set the page count info - pageCount.setText("" + pagenum); - totalPages.setText(pageImages.size() + " "); + pageCount.setText(Bundle.getMessage("HeaderPageNum", pagenum, pageImages.size())); // repaint the frame but don't use pack() as we don't want resizing previewFrame.invalidate(); previewFrame.revalidate(); @@ -274,8 +271,8 @@ protected void displayPage() { * Send text to Writer output. * * @param buffer block of text characters - * @param index position to start printing - * @param len length (number of characters) of output + * @param index position to start printing + * @param len length (number of characters) of output */ @Override public void write(char[] buffer, int index, int len) { @@ -349,8 +346,7 @@ public void write(char[] buffer, int index, int len) { /** * Write a given String with the desired color. *

              - * Reset the text color back to the default after - * the string is written. + * Reset the text color back to the default after the string is written. * * @param c the color desired for this String * @param s the String @@ -372,8 +368,8 @@ public void flush() { } /** - * Handle close event of pane. - * Modified to clean up the added preview capability. + * Handle close event of pane. Modified to clean up the added preview + * capability. * * @author David Flanagan, modified by Dennis Miller */ diff --git a/java/src/jmri/util/swing/DrawSquares.java b/java/src/jmri/util/swing/DrawSquares.java new file mode 100644 index 00000000000..1addfce0481 --- /dev/null +++ b/java/src/jmri/util/swing/DrawSquares.java @@ -0,0 +1,76 @@ +package jmri.util.swing; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import javax.swing.JPanel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Common utility to draw colored rectangular Image. + * Used as background in jmrit.catalog, jmrit.display.LE#AddItems, Palette. + * + * @author Egbert Broerse copyright (c) 2017 + */ +public class DrawSquares { + + /** + * Produce either a plain image or a grid of gray/white squares. + * + * @param width image width in pixels to match parent frame size + * @param height image height in pixels to match parent frame size + * @param dim length of sides of squares in pixels + * @param color1 background color + * @param color2 contrasting squares fill color + * @see jmri.jmrit.catalog.PreviewDialog#setupPanel() + */ + public static BufferedImage getImage(int width, int height, int dim, Color color1, Color color2) { + Color sqColor = new Color(235, 235, 235); // light gray + Color bgColor = Color.white; + int sqSize = 10; // square width in pixels + BufferedImage back; + int w = 500; + int h = 500; + if (width > 0) { w = width; } + if (height > 0) { h = height; } + sqSize = dim; + if (color1 != null) { + bgColor = color1; + } + if (color2 != null) { + sqColor = color2; + } + // paint alternate squares + back = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = back.createGraphics(); + g2d.setColor(bgColor); + g2d.fillRect(0, 0, w, h); // plain rect background + if (sqColor != bgColor) { + g2d.setColor(sqColor); + for (int j = 0; j <= (w / sqSize); j++) { + for (int k = 0; k <= (h / sqSize); k++) { + if ((j + k) % 2 == 0) { // skip every other square + g2d.fillRect(j * sqSize, k * sqSize, sqSize, sqSize); // gray squares + } + } + } + } + g2d.dispose(); + + // this.setSize(w, h); + // Dimension d1 = new Dimension(w, h); + // this.setPreferredSize(d1); + // this.setMinimumSize(d1); + // this.setMaximumSize(d1); + // this.setOpaque(true); + log.debug("DrawSquares ready"); + return back; + } + + private static final Logger log = LoggerFactory.getLogger(DrawSquares.class); + +} diff --git a/java/src/jmri/util/swing/ImagePanel.java b/java/src/jmri/util/swing/ImagePanel.java new file mode 100644 index 00000000000..b63ce44046e --- /dev/null +++ b/java/src/jmri/util/swing/ImagePanel.java @@ -0,0 +1,59 @@ +package jmri.util.swing; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; +import javax.swing.JPanel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Common utility to draw a BufferedImage as background behind a JPanel. + * Used in jmri.jmrit.catalog, jmri.jmrit.display.palette (via LayoutEditor 'Add Items' menu). + * + * @author Egbert Broerse copyright (c) 2017 + */ +public class ImagePanel extends JPanel { + + private Image back = null; + int imgWidth; + int imgHeight; + + /** + * Set background images for ImagePanel. + * @see jmri.jmrit.catalog.PreviewDialog#setupPanel() + * @see jmri.jmrit.catalog.CatalogPanel#makeButtonPanel() + * + * @param img Image to load as background + */ + public void setImage(Image img) { + back = img; + repaint(); + log.debug("DrawPanel ready"); + } + + //public Dimension getPreferredSize() { + // return new Dimension(imgWidth, imgHeight); + //} + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + if (back != null) { + imgWidth = getWidth(); + imgHeight = getHeight(); + g.drawImage(back, 0, 0, imgWidth, imgHeight, this); + } + } + + //private void update() { + // repaint(); + //} + + private static final Logger log = LoggerFactory.getLogger(ImagePanel.class); + +} diff --git a/java/src/jmri/util/swing/JComboBoxUtil.java b/java/src/jmri/util/swing/JComboBoxUtil.java new file mode 100644 index 00000000000..da762b43a0f --- /dev/null +++ b/java/src/jmri/util/swing/JComboBoxUtil.java @@ -0,0 +1,47 @@ +package jmri.util.swing; + +import java.awt.*; +import javax.swing.*; +import javax.swing.plaf.basic.BasicComboPopup; + +/** + * Common utility methods for working with JComboBoxes. + *

              + * + * @author Bob Jacobsen Copyright 2003, 2010 + * @since 4.9.5 + */ +public class JComboBoxUtil { + + /** + * Set the maximum number of rows for a JComboBox so that + * it always can fit on the screen + */ + public static void setupComboBoxMaxRows(T inComboBox) { + // find the max height of all popup items + BasicComboPopup popup = (BasicComboPopup) inComboBox.getAccessibleContext().getAccessibleChild(0); + JList list = popup.getList(); + ListModel lm = list.getModel(); + ListCellRenderer renderer = list.getCellRenderer(); + int maxItemHeight = 12; // pick some absolute minimum here + for (int i = 0; i < lm.getSize(); ++i) { + Object value = lm.getElementAt(i); + Component c = renderer.getListCellRendererComponent(list, value, i, false, false); + maxItemHeight = Math.max(maxItemHeight, c.getPreferredSize().height); + } + + int itemsPerScreen = inComboBox.getItemCount(); + // calculate the number of items that will fit on the screen + if (!GraphicsEnvironment.isHeadless()) { + // note: this line returns the maximum available size, accounting all + // taskbars etc. no matter where they are aligned: + Rectangle maxWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); + itemsPerScreen = (int) maxWindowBounds.getHeight() / maxItemHeight; + } + + int c = Math.min(itemsPerScreen, inComboBox.getItemCount()); + inComboBox.setMaximumRowCount(c); + } + + +} diff --git a/java/src/jmri/util/swing/JmriBeanComboBox.java b/java/src/jmri/util/swing/JmriBeanComboBox.java index e024804293b..0d238a38e3b 100644 --- a/java/src/jmri/util/swing/JmriBeanComboBox.java +++ b/java/src/jmri/util/swing/JmriBeanComboBox.java @@ -2,6 +2,8 @@ import java.awt.Color; import java.awt.Component; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; import java.awt.event.ItemEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -17,9 +19,12 @@ import javax.swing.JComboBox; import javax.swing.JComboBox.KeySelectionManager; import javax.swing.JList; +import javax.swing.ListCellRenderer; +import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.UIManager; import javax.swing.plaf.basic.BasicComboBoxRenderer; +import javax.swing.plaf.basic.BasicComboPopup; import javax.swing.text.JTextComponent; import jmri.Manager; import jmri.NamedBean; @@ -133,7 +138,6 @@ private void updateComboBox(String inSelect) { setSelectedIndex(0); } } - } /** diff --git a/java/src/jmri/util/usb/Bundle.properties b/java/src/jmri/util/usb/Bundle.properties index 9db019eb319..cf656eac014 100644 --- a/java/src/jmri/util/usb/Bundle.properties +++ b/java/src/jmri/util/usb/Bundle.properties @@ -17,5 +17,17 @@ UsbDeviceSerial=Serial Number UsbDeviceVendorId=Vendor ID #USB Product ID for device UsbDeviceProductId=Product ID +#USB Location for device +UsbDeviceLocation=Location #Table text when there is no selection EmptySelection=No device selected +#USB Class for device +UsbDeviceClass=Class +#USB SubClass for device +UsbDeviceSubClass=SubClass +#USB Protocol for device +UsbDeviceProtocol=Protocol +#USB BCD Release Number for device +UsbDeviceReleaseNumber=Release Number +#USB Number of Configurations for device +UsbDeviceNumConfigurations=Configurations diff --git a/java/src/jmri/util/usb/UsbBrowserPanel.form b/java/src/jmri/util/usb/UsbBrowserPanel.form index fd4fe6401c5..a870e4b3478 100644 --- a/java/src/jmri/util/usb/UsbBrowserPanel.form +++ b/java/src/jmri/util/usb/UsbBrowserPanel.form @@ -56,7 +56,11 @@ + + + + @@ -78,11 +82,12 @@ - + + diff --git a/java/src/jmri/util/usb/UsbBrowserPanel.java b/java/src/jmri/util/usb/UsbBrowserPanel.java index 28b31f90b5a..763b50d511e 100644 --- a/java/src/jmri/util/usb/UsbBrowserPanel.java +++ b/java/src/jmri/util/usb/UsbBrowserPanel.java @@ -11,13 +11,17 @@ *============================================================================*/ package jmri.util.usb; +import java.awt.Image; import java.io.UnsupportedEncodingException; import java.util.List; +import javax.swing.ImageIcon; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.table.AbstractTableModel; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; import javax.usb.UsbDevice; @@ -25,6 +29,7 @@ import javax.usb.UsbException; import javax.usb.UsbHostManager; import javax.usb.UsbHub; +import javax.usb.UsbPort; import javax.usb.event.UsbServicesEvent; import javax.usb.event.UsbServicesListener; import org.slf4j.Logger; @@ -39,10 +44,28 @@ public class UsbBrowserPanel extends javax.swing.JPanel { private final UsbTreeNode root; private final UsbDeviceTableModel deviceModel = new UsbDeviceTableModel(); private final static Logger log = LoggerFactory.getLogger(UsbBrowserPanel.class); - private final UsbServicesListener usbServicesListener = new UsbServicesListener() { + private transient final UsbServicesListener usbServicesListener = new UsbServicesListener() { @Override public void usbDeviceAttached(UsbServicesEvent use) { - // TODO: use sublter method to add device to tree + // subtler method to add usbDevice to tree + UsbDevice usbDevice = use.getUsbDevice(); + UsbPort usbPort = usbDevice.getParentUsbPort(); + if (usbPort != null) { + UsbDevice parentUsbDevice = usbPort.getUsbHub(); + UsbTreeNode parentNode = findNodeForDevice(root, parentUsbDevice); + if (parentNode != null) { + UsbTreeNode node = new UsbTreeNode(usbDevice); + parentNode.add(node); + if (usbTree != null) { + TreePath selection = usbTree.getSelectionPath(); + ((DefaultTreeModel) usbTree.getModel()).nodeChanged(parentNode); + // .nodeChanged(parent) isn't enough + ((DefaultTreeModel) usbTree.getModel()).reload(root); + usbTree.setSelectionPath(selection); + } + return; + } + } UsbTreeNode root = UsbBrowserPanel.this.root; root.removeAllChildren(); UsbBrowserPanel.this.buildTree(root); @@ -50,17 +73,32 @@ public void usbDeviceAttached(UsbServicesEvent use) { @Override public void usbDeviceDetached(UsbServicesEvent use) { - // TODO: use sublter method to remove device from tree + // subtler method to remove usbDevice from tree UsbTreeNode root = UsbBrowserPanel.this.root; - root.removeAllChildren(); - UsbBrowserPanel.this.buildTree(root); + UsbDevice usbDevice = use.getUsbDevice(); + UsbTreeNode usbTreeNode = findNodeForDevice(root, usbDevice); + if (usbTreeNode != null) { + TreeNode parentTreeNode = usbTreeNode.getParent(); + usbTreeNode.removeFromParent(); + if (usbTree != null) { + TreePath selection = usbTree.getSelectionPath(); + if (parentTreeNode != null) { + ((DefaultTreeModel) usbTree.getModel()).reload(parentTreeNode); + } else { + ((DefaultTreeModel) usbTree.getModel()).reload(root); + } + usbTree.setSelectionPath(selection); + } + } else { + root.removeAllChildren(); + UsbBrowserPanel.this.buildTree(root); + } } }; private final TreeSelectionListener treeSelectionListener = (TreeSelectionEvent e) -> { UsbTreeNode node = (UsbTreeNode) this.usbTree.getLastSelectedPathComponent(); if (node != null) { - UsbDevice device = (UsbDevice) node.getUserObject(); - this.deviceModel.setUsbDevice(device); + deviceModel.setNode(node); } else { this.usbTree.setSelectionPath(e.getNewLeadSelectionPath()); } @@ -68,41 +106,70 @@ public void usbDeviceDetached(UsbServicesEvent use) { /** * Create new UsbBrowserPanel. - * */ public UsbBrowserPanel() { - this.root = new UsbTreeNode(); - this.buildTree(this.root); - if (this.root.getUserObject() != null) { + root = new UsbTreeNode(); + buildTree(root); + if (root.getUserObject() != null) { try { - UsbHostManager.getUsbServices().addUsbServicesListener(this.usbServicesListener); + UsbHostManager.getUsbServices().addUsbServicesListener(usbServicesListener); } catch (UsbException | SecurityException ex) { log.error("Unable to get root USB hub.", ex); } } initComponents(); + for (int i = 0; i < usbTree.getRowCount(); i++) { + usbTree.expandRow(i); + } } private void buildTree(UsbTreeNode root) { - if (root.getUserObject() != null && ((UsbDevice) root.getUserObject()).isUsbHub()) { - ((List) ((UsbHub) root.getUserObject()).getAttachedUsbDevices()).forEach((device) -> { - UsbTreeNode node = new UsbTreeNode(device); - this.buildTree(node); - log.debug("Adding {} to {}", node, root); - root.add(new UsbTreeNode(device)); + Object userObject = root.getUserObject(); + if (userObject != null && ((UsbDevice) userObject).isUsbHub()) { + UsbHub usbHub = (UsbHub) userObject; + List usbDevices = usbHub.getAttachedUsbDevices(); + usbDevices.forEach((UsbDevice usbDevice) -> { + UsbTreeNode node = new UsbTreeNode(usbDevice); + log.debug("Adding {} to {}, depth: {}", node, root, node.getLevel()); + buildTree(node); + root.add(node); }); } // prevent NPE if called in constructor - if (this.usbTree != null) { - TreePath selection = this.usbTree.getSelectionPath(); - ((DefaultTreeModel) this.usbTree.getModel()).reload(root); - this.usbTree.setSelectionPath(selection); + if (usbTree != null) { + TreePath selection = usbTree.getSelectionPath(); + ((DefaultTreeModel) usbTree.getModel()).reload(root); + usbTree.setSelectionPath(selection); } } + /* + * recursively search all children of root for usb device + */ + private UsbTreeNode findNodeForDevice(UsbTreeNode root, UsbDevice usbDevice) { + if (!root.isLeaf()) { + for (int idx = 0; idx < root.getChildCount(); idx++) { + TreeNode treeNode = root.getChildAt(idx); + if (treeNode instanceof UsbTreeNode) { + UsbTreeNode usbTreeNode = (UsbTreeNode) treeNode; + UsbDevice tryUsbDevice = usbTreeNode.getUsbDevice(); + log.debug("trying device: {}", tryUsbDevice); + if ((tryUsbDevice != null) && (tryUsbDevice == usbDevice)) { + return usbTreeNode; + } + UsbTreeNode result = findNodeForDevice(usbTreeNode, usbDevice); + if (result != null) { + return result; + } + } + } + } + return null; + } + public void dispose() { try { - UsbHostManager.getUsbServices().removeUsbServicesListener(this.usbServicesListener); + UsbHostManager.getUsbServices().removeUsbServicesListener(usbServicesListener); } catch (UsbException | SecurityException ex) { // silently ignore, since it was logged when this panel was constructed } @@ -121,22 +188,25 @@ private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(this.usbTree); usbTree = new javax.swing.JTree(this.root); jScrollPane2 = new javax.swing.JScrollPane(); - jTable1 = new javax.swing.JTable(); + detailsTable = new javax.swing.JTable(); jSplitPane1.setBorder(null); jSplitPane1.setResizeWeight(0.5); jScrollPane1.setBorder(null); + usbTree.setCellRenderer(new UsbTreeCellRenderer()); usbTree.setRootVisible(false); + usbTree.setShowsRootHandles(true); usbTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); usbTree.addTreeSelectionListener(this.treeSelectionListener); jScrollPane1.setViewportView(usbTree); jSplitPane1.setLeftComponent(jScrollPane1); - jTable1.setModel(this.deviceModel); - jScrollPane2.setViewportView(jTable1); + detailsTable.setModel(this.deviceModel); + detailsTable.setCellSelectionEnabled(true); + jScrollPane2.setViewportView(detailsTable); jSplitPane1.setRightComponent(jScrollPane2); @@ -154,10 +224,10 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTable detailsTable; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JSplitPane jSplitPane1; - private javax.swing.JTable jTable1; private javax.swing.JTree usbTree; // End of variables declaration//GEN-END:variables @@ -167,51 +237,65 @@ public UsbTreeNode() { this(null); } - public UsbTreeNode(UsbDevice node) { + public UsbTreeNode(UsbDevice usbDevice) { super(); - if (node == null) { + + if (usbDevice == null) { try { - node = javax.usb.UsbHostManager.getUsbServices().getRootUsbHub(); - log.debug("Using root node {}", node); + userObject = UsbHostManager.getUsbServices().getRootUsbHub(); + log.debug("Using root usbDevice {}", userObject); } catch (UsbException | SecurityException ex) { log.error("Unable to get root USB hub.", ex); + userObject = null; } } else { - log.error("Description of {} is\n{}", node, node.getUsbDeviceDescriptor()); + log.debug("Description of {} is\n{}", usbDevice, usbDevice.getUsbDeviceDescriptor()); + userObject = usbDevice; } - this.userObject = node; + } + + public UsbDevice getUsbDevice() { + return (UsbDevice) userObject; + } + + public void setUsbDevice(UsbDevice usbDevice) { + userObject = usbDevice; + } + + @Override + public boolean isLeaf() { + if (userObject instanceof UsbHub) { + return false; + } + return super.isLeaf(); } @Override public String toString() { - if (this.userObject == null) { + if (userObject == null) { return Bundle.getMessage("UnableToGetUsbRootHub"); - } else if (this.userObject instanceof UsbDevice) { - try { - UsbDevice device = ((UsbDevice) this.userObject); - if (device.getProductString() != null) { - return device.getProductString(); - } - } catch (UsbException | UnsupportedEncodingException | UsbDisconnectedException ex) { - log.error("Unable to get USB device properties for {}", this.userObject); + } else if (userObject instanceof UsbDevice) { + String name = UsbUtil.getFullProductName((UsbDevice) userObject); + if (name != null) { + return name; } } return super.toString(); } - } + } // class UsbTreeNode private static class UsbDeviceTableModel extends AbstractTableModel { - private UsbDevice device = null; + private UsbTreeNode node = null; @Override public int getRowCount() { - return (device != null) ? 5 : 1; + return ((node != null) && (node.getUsbDevice() != null)) ? 11 : 1; } @Override public int getColumnCount() { - return (device != null) ? 2 : 1; + return ((node != null) && (node.getUsbDevice() != null)) ? 2 : 1; } @Override @@ -221,7 +305,7 @@ public String getColumnName(int columnIndex) { @Override public Object getValueAt(int rowIndex, int columnIndex) { - if (device == null) { + if ((node == null) || (node.getUsbDevice() == null)) { return Bundle.getMessage("EmptySelection"); } switch (columnIndex) { @@ -237,6 +321,18 @@ public Object getValueAt(int rowIndex, int columnIndex) { return Bundle.getMessage("UsbDeviceVendorId"); case 4: return Bundle.getMessage("UsbDeviceProductId"); + case 5: + return Bundle.getMessage("UsbDeviceClass"); + case 6: + return Bundle.getMessage("UsbDeviceSubClass"); + case 7: + return Bundle.getMessage("UsbDeviceProtocol"); + case 8: + return Bundle.getMessage("UsbDeviceReleaseNumber"); + case 9: + return Bundle.getMessage("UsbDeviceNumConfigurations"); + case 10: + return Bundle.getMessage("UsbDeviceLocation"); default: break; } @@ -246,20 +342,32 @@ public Object getValueAt(int rowIndex, int columnIndex) { try { switch (rowIndex) { case 0: - return this.device.getManufacturerString(); + return node.getUsbDevice().getManufacturerString(); case 1: - return this.device.getProductString(); + return node.getUsbDevice().getProductString(); case 2: - return this.device.getSerialNumberString(); + return node.getUsbDevice().getSerialNumberString(); case 3: - return String.format("%04x", this.device.getUsbDeviceDescriptor().idVendor()); + return String.format("%04x", node.getUsbDevice().getUsbDeviceDescriptor().idVendor()); case 4: - return String.format("%04x", this.device.getUsbDeviceDescriptor().idProduct()); + return String.format("%04x", node.getUsbDevice().getUsbDeviceDescriptor().idProduct()); + case 5: + return String.format("%02X", node.getUsbDevice().getUsbDeviceDescriptor().bDeviceClass()); + case 6: + return String.format("%02X", node.getUsbDevice().getUsbDeviceDescriptor().bDeviceSubClass()); + case 7: + return String.format("%02X", node.getUsbDevice().getUsbDeviceDescriptor().bDeviceProtocol()); + case 8: + return String.format("%04x", node.getUsbDevice().getUsbDeviceDescriptor().bcdDevice()); + case 9: + return node.getUsbDevice().getUsbDeviceDescriptor().bNumConfigurations(); + case 10: + return UsbUtil.getLocation(node.getUsbDevice()); default: return null; } - }catch (UsbDisconnectedException ex) { - this.setUsbDevice(null); + } catch (UsbDisconnectedException ex) { + node.setUsbDevice(null); } catch (UnsupportedEncodingException | UsbException ex) { log.error("Unable to get USB device property.", ex); } @@ -270,13 +378,43 @@ public Object getValueAt(int rowIndex, int columnIndex) { return null; } - public void setUsbDevice(UsbDevice device) { - UsbDevice old = this.device; - this.device = device; - if ((old == null && device != null) || (old != null && device == null)) { - this.fireTableStructureChanged(); + public void setNode(UsbTreeNode node) { + UsbTreeNode old = this.node; + this.node = node; + if (((old == null) && (node != null)) || ((old != null) && (node == null))) { + fireTableStructureChanged(); + } + fireTableDataChanged(); + } + } + + private final static class UsbTreeCellRenderer extends DefaultTreeCellRenderer { + + public UsbTreeCellRenderer() { + int width = getOpenIcon().getIconWidth(); + int height = getOpenIcon().getIconHeight(); + try { + setOpenIcon(new ImageIcon(new ImageIcon(getClass().getResource("/jmri/util/usb/topology.png")) + .getImage() + .getScaledInstance(width, height, Image.SCALE_SMOOTH))); + } catch (NullPointerException ex) { + log.error("Unable to get resource /jmri/util/usb/topology.png from JMRI classpath"); + } + try { + setClosedIcon(new ImageIcon(new ImageIcon(getClass().getResource("/jmri/util/usb/topology.png")) + .getImage() + .getScaledInstance(width, height, Image.SCALE_SMOOTH))); + } catch (NullPointerException ex) { + log.error("Unable to get resource /jmri/util/usb/topology.png from JMRI classpath"); + } + try { + setLeafIcon(new ImageIcon(new ImageIcon(getClass().getResource("/jmri/util/usb/usb.png")) + .getImage() + .getScaledInstance(width, height, Image.SCALE_SMOOTH))); + } catch (NullPointerException ex) { + log.error("Unable to get resource /jmri/util/usb/usb.png from JMRI classpath"); } - this.fireTableDataChanged(); } + } } diff --git a/java/src/jmri/util/usb/UsbUtil.java b/java/src/jmri/util/usb/UsbUtil.java new file mode 100644 index 00000000000..252747853b5 --- /dev/null +++ b/java/src/jmri/util/usb/UsbUtil.java @@ -0,0 +1,296 @@ +package jmri.util.usb; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.usb.UsbConfiguration; +import javax.usb.UsbDevice; +import javax.usb.UsbDeviceDescriptor; +import javax.usb.UsbDisconnectedException; +import javax.usb.UsbException; +import javax.usb.UsbHostManager; +import javax.usb.UsbHub; +import javax.usb.UsbInterface; +import javax.usb.UsbNotActiveException; +import javax.usb.UsbNotClaimedException; +import javax.usb.UsbNotOpenException; +import javax.usb.UsbPipe; +import javax.usb.UsbPort; +import javax.usb.event.UsbPipeDataEvent; +import javax.usb.event.UsbPipeErrorEvent; +import javax.usb.event.UsbPipeListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * USB utilities. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public final class UsbUtil { + + /** + * Prevent construction, since this is a stateless utility class + */ + private UsbUtil() { + // prevent construction, since this is a stateless utility class + } + + /** + * Get all USB devices. + * + * @return a list of all UsbDevice's + */ + public static List getAllDevices() { + return getMatchingDevices((short) 0, (short) 0, null); + } + + /** + * Get matching USB devices. + * + * @param idVendor the vendor id to match (zero matches any) + * @param idProduct the product id to match (zero matches any) + * @param serialNumber the serial number to match (null matches any) + * @return a list of matching UsbDevices + */ + public static List getMatchingDevices(short idVendor, short idProduct, @Nullable String serialNumber) { + return findUsbDevices(null, idVendor, idProduct, serialNumber); + } + + /** + * Get matching USB device. + * + * @param idVendor the vendor id to match (zero matches any) + * @param idProduct the product id to match (zero matches any) + * @param serialNumber the serial number to match (null matches any) + * @param idLocation the location to match + * @return the matching UsbDevice or null if no match could be found + */ + @CheckForNull + public static UsbDevice getMatchingDevice(short idVendor, short idProduct, @Nullable String serialNumber, @Nonnull String idLocation) { + for (UsbDevice usbDevice : findUsbDevices(null, idVendor, idProduct, serialNumber)) { + String locationID = getLocation(usbDevice); + if (locationID.equals(idLocation)) { + return usbDevice; + } + } + return null; + } + + /** + * Get a USB device's full product (manufacturer + product) name. + * + * @param usbDevice the USB device to get the full product name of + * @return the full product name or null if the product name is not encoded + * in the device + */ + @CheckForNull + public static String getFullProductName(@Nonnull UsbDevice usbDevice) { + String result = null; + try { + String manufacturer = usbDevice.getManufacturerString(); + String product = usbDevice.getProductString(); + if (product != null) { + if (manufacturer == null || product.startsWith(manufacturer)) { + result = product; + } else { + result = Bundle.getMessage("UsbDevice", manufacturer, product); + } + } + } catch (UsbException | UnsupportedEncodingException ex) { + log.error("Unable to read data from {}", usbDevice, ex); + } catch (UsbDisconnectedException ex) { + log.error("Unable to read data from disconnected device {}", usbDevice); + } + return result; + } + + /** + * Get a USB device's serial number. + * + * @param usbDevice the USB device to get the serial number of + * @return serial number + */ + @CheckForNull + public static String getSerialNumber(@Nonnull UsbDevice usbDevice) { + try { + return usbDevice.getSerialNumberString(); + } catch (UsbException | UnsupportedEncodingException | UsbDisconnectedException ex) { + log.error("Unable to get serial number of {}", usbDevice); + } + return null; + } + + /** + * Get a unique value that represents the device's location in the USB + * device topology. + *

              + * The location is a series of USB ports separated by colons (:) starting + * from the the root hub (a virtual hub maintained by the operating system), + * represented as {@code USB} in the location, passing through hubs (which + * may be virtual or physical), to the port the requested device is plugged + * into. + *

              + * Note: this method should only be used to uniquely + * identify USB devices in combination with consideration of the USB device + * product ID, vendor ID, and serial number, as using this alone could mean + * that two devices with the same product and vendor IDs, but different + * serial numbers could be misidentified if unplugged and reconnected in + * ports previously used by the other device, or if the hub does not + * consistently enumerate ports the same way. + * + * @param usbDevice the device to get the location of + * @return the location + */ + public static String getLocation(@Nonnull UsbDevice usbDevice) { + UsbDevice device = usbDevice; + StringBuilder path = new StringBuilder(); + while (device != null) { + UsbPort port = device.getParentUsbPort(); + if (port == null) { + break; + } + path.append(Byte.toString(port.getPortNumber())).append(':'); + device = port.getUsbHub(); + } + return String.format("USB%s", path.reverse().toString()); + } + + /** + * Recursive routine to collect USB devices. + * + * @param usbHub the hub who's devices we want to collect (null for + * root) + * @param idVendor the vendor id to match against + * @param idProduct the product id to match against + * @param serialNumber the serial number to match against + */ + @Nonnull + private static List findUsbDevices( + @Nullable UsbHub usbHub, + short idVendor, + short idProduct, + @Nullable String serialNumber) { + if (usbHub == null) { + try { + return findUsbDevices(UsbHostManager.getUsbServices().getRootUsbHub(), idVendor, idProduct, serialNumber); + } catch (UsbException | SecurityException ex) { + log.error("Exception: {}", ex.toString()); + return new ArrayList<>(); // abort with an empty list + } + } + List devices = new ArrayList<>(); + List usbDevices = usbHub.getAttachedUsbDevices(); + usbDevices.forEach((usbDevice) -> { + if (usbDevice instanceof UsbHub) { + UsbHub childUsbHub = (UsbHub) usbDevice; + devices.addAll(findUsbDevices(childUsbHub, idVendor, idProduct, serialNumber)); + } else { + UsbDeviceDescriptor usbDeviceDescriptor = usbDevice.getUsbDeviceDescriptor(); + try { + if (((idVendor == 0) || (idVendor == usbDeviceDescriptor.idVendor())) + && ((idProduct == 0) || (idProduct == usbDeviceDescriptor.idProduct())) + && ((serialNumber == null) || serialNumber.equals(usbDevice.getSerialNumberString()))) { + devices.add(usbDevice); + } + } catch (UsbException | UnsupportedEncodingException | UsbDisconnectedException ex) { + log.error("Unable to request serial number from device {}", usbDevice, ex); + } + } + }); + return devices; + } + + /** + * Read message synchronously. + * + * @param iface the interface + * @param endPoint the end point + */ + public static void readMessage(@Nonnull UsbInterface iface, byte endPoint) { + + try { + iface.claim((UsbInterface usbInterface) -> true); + UsbPipe pipe = iface.getUsbEndpoint(endPoint).getUsbPipe(); + pipe.open(); + + byte[] data = new byte[8]; + int received = pipe.syncSubmit(data); + log.debug("{} bytes received", received); + + pipe.close(); + + } catch (IllegalArgumentException | UsbDisconnectedException | UsbException | UsbNotActiveException | UsbNotClaimedException | UsbNotOpenException ex) { + log.error("Unable to read message", ex); + } finally { + try { + iface.release(); + } catch (UsbNotActiveException | UsbDisconnectedException | UsbException ex) { + log.error("Unable to release USB device", ex); + } + } + } + + /** + * Read message asynchronously. + * + * @param iface the interface + * @param endPoint the end point + */ + public static void readMessageAsynch(@Nonnull UsbInterface iface, byte endPoint) { + + try { + iface.claim((UsbInterface usbInterface) -> true); + + UsbPipe pipe = iface.getUsbEndpoint(endPoint).getUsbPipe(); + + pipe.open(); + + pipe.addUsbPipeListener(new UsbPipeListener() { + @Override + public void errorEventOccurred(UsbPipeErrorEvent event) { + log.error("UsbPipeErrorEvent: {}", event, event.getUsbException()); + } + + @Override + public void dataEventOccurred(UsbPipeDataEvent event) { + byte[] data = event.getData(); + if (log.isDebugEnabled()) { // avoid array->string conversion unless debugging + log.debug("bytes received: {}", Arrays.toString(data)); + } + } + }); + pipe.close(); + } catch (UsbDisconnectedException | UsbException | UsbNotActiveException | UsbNotClaimedException | UsbNotOpenException ex) { + log.error("Unable to read USB message.", ex); + } finally { + try { + iface.release(); + } catch (UsbNotActiveException | UsbDisconnectedException | UsbException ex) { + log.error("Unable to release USB device.", ex); + } + } + } + + /** + * Get USB device interface. + * + * @param device the USB device + * @param index the USB interface index + * @return the USB interface + */ + public static UsbInterface getDeviceInterface(@Nonnull UsbDevice device, byte index) { + UsbConfiguration configuration = device.getActiveUsbConfiguration(); + if (configuration != null) { + return configuration.getUsbInterface(index); + } + return null; + } + + private final static Logger log = LoggerFactory.getLogger(UsbUtil.class); +} diff --git a/java/src/jmri/util/usb/topology.png b/java/src/jmri/util/usb/topology.png new file mode 100644 index 00000000000..af5fcfe6f3c Binary files /dev/null and b/java/src/jmri/util/usb/topology.png differ diff --git a/java/src/jmri/util/usb/usb.png b/java/src/jmri/util/usb/usb.png new file mode 100644 index 00000000000..168a3a14a54 Binary files /dev/null and b/java/src/jmri/util/usb/usb.png differ diff --git a/java/test/apps/DecoderPro/DecoderProTest.java b/java/test/apps/DecoderPro/DecoderProTest.java index c9e532ff5d8..f2800084197 100644 --- a/java/test/apps/DecoderPro/DecoderProTest.java +++ b/java/test/apps/DecoderPro/DecoderProTest.java @@ -9,7 +9,7 @@ /** * - * Description: Tests for the DecoderPro application. + * Tests for the DecoderPro application. * * @author Paul Bender Copyright (C) 2016 */ @@ -33,5 +33,4 @@ public void tearDown() { JUnitUtil.tearDown(); } - } diff --git a/java/test/apps/PanelPro/PanelProActionTest.java b/java/test/apps/PanelPro/PanelProActionTest.java index 78caca28b0c..2681670737d 100644 --- a/java/test/apps/PanelPro/PanelProActionTest.java +++ b/java/test/apps/PanelPro/PanelProActionTest.java @@ -30,4 +30,5 @@ public void tearDown() { } // private final static Logger log = LoggerFactory.getLogger(PanelProActionTest.class); + } diff --git a/java/test/apps/PanelPro/PanelProTest.java b/java/test/apps/PanelPro/PanelProTest.java index ac26c659d06..85131af974f 100644 --- a/java/test/apps/PanelPro/PanelProTest.java +++ b/java/test/apps/PanelPro/PanelProTest.java @@ -12,11 +12,14 @@ import org.junit.Test; import org.junit.Rule; import org.junit.rules.TemporaryFolder; +import org.junit.rules.Timeout; import jmri.util.JUnitUtil; import jmri.util.JmriJFrame; import jmri.util.JUnitAppender; import jmri.util.JUnitUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is more of an acceptance test than a unit test. It confirms that the entire @@ -30,33 +33,22 @@ public class PanelProTest { @Rule public TemporaryFolder folder = new TemporaryFolder(); + @Rule + public Timeout globalTimeout = Timeout.seconds(90); // 90 second timeout for methods in this test class. + @Test - public void testLaunch() throws IOException { + public void testLaunchLocoNet() throws IOException { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); try { // create a custom profile - FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/LocoNet_Simulator"), folder.newFolder()); - System.setProperty("org.jmri.profile", "temp/LocoNet_Simulator"); + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/LocoNet_Simulator"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); // launch! PanelPro.main(new String[]{"PanelPro"}); - - // last few messages from a normal startup are: - // INFO - Starting with profile LocoNet_Simulator.3eac0cdc [main] apps.Apps.?() - // INFO - Using jmri-92FD61C1C87D-3eac0cdc as the JMRI Node identity [main] jmri.util.node.NodeIdentity.?() - // INFO - No local configuration found. [main] jmri.jmrix.ConnectionConfigManager.?() - // INFO - LocoNet Simulator Started [main] jmrix.loconet.hexfile.LnHexFilePort.?() - // INFO - Table preferences not found. - // This is expected on the first time the "LocoNet Simulator" profile is used on this computer. [main] jmri.swing.JmriJTablePersistenceManager.?() - // INFO - File path program: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path preference: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/temp/LocoNet_Simulator/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path profile: is temp/LocoNet_Simulator/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path settings: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/temp/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path home: is /Users/jake/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path scripts: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/jython/ [main] jmri.util.FileUtilSupport.?() - // WARN - Cleaning up frame "LocoNet Simulator" (a class jmri.jmrix.loconet.hexfile.HexFileFrame) from earlier test. [main] jmri.util.JUnitUtil.?() - // WARN - Cleaning up frame "PanelPro" (a class jmri.util.JmriJFrame) from earlier test. [main] jmri.util.JUnitUtil.?() + log.debug("started LocoNetSim"); JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("PanelPro") != null;},"window up"); @@ -75,6 +67,58 @@ public void testLaunch() throws IOException { } } + @Test + public void testLaunchEasyDcc() throws IOException { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + + try { + // create a custom profile + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/EasyDcc_Simulator"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); + + // launch! + PanelPro.main(new String[]{"PanelPro"}); + log.debug("started EasyDccSim"); + + JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("PanelPro") != null;},"window up"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("PanelPro version") != null;}, "first Info line seen"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("Main initialization done") != null;}, "last Info line seen"); + + // PanelPro + } finally { + // wait for threads, etc + jmri.util.JUnitUtil.releaseThread(this, 5000); + } + } + + @Test + public void testLaunchTmcc() throws IOException { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + + try { + // create a custom profile + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/TMCC_Simulator"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); + + // launch! + PanelPro.main(new String[]{"PanelPro"}); + log.debug("started TmcccSim"); + JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("PanelPro") != null;},"window up"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("PanelPro version") != null;}, "first Info line seen"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("Main initialization done") != null;}, "last Info line seen"); + + // PanelPro + } finally { + // wait for threads, etc + jmri.util.JUnitUtil.releaseThread(this, 5000); + } + } @Test public void testLaunchInitLoop() throws IOException { @@ -82,33 +126,17 @@ public void testLaunchInitLoop() throws IOException { try { // create a custom profile - FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/Prevent_Init_Loop"), folder.newFolder()); - System.setProperty("org.jmri.profile", "temp/Prevent_Init_Loop"); + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/Prevent_Init_Loop"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); // launch! PanelPro.main(new String[]{"PanelPro"}); - - // last few messages from a normal startup are: - // INFO - Starting with profile LocoNet_Simulator.3eac0cdc [main] apps.Apps.?() - // INFO - Using jmri-92FD61C1C87D-3eac0cdc as the JMRI Node identity [main] jmri.util.node.NodeIdentity.?() - // INFO - No local configuration found. [main] jmri.jmrix.ConnectionConfigManager.?() - // INFO - LocoNet Simulator Started [main] jmrix.loconet.hexfile.LnHexFilePort.?() - // INFO - Table preferences not found. - // This is expected on the first time the "LocoNet Simulator" profile is used on this computer. [main] jmri.swing.JmriJTablePersistenceManager.?() - // INFO - File path program: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path preference: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/temp/LocoNet_Simulator/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path profile: is temp/LocoNet_Simulator/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path settings: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/temp/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path home: is /Users/jake/ [main] jmri.util.FileUtilSupport.?() - // INFO - File path scripts: is /Users/jake/Documents/Trains/JMRI/projects/JMRI/jython/ [main] jmri.util.FileUtilSupport.?() - // WARN - Cleaning up frame "LocoNet Simulator" (a class jmri.jmrix.loconet.hexfile.HexFileFrame) from earlier test. [main] jmri.util.JUnitUtil.?() - // WARN - Cleaning up frame "PanelPro" (a class jmri.util.JmriJFrame) from earlier test. [main] jmri.util.JUnitUtil.?() JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("PanelPro") != null;},"window up"); JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("PanelPro version") != null;}, "first Info line seen"); - //JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("File path scripts:") != null;}, "last Info line seen"); JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("Main initialization done") != null;}, "last Info line seen"); // maybe have it run a script to indicate that it's really up? @@ -131,4 +159,7 @@ public void setUp() { public void tearDown() { JUnitUtil.tearDown(); } + + private final static Logger log = LoggerFactory.getLogger(PanelProTest.class); + } diff --git a/java/test/apps/PanelPro/profiles/EasyDcc_Simulator/profile/profile.properties b/java/test/apps/PanelPro/profiles/EasyDcc_Simulator/profile/profile.properties new file mode 100644 index 00000000000..ad84c6cf0e5 --- /dev/null +++ b/java/test/apps/PanelPro/profiles/EasyDcc_Simulator/profile/profile.properties @@ -0,0 +1,54 @@ +#JMRI Preferences version 4.9.6ish+me+20171108T1748Z+Rebfe011413 +#Wed Nov 08 18:49:34 CET 2017 +apps-gui.fontSize=0 +apps-gui.graphicTableState=true +apps-gui.locale=en-US +apps-gui.lookAndFeel=com.apple.laf.AquaLookAndFeel +apps-gui.nonstandardMouseEvent=false +apps-gui.showToolTipDismissDelay=4000 +apps-gui.verticalToolBar=false +apps-systemconsole.fontFamily=Monospaced +apps-systemconsole.fontSize=12 +apps-systemconsole.fontStyle=0 +apps-systemconsole.scheme=7 +apps-systemconsole.wrapStyle=2 +jmri-implementation.scripts=program\:jython/ +jmri-implementation.user-files=profile\: +jmri-jmris-json.heartbeatInterval=15000 +jmri-jmris-json.port=2056 +jmri-jmris-simpleserver.port=2048 +jmri-jmris-srcp.port=4303 +jmri-jmrit-roster.defaultOwner= +jmri-jmrit-roster.directory=preference\: +jmri-jmrit-symbolicprog.canCacheDefault=false +jmri-jmrit-symbolicprog.defaultFile=Comprehensive +jmri-jmrit-symbolicprog.doConfirmRead=false +jmri-jmrit-symbolicprog.showCvNumbers=false +jmri-jmrit-symbolicprog.showEmptyPanes=true +jmri-jmrix-loconet-loconetovertcp.port=1234 +jmri-managers.allInternalDefaults=false +jmri-managers.defaults.jmri-AddressedProgrammerManager=EasyDCC Simulator +jmri-managers.defaults.jmri-CommandStation=EasyDCC Simulator +jmri-managers.defaults.jmri-ConsistManager=EasyDCC Simulator +jmri-managers.defaults.jmri-GlobalProgrammerManager=EasyDCC Simulator +jmri-managers.defaults.jmri-PowerManager=EasyDCC Simulator +jmri-managers.defaults.jmri-ThrottleManager=EasyDCC Simulator +jmri-web-server.allowRemoteConfig=false +jmri-web-server.clickDelay=1 +jmri-web-server.disableFrames=false +jmri-web-server.disallowedFrames.0=DecoderPro +jmri-web-server.disallowedFrames.1=PanelPro +jmri-web-server.disallowedFrames.2=LocoNet Simulator +jmri-web-server.disallowedFrames.3=Preferences +jmri-web-server.disallowedFrames.4=WiThrottle +jmri-web-server.disallowedFrames.5=Change Signal Head Icons +jmri-web-server.disallowedFrames.6=Item Palette +jmri-web-server.port=12080 +jmri-web-server.railRoadName=Test Ops Entry +jmri-web-server.readonlyPower=false +jmri-web-server.redirectFramesToPanels=true +jmri-web-server.refreshDelay=5 +jmri-web-server.simple=false +jmri-web-server.useAjax=true +profile.id=EasyDcc_Simulator.3f033c2b +profile.name=EasyDCC Simulator diff --git a/java/test/apps/PanelPro/profiles/EasyDcc_Simulator/profile/profile.xml b/java/test/apps/PanelPro/profiles/EasyDcc_Simulator/profile/profile.xml new file mode 100644 index 00000000000..d57b510724a --- /dev/null +++ b/java/test/apps/PanelPro/profiles/EasyDcc_Simulator/profile/profile.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/java/test/apps/PanelPro/profiles/TMCC_Simulator/profile/profile.properties b/java/test/apps/PanelPro/profiles/TMCC_Simulator/profile/profile.properties new file mode 100644 index 00000000000..3353ab25438 --- /dev/null +++ b/java/test/apps/PanelPro/profiles/TMCC_Simulator/profile/profile.properties @@ -0,0 +1,53 @@ +#JMRI Preferences version 4.9.6ish+me+20171108T1748Z+Rebfe011413 +#Wed Nov 08 18:52:33 CET 2017 +apps-gui.fontSize=0 +apps-gui.graphicTableState=true +apps-gui.lookAndFeel=com.apple.laf.AquaLookAndFeel +apps-gui.nonstandardMouseEvent=false +apps-gui.showToolTipDismissDelay=4000 +apps-gui.verticalToolBar=false +apps-systemconsole.fontFamily=Monospaced +apps-systemconsole.fontSize=12 +apps-systemconsole.fontStyle=0 +apps-systemconsole.scheme=7 +apps-systemconsole.wrapStyle=2 +jmri-implementation.scripts=program\:jython/ +jmri-implementation.user-files=profile\: +jmri-jmris-json.heartbeatInterval=15000 +jmri-jmris-json.port=2056 +jmri-jmris-simpleserver.port=2048 +jmri-jmris-srcp.port=4303 +jmri-jmrit-roster.defaultOwner= +jmri-jmrit-roster.directory=preference\: +jmri-jmrit-symbolicprog.canCacheDefault=false +jmri-jmrit-symbolicprog.defaultFile=Comprehensive +jmri-jmrit-symbolicprog.doConfirmRead=false +jmri-jmrit-symbolicprog.showCvNumbers=false +jmri-jmrit-symbolicprog.showEmptyPanes=true +jmri-jmrix-loconet-loconetovertcp.port=1234 +jmri-managers.allInternalDefaults=false +jmri-managers.defaults.jmri-AddressedProgrammerManager=Internal +jmri-managers.defaults.jmri-CommandStation=Internal +jmri-managers.defaults.jmri-ConsistManager=Internal +jmri-managers.defaults.jmri-GlobalProgrammerManager=Internal +jmri-managers.defaults.jmri-PowerManager=Internal +jmri-managers.defaults.jmri-ThrottleManager=TMCC Simulator +jmri-web-server.allowRemoteConfig=false +jmri-web-server.clickDelay=1 +jmri-web-server.disableFrames=false +jmri-web-server.disallowedFrames.0=DecoderPro +jmri-web-server.disallowedFrames.1=PanelPro +jmri-web-server.disallowedFrames.2=LocoNet Simulator +jmri-web-server.disallowedFrames.3=Preferences +jmri-web-server.disallowedFrames.4=WiThrottle +jmri-web-server.disallowedFrames.5=Change Signal Head Icons +jmri-web-server.disallowedFrames.6=Item Palette +jmri-web-server.port=12080 +jmri-web-server.railRoadName=Test Ops Entry +jmri-web-server.readonlyPower=false +jmri-web-server.redirectFramesToPanels=true +jmri-web-server.refreshDelay=5 +jmri-web-server.simple=false +jmri-web-server.useAjax=true +profile.id=TMCC Simulator.3f033c2b +profile.name=TMCC_Simulator diff --git a/java/test/apps/PanelPro/profiles/TMCC_Simulator/profile/profile.xml b/java/test/apps/PanelPro/profiles/TMCC_Simulator/profile/profile.xml new file mode 100644 index 00000000000..ee837323822 --- /dev/null +++ b/java/test/apps/PanelPro/profiles/TMCC_Simulator/profile/profile.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/java/test/apps/SignalPro/SignalProTest.java b/java/test/apps/SignalPro/SignalProTest.java index 6bb60fd2808..3327c40d78b 100644 --- a/java/test/apps/SignalPro/SignalProTest.java +++ b/java/test/apps/SignalPro/SignalProTest.java @@ -1,32 +1,154 @@ package apps.SignalPro; import java.awt.GraphicsEnvironment; -import jmri.util.JUnitUtil; +import java.io.*; + +import org.apache.commons.io.*; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import org.junit.Rule; +import org.junit.rules.TemporaryFolder; +import org.junit.rules.Timeout; + +import jmri.util.JUnitUtil; +import jmri.util.JmriJFrame; +import jmri.util.JUnitAppender; +import jmri.util.JUnitUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * + * This is more of an acceptance test than a unit test. It confirms that the entire + * application can start up and configure itself. + * * @author Paul Bender Copyright (C) 2017 + * @author Bob Jacobsen Copyright (C) 2017 */ public class SignalProTest { + @Rule + public TemporaryFolder folder = new TemporaryFolder(); + + @Rule + public Timeout globalTimeout = Timeout.seconds(90); // 90 second timeout for methods in this test class. + + + @Test + public void testLaunchLocoNet() throws IOException { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + + try { + // create a custom profile + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/LocoNet_Simulator"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); + + // launch! + SignalPro.main(new String[]{"SignalPro"}); + log.debug("started LocoNetSim"); + + JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("SignalPro") != null;},"window up"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("SignalPro version") != null;}, "first Info line seen"); + + // maybe have it run a script to indicate that it's really up? + + // now clean up frames, depending on what's actually left + // SignalPro + } finally { + // wait for threads, etc + jmri.util.JUnitUtil.releaseThread(this, 5000); + } + } + + @Test + public void testLaunchEasyDcc() throws IOException { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + + try { + // create a custom profile + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/EasyDcc_Simulator"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); + + // launch! + SignalPro.main(new String[]{"SignalPro"}); + log.debug("started EasyDccSim"); + + JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("SignalPro") != null;},"window up"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("SignalPro version") != null;}, "first Info line seen"); + + + // SignalPro + } finally { + // wait for threads, etc + jmri.util.JUnitUtil.releaseThread(this, 5000); + } + } + @Test - @Ignore("Causes Exception") - public void testCTor() { + public void testLaunchTmcc() throws IOException { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - SignalPro t = new SignalPro(); - Assert.assertNotNull("exists", t); + + try { + // create a custom profile + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/TMCC_Simulator"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); + + // launch! + SignalPro.main(new String[]{"SignalPro"}); + log.debug("started TmcccSim"); + JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("SignalPro") != null;},"window up"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("SignalPro version") != null;}, "first Info line seen"); + + + // SignalPro + } finally { + // wait for threads, etc + jmri.util.JUnitUtil.releaseThread(this, 5000); + } } + @Test + public void testLaunchInitLoop() throws IOException { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + + try { + // create a custom profile + File tempFolder = folder.newFolder(); + FileUtils.copyDirectory(new File("java/test/apps/PanelPro/profiles/Prevent_Init_Loop"), tempFolder); + System.setProperty("org.jmri.profile", tempFolder.getAbsolutePath() ); + + // launch! + SignalPro.main(new String[]{"SignalPro"}); + + JUnitUtil.waitFor(()->{return JmriJFrame.getFrame("SignalPro") != null;},"window up"); + + JUnitUtil.waitFor(()->{return JUnitAppender.checkForMessageStartingWith("SignalPro version") != null;}, "first Info line seen"); + + + // maybe have it run a script to indicate that it's really up? + + // now clean up frames, depending on what's actually left + // SignalPro + } finally { + // wait for threads, etc + jmri.util.JUnitUtil.releaseThread(this, 5000); + } + } + // The minimal setup for log4J @Before public void setUp() { JUnitUtil.setUp(); + JUnitUtil.resetApplication(); } @After @@ -34,5 +156,6 @@ public void tearDown() { JUnitUtil.tearDown(); } - // private final static Logger log = LoggerFactory.getLogger(SignalProTest.class); + private final static Logger log = LoggerFactory.getLogger(SignalProTest.class); + } diff --git a/java/test/jmri/NmraPacketTest.java b/java/test/jmri/NmraPacketTest.java index 22e7ce9804f..2ff4e31eb3d 100644 --- a/java/test/jmri/NmraPacketTest.java +++ b/java/test/jmri/NmraPacketTest.java @@ -1360,6 +1360,182 @@ public void testAccSignalDecoderPkt2044Aspect31() { Assert.assertEquals("byte 3", 0xA7, ba[3] & 0xFF); } + @Test + public void testAltAccSignalDecoderPktOpsMode1() { + int address = 1; + int cv = 384; + int data = 255; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x80, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x71, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xED, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x7F, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0xFF, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x9C, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode4() { + int address = 4; + int cv = 384; + int data = 255; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 1", 0x77, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xED, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x7F, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0xFF, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x9A, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode5() { + int address = 5; + int cv = 384; + int data = 255; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x81, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x71, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xED, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x7F, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0xFF, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x9D, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode8() { + int address = 8; + int cv = 56; + int data = 0; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x81, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x77, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEC, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x37, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0x00, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x2D, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode9() { + int address = 9; + int cv = 1; + int data = 30; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x82, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x71, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEC, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x00, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0x1E, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x01, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode256() { + int address = 256; + int cv = 999; + int data = 179; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0xBF, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x77, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEF, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0xE6, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0xB3, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x72, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode257() { + int address = 257; + int cv = 1; + int data = 241; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x80, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x61, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEC, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x00, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0xF1, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0xFC, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode260() { + int address = 260; + int cv = 55; + int data = 127; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x80, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x67, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEC, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x36, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0x7F, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x42, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode261() { + int address = 261; + int cv = 55; + int data = 99; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0x81, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x61, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEC, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x36, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0x63, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x59, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode2041() { + int address = 2041; + int cv = 556; + int data = 175; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0xBE, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x01, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEE, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x2B, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0xAF, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0xD5, ba[5] & 0xFF); + } + + @Test + public void testAltAccSignalDecoderPktOpsMode2044() { + int address = 2044; + int cv = 771; + int data = 102; + byte[] ba = NmraPacket.altAccSignalDecoderPktOpsMode(address, cv, data); + + Assert.assertEquals("length", 6, ba.length); + Assert.assertEquals("byte 0", 0xBE, ba[0] & 0xFF); + Assert.assertEquals("byte 1", 0x07, ba[1] & 0xFF); + Assert.assertEquals("byte 2", 0xEF, ba[2] & 0xFF); + Assert.assertEquals("byte 3", 0x02, ba[3] & 0xFF); + Assert.assertEquals("byte 4", 0x66, ba[4] & 0xFF); + Assert.assertEquals("byte 5", 0x32, ba[5] & 0xFF); + } + + @Test public void testExtractAddressTypeAcc() { byte[] ba = NmraPacket.accSignalDecoderPkt(123, 12); diff --git a/java/test/jmri/ProgListenerScaffold.java b/java/test/jmri/ProgListenerScaffold.java index 3bc050e17dc..f49dbc2aea5 100644 --- a/java/test/jmri/ProgListenerScaffold.java +++ b/java/test/jmri/ProgListenerScaffold.java @@ -24,6 +24,7 @@ public ProgListenerScaffold() { rcvdInvoked = 0; rcvdValue = -1; rcvdStatus = -1; + wasOnRightThread = false; } @Override @@ -31,11 +32,13 @@ public void programmingOpReply(int value, int status) { rcvdValue = value; rcvdStatus = status; rcvdInvoked++; + wasOnRightThread = jmri.util.ThreadingUtil.isGUIThread(); } private int rcvdValue; private int rcvdStatus; private int rcvdInvoked; + private boolean wasOnRightThread; public int getRcvdValue() { return rcvdValue; @@ -49,6 +52,9 @@ public int getRcvdInvoked() { return rcvdInvoked; } + public boolean wasRightThread() { + return wasOnRightThread; + } } diff --git a/java/test/jmri/implementation/AbstractLightTestBase.java b/java/test/jmri/implementation/AbstractLightTestBase.java index 156dbfa0532..097d716679b 100644 --- a/java/test/jmri/implementation/AbstractLightTestBase.java +++ b/java/test/jmri/implementation/AbstractLightTestBase.java @@ -2,8 +2,9 @@ import java.beans.PropertyChangeListener; import jmri.Light; -import junit.framework.TestCase; import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; /** * Abstract Base Class for Light tests in specific jmrix packages. This is not @@ -12,12 +13,12 @@ * * @author Bob Jacobsen 2002, 2004, 2005, 2007, 2008 */ -public abstract class AbstractLightTestBase extends TestCase { +public abstract class AbstractLightTestBase { // implementing classes must provide these abstract members: // - @Override - abstract protected void setUp(); // load t with actual object; create scaffolds as needed + @Before + abstract public void setUp(); // load t with actual object; create scaffolds as needed abstract public int numListeners(); // return number of listeners registered with the TrafficController @@ -25,10 +26,6 @@ public abstract class AbstractLightTestBase extends TestCase { abstract public void checkOffMsgSent(); - public AbstractLightTestBase(String s) { - super(s); - } - protected Light t = null; // holds objects under test static protected boolean listenerResult = false; @@ -43,11 +40,13 @@ public void propertyChange(java.beans.PropertyChangeEvent e) { // start of common tests // test creation - real work is in the setup() routine + @Test public void testCreate() { // initial state when created must be OFF Assert.assertEquals("initial commanded state", Light.OFF, t.getState()); } + @Test public void testAddListener() { t.addPropertyChangeListener(new Listen()); listenerResult = false; @@ -58,6 +57,7 @@ public void testAddListener() { Assert.assertTrue("listener invoked by setCommandedState", listenerResult); } + @Test public void testRemoveListener() { Listen ln = new Listen(); t.addPropertyChangeListener(ln); @@ -68,6 +68,7 @@ public void testRemoveListener() { !listenerResult); } + @Test public void testDispose() { t.setState(Light.ON); // in case registration with TrafficController //is deferred to after first use @@ -75,6 +76,7 @@ public void testDispose() { Assert.assertEquals("controller listeners remaining", 0, numListeners()); } + @Test public void testCommandOff() { t.setState(Light.OFF); // check @@ -83,6 +85,7 @@ public void testCommandOff() { checkOffMsgSent(); } + @Test public void testCommandOn() { t.setState(Light.ON); // check diff --git a/java/test/jmri/implementation/AbstractMultiMeterTestBase.java b/java/test/jmri/implementation/AbstractMultiMeterTestBase.java new file mode 100644 index 00000000000..c09f1da3e4c --- /dev/null +++ b/java/test/jmri/implementation/AbstractMultiMeterTestBase.java @@ -0,0 +1,83 @@ +package jmri.implementation; + +import java.beans.PropertyChangeListener; +import jmri.MultiMeter; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +/** + * Abstract Base Class for MultiMeter tests in specific jmrix packages. This is + * not itself a test class, e.g. should not be added to a suite. Instead, this + * forms the base for test classes, including providing some common tests. + * + * @author Bob Jacobsen 2002, 2004, 2005, 2007, 2008 + * @author Paul Bender Copyright (C) 2017 + */ +public abstract class AbstractMultiMeterTestBase { + + // implementing classes must provide these abstract members: + // + @Before + abstract public void setUp(); // load t with actual object; create scaffolds as needed + + + protected MultiMeter mm = null; // holds objects under test + + protected class Listen implements PropertyChangeListener { + + private boolean listenerResult = false; + + @Override + public void propertyChange(java.beans.PropertyChangeEvent e) { + listenerResult = true; + } + + public boolean eventSeen(){ + return listenerResult; + } + } + + // start of common tests + // test creation - real work is in the setup() routine + @Test + public void testCreate() { + Assert.assertNotNull("MultiMeter Created", mm ); + } + + @Test + public void testUpdateAndGetCurrent(){ + Assume.assumeTrue(mm.hasCurrent()); + mm.setCurrent(0.5f); + Assert.assertEquals("current after set",0.5f,mm.getCurrent(),0.0001); + } + + @Test + public void testUpdateAndGetVoltage(){ + Assume.assumeTrue(mm.hasVoltage()); + mm.setVoltage(0.5f); + Assert.assertEquals("current after set",0.5f,mm.getVoltage(),0.0001); + } + + @Test + public void testAddListener() { + Listen ln = new Listen(); + mm.addDataUpdateListener(ln); + mm.setCurrent(0.5f); + jmri.util.JUnitUtil.waitFor(()->{ return ln.eventSeen(); } ); + Assert.assertTrue("listener invoked by setCurrent", ln.eventSeen()); + } + + @Test + public void testRemoveListener() { + Listen ln = new Listen(); + mm.addDataUpdateListener(ln); + mm.removeDataUpdateListener(ln); + mm.setCurrent(0.5f); + // this should just timeout; + Assert.assertFalse(jmri.util.JUnitUtil.waitFor(()->{ return ln.eventSeen(); } )); + Assert.assertFalse("listener invoked by setCurrent, but not listening", ln.eventSeen()); + } + +} diff --git a/java/test/jmri/implementation/AccessoryOpsModeProgrammerFacadeTest.java b/java/test/jmri/implementation/AccessoryOpsModeProgrammerFacadeTest.java index 4fb2a316116..11edd3b5045 100644 --- a/java/test/jmri/implementation/AccessoryOpsModeProgrammerFacadeTest.java +++ b/java/test/jmri/implementation/AccessoryOpsModeProgrammerFacadeTest.java @@ -1,14 +1,21 @@ package jmri.implementation; +import java.text.MessageFormat; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import jmri.CommandStation; import jmri.InstanceManager; import jmri.ProgListener; import jmri.Programmer; import jmri.progdebugger.ProgDebugger; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,18 +23,74 @@ * Test the AccessoryOpsModeProgrammerFacade class. * * @author Bob Jacobsen Copyright 2014 + * @author Dave Heap 2017 * */ // @ToDo("transform to annotations requires e.g. http://alchemy.grimoire.ca/m2/sites/ca.grimoire/todo-annotations/") // @ToDo("test mode handling") // @ToDo("test packet contents in each mode") // @ToDo("test address handling") -public class AccessoryOpsModeProgrammerFacadeTest extends TestCase { - - public void testWriteDirect() throws jmri.ProgrammerException, InterruptedException { +public class AccessoryOpsModeProgrammerFacadeTest { + @Test + public void testCvLimit() { ProgDebugger dp = new ProgDebugger(true, 123); - Programmer p = new AccessoryOpsModeProgrammerFacade(dp, null); + dp.setTestReadLimit(1024); + dp.setTestWriteLimit(1024); + + Programmer p = new AccessoryOpsModeProgrammerFacade(dp, "", 0, dp); + + Assert.assertTrue("CV limit read OK", p.getCanRead("1024")); + Assert.assertTrue("CV limit write OK", p.getCanWrite("1024")); + Assert.assertTrue("CV limit read fail", !p.getCanRead("1025")); + Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025")); + } + + @Test + public void testWriteAddr123long1cv234val14delay200signal() throws jmri.ProgrammerException, InterruptedException { + testMethod(); + } + + @Test + public void testWriteAddr3long0cv12val0delay500accessory() throws jmri.ProgrammerException, InterruptedException { + testMethod(); + } + + @Test + public void testWriteAddr511long1cv1024val255delay0decoder() throws jmri.ProgrammerException, InterruptedException { + testMethod(); + } + + // from here down is testing infrastructure + // Perform tests with parameters parsed from the name of the calling method. + @Ignore + synchronized void testMethod() throws jmri.ProgrammerException, InterruptedException { + String methodName = ""; + int addr = 0; + boolean isLong = false; + String addrType = ""; + String cv = ""; + int value = 0; + int delay = 0; + + ArrayList items = itemsFromMethodName(3, 5); + if (!items.isEmpty()) { + methodName = items.get(0); + addr = Integer.parseInt(items.get(2)); + isLong = (Integer.parseInt(items.get(4)) != 0); + cv = items.get(6); + value = Integer.parseInt(items.get(8)); + delay = Integer.parseInt(items.get(10)); + addrType = items.get(11); + } + log.debug( + "Testing: {}:\nExtracted parameters addr='{}',isLong={},cv='{}', value={}, delay={}, addrType='{}'", + methodName, addr, isLong, cv, value, delay, addrType); + + // Create an addressed programmer. + ProgDebugger dp = new ProgDebugger(isLong, addr); + // Create a facade over the base programmer and also a listener for the facade. + Programmer p = new AccessoryOpsModeProgrammerFacade(dp, addrType, 0, dp); ProgListener l = new ProgListener() { @Override public void programmingOpReply(int value, int status) { @@ -37,27 +100,48 @@ public void programmingOpReply(int value, int status) { } }; - p.writeCV("4", 12, l); + // Write to the facade programmer. + p.writeCV(cv, value, l); waitReply(); - Assert.assertTrue("target not directly written", !dp.hasBeenWritten(12)); + + // Check that the write did not through to the base programmer. + Assert.assertTrue("target not directly written", !dp.hasBeenWritten(value)); Assert.assertTrue("index not written", !dp.hasBeenWritten(81)); + // Check that a packet was sent. Assert.assertNotNull("packet sent", lastPacket); } - public void testCvLimit() { - ProgDebugger dp = new ProgDebugger(true, 123); - dp.setTestReadLimit(1024); - dp.setTestWriteLimit(1024); - - Programmer p = new AccessoryOpsModeProgrammerFacade(dp, null); - - Assert.assertTrue("CV limit read OK", p.getCanRead("1024")); - Assert.assertTrue("CV limit write OK", p.getCanWrite("1024")); - Assert.assertTrue("CV limit read fail", !p.getCanRead("1025")); - Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025")); + // Extract test parameters from test name. + @Ignore + synchronized ArrayList itemsFromMethodName(int methodOffset, int groupReps) { + StringBuilder sb = new StringBuilder(); + Pattern pattern; + Matcher matcher; + ArrayList retString = new ArrayList(); + + // Extract test parameters from test name. + String methodName = Thread.currentThread().getStackTrace()[methodOffset].getMethodName(); + sb.append("^"); + for (int i = 1; i <= groupReps; i++) { + sb.append("(\\D+)(\\d+)"); + } + sb.append("(\\D*)$"); + String pat = sb.toString(); + pattern = Pattern.compile(pat); + matcher = pattern.matcher(methodName); + log.debug("Test: {} pat=\"{}\", groupCount={}", methodName, pat, matcher.groupCount()); + if (matcher.find()) { + for (int j = 0; j <= matcher.groupCount(); j++) { + retString.add(matcher.group(j)); + log.debug("Adding item={}, string=\"{}\"", j, matcher.group(j)); + } + } else { + log.error("method=\"{}\" did not match pattern=\"{}\"", methodName, pat); + } + return retString; } - // from here down is testing infrastructure + @Ignore class MockCommandStation implements CommandStation { @Override @@ -80,6 +164,7 @@ public String getSystemPrefix() { int readValue = -2; boolean replied = false; + @Ignore synchronized void waitReply() throws InterruptedException { while (!replied) { wait(200); @@ -88,38 +173,19 @@ synchronized void waitReply() throws InterruptedException { } // The minimal setup for log4J - @Override - protected void setUp() throws Exception { + @Before + public void setUp() throws Exception { apps.tests.Log4JFixture.setUp(); - super.setUp(); jmri.util.JUnitUtil.resetInstanceManager(); - InstanceManager.setCommandStation(new MockCommandStation()); + InstanceManager.setDefault(CommandStation.class, new MockCommandStation()); lastPacket = null; } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { jmri.util.JUnitUtil.tearDown(); } - // from here down is testing infrastructure - public AccessoryOpsModeProgrammerFacadeTest(String s) { - super(s); - } - - // Main entry point - static public void main(String[] args) { - String[] testCaseName = {AccessoryOpsModeProgrammerFacadeTest.class.getName()}; - junit.textui.TestRunner.main(testCaseName); - } - - // test suite from all defined tests - public static Test suite() { - apps.tests.AllTest.initLogging(); - TestSuite suite = new TestSuite(AccessoryOpsModeProgrammerFacadeTest.class); - return suite; - } - private final static Logger log = LoggerFactory.getLogger(AccessoryOpsModeProgrammerFacadeTest.class); } diff --git a/java/test/jmri/implementation/OpsModeDelayedProgrammerFacadeTest.java b/java/test/jmri/implementation/OpsModeDelayedProgrammerFacadeTest.java new file mode 100644 index 00000000000..9b1e2f3d001 --- /dev/null +++ b/java/test/jmri/implementation/OpsModeDelayedProgrammerFacadeTest.java @@ -0,0 +1,176 @@ +package jmri.implementation; + +import java.text.MessageFormat; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import jmri.ProgListener; +import jmri.Programmer; +import jmri.progdebugger.ProgDebugger; +import junit.framework.TestCase; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Test the OpsModeDelayedProgrammerFacade class. + * + * @author Bob Jacobsen Copyright 2014 + * + */ +public class OpsModeDelayedProgrammerFacadeTest extends TestCase { + + @Test + public void testWrite4Val12Delay0() throws jmri.ProgrammerException, InterruptedException { + testMethod(123, true); + } + + @Test + public void testWrite37Val102Delay1000() throws jmri.ProgrammerException, InterruptedException { + testMethod(123, true); + } + + @Test + public void testWrite1024Val255Delay2000() throws jmri.ProgrammerException, InterruptedException { + testMethod(123, true); + } + + @Test + public void testWrite0Val23Delay100() throws jmri.ProgrammerException, InterruptedException { + testMethod(123, true); + } + + @Test + public void testCvLimit() { + ProgDebugger dp = new ProgDebugger(true, 123); + dp.setTestReadLimit(1024); + dp.setTestWriteLimit(1024); + + Programmer p = new OpsModeDelayedProgrammerFacade(dp, 0); + + Assert.assertTrue("CV limit read OK", p.getCanRead("1024")); + Assert.assertTrue("CV limit write OK", p.getCanWrite("1024")); + Assert.assertTrue("CV limit read fail", !p.getCanRead("1025")); + Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025")); + } + + int facProgRetValue = -2; + int facProgRetStatus = -2; + int facProgRetDelay = 0; + transient volatile boolean facProgReplied = false; + + // Perform tests with parameters parsed from the name of the calling method. + @Ignore + synchronized void testMethod(int addr, boolean addrType) throws jmri.ProgrammerException, InterruptedException { + String methodName = ""; + String cv = ""; + int value = 0; + int delay = 0; + + facProgRetValue = -2; + facProgRetStatus = -2; + facProgReplied = false; + + ArrayList items = itemsFromMethodName(3, 3); + if (!items.isEmpty()) { + methodName = items.get(0); + cv = items.get(2); + value = Integer.parseInt(items.get(4)); + delay = Integer.parseInt(items.get(6)); + } + log.debug("Testing: {}:\nExtracted parameters cv='{}', value={}, delay={}", methodName, cv, value, delay); + + // Create a base addressed programmer. + ProgDebugger baseProg = new ProgDebugger(addrType, addr); + + // Create a facade over the base programmer and also a listener for the facade. + Programmer facProg = new OpsModeDelayedProgrammerFacade(baseProg, delay); + ProgListener facProgListnr = new ProgListener() { + @Override + public void programmingOpReply(int value, int status) { + log.debug("facProg callback value={},status={}", value, +status); + facProgReplied = true; + facProgRetValue = value; + facProgRetStatus = status; + } + }; + + // Write to the facade programmer. + Instant start = Instant.now(); + facProg.writeCV(cv, value, facProgListnr); + facProgWaitReply(); + Instant end = Instant.now(); + long elapsed = Duration.between(start, end).toMillis(); + + // Check that the write flowed through to the base programmer. + Assert.assertTrue("Original CV has been written", baseProg.hasBeenWritten(Integer.parseInt(cv))); + Assert.assertEquals("Original CV was last one written", Integer.parseInt(cv), baseProg.lastWriteCv()); + Assert.assertEquals("Original CV value is as expected", value, baseProg.lastWrite()); + + log.debug("Notification delay={}, elapsed={}", delay, elapsed); + Assert.assertEquals(MessageFormat.format("Elapsed time ({0}) >= delay ({1})", elapsed, delay), true, (elapsed >= delay)); + Assert.assertEquals("Facade listener return value OK", value, facProgRetValue); + Assert.assertEquals("Facade listener return status OK", ProgListener.OK, facProgRetStatus); + } + + // Extract test parameters from test name. + @Ignore + synchronized ArrayList itemsFromMethodName(int methodOffset, int groupReps) { + StringBuilder sb = new StringBuilder(); + Pattern pattern; + Matcher matcher; + ArrayList retString = new ArrayList(); + + // Extract test parameters from test name. + String methodName = Thread.currentThread().getStackTrace()[methodOffset].getMethodName(); + sb.append("^"); + for (int i = 1; i <= groupReps; i++) { + sb.append("(\\D+)(\\d+)"); + } + sb.append("(\\D*)$"); + String pat = sb.toString(); + pattern = Pattern.compile(pat); + matcher = pattern.matcher(methodName); + log.debug("Test: {} pat=\"{}\", groupCount={}", methodName, pat, matcher.groupCount()); + if (matcher.find()) { + for (int j = 0; j <= matcher.groupCount(); j++) { + retString.add(matcher.group(j)); + log.debug("Adding item={}, string=\"{}\"", j, matcher.group(j)); + } + } else { + log.error("method=\"{}\" did not match pattern=\"{}\"", methodName, pat); + } + return retString; + } + + @Ignore + synchronized void facProgWaitReply() throws InterruptedException { + while (!facProgReplied) { + wait(10); + } + facProgReplied = false; + } + + // The minimal setup for log4J + @Before + @Override + public void setUp() throws Exception { + jmri.util.JUnitUtil.setUp(); + } + + @After + @Override + public void tearDown() throws Exception { + jmri.util.JUnitUtil.tearDown(); + } + + private final static Logger log = LoggerFactory.getLogger(OpsModeDelayedProgrammerFacadeTest.class + ); + +} diff --git a/java/test/jmri/implementation/PackageTest.java b/java/test/jmri/implementation/PackageTest.java index 641145c3f7d..44c8dc90897 100644 --- a/java/test/jmri/implementation/PackageTest.java +++ b/java/test/jmri/implementation/PackageTest.java @@ -34,7 +34,8 @@ public static Test suite() { // implementations suite.addTest(AbstractSensorTest.suite()); - suite.addTest(AccessoryOpsModeProgrammerFacadeTest.suite()); + suite.addTest(new JUnit4TestAdapter(AccessoryOpsModeProgrammerFacadeTest.class)); + suite.addTest(new JUnit4TestAdapter(OpsModeDelayedProgrammerFacadeTest.class)); suite.addTest(AddressedHighCvProgrammerFacadeTest.suite()); suite.addTest(new JUnit4TestAdapter(DccSignalHeadTest.class)); suite.addTest(new JUnit4TestAdapter(DccSignalMastTest.class)); diff --git a/java/test/jmri/implementation/swing/PackageTest.java b/java/test/jmri/implementation/swing/PackageTest.java index f5063ba25ef..7726365a627 100644 --- a/java/test/jmri/implementation/swing/PackageTest.java +++ b/java/test/jmri/implementation/swing/PackageTest.java @@ -30,6 +30,7 @@ public static Test suite() { suite.addTest(SwingShutDownTaskDemo.suite()); // Normally a user-invoked demo, but in this case also a test suite.addTest(new junit.framework.JUnit4TestAdapter(BundleTest.class)); + suite.addTest(new junit.framework.JUnit4TestAdapter(SwingShutDownTaskTest.class)); return suite; } diff --git a/java/test/jmri/implementation/swing/SwingShutDownTaskTest.java b/java/test/jmri/implementation/swing/SwingShutDownTaskTest.java new file mode 100644 index 00000000000..cd7a85cc317 --- /dev/null +++ b/java/test/jmri/implementation/swing/SwingShutDownTaskTest.java @@ -0,0 +1,43 @@ +package jmri.implementation.swing; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import java.awt.GraphicsEnvironment; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class SwingShutDownTaskTest { + + @Test + public void testCTor() { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + SwingShutDownTask t = new SwingShutDownTask("SwingShutDownTask Window Check", + "Do Something quits, click Continue Qutting to quit, Cancel Quit to continue", + "Do Something and Stop", + null) { + @Override + public boolean checkPromptNeeded() { + return false; + } + }; + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/jmrit/PackageTest.java b/java/test/jmri/jmrit/PackageTest.java index 37d16a8218f..460200bf59a 100644 --- a/java/test/jmri/jmrit/PackageTest.java +++ b/java/test/jmri/jmrit/PackageTest.java @@ -43,6 +43,7 @@ public static Test suite() { suite.addTest(jmri.jmrit.decoderdefn.PackageTest.suite()); suite.addTest(jmri.jmrit.dispatcher.PackageTest.suite()); suite.addTest(new JUnit4TestAdapter(jmri.jmrit.display.PackageTest.class)); + suite.addTest(new JUnit4TestAdapter(jmri.jmrit.entryexit.PackageTest.class)); suite.addTest(jmri.jmrit.jython.PackageTest.suite()); suite.addTest(new JUnit4TestAdapter(jmri.jmrit.log.PackageTest.class)); suite.addTest(jmri.jmrit.logix.PackageTest.suite()); diff --git a/java/test/jmri/jmrit/ampmeter/AmpMeterFrameTest.java b/java/test/jmri/jmrit/ampmeter/AmpMeterFrameTest.java index 656cd68c03a..bdddf5877cb 100644 --- a/java/test/jmri/jmrit/ampmeter/AmpMeterFrameTest.java +++ b/java/test/jmri/jmrit/ampmeter/AmpMeterFrameTest.java @@ -16,7 +16,6 @@ public class AmpMeterFrameTest { @Test - @Ignore("need to create default jmri.MultiMeter object") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); AmpMeterFrame t = new AmpMeterFrame(); @@ -27,6 +26,7 @@ public void testCTor() { @Before public void setUp() { JUnitUtil.setUp(); + jmri.InstanceManager.setDefault(jmri.MultiMeter.class,new TestMeter()); } @After @@ -34,6 +34,39 @@ public void tearDown() { JUnitUtil.tearDown(); } + private class TestMeter extends jmri.implementation.AbstractMultiMeter { + public TestMeter(){ + super(0); + } + @Override + public void initializeHardwareMeter(){ + } + @Override + public void requestUpdateFromLayout(){ + } + @Override + public void dispose(){ + } + @Override + public boolean hasCurrent(){ + return false; + } + @Override + public boolean hasVoltage(){ + return false; + } + @Override + public String getHardwareMeterName(){ + return "test"; + } + @Override + public void enable(){ + } + @Override + public void disable(){ + } + } + // private final static Logger log = LoggerFactory.getLogger(AmpMeterFrameTest.class); } diff --git a/java/test/jmri/jmrit/audio/AudioCommandTest.java b/java/test/jmri/jmrit/audio/AudioCommandTest.java index 29caacc0eda..1f50be9337c 100644 --- a/java/test/jmri/jmrit/audio/AudioCommandTest.java +++ b/java/test/jmri/jmrit/audio/AudioCommandTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -14,7 +13,6 @@ public class AudioCommandTest { @Test - @Ignore("Fails because there's no AudioSource in the InstanceManager") public void testCTor() { AudioCommand t = new AudioCommand(new NullAudioSource("test"),1); Assert.assertNotNull("exists",t); @@ -24,6 +22,9 @@ public void testCTor() { @Before public void setUp() { JUnitUtil.setUp(); + jmri.AudioManager am = new DefaultAudioManager(); + jmri.InstanceManager.setDefault(jmri.AudioManager.class,am); + am.init(); } @After diff --git a/java/test/jmri/jmrit/audio/JavaSoundAudioSourceTest.java b/java/test/jmri/jmrit/audio/JavaSoundAudioSourceTest.java index 5e2bd4e6c97..0f405393c8a 100644 --- a/java/test/jmri/jmrit/audio/JavaSoundAudioSourceTest.java +++ b/java/test/jmri/jmrit/audio/JavaSoundAudioSourceTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -15,14 +14,12 @@ public class JavaSoundAudioSourceTest { @Test - @Ignore("Fails when the constructor calls the superclass constructor") public void testCtor() { JavaSoundAudioSource l = new JavaSoundAudioSource("test"); Assert.assertNotNull("exists", l); } @Test - @Ignore("Fails when the constructor calls the superclass constructor") public void testC2Stringtor() { JavaSoundAudioSource l = new JavaSoundAudioSource("testsysname","testusername"); Assert.assertNotNull("exists", l); @@ -31,6 +28,9 @@ public void testC2Stringtor() { @Before public void setUp() { JUnitUtil.setUp(); + jmri.AudioManager am = new DefaultAudioManager(); + jmri.InstanceManager.setDefault(jmri.AudioManager.class,am); + am.init(); } @After diff --git a/java/test/jmri/jmrit/audio/JoalAudioBufferTest.java b/java/test/jmri/jmrit/audio/JoalAudioBufferTest.java index cd37752fd34..431518c47fe 100644 --- a/java/test/jmri/jmrit/audio/JoalAudioBufferTest.java +++ b/java/test/jmri/jmrit/audio/JoalAudioBufferTest.java @@ -3,8 +3,8 @@ import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -15,15 +15,15 @@ public class JoalAudioBufferTest { @Test - @Ignore("Causes NPE when run, needs additional setup") public void testCtor() { + Assume.assumeNotNull(JoalAudioFactory.getAL()); JoalAudioBuffer l = new JoalAudioBuffer("test"); Assert.assertNotNull("exists", l); } @Test - @Ignore("Causes NPE when run, needs additional setup") public void testC2Stringtor() { + Assume.assumeNotNull(JoalAudioFactory.getAL()); JoalAudioBuffer l = new JoalAudioBuffer("testsysname","testusername"); Assert.assertNotNull("exists", l); } @@ -31,6 +31,9 @@ public void testC2Stringtor() { @Before public void setUp() { JUnitUtil.setUp(); + jmri.AudioManager am = new DefaultAudioManager(); + jmri.InstanceManager.setDefault(jmri.AudioManager.class,am); + am.init(); } @After diff --git a/java/test/jmri/jmrit/audio/JoalAudioSourceTest.java b/java/test/jmri/jmrit/audio/JoalAudioSourceTest.java index aea304fe31b..d3a31ce723c 100644 --- a/java/test/jmri/jmrit/audio/JoalAudioSourceTest.java +++ b/java/test/jmri/jmrit/audio/JoalAudioSourceTest.java @@ -3,8 +3,8 @@ import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -15,15 +15,15 @@ public class JoalAudioSourceTest { @Test - @Ignore("Fails when the constructor calls the superclass constructor") public void testCtor() { + Assume.assumeNotNull(JoalAudioFactory.getAL()); JoalAudioSource l = new JoalAudioSource("test"); Assert.assertNotNull("exists", l); } @Test - @Ignore("Fails when the constructor calls the superclass constructor") public void testC2Stringtor() { + Assume.assumeNotNull(JoalAudioFactory.getAL()); JoalAudioSource l = new JoalAudioSource("testsysname","testusername"); Assert.assertNotNull("exists", l); } @@ -31,6 +31,9 @@ public void testC2Stringtor() { @Before public void setUp() { JUnitUtil.setUp(); + jmri.AudioManager am = new DefaultAudioManager(); + jmri.InstanceManager.setDefault(jmri.AudioManager.class,am); + am.init(); } @After diff --git a/java/test/jmri/jmrit/audio/NullAudioSourceTest.java b/java/test/jmri/jmrit/audio/NullAudioSourceTest.java index 209e9208561..662e5ddc5e6 100644 --- a/java/test/jmri/jmrit/audio/NullAudioSourceTest.java +++ b/java/test/jmri/jmrit/audio/NullAudioSourceTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -15,22 +14,23 @@ public class NullAudioSourceTest { @Test - @Ignore("Fails when the constructor calls the superclass constructor") public void testCtor() { - NullAudioSource l = new NullAudioSource("test"); + NullAudioSource l = new NullAudioSource("IAS1"); Assert.assertNotNull("exists", l); } @Test - @Ignore("Fails when the constructor calls the superclass constructor") public void testC2Stringtor() { - NullAudioSource l = new NullAudioSource("testsysname","testusername"); + NullAudioSource l = new NullAudioSource("IAS1","testusername"); Assert.assertNotNull("exists", l); } @Before public void setUp() { JUnitUtil.setUp(); + jmri.AudioManager am = new DefaultAudioManager(); + jmri.InstanceManager.setDefault(jmri.AudioManager.class,am); + am.init(); } @After diff --git a/java/test/jmri/jmrit/display/AbstractEditorTestBase.java b/java/test/jmri/jmrit/display/AbstractEditorTestBase.java index 24089065e60..b76b815293c 100644 --- a/java/test/jmri/jmrit/display/AbstractEditorTestBase.java +++ b/java/test/jmri/jmrit/display/AbstractEditorTestBase.java @@ -1,15 +1,15 @@ package jmri.jmrit.display; import java.awt.GraphicsEnvironment; +import javax.swing.UIManager; import jmri.util.JUnitUtil; +import jmri.util.SystemType; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import jmri.jmrit.display.EditorFrameOperator; -import org.netbeans.jemmy.operators.JMenuItemOperator; import org.netbeans.jemmy.operators.JMenuOperator; /** @@ -26,8 +26,8 @@ public void checkFileMenuExists() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); e.setVisible(true); EditorFrameOperator jfo = new EditorFrameOperator(e); - JMenuOperator jmo = new JMenuOperator(jfo,Bundle.getMessage("MenuFile")); - Assert.assertNotNull("File Menu Exists",jmo); + JMenuOperator jmo = new JMenuOperator(jfo, Bundle.getMessage("MenuFile")); + Assert.assertNotNull("File Menu Exists", jmo); } @Test @@ -44,9 +44,9 @@ public void checkWindowMenuExists() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); e.setVisible(true); EditorFrameOperator jfo = new EditorFrameOperator(e); - JMenuOperator jmo = new JMenuOperator(jfo,Bundle.getMessage("MenuWindow")); - Assert.assertNotNull("Window Menu Exists",jmo); - Assert.assertEquals("Menu Item Count",0,jmo.getItemCount()); + JMenuOperator jmo = new JMenuOperator(jfo, Bundle.getMessage("MenuWindow")); + Assert.assertNotNull("Window Menu Exists", jmo); + Assert.assertEquals("Menu Item Count", 0, jmo.getItemCount()); } @Test @@ -54,9 +54,15 @@ public void checkHelpMenuExists() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); e.setVisible(true); EditorFrameOperator jfo = new EditorFrameOperator(e); - JMenuOperator jmo = new JMenuOperator(jfo,Bundle.getMessage("MenuHelp")); - Assert.assertNotNull("Help Menu Exists",jmo); - Assert.assertEquals("Menu Item Count",10,jmo.getItemCount()); + JMenuOperator jmo = new JMenuOperator(jfo, Bundle.getMessage("MenuHelp")); + Assert.assertNotNull("Help Menu Exists", jmo); + if (SystemType.isMacOSX() && UIManager.getLookAndFeel().isNativeLookAndFeel()) { + // macOS w/ native L&F help menu does not include "About" menu item + // or the preceding separator + Assert.assertEquals("Menu Item Count", 8, jmo.getItemCount()); + } else { + Assert.assertEquals("Menu Item Count", 10, jmo.getItemCount()); + } } @Test @@ -65,7 +71,9 @@ public void testSetSize() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); java.awt.Dimension d0 = e.getSize(); e.setSize(100, 100); - JUnitUtil.waitFor( () -> { return d0 != e.getSize(); } ); + JUnitUtil.waitFor(() -> { + return d0 != e.getSize(); + }); java.awt.Dimension d = e.getSize(); // the java.awt.Dimension stores the values as floating point // numbers, but setSize expects integer parameters. diff --git a/java/test/jmri/jmrit/display/layoutEditor/LayoutEditorChecksTest.java b/java/test/jmri/jmrit/display/layoutEditor/LayoutEditorChecksTest.java new file mode 100644 index 00000000000..c410034b991 --- /dev/null +++ b/java/test/jmri/jmrit/display/layoutEditor/LayoutEditorChecksTest.java @@ -0,0 +1,36 @@ +package jmri.jmrit.display.layoutEditor; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import java.awt.GraphicsEnvironment; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class LayoutEditorChecksTest { + + @Test + public void testCTor() { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + LayoutEditor le = new LayoutEditor("Test Layout"); + LayoutEditorChecks t = new LayoutEditorChecks(le); + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/jmrit/display/layoutEditor/PackageTest.java b/java/test/jmri/jmrit/display/layoutEditor/PackageTest.java index 588d405d51a..8c282b49e34 100644 --- a/java/test/jmri/jmrit/display/layoutEditor/PackageTest.java +++ b/java/test/jmri/jmrit/display/layoutEditor/PackageTest.java @@ -41,7 +41,8 @@ TransitCreationToolTest.class, LayoutTrackEditorsTest.class, LayoutEditorComponentTest.class, - LayoutEditorToolsTest.class + LayoutEditorToolsTest.class, + LayoutEditorChecksTest.class }) public class PackageTest { } diff --git a/java/test/jmri/jmrit/display/layoutEditor/loadref/LayoutEditorTest.xml b/java/test/jmri/jmrit/display/layoutEditor/loadref/LayoutEditorTest.xml index 809a56d10bf..67247b0f141 100644 --- a/java/test/jmri/jmrit/display/layoutEditor/loadref/LayoutEditorTest.xml +++ b/java/test/jmri/jmrit/display/layoutEditor/loadref/LayoutEditorTest.xml @@ -4,7 +4,7 @@ 4 9 - 6 + 7 ish @@ -204,6 +204,30 @@ 500 + + #9E9C9D + 15 + 3 + #C0BFBF + 2 + 3 + 2 + #D5CFCC + 5 + 11 + 2 + #AEACAD + 13 + 3 + #9B705E + 2 + 3 + 1 + #391E16 + 4 + 9 + 3 + @@ -294,5 +318,5 @@ - + diff --git a/java/test/jmri/jmrit/display/switchboardEditor/SwitchboardEditorTest.java b/java/test/jmri/jmrit/display/switchboardEditor/SwitchboardEditorTest.java index 066ff411be0..ea113e5a87e 100644 --- a/java/test/jmri/jmrit/display/switchboardEditor/SwitchboardEditorTest.java +++ b/java/test/jmri/jmrit/display/switchboardEditor/SwitchboardEditorTest.java @@ -1,6 +1,8 @@ package jmri.jmrit.display.switchboardEditor; import java.awt.GraphicsEnvironment; +import jmri.jmrit.display.AbstractEditorTestBase; +import jmri.util.ColorUtil; import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; @@ -14,14 +16,14 @@ * @author Paul Bender Copyright (C) 2016 * @author Egbert Broerse Copyright (C) 2017 */ -public class SwitchboardEditorTest extends jmri.jmrit.display.AbstractEditorTestBase { - +public class SwitchboardEditorTest extends AbstractEditorTestBase { + private SwitchboardEditor swe = null; @Test public void testDefaultCtor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - Assert.assertNotNull("exists", new SwitchboardEditor() ); + Assert.assertNotNull("exists", new SwitchboardEditor()); } @Test @@ -67,14 +69,14 @@ public void testResetDirty() { @Test public void testGetDefaultTextColor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - Assert.assertEquals("Default Text Color",jmri.util.ColorUtil.ColorBlack, swe.getDefaultTextColor()); + Assert.assertEquals("Default Text Color", ColorUtil.ColorBlack, swe.getDefaultTextColor()); } @Test public void testSetDefaultTextColor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - swe.setDefaultTextColor(jmri.util.ColorUtil.ColorPink); - Assert.assertEquals("Default Text Color after Set",jmri.util.ColorUtil.ColorPink, swe.getDefaultTextColor()); + swe.setDefaultTextColor(ColorUtil.ColorPink); + Assert.assertEquals("Default Text Color after Set", ColorUtil.ColorPink, swe.getDefaultTextColor()); } @Before diff --git a/java/test/jmri/jmrit/signalling/AddEntryExitPairActionTest.java b/java/test/jmri/jmrit/entryexit/AddEntryExitPairActionTest.java similarity index 92% rename from java/test/jmri/jmrit/signalling/AddEntryExitPairActionTest.java rename to java/test/jmri/jmrit/entryexit/AddEntryExitPairActionTest.java index d19f2debd62..f0c03620d4a 100644 --- a/java/test/jmri/jmrit/signalling/AddEntryExitPairActionTest.java +++ b/java/test/jmri/jmrit/entryexit/AddEntryExitPairActionTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.GraphicsEnvironment; import jmri.jmrit.display.layoutEditor.LayoutEditor; @@ -11,7 +11,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class AddEntryExitPairActionTest { diff --git a/java/test/jmri/jmrit/signalling/AddEntryExitPairFrameTest.java b/java/test/jmri/jmrit/entryexit/AddEntryExitPairFrameTest.java similarity index 90% rename from java/test/jmri/jmrit/signalling/AddEntryExitPairFrameTest.java rename to java/test/jmri/jmrit/entryexit/AddEntryExitPairFrameTest.java index 1410a040d24..873a6ff59ea 100644 --- a/java/test/jmri/jmrit/signalling/AddEntryExitPairFrameTest.java +++ b/java/test/jmri/jmrit/entryexit/AddEntryExitPairFrameTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.GraphicsEnvironment; import jmri.util.JUnitUtil; @@ -10,7 +10,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class AddEntryExitPairFrameTest { diff --git a/java/test/jmri/jmrit/signalling/AddEntryExitPairPanelTest.java b/java/test/jmri/jmrit/entryexit/AddEntryExitPairPanelTest.java similarity index 92% rename from java/test/jmri/jmrit/signalling/AddEntryExitPairPanelTest.java rename to java/test/jmri/jmrit/entryexit/AddEntryExitPairPanelTest.java index 40bba689998..b945c012d59 100644 --- a/java/test/jmri/jmrit/signalling/AddEntryExitPairPanelTest.java +++ b/java/test/jmri/jmrit/entryexit/AddEntryExitPairPanelTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import java.awt.GraphicsEnvironment; import jmri.jmrit.display.layoutEditor.LayoutEditor; @@ -11,7 +11,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class AddEntryExitPairPanelTest { diff --git a/java/test/jmri/jmrit/signalling/entryexit/BundleTest.java b/java/test/jmri/jmrit/entryexit/BundleTest.java similarity index 97% rename from java/test/jmri/jmrit/signalling/entryexit/BundleTest.java rename to java/test/jmri/jmrit/entryexit/BundleTest.java index 032c4ce9ccc..eb74642eb81 100644 --- a/java/test/jmri/jmrit/signalling/entryexit/BundleTest.java +++ b/java/test/jmri/jmrit/entryexit/BundleTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.util.Locale; import org.junit.Assert; diff --git a/java/test/jmri/jmrit/signalling/entryexit/DestinationPointsTest.java b/java/test/jmri/jmrit/entryexit/DestinationPointsTest.java similarity index 94% rename from java/test/jmri/jmrit/signalling/entryexit/DestinationPointsTest.java rename to java/test/jmri/jmrit/entryexit/DestinationPointsTest.java index 9e270dd8274..3a987b83768 100644 --- a/java/test/jmri/jmrit/signalling/entryexit/DestinationPointsTest.java +++ b/java/test/jmri/jmrit/entryexit/DestinationPointsTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.util.ArrayList; import java.util.List; @@ -12,7 +12,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class DestinationPointsTest { diff --git a/java/test/jmri/jmrit/signalling/EntryExitPairsTest.java b/java/test/jmri/jmrit/entryexit/EntryExitPairsTest.java similarity index 88% rename from java/test/jmri/jmrit/signalling/EntryExitPairsTest.java rename to java/test/jmri/jmrit/entryexit/EntryExitPairsTest.java index b201c33b571..4faee69c1d9 100644 --- a/java/test/jmri/jmrit/signalling/EntryExitPairsTest.java +++ b/java/test/jmri/jmrit/entryexit/EntryExitPairsTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling; +package jmri.jmrit.entryexit; import jmri.util.JUnitUtil; import org.junit.After; @@ -8,7 +8,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class EntryExitPairsTest { diff --git a/java/test/jmri/jmrit/signalling/entryexit/ManuallySetRouteTest.java b/java/test/jmri/jmrit/entryexit/ManuallySetRouteTest.java similarity index 93% rename from java/test/jmri/jmrit/signalling/entryexit/ManuallySetRouteTest.java rename to java/test/jmri/jmrit/entryexit/ManuallySetRouteTest.java index cb860933f12..a53caefbc9d 100644 --- a/java/test/jmri/jmrit/signalling/entryexit/ManuallySetRouteTest.java +++ b/java/test/jmri/jmrit/entryexit/ManuallySetRouteTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.util.ArrayList; import java.util.List; @@ -12,7 +12,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class ManuallySetRouteTest { diff --git a/java/test/jmri/jmrit/entryexit/PackageTest.java b/java/test/jmri/jmrit/entryexit/PackageTest.java new file mode 100644 index 00000000000..222fc2a913a --- /dev/null +++ b/java/test/jmri/jmrit/entryexit/PackageTest.java @@ -0,0 +1,26 @@ +package jmri.jmrit.entryexit; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + BundleTest.class, + AddEntryExitPairFrameTest.class, + AddEntryExitPairActionTest.class, + AddEntryExitPairPanelTest.class, + EntryExitPairsTest.class, + DestinationPointsTest.class, + ManuallySetRouteTest.class, + PointDetailsTest.class, + SourceTest.class, + StackNXPanelTest.class, + jmri.jmrit.entryexit.configurexml.PackageTest.class +}) +/** + * Invokes complete set of tests in the jmri.jmrit.entryexit tree + * + * @author Bob Jacobsen Copyright 2001, 2003, 2012 + */ +public class PackageTest { +} diff --git a/java/test/jmri/jmrit/signalling/entryexit/PointDetailsTest.java b/java/test/jmri/jmrit/entryexit/PointDetailsTest.java similarity index 92% rename from java/test/jmri/jmrit/signalling/entryexit/PointDetailsTest.java rename to java/test/jmri/jmrit/entryexit/PointDetailsTest.java index 5a1ae2afd4d..7974f67011c 100644 --- a/java/test/jmri/jmrit/signalling/entryexit/PointDetailsTest.java +++ b/java/test/jmri/jmrit/entryexit/PointDetailsTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.util.ArrayList; import java.util.List; @@ -11,7 +11,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class PointDetailsTest { diff --git a/java/test/jmri/jmrit/signalling/entryexit/SourceTest.java b/java/test/jmri/jmrit/entryexit/SourceTest.java similarity index 93% rename from java/test/jmri/jmrit/signalling/entryexit/SourceTest.java rename to java/test/jmri/jmrit/entryexit/SourceTest.java index eafcf2249a8..cd812579f3e 100644 --- a/java/test/jmri/jmrit/signalling/entryexit/SourceTest.java +++ b/java/test/jmri/jmrit/entryexit/SourceTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import java.util.ArrayList; import java.util.List; @@ -12,7 +12,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class SourceTest { diff --git a/java/test/jmri/jmrit/signalling/entryexit/StackNXPanelTest.java b/java/test/jmri/jmrit/entryexit/StackNXPanelTest.java similarity index 87% rename from java/test/jmri/jmrit/signalling/entryexit/StackNXPanelTest.java rename to java/test/jmri/jmrit/entryexit/StackNXPanelTest.java index 0a9741dd5bc..22d5104280d 100644 --- a/java/test/jmri/jmrit/signalling/entryexit/StackNXPanelTest.java +++ b/java/test/jmri/jmrit/entryexit/StackNXPanelTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.entryexit; +package jmri.jmrit.entryexit; import jmri.util.JUnitUtil; import org.junit.After; @@ -8,7 +8,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class StackNXPanelTest { diff --git a/java/test/jmri/jmrit/signalling/configurexml/EntryExitPairsXmlTest.java b/java/test/jmri/jmrit/entryexit/configurexml/EntryExitPairsXmlTest.java similarity index 87% rename from java/test/jmri/jmrit/signalling/configurexml/EntryExitPairsXmlTest.java rename to java/test/jmri/jmrit/entryexit/configurexml/EntryExitPairsXmlTest.java index 99ed02cb50a..90a2e326259 100644 --- a/java/test/jmri/jmrit/signalling/configurexml/EntryExitPairsXmlTest.java +++ b/java/test/jmri/jmrit/entryexit/configurexml/EntryExitPairsXmlTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.configurexml; +package jmri.jmrit.entryexit.configurexml; import jmri.util.JUnitUtil; import org.junit.After; @@ -8,7 +8,7 @@ /** * - * @author Paul Bender Copyright (C) 2017 + * @author Paul Bender Copyright (C) 2017 */ public class EntryExitPairsXmlTest { diff --git a/java/test/jmri/jmrit/signalling/configurexml/PackageTest.java b/java/test/jmri/jmrit/entryexit/configurexml/PackageTest.java similarity index 95% rename from java/test/jmri/jmrit/signalling/configurexml/PackageTest.java rename to java/test/jmri/jmrit/entryexit/configurexml/PackageTest.java index 4c820095b26..fdcbf7a9fed 100644 --- a/java/test/jmri/jmrit/signalling/configurexml/PackageTest.java +++ b/java/test/jmri/jmrit/entryexit/configurexml/PackageTest.java @@ -1,4 +1,4 @@ -package jmri.jmrit.signalling.configurexml; +package jmri.jmrit.entryexit.configurexml; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/java/test/jmri/jmrit/logix/MergePromptTest.java b/java/test/jmri/jmrit/logix/MergePromptTest.java index a9f166d837d..e645b4b7dd2 100644 --- a/java/test/jmri/jmrit/logix/MergePromptTest.java +++ b/java/test/jmri/jmrit/logix/MergePromptTest.java @@ -14,7 +14,6 @@ import org.junit.Rule; import org.junit.rules.Timeout; - /** * * @author Paul Bender Copyright (C) 2017 @@ -30,11 +29,11 @@ public void testCTor() { new Thread(() -> { // constructor for jdo will wait until the dialog is visible - JDialogOperator jdo = new JDialogOperator("test"); + JDialogOperator jdo = new JDialogOperator("Merge Prompt CTor Test"); jdo.close(); }).start(); - MergePrompt t = new MergePrompt("test",new HashMap(), + MergePrompt t = new MergePrompt("Merge Prompt CTor Test",new HashMap(), new HashMap>()); Assert.assertNotNull("exists",t); t.dispose(); diff --git a/java/test/jmri/jmrit/mailreport/ReportContextTest.java b/java/test/jmri/jmrit/mailreport/ReportContextTest.java index f4153174c17..2b86f6684b3 100644 --- a/java/test/jmri/jmrit/mailreport/ReportContextTest.java +++ b/java/test/jmri/jmrit/mailreport/ReportContextTest.java @@ -18,6 +18,24 @@ public void testCTor() { Assert.assertNotNull("exists",t); } + + @Test + public void testThatItRuns() { + ReportContext t = new ReportContext(); + Assert.assertNotNull("exists",t); + + String output = t.getReport(false); + } + + @Test + public void testCheckForNodeID() { + ReportContext t = new ReportContext(); + Assert.assertNotNull("exists",t); + + String output = t.getReport(false); + Assert.assertTrue(output.contains("JMRI Node ID:")); + } + // The minimal setup for log4J @Before public void setUp() { diff --git a/java/test/jmri/jmrit/mastbuilder/BundleTest.java b/java/test/jmri/jmrit/mastbuilder/BundleTest.java new file mode 100644 index 00000000000..d7db328a69c --- /dev/null +++ b/java/test/jmri/jmrit/mastbuilder/BundleTest.java @@ -0,0 +1,43 @@ +package jmri.jmrit.mastbuilder; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeysMessage() { + Assert.assertEquals("Tools", Bundle.getMessage("MenuTools")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKeyMessage() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + + @Test public void testGoodKeysMessageArg() { + Assert.assertEquals("Tools", Bundle.getMessage("MenuTools", "foo")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout", "foo")); + Assert.assertEquals("About Test", Bundle.getMessage("TitleAbout", "Test")); + } + + @Test public void testBadKeyMessageArg() { + try { + Bundle.getMessage("FFFFFTTTTTTT", "foo"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + + +} diff --git a/java/test/jmri/jmrit/mastbuilder/MastBuilderActionTest.java b/java/test/jmri/jmrit/mastbuilder/MastBuilderActionTest.java new file mode 100644 index 00000000000..3c57a8fd7f0 --- /dev/null +++ b/java/test/jmri/jmrit/mastbuilder/MastBuilderActionTest.java @@ -0,0 +1,33 @@ +package jmri.jmrit.mastbuilder; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class MastBuilderActionTest { + + @Test + public void testCTor() { + MastBuilderAction t = new MastBuilderAction(); + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/jmrit/mastbuilder/PackageTest.java b/java/test/jmri/jmrit/mastbuilder/PackageTest.java index b0c7faf2701..09804406e90 100644 --- a/java/test/jmri/jmrit/mastbuilder/PackageTest.java +++ b/java/test/jmri/jmrit/mastbuilder/PackageTest.java @@ -6,7 +6,9 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ MastBuilderTest.class, - MastBuilderPaneTest.class + MastBuilderPaneTest.class, + MastBuilderActionTest.class, + BundleTest.class }) /** diff --git a/java/test/jmri/jmrit/operations/ExceptionDisplayFrameTest.java b/java/test/jmri/jmrit/operations/ExceptionDisplayFrameTest.java index bdaa52411db..5e54bd9a6a7 100644 --- a/java/test/jmri/jmrit/operations/ExceptionDisplayFrameTest.java +++ b/java/test/jmri/jmrit/operations/ExceptionDisplayFrameTest.java @@ -6,8 +6,8 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; +import org.netbeans.jemmy.operators.JDialogOperator; /** * @@ -16,12 +16,21 @@ public class ExceptionDisplayFrameTest { @Test - @Ignore("Constructor causes modal dialog to launch that is not associated with a JFrame, so it can't be easilly dismissed with a Jemmy operator.") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); ExceptionContext ec = new ExceptionContext(new Exception("Test"),"Test","Test"); - ExceptionDisplayFrame t = new ExceptionDisplayFrame(ec); - Assert.assertNotNull("exists",t); + new Thread(() -> { + // constructor for jdo will wait until the dialog is visible + JDialogOperator jdo = new JDialogOperator(ec.getTitle()); + jdo.close(); + }).start(); + ExceptionDisplayFrame dialog = new ExceptionDisplayFrame(ec); + Assert.assertNotNull("exists",dialog); + JUnitUtil.waitFor(() -> { + return !dialog.isVisible(); + }, "Exception Frame did not close"); + dialog.dispose(); + JUnitUtil.dispose(dialog); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/OperationsFrameTest.java b/java/test/jmri/jmrit/operations/OperationsFrameTest.java index 30b6f94ddc1..5aac2b5ba8f 100644 --- a/java/test/jmri/jmrit/operations/OperationsFrameTest.java +++ b/java/test/jmri/jmrit/operations/OperationsFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class OperationsFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); OperationsFrame t = new OperationsFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/OperationsSwingTestCase.java b/java/test/jmri/jmrit/operations/OperationsSwingTestCase.java index 4867421804f..4d99bf72bf3 100644 --- a/java/test/jmri/jmrit/operations/OperationsSwingTestCase.java +++ b/java/test/jmri/jmrit/operations/OperationsSwingTestCase.java @@ -1,7 +1,6 @@ //OperationsTestCase.java package jmri.jmrit.operations; -import java.util.Locale; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JRadioButton; diff --git a/java/test/jmri/jmrit/operations/OperationsTestCase.java b/java/test/jmri/jmrit/operations/OperationsTestCase.java index 8027034995e..18e6da2e405 100644 --- a/java/test/jmri/jmrit/operations/OperationsTestCase.java +++ b/java/test/jmri/jmrit/operations/OperationsTestCase.java @@ -1,6 +1,5 @@ package jmri.jmrit.operations; -import java.util.Locale; import jmri.util.JUnitOperationsUtil; import jmri.util.JUnitUtil; import junit.framework.TestCase; diff --git a/java/test/jmri/jmrit/operations/locations/SpurEditFrameTest.java b/java/test/jmri/jmrit/operations/locations/SpurEditFrameTest.java index 8e860a9a6da..57077891096 100644 --- a/java/test/jmri/jmrit/operations/locations/SpurEditFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/SpurEditFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,7 +15,6 @@ public class SpurEditFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); SpurEditFrame t = new SpurEditFrame(); diff --git a/java/test/jmri/jmrit/operations/locations/schedules/ScheduleCopyFrameTest.java b/java/test/jmri/jmrit/operations/locations/schedules/ScheduleCopyFrameTest.java index f6733493aec..2a7e169d68a 100644 --- a/java/test/jmri/jmrit/operations/locations/schedules/ScheduleCopyFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/schedules/ScheduleCopyFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class ScheduleCopyFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); ScheduleCopyFrame t = new ScheduleCopyFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/locations/schedules/SchedulesByLoadFrameTest.java b/java/test/jmri/jmrit/operations/locations/schedules/SchedulesByLoadFrameTest.java index 7b77ed3269e..e50280279e3 100644 --- a/java/test/jmri/jmrit/operations/locations/schedules/SchedulesByLoadFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/schedules/SchedulesByLoadFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class SchedulesByLoadFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); SchedulesByLoadFrame t = new SchedulesByLoadFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/locations/schedules/SchedulesTableFrameTest.java b/java/test/jmri/jmrit/operations/locations/schedules/SchedulesTableFrameTest.java index c255c34ca5d..7a7aebb4a68 100644 --- a/java/test/jmri/jmrit/operations/locations/schedules/SchedulesTableFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/schedules/SchedulesTableFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class SchedulesTableFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); SchedulesTableFrame t = new SchedulesTableFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/locations/tools/LocationCopyFrameTest.java b/java/test/jmri/jmrit/operations/locations/tools/LocationCopyFrameTest.java index 7600b2e8803..bb19c5c125b 100644 --- a/java/test/jmri/jmrit/operations/locations/tools/LocationCopyFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/tools/LocationCopyFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class LocationCopyFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); LocationCopyFrame t = new LocationCopyFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/locations/tools/LocationTrackBlockingOrderFrameTest.java b/java/test/jmri/jmrit/operations/locations/tools/LocationTrackBlockingOrderFrameTest.java index a4793c0e80a..81f755122c8 100644 --- a/java/test/jmri/jmrit/operations/locations/tools/LocationTrackBlockingOrderFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/tools/LocationTrackBlockingOrderFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class LocationTrackBlockingOrderFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); LocationTrackBlockingOrderFrame t = new LocationTrackBlockingOrderFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarLoadFrameTest.java b/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarLoadFrameTest.java index 3dd2a759892..f695f5ad91f 100644 --- a/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarLoadFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarLoadFrameTest.java @@ -2,11 +2,11 @@ import java.awt.GraphicsEnvironment; import jmri.util.JUnitUtil; +import jmri.util.JUnitOperationsUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,7 +16,6 @@ public class LocationsByCarLoadFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); LocationsByCarLoadFrame t = new LocationsByCarLoadFrame(); @@ -27,6 +26,8 @@ public void testCTor() { @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarTypeFrameTest.java b/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarTypeFrameTest.java index cbc1026cc74..860d32a9582 100644 --- a/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarTypeFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/tools/LocationsByCarTypeFrameTest.java @@ -2,11 +2,11 @@ import java.awt.GraphicsEnvironment; import jmri.util.JUnitUtil; +import jmri.util.JUnitOperationsUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,7 +16,6 @@ public class LocationsByCarTypeFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); LocationsByCarTypeFrame t = new LocationsByCarTypeFrame(); @@ -27,6 +26,8 @@ public void testCTor() { @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/locations/tools/ShowTrainsServingLocationFrameTest.java b/java/test/jmri/jmrit/operations/locations/tools/ShowTrainsServingLocationFrameTest.java index c8b8239a8e6..367ac3a66ac 100644 --- a/java/test/jmri/jmrit/operations/locations/tools/ShowTrainsServingLocationFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/tools/ShowTrainsServingLocationFrameTest.java @@ -2,11 +2,11 @@ import java.awt.GraphicsEnvironment; import jmri.util.JUnitUtil; +import jmri.util.JUnitOperationsUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,7 +16,6 @@ public class ShowTrainsServingLocationFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); ShowTrainsServingLocationFrame t = new ShowTrainsServingLocationFrame(); @@ -27,6 +26,8 @@ public void testCTor() { @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/locations/tools/TrackLoadEditFrameTest.java b/java/test/jmri/jmrit/operations/locations/tools/TrackLoadEditFrameTest.java index 6769b6ff2c1..caab14bd0cc 100644 --- a/java/test/jmri/jmrit/operations/locations/tools/TrackLoadEditFrameTest.java +++ b/java/test/jmri/jmrit/operations/locations/tools/TrackLoadEditFrameTest.java @@ -2,11 +2,11 @@ import java.awt.GraphicsEnvironment; import jmri.util.JUnitUtil; +import jmri.util.JUnitOperationsUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,7 +16,6 @@ public class TrackLoadEditFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrackLoadEditFrame t = new TrackLoadEditFrame(); @@ -27,6 +26,8 @@ public void testCTor() { @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/rollingstock/RollingStockSetFrameTest.java b/java/test/jmri/jmrit/operations/rollingstock/RollingStockSetFrameTest.java index 7b854cdf60e..8e60f3c393d 100644 --- a/java/test/jmri/jmrit/operations/rollingstock/RollingStockSetFrameTest.java +++ b/java/test/jmri/jmrit/operations/rollingstock/RollingStockSetFrameTest.java @@ -7,7 +7,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -17,11 +16,11 @@ public class RollingStockSetFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); RollingStockSetFrame t = new RollingStockSetFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/rollingstock/cars/CarTypesTest.java b/java/test/jmri/jmrit/operations/rollingstock/cars/CarTypesTest.java index 60dc250550b..b8f9d941b2d 100644 --- a/java/test/jmri/jmrit/operations/rollingstock/cars/CarTypesTest.java +++ b/java/test/jmri/jmrit/operations/rollingstock/cars/CarTypesTest.java @@ -3,8 +3,8 @@ import java.util.Locale; import javax.swing.JComboBox; import jmri.InstanceManager; -import jmri.util.JUnitUtil; import jmri.util.JUnitOperationsUtil; +import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -36,7 +36,6 @@ public void testDefaultCarTypes() { @Test public void testAddAndDeleteCarTypes() { - String carTypes[]=Bundle.getMessage("carTypeNames").split(","); CarTypes ct1 = InstanceManager.getDefault(CarTypes.class); ct1.getNames(); //Load predefined car types diff --git a/java/test/jmri/jmrit/operations/rollingstock/cars/CarsSetFrameTest.java b/java/test/jmri/jmrit/operations/rollingstock/cars/CarsSetFrameTest.java index 12408e74ffb..f3dd61eaf7c 100644 --- a/java/test/jmri/jmrit/operations/rollingstock/cars/CarsSetFrameTest.java +++ b/java/test/jmri/jmrit/operations/rollingstock/cars/CarsSetFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class CarsSetFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); CarsSetFrame t = new CarsSetFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/routes/RouteCopyFrameTest.java b/java/test/jmri/jmrit/operations/routes/RouteCopyFrameTest.java index 4fdc075e00c..f81a0e6946b 100644 --- a/java/test/jmri/jmrit/operations/routes/RouteCopyFrameTest.java +++ b/java/test/jmri/jmrit/operations/routes/RouteCopyFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class RouteCopyFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); RouteCopyFrame t = new RouteCopyFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/routes/RouteEditFrameTest.java b/java/test/jmri/jmrit/operations/routes/RouteEditFrameTest.java index 20bdf525191..08b370b3af9 100644 --- a/java/test/jmri/jmrit/operations/routes/RouteEditFrameTest.java +++ b/java/test/jmri/jmrit/operations/routes/RouteEditFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class RouteEditFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); RouteEditFrame t = new RouteEditFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/routes/RoutesTableFrameTest.java b/java/test/jmri/jmrit/operations/routes/RoutesTableFrameTest.java index a15a7de2f82..31c29ec6d9e 100644 --- a/java/test/jmri/jmrit/operations/routes/RoutesTableFrameTest.java +++ b/java/test/jmri/jmrit/operations/routes/RoutesTableFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class RoutesTableFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); RoutesTableFrame t = new RoutesTableFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/routes/SetTrainIconRouteFrameTest.java b/java/test/jmri/jmrit/operations/routes/SetTrainIconRouteFrameTest.java index 87889d160e4..fee6182733f 100644 --- a/java/test/jmri/jmrit/operations/routes/SetTrainIconRouteFrameTest.java +++ b/java/test/jmri/jmrit/operations/routes/SetTrainIconRouteFrameTest.java @@ -1,12 +1,12 @@ package jmri.jmrit.operations.routes; import java.awt.GraphicsEnvironment; +import jmri.util.JUnitOperationsUtil; import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,17 +16,27 @@ public class SetTrainIconRouteFrameTest { @Test - @Ignore("needs more setup, causes NPE") - public void testCTor() { + public void testCTorNull() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - SetTrainIconRouteFrame t = new SetTrainIconRouteFrame("Test"); + SetTrainIconRouteFrame t = new SetTrainIconRouteFrame(null); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); + } + + @Test + public void testCTorRoute() { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + SetTrainIconRouteFrame t = new SetTrainIconRouteFrame("Southbound Main Route"); + Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/setup/OperationsBackupTest.java b/java/test/jmri/jmrit/operations/setup/OperationsBackupTest.java index 104fd9f82c1..fe7a97c294c 100644 --- a/java/test/jmri/jmrit/operations/setup/OperationsBackupTest.java +++ b/java/test/jmri/jmrit/operations/setup/OperationsBackupTest.java @@ -5,7 +5,6 @@ import java.io.FileWriter; import java.io.IOException; import java.util.Calendar; -import java.util.Locale; import jmri.InstanceManager; import jmri.jmrit.XmlFile; import jmri.jmrit.operations.OperationsXml; @@ -49,25 +48,25 @@ */ public class OperationsBackupTest extends TestCase { - private File operationsRoot; + private final File operationsRoot; public File getOperationsRoot() { return operationsRoot; } - private File defaultBackupRoot; + private final File defaultBackupRoot; public File getDefaultBackupRoot() { return defaultBackupRoot; } - private File autoBackupRoot; + private final File autoBackupRoot; public File getAutoBackupRoot() { return autoBackupRoot; } - private String[] regularBackupSetFileNames; + private final String[] regularBackupSetFileNames; // public String[] getRegularBackupSetFileNames() { // return regularBackupSetFileNames; diff --git a/java/test/jmri/jmrit/operations/trains/TrainBuilderTest.java b/java/test/jmri/jmrit/operations/trains/TrainBuilderTest.java index 57684cde561..a43c362d26c 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainBuilderTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainBuilderTest.java @@ -1,8 +1,6 @@ package jmri.jmrit.operations.trains; -import java.util.List; import jmri.InstanceManager; -import jmri.jmrit.operations.OperationsTestCase; import jmri.jmrit.operations.locations.Location; import jmri.jmrit.operations.locations.LocationManager; import jmri.jmrit.operations.locations.Track; @@ -28,10 +26,10 @@ import jmri.jmrit.operations.routes.RouteManager; import jmri.jmrit.operations.setup.Control; import jmri.jmrit.operations.setup.Setup; -import jmri.util.JUnitUtil; import jmri.util.JUnitOperationsUtil; -import org.junit.Assert; +import jmri.util.JUnitUtil; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -233,6 +231,9 @@ public void testRouteRandomFeature() { } + /* + * The requires cars option isn't available to users + */ @Test public void testBuildRequiresCars() { Train train = tmanager.newTrain("TestBuildRequiresCars"); @@ -319,8 +320,6 @@ public void testAutoEnginesTwoEngines() { Engine e1 = emanager.getByRoadAndNumber("E", "1"); Engine e2 = emanager.getByRoadAndNumber("E", "2"); - Engine e3 = emanager.getByRoadAndNumber("E", "3"); - Engine e4 = emanager.getByRoadAndNumber("E", "4"); // change requirements rA.setMaxCarMoves(12); @@ -331,9 +330,9 @@ public void testAutoEnginesTwoEngines() { new TrainBuilder().build(train); Assert.assertFalse("Train should not build, only single engines", train.isBuilt()); - Consist c = emanager.newConsist("c"); - e1.setConsist(c); - e2.setConsist(c); + Consist consist = emanager.newConsist("c"); + e1.setConsist(consist); + e2.setConsist(consist); // train should require two engines train.reset(); @@ -346,8 +345,6 @@ public void testAutoEnginesTwoEngines() { @Test public void testAutoEnginesGrade() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); - String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // This test uses the maximum length of a train in route Setup.setMaxTrainLength(1000); Setup.setMaxNumberEngines(6); @@ -370,21 +367,21 @@ public void testAutoEnginesGrade() { Engine e3 = emanager.getByRoadAndNumber("E", "3"); Engine e4 = emanager.getByRoadAndNumber("E", "4"); - Consist c = emanager.newConsist("c"); - e1.setConsist(c); - e2.setConsist(c); + Consist consist = emanager.newConsist("c"); + e1.setConsist(consist); + e2.setConsist(consist); // train should require four engines train.reset(); new TrainBuilder().build(train); Assert.assertFalse("Train should not build, needs four engines, only two", train.isBuilt()); - e3.setConsist(c); + e3.setConsist(consist); train.reset(); new TrainBuilder().build(train); Assert.assertFalse("Train should not build, needs four engines, only three", train.isBuilt()); - e4.setConsist(c); + e4.setConsist(consist); train.reset(); new TrainBuilder().build(train); Assert.assertTrue("Train should build, four engines available", train.isBuilt()); @@ -476,11 +473,11 @@ public void testMaxEngines() { Engine e3 = emanager.getByRoadAndNumber("E", "3"); Engine e4 = emanager.getByRoadAndNumber("E", "4"); - Consist c = emanager.newConsist("c"); - e1.setConsist(c); - e2.setConsist(c); - e3.setConsist(c); - e4.setConsist(c); + Consist consist = emanager.newConsist("c"); + e1.setConsist(consist); + e2.setConsist(consist); + e3.setConsist(consist); + e4.setConsist(consist); Setup.setMaxNumberEngines(3); // limit the maximum to three engines train.reset(); @@ -489,7 +486,7 @@ public void testMaxEngines() { .isBuilt()); // remove one engine from consist, train should build - c.delete(e4); + consist.delete(e4); train.reset(); new TrainBuilder().build(train); Assert.assertTrue("Train should build, three engines available", train.isBuilt()); @@ -502,7 +499,6 @@ public void testMaxEngines() { // tests consists and kernels @Test public void testSidingsYards() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // register the car and engine types used @@ -1115,7 +1111,6 @@ public void testSidingsYards() { // test train staging to staging @Test public void testStagingtoStaging() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1123,33 +1118,6 @@ public void testStagingtoStaging() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); - Engine e1 = emanager.getByRoadAndNumber("PC","5016"); - Engine e2 = emanager.getByRoadAndNumber("PC","5019"); - Engine e3 = emanager.getByRoadAndNumber("PC","5524"); - Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); - Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); - Track l1s1 = l1.getTrackById("1s1"); - Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); // Try building without engines train1.reset(); @@ -1161,6 +1129,9 @@ public void testStagingtoStaging() { Assert.assertFalse("Train 2 After 1st Build exclude Boxcar", train2.isBuilt()); } + /* + * Test car road names + */ @Test public void testStagingtoStagingA() { Setup.setSwitchTime(11); @@ -1171,37 +1142,16 @@ public void testStagingtoStagingA() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); + Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); + Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); - Engine e1 = emanager.getByRoadAndNumber("PC","5016"); - Engine e2 = emanager.getByRoadAndNumber("PC","5019"); - Engine e3 = emanager.getByRoadAndNumber("PC","5524"); - Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); - Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); - Track l1s1 = l1.getTrackById("1s1"); - Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); // Try building without engines train1.reset(); new TrainBuilder().build(train1); - + Assert.assertTrue("Train 1 should build", train1.isBuilt()); // now allow train 2 to service Boxcars train2.addTypeName("Boxcar"); @@ -1250,6 +1200,9 @@ public void testStagingtoStagingA() { .getDestinationTrackName()); } + /* + * Test required number of engines departing staging + */ @Test public void testStagingtoStagingB() { Setup.setSwitchTime(11); @@ -1272,8 +1225,7 @@ public void testStagingtoStagingB() { Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); Location l2 = lmanager.getLocationById("2"); Location l3 = lmanager.getLocationById("3"); @@ -1436,9 +1388,11 @@ public void testStagingtoStagingB() { Assert.assertEquals("Reset Pickup count for South End, track South End 2", 0, l3s2.getPickupRS()); } + /* + * Test car type name departing staging + */ @Test public void testStagingtoStagingC() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1446,33 +1400,17 @@ public void testStagingtoStagingC() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1489,12 +1427,17 @@ public void testStagingtoStagingC() { train1.reset(); new TrainBuilder().build(train1); Assert.assertEquals("Train 1 After Build with engines but exclude Caboose", false, train1.isBuilt()); + train1.addTypeName(Bundle.getMessage("Caboose")); + new TrainBuilder().build(train1); + Assert.assertEquals("Train 1 After Build with engines include Caboose", true, train1.isBuilt()); } + /* + * Test car road names departing staging + */ @Test public void testStagingtoStagingD() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1502,33 +1445,17 @@ public void testStagingtoStagingD() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1548,12 +1475,17 @@ public void testStagingtoStagingD() { train1.reset(); new TrainBuilder().build(train1); Assert.assertFalse("Train 1 After Build with engines but exclude road CP", train1.isBuilt()); + train1.setRoadOption(Train.ALL_ROADS); + new TrainBuilder().build(train1); + Assert.assertTrue("Train 1 allow all roads", train1.isBuilt()); } + /* + * Test car with destination set departing staging + */ @Test public void testStagingtoStagingE() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1562,32 +1494,18 @@ public void testStagingtoStagingE() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); Location l2 = lmanager.getLocationById("2"); Location l3 = lmanager.getLocationById("3"); Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1611,9 +1529,11 @@ public void testStagingtoStagingE() { Assert.assertTrue("Train 1 build, caboose destination is terminal", train1.isBuilt()); } + /* + * Test location car type acceptance + */ @Test public void testStagingtoStagingF() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1621,33 +1541,18 @@ public void testStagingtoStagingF() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); + Location l3 = lmanager.getLocationById("3"); Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1658,17 +1563,23 @@ public void testStagingtoStagingF() { Assert.assertEquals("Place e3", Track.OKAY, e3.setLocation(l1, l1s2)); Assert.assertEquals("Place e4", Track.OKAY, e4.setLocation(l1, l1s2)); - // don't allow cabooses road + // don't allow type "Caboose" to be serviced l3.deleteTypeName(Bundle.getMessage("Caboose")); train1.reset(); new TrainBuilder().build(train1); - Assert.assertFalse("Train 1 build, caboose destination is terminal", train1.isBuilt()); + Assert.assertFalse("Train 1 build, Caboose not serviced by location", train1.isBuilt()); + + // now allow location to service type name "Caboose" l3.addTypeName(Bundle.getMessage("Caboose")); + new TrainBuilder().build(train1); + Assert.assertTrue("Train 1 build, Caboose is allowed", train1.isBuilt()); } + /* + * Test car built dates + */ @Test public void testStagingtoStagingG() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1676,33 +1587,19 @@ public void testStagingtoStagingG() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); + Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1736,6 +1633,9 @@ public void testStagingtoStagingG() { Assert.assertTrue("Train 1 After 4th Build with rs built before 1985", train1.isBuilt()); } + /* + * Test engine type names + */ @Test public void testStagingtoStagingH() { String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); @@ -1746,33 +1646,17 @@ public void testStagingtoStagingH() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1794,9 +1678,11 @@ public void testStagingtoStagingH() { Assert.assertEquals("Train 1 After 2nd Build type Diesel serviced", true, train1.isBuilt()); } + /* + * Test car owner + */ @Test public void testStagingtoStagingI() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1804,33 +1690,17 @@ public void testStagingtoStagingI() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1865,9 +1735,11 @@ public void testStagingtoStagingI() { Assert.assertEquals("Train 1 After 5th Build all owners", true, train1.isBuilt()); } + /* + * Test car load restrictions departing staging + */ @Test public void testStagingtoStagingJ() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1876,32 +1748,22 @@ public void testStagingtoStagingJ() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); + Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); + Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -1966,9 +1828,11 @@ public void testStagingtoStagingJ() { train1.setLoadOption(Train.ALL_LOADS); } + /* + * Test service direction departing staging + */ @Test public void testStagingtoStagingK() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -1976,33 +1840,17 @@ public void testStagingtoStagingK() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -2030,9 +1878,11 @@ public void testStagingtoStagingK() { train1.reset(); } + /* + * Test car departing staging with destination + */ @Test public void testStagingtoStagingL() { - String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setSwitchTime(11); Setup.setTravelTime(111); @@ -2040,33 +1890,19 @@ public void testStagingtoStagingL() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); + Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -2098,6 +1934,10 @@ public void testStagingtoStagingL() { .getNextLocationName()); } + /* + * Test route car move counts out of staging, move and terminate trains. + * Confirm cars go to correct locations and tracks. + */ @Test public void testStagingtoStagingM() { Setup.setSwitchTime(11); @@ -2120,8 +1960,7 @@ public void testStagingtoStagingM() { Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); Location l2 = lmanager.getLocationById("2"); Location l3 = lmanager.getLocationById("3"); @@ -2132,8 +1971,7 @@ public void testStagingtoStagingM() { Track l3s2 = l3.getTrackById("3s2"); Route route1 = rmanager.getRouteById("1"); RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + train1.setEngineRoad("PC"); train1.setEngineModel("GP40"); train1.setNumberEngines("2"); @@ -2144,7 +1982,6 @@ public void testStagingtoStagingM() { Assert.assertEquals("Place e3", Track.OKAY, e3.setLocation(l1, l1s2)); Assert.assertEquals("Place e4", Track.OKAY, e4.setLocation(l1, l1s2)); - // now trying limiting the number of cars that can depart staging rl1.setMaxCarMoves(2); // there are three cars in staging train1.reset(); @@ -2349,6 +2186,9 @@ public void testStagingtoStagingM() { Assert.assertEquals("Terminated Pickup count for South End, track South End 2", 0, l3s2.getPickupRS()); } + /* + * Test number of engines departing staging + */ @Test public void testStagingtoStagingN() { Setup.setSwitchTime(11); @@ -2356,35 +2196,18 @@ public void testStagingtoStagingN() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + // Place Engines on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l1, l1s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); @@ -2415,6 +2238,9 @@ public void testStagingtoStagingN() { train2.isBuilt()); } + /* + * Test number of engines departing staging + */ @Test public void testStagingtoStagingO() { Setup.setSwitchTime(11); @@ -2422,35 +2248,18 @@ public void testStagingtoStagingO() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + // Place Engines on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l1, l1s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); @@ -2473,6 +2282,9 @@ public void testStagingtoStagingO() { Assert.assertEquals("Train 2 After Build require 2 engine", true, train2.isBuilt()); } + /* + * Test engine "out of service" departing staging + */ @Test public void testStagingtoStagingP() { Setup.setSwitchTime(11); @@ -2482,33 +2294,17 @@ public void testStagingtoStagingP() { Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + // Place Engines on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l1, l1s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); @@ -2533,6 +2329,9 @@ public void testStagingtoStagingP() { Assert.assertTrue("Train 2 After Build engine in service", train2.isBuilt()); } + /* + * Test engine road names when departing staging + */ @Test public void testStagingtoStagingQ() { Setup.setSwitchTime(11); @@ -2540,35 +2339,18 @@ public void testStagingtoStagingQ() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); - Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + // Place Engines on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l1, l1s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); @@ -2581,9 +2363,16 @@ public void testStagingtoStagingQ() { train2.reset(); new TrainBuilder().build(train2); Assert.assertEquals("Train 2 After Build require road CP", false, train2.isBuilt()); + train2.setEngineRoad("PC"); + train2.reset(); + new TrainBuilder().build(train2); + Assert.assertEquals("Train 2 After Build require road PC", true, train2.isBuilt()); } + /* + * Test car departing staging requiring FRED + */ @Test public void testStagingtoStagingR() { Setup.setSwitchTime(11); @@ -2591,35 +2380,20 @@ public void testStagingtoStagingR() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); - Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); - Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); + Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); - Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); - Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); - Car c9 = cmanager.getByRoadAndNumber("CP","99"); + Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + // Place Engines on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l1, l1s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); @@ -2639,6 +2413,9 @@ public void testStagingtoStagingR() { Assert.assertEquals("Train 2 After Build 2 requires FRED", true, train2.isBuilt()); } + /* + * Test engine model departing staging + */ @Test public void testStagingtoStagingS() { Setup.setSwitchTime(11); @@ -2646,35 +2423,26 @@ public void testStagingtoStagingS() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); - Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); + Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); Car c3 = cmanager.getByRoadAndNumber("CP","X10001"); - Car c4 = cmanager.getByRoadAndNumber("CP","X10002"); + Car c5 = cmanager.getByRoadAndNumber("CP","X20001"); Car c6 = cmanager.getByRoadAndNumber("CP","X20002"); Car c7 = cmanager.getByRoadAndNumber("CP","777"); - Car c8 = cmanager.getByRoadAndNumber("CP","888"); + Car c9 = cmanager.getByRoadAndNumber("CP","99"); Engine e1 = emanager.getByRoadAndNumber("PC","5016"); Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); - Location l3 = lmanager.getLocationById("3"); + Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); - Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); + // Place Engines on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l1, l1s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); @@ -2706,6 +2474,9 @@ public void testStagingtoStagingS() { } + /* + * Test train departing staging, car types, lengths, and loads + */ @Test public void testStagingtoStagingT() { Setup.setSwitchTime(11); @@ -2713,7 +2484,6 @@ public void testStagingtoStagingT() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); @@ -2728,15 +2498,13 @@ public void testStagingtoStagingT() { Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); - Location l2 = lmanager.getLocationById("2"); + Location l3 = lmanager.getLocationById("3"); Track l1s1 = l1.getTrackById("1s1"); Track l1s2 = l1.getTrackById("1s2"); - Track l2s1 = l2.getTrackById("2s1"); - Track l3s1 = l3.getTrackById("3s1"); + Track l3s2 = l3.getTrackById("3s2"); Route route1 = rmanager.getRouteById("1"); RouteLocation rl1 = route1.getLocationById("1r1"); @@ -2747,6 +2515,7 @@ public void testStagingtoStagingT() { Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l1, l1s1)); Assert.assertEquals("Place e3", Track.OKAY, e3.setLocation(l1, l1s2)); Assert.assertEquals("Place e4", Track.OKAY, e4.setLocation(l1, l1s2)); + train2.addTypeName("Boxcar"); // now allow Flat @@ -2818,7 +2587,10 @@ public void testStagingtoStagingT() { Assert.assertEquals("Car c8 load after Terminate Train 2", "L", c8.getLoadName()); Assert.assertEquals("Car c9 load after Terminate Train 2", "E", c9.getLoadName()); } - + + /* + * Test train terminating into staging, tracks full, staging track size, car type and road restrictions + */ @Test public void testStagingtoStagingU() { Setup.setSwitchTime(11); @@ -2826,7 +2598,6 @@ public void testStagingtoStagingU() { JUnitOperationsUtil.initOperationsData(); - Train train1 = tmanager.getTrainById("1"); Train train2 = tmanager.getTrainById("2"); Car c1 = cmanager.getByRoadAndNumber("CP","C10099"); Car c2 = cmanager.getByRoadAndNumber("CP","C20099"); @@ -2841,21 +2612,17 @@ public void testStagingtoStagingU() { Engine e2 = emanager.getByRoadAndNumber("PC","5019"); Engine e3 = emanager.getByRoadAndNumber("PC","5524"); Engine e4 = emanager.getByRoadAndNumber("PC","5559"); - Consist con1 = emanager.getConsistByName("C16"); - Consist con2 = emanager.getConsistByName("C14"); + Location l1 = lmanager.getLocationById("1"); Location l2 = lmanager.getLocationById("2"); Location l3 = lmanager.getLocationById("3"); Track l1s1 = l1.getTrackById("1s1"); - Track l1s2 = l1.getTrackById("1s2"); + Track l2s1 = l2.getTrackById("2s1"); Track l3s1 = l3.getTrackById("3s1"); Track l3s2 = l3.getTrackById("3s2"); - Route route1 = rmanager.getRouteById("1"); - RouteLocation rl1 = route1.getLocationById("1r1"); - RouteLocation rl2 = route1.getLocationById("1r2"); - RouteLocation rl3 = route1.getLocationById("1r3"); - // Place Engines on Staging tracks + + // Place Engines and cars on Staging tracks Assert.assertEquals("Place e1", Track.OKAY, e1.setLocation(l3, l3s1)); Assert.assertEquals("Place e2", Track.OKAY, e2.setLocation(l3, l3s1)); Assert.assertEquals("Place e3", Track.OKAY, e3.setLocation(l3, l3s2)); @@ -2867,6 +2634,7 @@ public void testStagingtoStagingU() { Assert.assertEquals("Place c7", Track.OKAY, c7.setLocation(l3, l3s2)); Assert.assertEquals("Place c8", Track.OKAY, c8.setLocation(l3, l3s1)); Assert.assertEquals("Place c9", Track.OKAY, c9.setLocation(l3, l3s2)); + train2.addTypeName("Boxcar"); train2.setRoadOption(Train.ALL_ROADS); @@ -2976,7 +2744,7 @@ public void testStagingtoStagingU() { new TrainBuilder().build(train2); Assert.assertTrue("Train 2 will build no road restrictions", train2.isBuilt()); - cr.addName("BM"); // BM is not a road in all languges, so add it. + cr.addName("BM"); // BM is not a road in all languages, so add it. l3s3.addRoadName("BM"); Assert.assertEquals("Number of road names", 1, l3s3.getRoadNames().length); @@ -2992,7 +2760,6 @@ public void testStagingtoStagingU() { // test train staging to staging @Test public void testStagingtoStaging2() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // register the car colors used @@ -3271,9 +3038,11 @@ public void testStagingtoStaging2() { } + /* + * Test the loading of custom load into cars departing staging + */ @Test public void testStagingtoStagingCustomLoads() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // register the car colors used @@ -4524,7 +4293,6 @@ public void testScheduleLoads() { @Test public void testInterchange() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); Setup.setMaxTrainLength(500); @@ -5184,7 +4952,6 @@ public void testInterchange() { @Test public void testCaboose() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // register the car and engine types used @@ -5851,7 +5618,6 @@ public void testCaboose() { @Test public void testTrainBuildOptions() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // register the car and engine types used @@ -6238,7 +6004,6 @@ public void testTrainBuildOptions() { @Test public void testCarBlockingFromStaging() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // create 5 locations with tracks @@ -6528,8 +6293,6 @@ public void testCarBlockingFromStaging() { */ @Test public void testEngineChanges() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); - String carTypes[] = Bundle.getMessage("carTypeNames").split(","); et.addName("Diesel"); @@ -6697,7 +6460,6 @@ public void testEngineChanges() { */ @Test public void testCabooseChanges() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); // test confirms the order cabooses are assigned to the train Setup.setBuildAggressive(true); @@ -6874,7 +6636,6 @@ public void testCabooseChanges() { @Test public void testAutoHP() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); Assert.assertEquals("confirm default of 1 HPT", 1, Setup.getHorsePowerPerTon()); @@ -7010,7 +6771,6 @@ public void testAutoHP() { @Test public void testAggressiveBuildOption() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); String engineTypes[] = Bundle.getMessage("engineDefaultTypes").split(","); Setup.setBuildAggressive(true); @@ -7455,7 +7215,6 @@ public void testAggressiveBuildOption() { // test private method getCarOrder @Test public void testCarOrderNORMAL() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); TrainBuilder tb = new TrainBuilder(); // start by creating a track @@ -7505,7 +7264,7 @@ public void testCarOrderNORMAL() { getCarOrderMethod.setAccessible(true); // and set the car list up. - tb._carList = new java.util.ArrayList(); + tb._carList = new java.util.ArrayList<>(); tb._carList.add(a); tb._carList.add(b); tb._carList.add(c); @@ -7529,7 +7288,6 @@ public void testCarOrderNORMAL() { @Test public void testCarOrderFIFO() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); TrainBuilder tb = new TrainBuilder(); // start by creating a track @@ -7579,7 +7337,7 @@ public void testCarOrderFIFO() { getCarOrderMethod.setAccessible(true); // and set the car list up. - tb._carList = new java.util.ArrayList(); + tb._carList = new java.util.ArrayList<>(); tb._carList.add(a); tb._carList.add(b); tb._carList.add(c); @@ -7602,7 +7360,6 @@ public void testCarOrderFIFO() { @Test public void testCarOrderLIFO() { - String roadNames[] = Bundle.getMessage("carRoadNames").split(","); String carTypes[] = Bundle.getMessage("carTypeNames").split(","); TrainBuilder tb = new TrainBuilder(); // start by creating a track @@ -7652,7 +7409,7 @@ public void testCarOrderLIFO() { getCarOrderMethod.setAccessible(true); // and set the car list up. - tb._carList = new java.util.ArrayList(); + tb._carList = new java.util.ArrayList<>(); tb._carList.add(a); tb._carList.add(b); tb._carList.add(c); diff --git a/java/test/jmri/jmrit/operations/trains/TrainEditBuildOptionsFrameTest.java b/java/test/jmri/jmrit/operations/trains/TrainEditBuildOptionsFrameTest.java index c622d926fdd..033cd04759f 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainEditBuildOptionsFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainEditBuildOptionsFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainEditBuildOptionsFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainEditBuildOptionsFrame t = new TrainEditBuildOptionsFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/TrainLoadOptionsFrameTest.java b/java/test/jmri/jmrit/operations/trains/TrainLoadOptionsFrameTest.java index c3f631d73da..46b16cb0ece 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainLoadOptionsFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainLoadOptionsFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainLoadOptionsFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainLoadOptionsFrame t = new TrainLoadOptionsFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/TrainRoadOptionsFrameTest.java b/java/test/jmri/jmrit/operations/trains/TrainRoadOptionsFrameTest.java index 620d125e1cc..db44fc9aa5b 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainRoadOptionsFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainRoadOptionsFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainRoadOptionsFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainRoadOptionsFrame t = new TrainRoadOptionsFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/TrainSwitchListEditFrameTest.java b/java/test/jmri/jmrit/operations/trains/TrainSwitchListEditFrameTest.java index c6d8b95e963..6ae790cf4bd 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainSwitchListEditFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainSwitchListEditFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainSwitchListEditFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainSwitchListEditFrame t = new TrainSwitchListEditFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/TrainTest.java b/java/test/jmri/jmrit/operations/trains/TrainTest.java index cb635955adb..7d32ab26793 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainTest.java @@ -1,7 +1,6 @@ //TrainTest.java package jmri.jmrit.operations.trains; -import java.util.List; import jmri.InstanceManager; import jmri.jmrit.operations.OperationsTestCase; import jmri.jmrit.operations.locations.Location; @@ -11,19 +10,15 @@ import jmri.jmrit.operations.locations.schedules.ScheduleItem; import jmri.jmrit.operations.locations.schedules.ScheduleManager; import jmri.jmrit.operations.rollingstock.cars.Car; -import jmri.jmrit.operations.rollingstock.cars.CarColors; -import jmri.jmrit.operations.rollingstock.cars.CarLengths; import jmri.jmrit.operations.rollingstock.cars.CarLoad; import jmri.jmrit.operations.rollingstock.cars.CarLoads; import jmri.jmrit.operations.rollingstock.cars.CarManager; -import jmri.jmrit.operations.rollingstock.cars.CarOwners; import jmri.jmrit.operations.rollingstock.cars.CarRoads; import jmri.jmrit.operations.rollingstock.cars.CarTypes; import jmri.jmrit.operations.rollingstock.cars.Kernel; import jmri.jmrit.operations.rollingstock.engines.Consist; import jmri.jmrit.operations.rollingstock.engines.Engine; import jmri.jmrit.operations.rollingstock.engines.EngineManager; -import jmri.jmrit.operations.rollingstock.engines.EngineModels; import jmri.jmrit.operations.rollingstock.engines.EngineTypes; import jmri.jmrit.operations.routes.Route; import jmri.jmrit.operations.routes.RouteLocation; diff --git a/java/test/jmri/jmrit/operations/trains/TrainsTableFrameTest.java b/java/test/jmri/jmrit/operations/trains/TrainsTableFrameTest.java index 8aac2462140..843d037c8d9 100644 --- a/java/test/jmri/jmrit/operations/trains/TrainsTableFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/TrainsTableFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainsTableFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainsTableFrame t = new TrainsTableFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramFrameTest.java b/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramFrameTest.java index 4b6d99cbec0..5a00ce20a67 100644 --- a/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class SetupExcelProgramFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); SetupExcelProgramFrame t = new SetupExcelProgramFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramManifestFrameTest.java b/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramManifestFrameTest.java index edd98f69b42..e4f4517f5a2 100644 --- a/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramManifestFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramManifestFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class SetupExcelProgramManifestFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); SetupExcelProgramManifestFrame t = new SetupExcelProgramManifestFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramSwitchListFrameTest.java b/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramSwitchListFrameTest.java index 4b0b99108a0..fd7b38c5e7b 100644 --- a/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramSwitchListFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/excel/SetupExcelProgramSwitchListFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class SetupExcelProgramSwitchListFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); SetupExcelProgramSwitchListFrame t = new SetupExcelProgramSwitchListFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleEditFrameTest.java b/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleEditFrameTest.java index c74c7bacd8f..8e898f44b35 100644 --- a/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleEditFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleEditFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainsScheduleEditFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainsScheduleEditFrame t = new TrainsScheduleEditFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleTableFrameTest.java b/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleTableFrameTest.java index c38ddb49a98..caebbb7e2e8 100644 --- a/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleTableFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/timetable/TrainsScheduleTableFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainsScheduleTableFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainsScheduleTableFrame t = new TrainsScheduleTableFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/tools/ChangeDepartureTimesFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/ChangeDepartureTimesFrameTest.java index 67c502669cb..136bd76ae59 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/ChangeDepartureTimesFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/ChangeDepartureTimesFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class ChangeDepartureTimesFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); ChangeDepartureTimesFrame t = new ChangeDepartureTimesFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/tools/ShowCarsInTrainFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/ShowCarsInTrainFrameTest.java index 544d7f571e7..a2b4cf395e8 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/ShowCarsInTrainFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/ShowCarsInTrainFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class ShowCarsInTrainFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); ShowCarsInTrainFrame t = new ShowCarsInTrainFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/tools/TrainByCarTypeFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/TrainByCarTypeFrameTest.java index 36fbdc83a4a..a9b9e13aee1 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/TrainByCarTypeFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/TrainByCarTypeFrameTest.java @@ -1,12 +1,12 @@ package jmri.jmrit.operations.trains.tools; import java.awt.GraphicsEnvironment; +import jmri.util.JUnitOperationsUtil; import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,17 +16,21 @@ public class TrainByCarTypeFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + jmri.jmrit.operations.trains.Train train = jmri.InstanceManager.getDefault(jmri.jmrit.operations.trains.TrainManager.class).getTrainById("1"); TrainByCarTypeFrame t = new TrainByCarTypeFrame(); + t.initComponents(train); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/trains/tools/TrainManifestOptionFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/TrainManifestOptionFrameTest.java index da56b02c170..f30cda915d7 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/TrainManifestOptionFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/TrainManifestOptionFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainManifestOptionFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainManifestOptionFrame t = new TrainManifestOptionFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/tools/TrainScriptFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/TrainScriptFrameTest.java index 80fec44f546..59953b7ab1b 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/TrainScriptFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/TrainScriptFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainScriptFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainScriptFrame t = new TrainScriptFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/operations/trains/tools/TrainsByCarTypeFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/TrainsByCarTypeFrameTest.java index 653104afabc..0679a752bb9 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/TrainsByCarTypeFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/TrainsByCarTypeFrameTest.java @@ -2,11 +2,11 @@ import java.awt.GraphicsEnvironment; import jmri.util.JUnitUtil; +import jmri.util.JUnitOperationsUtil; import org.junit.After; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,17 +16,20 @@ public class TrainsByCarTypeFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainsByCarTypeFrame t = new TrainsByCarTypeFrame(); + t.initComponents("BoxCar"); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J @Before public void setUp() { JUnitUtil.setUp(); + JUnitOperationsUtil.resetOperationsManager(); + JUnitOperationsUtil.initOperationsData(); } @After diff --git a/java/test/jmri/jmrit/operations/trains/tools/TrainsScriptFrameTest.java b/java/test/jmri/jmrit/operations/trains/tools/TrainsScriptFrameTest.java index 9cd601e5f41..d329194fa3e 100644 --- a/java/test/jmri/jmrit/operations/trains/tools/TrainsScriptFrameTest.java +++ b/java/test/jmri/jmrit/operations/trains/tools/TrainsScriptFrameTest.java @@ -6,7 +6,6 @@ import org.junit.Assert; import org.junit.Assume; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -16,11 +15,11 @@ public class TrainsScriptFrameTest { @Test - @Ignore("ignore constructor tests for Frames until test dependencies resovled") public void testCTor() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); TrainsScriptFrame t = new TrainsScriptFrame(); Assert.assertNotNull("exists",t); + JUnitUtil.dispose(t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/sendpacket/BundleTest.java b/java/test/jmri/jmrit/sendpacket/BundleTest.java new file mode 100644 index 00000000000..c5c9995d33b --- /dev/null +++ b/java/test/jmri/jmrit/sendpacket/BundleTest.java @@ -0,0 +1,43 @@ +package jmri.jmrit.sendpacket; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeysMessage() { + Assert.assertEquals("Tools", Bundle.getMessage("MenuTools")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKeyMessage() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + + @Test public void testGoodKeysMessageArg() { + Assert.assertEquals("Tools", Bundle.getMessage("MenuTools", "foo")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout", "foo")); + Assert.assertEquals("About Test", Bundle.getMessage("TitleAbout", "Test")); + } + + @Test public void testBadKeyMessageArg() { + try { + Bundle.getMessage("FFFFFTTTTTTT", "foo"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + + +} diff --git a/java/test/jmri/jmrit/sendpacket/PackageTest.java b/java/test/jmri/jmrit/sendpacket/PackageTest.java index 5872f68793a..b879408c758 100644 --- a/java/test/jmri/jmrit/sendpacket/PackageTest.java +++ b/java/test/jmri/jmrit/sendpacket/PackageTest.java @@ -7,7 +7,8 @@ @Suite.SuiteClasses({ SendPacketActionTest.class, SendPacketFrameTest.class, - SendPacketTest.class + SendPacketTest.class, + BundleTest.class }) /** diff --git a/java/test/jmri/jmrit/sensorgroup/SensorGroupActionTest.java b/java/test/jmri/jmrit/sensorgroup/SensorGroupActionTest.java index eb57704c706..23fd85d0f36 100644 --- a/java/test/jmri/jmrit/sensorgroup/SensorGroupActionTest.java +++ b/java/test/jmri/jmrit/sensorgroup/SensorGroupActionTest.java @@ -3,11 +3,16 @@ import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; +import org.junit.Assume; import org.junit.Before; import org.junit.Test; +import java.awt.GraphicsEnvironment; +import javax.swing.JFrame; +import org.netbeans.jemmy.operators.JFrameOperator; /** * + * @author Bob Jacobsen Copyright 2003, 2007 * @author Paul Bender Copyright (C) 2017 */ public class SensorGroupActionTest { @@ -18,6 +23,21 @@ public void testCTor() { Assert.assertNotNull("exists",t); } + @Test + public void testActionCreateAndFire() { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + SensorGroupAction a = new SensorGroupAction("Sensor Group"); + a.actionPerformed(null); + // wait for frame with "Sensor Group" in title, case insensitive + // first boolean is false for exact to allow substring to match + // second boolean is false to all case insensitive match + JFrame frame = JFrameOperator.waitJFrame("Sensor Group", false, false); + Assert.assertNotNull(frame); + // verify the action provided the expected frame class + Assert.assertEquals(SensorGroupFrame.class.getName(), frame.getClass().getName()); + JUnitUtil.dispose(frame); + } + // The minimal setup for log4J @Before public void setUp() { diff --git a/java/test/jmri/jmrit/sensorgroup/SensorGroupFrameTest.java b/java/test/jmri/jmrit/sensorgroup/SensorGroupFrameTest.java index 34a772c168d..d9d988a5ee0 100644 --- a/java/test/jmri/jmrit/sensorgroup/SensorGroupFrameTest.java +++ b/java/test/jmri/jmrit/sensorgroup/SensorGroupFrameTest.java @@ -10,6 +10,7 @@ /** * + * @author Bob Jacobsen Copyright 2003, 2007 * @author Paul Bender Copyright (C) 2017 */ public class SensorGroupFrameTest { diff --git a/java/test/jmri/jmrit/sensorgroup/SensorGroupTest.java b/java/test/jmri/jmrit/sensorgroup/SensorGroupTest.java index f50c6e1234f..059093407db 100644 --- a/java/test/jmri/jmrit/sensorgroup/SensorGroupTest.java +++ b/java/test/jmri/jmrit/sensorgroup/SensorGroupTest.java @@ -1,43 +1,23 @@ package jmri.jmrit.sensorgroup; -import java.awt.GraphicsEnvironment; -import javax.swing.JFrame; import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; -import org.junit.Assume; import org.junit.Before; import org.junit.Test; -import org.netbeans.jemmy.operators.JFrameOperator; /** - * Tests for classes in the jmri.jmrit.sensorgroup package + * Tests for classes in the SensorGroup class * * @author Bob Jacobsen Copyright 2003, 2007 + * @author Paul Bender Copyright (C) 2017 */ public class SensorGroupTest { @Test - public void testFrameCreate() { - Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - SensorGroupFrame frame = new SensorGroupFrame(); - Assert.assertNotNull(frame); - JUnitUtil.dispose(frame); - } - - @Test - public void testActionCreateAndFire() { - Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - SensorGroupAction a = new SensorGroupAction("Sensor Group"); - a.actionPerformed(null); - // wait for frame with "Sensor Group" in title, case insensitive - // first boolean is false for exact to allow substring to match - // second boolean is false to all case insensitive match - JFrame frame = JFrameOperator.waitJFrame("Sensor Group", false, false); - Assert.assertNotNull(frame); - // verify the action provided the expected frame class - Assert.assertEquals(SensorGroupFrame.class.getName(), frame.getClass().getName()); - JUnitUtil.dispose(frame); + public void testCTor() { + SensorGroup t = new SensorGroup("test"); + Assert.assertNotNull("exists",t); } // The minimal setup for log4J diff --git a/java/test/jmri/jmrit/signalling/PackageTest.java b/java/test/jmri/jmrit/signalling/PackageTest.java index 2338ef6b906..e8b24a030d7 100644 --- a/java/test/jmri/jmrit/signalling/PackageTest.java +++ b/java/test/jmri/jmrit/signalling/PackageTest.java @@ -28,18 +28,12 @@ public static Test suite() { TestSuite suite = new TestSuite("jmri.jmrit.signalling.PackageTest"); // no tests in this class itself suite.addTest(new junit.framework.JUnit4TestAdapter(BundleTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrit.signalling.entryexit.PackageTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrit.signalling.configurexml.PackageTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(AddEntryExitPairFrameTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(EntryExitPairsTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingActionTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingFrameActionTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingFrameTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingSourceActionTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingSourceFrameTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingGuiToolsTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(AddEntryExitPairActionTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(AddEntryExitPairPanelTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingSourcePanelTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SignallingPanelTest.class)); return suite; diff --git a/java/test/jmri/jmrit/signalling/entryexit/PackageTest.java b/java/test/jmri/jmrit/signalling/entryexit/PackageTest.java deleted file mode 100644 index 2e2212e9aa9..00000000000 --- a/java/test/jmri/jmrit/signalling/entryexit/PackageTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package jmri.jmrit.signalling.entryexit; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses({ - BundleTest.class, - StackNXPanelTest.class, - PointDetailsTest.class, - ManuallySetRouteTest.class, - SourceTest.class, - DestinationPointsTest.class, - -}) -/** - * Invokes complete set of tests in the jmri.jmrit.signalling.entryexit tree - * - * @author Bob Jacobsen Copyright 2001, 2003, 2012 - */ -public class PackageTest { -} diff --git a/java/test/jmri/jmrix/PackageTest.java b/java/test/jmri/jmrix/PackageTest.java index 1f357215987..13326543abe 100644 --- a/java/test/jmri/jmrix/PackageTest.java +++ b/java/test/jmri/jmrix/PackageTest.java @@ -26,6 +26,7 @@ static public void main(String[] args) { // test suite from all defined tests public static Test suite() { TestSuite suite = new TestSuite("jmri.jmrix.PackageTest"); + suite.addTest(new junit.framework.JUnit4TestAdapter(AbstractMRTrafficControllerTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(AbstractMRNodeTrafficControllerTest.class)); @@ -37,6 +38,7 @@ public static Test suite() { suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrix.ConnectionConfigManagerTest.class)); suite.addTest(jmri.jmrix.acela.PackageTest.suite()); + suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrix.anyma.PackageTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrix.bachrus.PackageTest.class)); suite.addTest(jmri.jmrix.can.PackageTest.suite()); suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrix.configurexml.PackageTest.class)); @@ -101,6 +103,7 @@ public static Test suite() { suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrix.ztc.PackageTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(jmri.jmrix.libusb.PackageTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(SystemConnectionMemoManagerTest.class)); + suite.addTest(new junit.framework.JUnit4TestAdapter(UsbPortAdapterTest.class)); return suite; } diff --git a/java/test/jmri/jmrix/UsbPortAdapterTest.java b/java/test/jmri/jmrix/UsbPortAdapterTest.java new file mode 100644 index 00000000000..0d6c4cd8170 --- /dev/null +++ b/java/test/jmri/jmrix/UsbPortAdapterTest.java @@ -0,0 +1,38 @@ +package jmri.jmrix; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class UsbPortAdapterTest { + + @Test + public void testCTor() { + UsbPortAdapter t = new UsbPortAdapter(new SystemConnectionMemo("I","test"){ + @Override + protected java.util.ResourceBundle getActionModelResourceBundle(){ + return null; + } + }); + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/jmrix/anyma/AnymaDMX_ConnectionConfigTest.java b/java/test/jmri/jmrix/anyma/AnymaDMX_ConnectionConfigTest.java new file mode 100644 index 00000000000..5ce0edd5c19 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/AnymaDMX_ConnectionConfigTest.java @@ -0,0 +1,32 @@ +package jmri.jmrix.anyma; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for AnymaDMX_ConnectionConfig class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_ConnectionConfigTest { + + @Test + public void ConstructorTest() { + Assert.assertNotNull("ConnectionConfig constructor", new AnymaDMX_ConnectionConfig()); + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/AnymaDMX_ConnectionTypeListTest.java b/java/test/jmri/jmrix/anyma/AnymaDMX_ConnectionTypeListTest.java new file mode 100644 index 00000000000..29eb58b4ff9 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/AnymaDMX_ConnectionTypeListTest.java @@ -0,0 +1,32 @@ +package jmri.jmrix.anyma; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for AnymaDMX_ConnectionTypeList class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_ConnectionTypeListTest { + + @Test + public void ConstructorTest() { + Assert.assertNotNull("ConnectionConfig constructor", new AnymaDMX_ConnectionTypeList()); + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/AnymaDMX_SystemConnectionMemoTest.java b/java/test/jmri/jmrix/anyma/AnymaDMX_SystemConnectionMemoTest.java new file mode 100644 index 00000000000..3b932784a6c --- /dev/null +++ b/java/test/jmri/jmrix/anyma/AnymaDMX_SystemConnectionMemoTest.java @@ -0,0 +1,42 @@ +package jmri.jmrix.anyma; + +import jmri.jmrix.SystemConnectionMemoTestBase; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for AnymaDMX_SystemConnectionMemo class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_SystemConnectionMemoTest extends SystemConnectionMemoTestBase { + + @Test + public void testDefaultCtor() { + Assert.assertNotNull("exists", scm); + } + + @Override + @Test + public void testProvidesConsistManager() { + Assert.assertFalse("Provides ConsistManager", scm.provides(jmri.ConsistManager.class)); + } + + @Override + @Before + public void setUp() { + JUnitUtil.setUp(); + //AnymaDMX_TrafficController tc = new AnymaDMX_TrafficController(); + scm = new AnymaDMX_SystemConnectionMemo(); + } + + @Override + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/AnymaDMX_TrafficControllerTest.java b/java/test/jmri/jmrix/anyma/AnymaDMX_TrafficControllerTest.java new file mode 100644 index 00000000000..86ec5804115 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/AnymaDMX_TrafficControllerTest.java @@ -0,0 +1,32 @@ +package jmri.jmrix.anyma; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for AnymaDMX_TrafficController class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_TrafficControllerTest { + + @Test + public void ConstructorTest() { + Assert.assertNotNull("ConnectionConfig constructor", new AnymaDMX_TrafficController()); + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/AnymaDMX_UsbLightTest.java b/java/test/jmri/jmrix/anyma/AnymaDMX_UsbLightTest.java new file mode 100644 index 00000000000..37e9989c960 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/AnymaDMX_UsbLightTest.java @@ -0,0 +1,46 @@ +package jmri.jmrix.anyma; + +import jmri.implementation.AbstractLightTestBase; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; + +/** + * Tests for AnymaDMX_UsbLight class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_UsbLightTest extends AbstractLightTestBase { + + private AnymaDMX_SystemConnectionMemo _memo = null; + + public void testCreate() { + t = new AnymaDMX_UsbLight("DXL1", "Test Light", _memo); + Assert.assertNotNull("testCreate", t); + } + + public int numListeners() { + return 0; + } + + public void checkOnMsgSent() { + } + + public void checkOffMsgSent() { + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + _memo = new AnymaDMX_SystemConnectionMemo(); + t = new AnymaDMX_UsbLight("DXL1", "Test Light", _memo); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/AnymaDMX_UsbPortAdapterTest.java b/java/test/jmri/jmrix/anyma/AnymaDMX_UsbPortAdapterTest.java new file mode 100644 index 00000000000..74d90014544 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/AnymaDMX_UsbPortAdapterTest.java @@ -0,0 +1,32 @@ +package jmri.jmrix.anyma; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for AnymaDMX_UsbPortAdapter class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_UsbPortAdapterTest { + + @Test + public void ConstructorTest() { + Assert.assertNotNull("ConnectionConfig constructor", new AnymaDMX_UsbPortAdapter()); + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/BundleTest.java b/java/test/jmri/jmrix/anyma/BundleTest.java new file mode 100644 index 00000000000..23daa220368 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.anyma; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/anyma/PackageTest.java b/java/test/jmri/jmrix/anyma/PackageTest.java new file mode 100644 index 00000000000..af1166caec1 --- /dev/null +++ b/java/test/jmri/jmrix/anyma/PackageTest.java @@ -0,0 +1,45 @@ +package jmri.jmrix.anyma; + +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + AnymaDMX_ConnectionConfigTest.class, + AnymaDMX_ConnectionTypeListTest.class, + AnymaDMX_SystemConnectionMemoTest.class, + AnymaDMX_TrafficControllerTest.class, + AnymaDMX_UsbLightTest.class, + AnymaDMX_UsbPortAdapterTest.class, + UsbLightManagerTest.class, + jmri.jmrix.anyma.configurexml.PackageTest.class, + BundleTest.class, + }) + +/** + * Tests for the jmri.jmrix.acela.configurexml package. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class PackageTest { + +// Main entry point + static public void main(String[] args) { + Result result = JUnitCore.runClasses(PackageTest.class); + for (org.junit.runner.notification.Failure fail : result.getFailures()) { + log.error(fail.toString()); + } + //junit.textui.TestRunner.main(testCaseName); + if (result.wasSuccessful()) { + log.info("Success"); + } + } + + private final static Logger log + = LoggerFactory.getLogger(PackageTest.class); +} diff --git a/java/test/jmri/jmrix/anyma/UsbLightManagerTest.java b/java/test/jmri/jmrix/anyma/UsbLightManagerTest.java new file mode 100644 index 00000000000..3b745189c1f --- /dev/null +++ b/java/test/jmri/jmrix/anyma/UsbLightManagerTest.java @@ -0,0 +1,71 @@ +package jmri.jmrix.anyma; + +import jmri.Light; +import jmri.managers.AbstractLightMgrTestBase; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Tests for UsbLightManager class. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class UsbLightManagerTest extends AbstractLightMgrTestBase { + + private AnymaDMX_SystemConnectionMemo _memo = null; + + @Test + public void ConstructorTest() { + Assert.assertNotNull("ConnectionConfig constructor", l); + } + + public String getSystemName(int i) { + return "DXL" + i; + } + + @Test + public void testAsAbstractFactory() { + String systemName = "DXL21"; + String userName = "My Name"; + Light tl = l.newLight(systemName, userName); + + if (log.isDebugEnabled()) { + log.debug("new light value: " + tl); + } + Assert.assertNotNull(tl); + + // make sure loaded into tables + if (log.isDebugEnabled()) { + log.debug("by system name: " + l.getBySystemName(systemName)); + } + Assert.assertNotNull(l.getBySystemName(systemName)); + + if (log.isDebugEnabled()) { + log.debug("by user name: " + l.getByUserName(userName)); + } + Assert.assertNotNull(l.getByUserName(userName)); + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + + _memo = new AnymaDMX_SystemConnectionMemo(); + l = _memo.getLightManager(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } + + private final static Logger log + = LoggerFactory.getLogger(UsbLightManagerTest.class); +} diff --git a/java/test/jmri/jmrix/anyma/configurexml/AnymaDMX_ConnectionConfigXmlTest.java b/java/test/jmri/jmrix/anyma/configurexml/AnymaDMX_ConnectionConfigXmlTest.java new file mode 100644 index 00000000000..8226b95142b --- /dev/null +++ b/java/test/jmri/jmrix/anyma/configurexml/AnymaDMX_ConnectionConfigXmlTest.java @@ -0,0 +1,34 @@ +package jmri.jmrix.anyma.configurexml; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * AnymaDMX_ConnectionConfigXmlTest.java + *

              + * Description: tests for the AnymaDMX_ConnectionConfigXml class + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class AnymaDMX_ConnectionConfigXmlTest { + + @Test + public void testCtor() { + Assert.assertNotNull("AnymaDMX_ConnectionConfigXml constructor", new AnymaDMX_ConnectionConfigXml()); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/anyma/configurexml/PackageTest.java b/java/test/jmri/jmrix/anyma/configurexml/PackageTest.java new file mode 100644 index 00000000000..3c409edf87d --- /dev/null +++ b/java/test/jmri/jmrix/anyma/configurexml/PackageTest.java @@ -0,0 +1,37 @@ +package jmri.jmrix.anyma.configurexml; + +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + AnymaDMX_ConnectionConfigXmlTest.class, + UsbLightManagerXmlTest.class,}) + +/** + * Tests for the jmri.jmrix.acela.configurexml package. + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class PackageTest { + + // Main entry point + static public void main(String[] args) { + Result result = JUnitCore + .runClasses(PackageTest.class); + for (org.junit.runner.notification.Failure fail : result.getFailures()) { + log.error(fail.toString()); + } + //junit.textui.TestRunner.main(testCaseName); + if (result.wasSuccessful()) { + log.info("Success"); + } + } + + private final static Logger log = LoggerFactory.getLogger(PackageTest.class); +} diff --git a/java/test/jmri/jmrix/anyma/configurexml/UsbLightManagerXmlTest.java b/java/test/jmri/jmrix/anyma/configurexml/UsbLightManagerXmlTest.java new file mode 100644 index 00000000000..d7e7d6fa9ea --- /dev/null +++ b/java/test/jmri/jmrix/anyma/configurexml/UsbLightManagerXmlTest.java @@ -0,0 +1,34 @@ +package jmri.jmrix.anyma.configurexml; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * UsbLightManagerXmlTest.java + *

              + * Description: tests for the UsbLightManagerXml class + * + * @author George Warner Copyright (C) 2017 + * @since 4.9.6 + */ +public class UsbLightManagerXmlTest { + + @Test + public void testCtor() { + Assert.assertNotNull("UsbLightManagerXml constructor", new UsbLightManagerXml()); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/can/adapters/loopback/BundleTest.java b/java/test/jmri/jmrix/can/adapters/loopback/BundleTest.java new file mode 100644 index 00000000000..41d9885cb62 --- /dev/null +++ b/java/test/jmri/jmrix/can/adapters/loopback/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.can.adapters.loopback; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/can/adapters/loopback/PackageTest.java b/java/test/jmri/jmrix/can/adapters/loopback/PackageTest.java index f50b4d7e0c7..05004fddaad 100644 --- a/java/test/jmri/jmrix/can/adapters/loopback/PackageTest.java +++ b/java/test/jmri/jmrix/can/adapters/loopback/PackageTest.java @@ -11,7 +11,8 @@ ConnectionConfigTest.class, jmri.jmrix.can.adapters.loopback.configurexml.PackageTest.class, LoopbackTrafficControllerTest.class, - PortTest.class + PortTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.can.adapters.loopback package. diff --git a/java/test/jmri/jmrix/dccpp/DCCppLightTest.java b/java/test/jmri/jmrix/dccpp/DCCppLightTest.java index 306ceba23cd..88eb1f3aa73 100644 --- a/java/test/jmri/jmrix/dccpp/DCCppLightTest.java +++ b/java/test/jmri/jmrix/dccpp/DCCppLightTest.java @@ -1,7 +1,9 @@ package jmri.jmrix.dccpp; import jmri.util.JUnitUtil; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; /** * Tests for the {@link jmri.jmrix.dccpp.DCCppLight} class. @@ -32,14 +34,10 @@ public void checkOffMsgSent() { Assert.assertEquals("OFF state", jmri.Light.OFF, t.getState()); } - // from here down is testing infrastructure - public DCCppLightTest(String s) { - super(s); - } - // The minimal setup for log4J @Override - protected void setUp() { + @Before + public void setUp() { apps.tests.Log4JFixture.setUp(); // prepare an interface xnis = new DCCppInterfaceScaffold(new DCCppCommandStation()); @@ -48,8 +46,8 @@ protected void setUp() { t = new DCCppLight(xnis, xlm, "DCCppL21"); } - @Override - protected void tearDown() { + @After + public void tearDown() { JUnitUtil.tearDown(); } diff --git a/java/test/jmri/jmrix/dccpp/DCCppMessageTest.java b/java/test/jmri/jmrix/dccpp/DCCppMessageTest.java index 3672420fce3..66cd7c5ea41 100644 --- a/java/test/jmri/jmrix/dccpp/DCCppMessageTest.java +++ b/java/test/jmri/jmrix/dccpp/DCCppMessageTest.java @@ -48,7 +48,7 @@ public void testStringCtor() { // Test the canned messages. @Test - public void testGetAccessoryDecoderMsg() { + public void testGetAccessoryDecoderMsgActivateTrue() { DCCppMessage m = DCCppMessage.makeAccessoryDecoderMsg(23, 2, true); log.debug("accessory decoder message = {}", m.toString()); Assert.assertEquals("length", 8, m.getNumDataElements()); @@ -63,13 +63,34 @@ public void testGetAccessoryDecoderMsg() { } @Test - public void testMonitorStringAccessoryDecoderMsg() { + public void testGetAccessoryDecoderMsgActivateFalse() { + DCCppMessage m = DCCppMessage.makeAccessoryDecoderMsg(23, 2, false); + log.debug("accessory decoder message = {}", m.toString()); + Assert.assertEquals("length", 8, m.getNumDataElements()); + Assert.assertEquals("0th byte", 'a', m.getElement(0) & 0xFF); + Assert.assertEquals("1st byte", ' ', m.getElement(1) & 0xFF); + Assert.assertEquals("2nd byte", '2', m.getElement(2) & 0xFF); + Assert.assertEquals("3rd byte", '3', m.getElement(3) & 0xFF); + Assert.assertEquals("4th byte", ' ', m.getElement(4) & 0xFF); + Assert.assertEquals("5th byte", '2', m.getElement(5) & 0xFF); + Assert.assertEquals("6th byte", ' ', m.getElement(6) & 0xFF); + Assert.assertEquals("7th byte", '0', m.getElement(7) & 0xFF); + } + + @Test + public void testMonitorStringAccessoryDecoderMsgActivateTrue() { DCCppMessage m = DCCppMessage.makeAccessoryDecoderMsg(23, 2, true); Assert.assertEquals("Monitor string","Accessory Decoder Cmd: \n\tAddress: 23\n\tSubaddr: 2\n\tState: ON",m.toMonitorString()); } @Test - public void testGetTurnoutCommandMsg() { + public void testMonitorStringAccessoryDecoderMsgActivateFalse() { + DCCppMessage m = DCCppMessage.makeAccessoryDecoderMsg(23, 2, false); + Assert.assertEquals("Monitor string","Accessory Decoder Cmd: \n\tAddress: 23\n\tSubaddr: 2\n\tState: OFF",m.toMonitorString()); + } + + @Test + public void testGetTurnoutCommandMsgThrown() { DCCppMessage m = DCCppMessage.makeTurnoutCommandMsg(23, true); log.debug("turnout message = {}", m.toString()); Assert.assertEquals("length", 6, m.getNumDataElements()); @@ -82,10 +103,28 @@ public void testGetTurnoutCommandMsg() { } @Test - public void testMonitorStringTurnoutCommandMsg() { + public void testGetTurnoutCommandMsgClosed() { + DCCppMessage m = DCCppMessage.makeTurnoutCommandMsg(23, false); + log.debug("turnout message = {}", m.toString()); + Assert.assertEquals("length", 6, m.getNumDataElements()); + Assert.assertEquals("0th byte", 'T', m.getElement(0) & 0xFF); + Assert.assertEquals("1st byte", ' ', m.getElement(1) & 0xFF); + Assert.assertEquals("2nd byte", '2', m.getElement(2) & 0xFF); + Assert.assertEquals("3rd byte", '3', m.getElement(3) & 0xFF); + Assert.assertEquals("4th byte", ' ', m.getElement(4) & 0xFF); + Assert.assertEquals("5th byte", '0', m.getElement(5) & 0xFF); + } + + @Test + public void testMonitorStringTurnoutCommandMsgThrown() { DCCppMessage m = DCCppMessage.makeTurnoutCommandMsg(23, true); Assert.assertEquals("Monitor string","Turnout Cmd: \n\tT/O ID: 23\n\tState: THROWN",m.toMonitorString()); } + @Test + public void testMonitorStringTurnoutCommandMsgClosed() { + DCCppMessage m = DCCppMessage.makeTurnoutCommandMsg(23, false); + Assert.assertEquals("Monitor string","Turnout Cmd: \n\tT/O ID: 23\n\tState: CLOSED",m.toMonitorString()); + } @Test public void testGetWriteDirectCVMsg() { @@ -393,6 +432,45 @@ public void testMonitorStringWriteDccPacketProgMsg() { Assert.assertEquals("Monitor string","Write DCC Packet Prog Cmd: \n\tRegister: 0\n\tPacket: C4 D2 12 0C 08",m.toMonitorString()); } + @Test + public void testGetOutputCmdMsgOn() { + DCCppMessage m = DCCppMessage.makeOutputCmdMsg(23, true); + log.debug("turnout message = {}", m.toString()); + Assert.assertEquals("length", 6, m.getNumDataElements()); + Assert.assertEquals("0th byte", 'Z', m.getElement(0) & 0xFF); + Assert.assertEquals("1st byte", ' ', m.getElement(1) & 0xFF); + Assert.assertEquals("2nd byte", '2', m.getElement(2) & 0xFF); + Assert.assertEquals("3rd byte", '3', m.getElement(3) & 0xFF); + Assert.assertEquals("4th byte", ' ', m.getElement(4) & 0xFF); + Assert.assertEquals("5th byte", '1', m.getElement(5) & 0xFF); + } + + @Test + public void testGetOutputCmdMsgOff() { + DCCppMessage m = DCCppMessage.makeOutputCmdMsg(23, false); + log.debug("turnout message = {}", m.toString()); + Assert.assertEquals("length", 6, m.getNumDataElements()); + Assert.assertEquals("0th byte", 'Z', m.getElement(0) & 0xFF); + Assert.assertEquals("1st byte", ' ', m.getElement(1) & 0xFF); + Assert.assertEquals("2nd byte", '2', m.getElement(2) & 0xFF); + Assert.assertEquals("3rd byte", '3', m.getElement(3) & 0xFF); + Assert.assertEquals("4th byte", ' ', m.getElement(4) & 0xFF); + Assert.assertEquals("5th byte", '0', m.getElement(5) & 0xFF); + } + + @Test + public void testMonitorStringOutputCmdMsgOn() { + DCCppMessage m = DCCppMessage.makeOutputCmdMsg(23, true); + Assert.assertEquals("Monitor string","Output Cmd: \n\tOutput ID: 23\n\tState: HIGH",m.toMonitorString()); + } + @Test + public void testMonitorStringOutputCmdMsgOff() { + DCCppMessage m = DCCppMessage.makeOutputCmdMsg(23, false); + Assert.assertEquals("Monitor string","Output Cmd: \n\tOutput ID: 23\n\tState: LOW",m.toMonitorString()); + } + + @Test + // The minimal setup for log4J @Before public void setUp() throws Exception { diff --git a/java/test/jmri/jmrix/dccpp/DCCppMultiMeterTest.java b/java/test/jmri/jmrix/dccpp/DCCppMultiMeterTest.java index ab3ce89cb31..b4c593857c8 100644 --- a/java/test/jmri/jmrix/dccpp/DCCppMultiMeterTest.java +++ b/java/test/jmri/jmrix/dccpp/DCCppMultiMeterTest.java @@ -10,27 +10,22 @@ * * @author Paul Bender Copyright (C) 2017 */ -public class DCCppMultiMeterTest { +public class DCCppMultiMeterTest extends jmri.implementation.AbstractMultiMeterTestBase{ - @Test - public void testCTor() { + @Override + @Before + public void setUp() { + JUnitUtil.setUp(); // infrastructure objects DCCppInterfaceScaffold tc = new DCCppInterfaceScaffold(new DCCppCommandStation()); DCCppSystemConnectionMemo memo = new DCCppSystemConnectionMemo(tc); - - DCCppMultiMeter t = new DCCppMultiMeter(memo); - Assert.assertNotNull("exists",t); - } - - // The minimal setup for log4J - @Before - public void setUp() { - JUnitUtil.setUp(); + mm = new DCCppMultiMeter(memo); } @After public void tearDown() { + mm.dispose(); JUnitUtil.tearDown(); } diff --git a/java/test/jmri/jmrix/dccpp/DCCppTurnoutTest.java b/java/test/jmri/jmrix/dccpp/DCCppTurnoutTest.java index 496d14c2526..f749a59e917 100644 --- a/java/test/jmri/jmrix/dccpp/DCCppTurnoutTest.java +++ b/java/test/jmri/jmrix/dccpp/DCCppTurnoutTest.java @@ -159,7 +159,7 @@ public void testExactMode() throws Exception { //Assert.assertEquals(t.getState(), Turnout.THROWN); DCCppMessage m = dnis.outbound.elementAt(0); Assert.assertTrue(m.isOutputCmdMessage()); - Assert.assertEquals(1, m.getOutputStateInt()); + Assert.assertEquals(0, m.getOutputStateInt()); DCCppReply r = DCCppReply.parseDCCppReply("Y 42 0"); ((DCCppTurnout) t).message(r); Assert.assertEquals(Turnout.THROWN, t.getState()); @@ -168,7 +168,7 @@ public void testExactMode() throws Exception { //Assert.assertEquals(t.getState(), Turnout.CLOSED); m = dnis.outbound.elementAt(1); Assert.assertTrue(m.isOutputCmdMessage()); - Assert.assertEquals(0, m.getOutputStateInt()); + Assert.assertEquals(1, m.getOutputStateInt()); r = DCCppReply.parseDCCppReply("Y 42 1"); ((DCCppTurnout) t).message(r); Assert.assertEquals(Turnout.CLOSED, t.getState()); @@ -180,7 +180,7 @@ public void testExactMode() throws Exception { //Assert.assertEquals(t.getState(), Turnout.THROWN); m = dnis.outbound.elementAt(2); Assert.assertTrue(m.isOutputCmdMessage()); - Assert.assertEquals(0, m.getOutputStateInt()); + Assert.assertEquals(1, m.getOutputStateInt()); r = DCCppReply.parseDCCppReply("Y 42 1"); ((DCCppTurnout) t).message(r); Assert.assertEquals(Turnout.THROWN, t.getState()); @@ -189,7 +189,7 @@ public void testExactMode() throws Exception { //Assert.assertEquals(t.getState(), Turnout.CLOSED); m = dnis.outbound.elementAt(3); Assert.assertTrue(m.isOutputCmdMessage()); - Assert.assertEquals(1, m.getOutputStateInt()); + Assert.assertEquals(0, m.getOutputStateInt()); r = DCCppReply.parseDCCppReply("Y 42 0"); ((DCCppTurnout) t).message(r); Assert.assertEquals(Turnout.CLOSED, t.getState()); diff --git a/java/test/jmri/jmrix/dccpp/PackageTest.java b/java/test/jmri/jmrix/dccpp/PackageTest.java index 6a990a86579..34a248ab990 100644 --- a/java/test/jmri/jmrix/dccpp/PackageTest.java +++ b/java/test/jmri/jmrix/dccpp/PackageTest.java @@ -39,7 +39,7 @@ public static Test suite() { suite.addTest(new TestSuite(DCCppProgrammerManagerTest.class)); suite.addTest(new TestSuite(DCCppPowerManagerTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(DCCppThrottleManagerTest.class)); - suite.addTest(new TestSuite(DCCppLightTest.class)); + suite.addTest(new junit.framework.JUnit4TestAdapter(DCCppLightTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(DCCppLightManagerTest.class)); suite.addTest(new TestSuite(DCCppOpsModeProgrammerTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(DCCppStreamPortControllerTest.class)); diff --git a/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerFrameTest.java b/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerFrameTest.java index 934e7199c85..9717a570365 100644 --- a/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerFrameTest.java +++ b/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerFrameTest.java @@ -18,7 +18,11 @@ public class ServerFrameTest { @Test public void getInstanceTest() { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - ServerFrame f = ServerFrame.getInstance(); + // Server is provided by InstanceManagerAutoInitialize + // and it is required to be available before we start the Server Frame + Server s = jmri.InstanceManager.getDefault(Server.class); + // ServerFrame is provided by InstanceManagerAutoInitialize + ServerFrame f = jmri.InstanceManager.getDefault(ServerFrame.class); Assert.assertNotNull("ServerFrame getInstance", f); f.dispose(); } diff --git a/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerTest.java b/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerTest.java index 9148498d224..a59fff18ec2 100644 --- a/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerTest.java +++ b/java/test/jmri/jmrix/dccpp/dccppovertcp/ServerTest.java @@ -16,13 +16,14 @@ public class ServerTest { @Test public void getInstanceTest(){ - Assert.assertNotNull("Server getInstance",Server.getInstance()); + // Server is provided by InstanceManagerAutoInitialize + Server s = jmri.InstanceManager.getDefault(Server.class); + Assert.assertNotNull("Server getInstance", s); } @Before public void setUp() { JUnitUtil.setUp(); - jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); } diff --git a/java/test/jmri/jmrix/dccpp/simulator/BundleTest.java b/java/test/jmri/jmrix/dccpp/simulator/BundleTest.java new file mode 100644 index 00000000000..2b3357c7948 --- /dev/null +++ b/java/test/jmri/jmrix/dccpp/simulator/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.dccpp.simulator; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/dccpp/simulator/PackageTest.java b/java/test/jmri/jmrix/dccpp/simulator/PackageTest.java index d8636cfcb5a..652a38559be 100644 --- a/java/test/jmri/jmrix/dccpp/simulator/PackageTest.java +++ b/java/test/jmri/jmrix/dccpp/simulator/PackageTest.java @@ -10,7 +10,8 @@ @Suite.SuiteClasses({ ConnectionConfigTest.class, jmri.jmrix.dccpp.simulator.configurexml.PackageTest.class, - DCCppSimulatorAdapterTest.class + DCCppSimulatorAdapterTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.dccpp.simulator package. diff --git a/java/test/jmri/jmrix/easydcc/BundleTest.java b/java/test/jmri/jmrix/easydcc/BundleTest.java new file mode 100644 index 00000000000..ebb0dc750cb --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.easydcc; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/PackageTest.java b/java/test/jmri/jmrix/easydcc/PackageTest.java index 524e6c05d10..2308eacd8e6 100644 --- a/java/test/jmri/jmrix/easydcc/PackageTest.java +++ b/java/test/jmri/jmrix/easydcc/PackageTest.java @@ -47,8 +47,7 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.simulator.PackageTest.class)); suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.networkdriver.PackageTest.class)); suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.configurexml.PackageTest.class)); - suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.easydccmon.EasyDccMonFrameTest.class)); - suite.addTest(jmri.jmrix.easydcc.easydccmon.EasyDccMonActionTest.suite()); + suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.easydccmon.PackageTest.class)); suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.packetgen.PackageTest.class)); suite.addTest(new JUnit4TestAdapter(EasyDccNetworkPortControllerTest.class)); suite.addTest(new JUnit4TestAdapter(EasyDccSystemConnectionMemoTest.class)); @@ -60,6 +59,8 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(EasyDccProgrammerManagerTest.class)); suite.addTest(new JUnit4TestAdapter(EasyDccThrottleManagerTest.class)); suite.addTest(new JUnit4TestAdapter(EasyDccThrottleTest.class)); + suite.addTest(new JUnit4TestAdapter(BundleTest.class)); + suite.addTest(new JUnit4TestAdapter(jmri.jmrix.easydcc.swing.PackageTest.class)); return suite; } diff --git a/java/test/jmri/jmrix/easydcc/easydccmon/BundleTest.java b/java/test/jmri/jmrix/easydcc/easydccmon/BundleTest.java new file mode 100644 index 00000000000..76396009c5a --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/easydccmon/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.easydcc.easydccmon; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/easydccmon/PackageTest.java b/java/test/jmri/jmrix/easydcc/easydccmon/PackageTest.java new file mode 100644 index 00000000000..c2e2c1b5ced --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/easydccmon/PackageTest.java @@ -0,0 +1,21 @@ +package jmri.jmrix.easydcc.easydccmon; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + BundleTest.class, + EasyDccMonFrameTest.class, + EasyDccMonActionTest.class +}) +/** + * Tests for the jmri.jmrix.easydcc.easydccmon package + * + * @author Paul Bender Copyright (C) 2017 + */ +public class PackageTest { + + +} diff --git a/java/test/jmri/jmrix/easydcc/networkdriver/BundleTest.java b/java/test/jmri/jmrix/easydcc/networkdriver/BundleTest.java new file mode 100644 index 00000000000..06fc3795b2c --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/networkdriver/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.easydcc.networkdriver; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/networkdriver/PackageTest.java b/java/test/jmri/jmrix/easydcc/networkdriver/PackageTest.java index 9e3861c51b1..5ebf3ffdba1 100644 --- a/java/test/jmri/jmrix/easydcc/networkdriver/PackageTest.java +++ b/java/test/jmri/jmrix/easydcc/networkdriver/PackageTest.java @@ -10,7 +10,8 @@ @Suite.SuiteClasses({ ConnectionConfigTest.class, jmri.jmrix.easydcc.networkdriver.configurexml.PackageTest.class, - NetworkDriverAdapterTest.class + NetworkDriverAdapterTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.easydcc.networkdriver package. diff --git a/java/test/jmri/jmrix/easydcc/packetgen/BundleTest.java b/java/test/jmri/jmrix/easydcc/packetgen/BundleTest.java new file mode 100644 index 00000000000..566baf3899e --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/packetgen/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.easydcc.packetgen; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/packetgen/PackageTest.java b/java/test/jmri/jmrix/easydcc/packetgen/PackageTest.java index e45a1f877d1..ac247a9a513 100644 --- a/java/test/jmri/jmrix/easydcc/packetgen/PackageTest.java +++ b/java/test/jmri/jmrix/easydcc/packetgen/PackageTest.java @@ -7,7 +7,8 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ EasyDccPacketGenActionTest.class, - EasyDccPacketGenFrameTest.class + EasyDccPacketGenFrameTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.swing package diff --git a/java/test/jmri/jmrix/easydcc/serialdriver/BundleTest.java b/java/test/jmri/jmrix/easydcc/serialdriver/BundleTest.java new file mode 100644 index 00000000000..529ea7859a0 --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/serialdriver/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.easydcc.serialdriver; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/serialdriver/PackageTest.java b/java/test/jmri/jmrix/easydcc/serialdriver/PackageTest.java index 164b72c7d3b..56685b4300d 100644 --- a/java/test/jmri/jmrix/easydcc/serialdriver/PackageTest.java +++ b/java/test/jmri/jmrix/easydcc/serialdriver/PackageTest.java @@ -10,7 +10,8 @@ @Suite.SuiteClasses({ ConnectionConfigTest.class, SerialDriverAdapterTest.class, - jmri.jmrix.easydcc.serialdriver.configurexml.PackageTest.class + jmri.jmrix.easydcc.serialdriver.configurexml.PackageTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.easydcc.serialdriver package. diff --git a/java/test/jmri/jmrix/easydcc/simulator/BundleTest.java b/java/test/jmri/jmrix/easydcc/simulator/BundleTest.java new file mode 100644 index 00000000000..477616d23a8 --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/simulator/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.easydcc.simulator; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/simulator/PackageTest.java b/java/test/jmri/jmrix/easydcc/simulator/PackageTest.java index e0b29bc1dfb..92d459fe3f5 100644 --- a/java/test/jmri/jmrix/easydcc/simulator/PackageTest.java +++ b/java/test/jmri/jmrix/easydcc/simulator/PackageTest.java @@ -9,8 +9,9 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ ConnectionConfigTest.class, - SerialDriverAdapterTest.class, - jmri.jmrix.easydcc.simulator.configurexml.PackageTest.class + SimulatorAdapterTest.class, + jmri.jmrix.easydcc.simulator.configurexml.PackageTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.easydcc.simulator package. diff --git a/java/test/jmri/jmrix/easydcc/simulator/SerialDriverAdapterTest.java b/java/test/jmri/jmrix/easydcc/simulator/SimulatorAdapterTest.java similarity index 86% rename from java/test/jmri/jmrix/easydcc/simulator/SerialDriverAdapterTest.java rename to java/test/jmri/jmrix/easydcc/simulator/SimulatorAdapterTest.java index c37c9925104..c534bb7a124 100644 --- a/java/test/jmri/jmrix/easydcc/simulator/SerialDriverAdapterTest.java +++ b/java/test/jmri/jmrix/easydcc/simulator/SimulatorAdapterTest.java @@ -7,12 +7,12 @@ import org.junit.Test; /** - * Tests for simulator SerialDriverAdapter class. + * Tests for simulator SimulatorAdapter class. * * @author Paul Bender Copyright (C) 2016 **/ -public class SerialDriverAdapterTest { +public class SimulatorAdapterTest { @Test public void ConstructorTest(){ diff --git a/java/test/jmri/jmrix/easydcc/swing/EasyDccComponentFactoryTest.java b/java/test/jmri/jmrix/easydcc/swing/EasyDccComponentFactoryTest.java new file mode 100644 index 00000000000..972d76602c1 --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/swing/EasyDccComponentFactoryTest.java @@ -0,0 +1,37 @@ +package jmri.jmrix.easydcc.swing; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import java.awt.GraphicsEnvironment; +import jmri.jmrix.easydcc.EasyDccSystemConnectionMemo; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class EasyDccComponentFactoryTest { + + @Test + public void testCTor() { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + EasyDccSystemConnectionMemo memo = new EasyDccSystemConnectionMemo(); + EasyDccComponentFactory t = new EasyDccComponentFactory(memo); + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/jmrix/easydcc/swing/PackageTest.java b/java/test/jmri/jmrix/easydcc/swing/PackageTest.java new file mode 100644 index 00000000000..fdf160232a0 --- /dev/null +++ b/java/test/jmri/jmrix/easydcc/swing/PackageTest.java @@ -0,0 +1,19 @@ +package jmri.jmrix.easydcc.swing; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + EasyDccComponentFactoryTest.class +}) +/** + * Tests for the jmri.jmrix.easydcc.swing package + * + * @author Paul Bender Copyright (C) 2017 + */ +public class PackageTest { + + +} diff --git a/java/test/jmri/jmrix/ecos/utilities/RosterToEcosTest.java b/java/test/jmri/jmrix/ecos/utilities/RosterToEcosTest.java index ba7e2f9fdcd..70cd0b44a5f 100644 --- a/java/test/jmri/jmrix/ecos/utilities/RosterToEcosTest.java +++ b/java/test/jmri/jmrix/ecos/utilities/RosterToEcosTest.java @@ -1,5 +1,6 @@ package jmri.jmrix.ecos.utilities; +import jmri.jmrix.ecos.EcosSystemConnectionMemo; import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; @@ -7,17 +8,15 @@ import org.junit.Test; /** - * RosterToEcosTest.java + * Tests for the RosterToEcos class. * - * Description: tests for the RosterToEcos class - * - * @author Paul Bender Copyright (C) 2016 + * @author Paul Bender Copyright (C) 2016 */ public class RosterToEcosTest { @Test - public void testCtor(){ - Assert.assertNotNull("RosterToEcos constructor",new RosterToEcos()); + public void testCtor() { + Assert.assertNotNull("RosterToEcos constructor", new RosterToEcos(new EcosSystemConnectionMemo())); } // The minimal setup for log4J @@ -32,4 +31,3 @@ public void tearDown() { } } - diff --git a/java/test/jmri/jmrix/grapevine/PackageTest.java b/java/test/jmri/jmrix/grapevine/PackageTest.java index bf6634e9c09..7b8feae6f36 100644 --- a/java/test/jmri/jmrix/grapevine/PackageTest.java +++ b/java/test/jmri/jmrix/grapevine/PackageTest.java @@ -39,7 +39,7 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(SerialTurnoutTest2.class)); suite.addTest(new JUnit4TestAdapter(SerialTurnoutTest3.class)); suite.addTest(new JUnit4TestAdapter(SerialTurnoutManagerTest.class)); - suite.addTest(SerialLightTest.suite()); + suite.addTest(new JUnit4TestAdapter(SerialLightTest.class)); suite.addTest(new JUnit4TestAdapter(SerialLightManagerTest.class)); suite.addTest(new JUnit4TestAdapter(SerialSensorManagerTest.class)); suite.addTest(SerialNodeTest.suite()); diff --git a/java/test/jmri/jmrix/grapevine/SerialLightTest.java b/java/test/jmri/jmrix/grapevine/SerialLightTest.java index 2afc088225c..c962c4646b1 100644 --- a/java/test/jmri/jmrix/grapevine/SerialLightTest.java +++ b/java/test/jmri/jmrix/grapevine/SerialLightTest.java @@ -1,9 +1,8 @@ package jmri.jmrix.grapevine; import jmri.implementation.AbstractLightTestBase; -import junit.framework.Test; -import junit.framework.TestSuite; import org.junit.Assert; +import org.junit.Before; /** * Tests for the jmri.jmrix.grapevine.SerialLight class, low address. @@ -15,6 +14,7 @@ public class SerialLightTest extends AbstractLightTestBase { private SerialTrafficControlScaffold tcis = null; @Override + @Before public void setUp() { // prepare an interface tcis = new SerialTrafficControlScaffold(); @@ -40,21 +40,4 @@ public void checkOnMsgSent() { Assert.assertEquals("content", "81 18 81 0C", tcis.outbound.elementAt(tcis.outbound.size() - 1).toString()); // THROWN message } - // from here down is testing infrastructure - public SerialLightTest(String s) { - super(s); - } - - // Main entry point - static public void main(String[] args) { - String[] testCaseName = {SerialLightTest.class.getName()}; - junit.textui.TestRunner.main(testCaseName); - } - - // test suite from all defined tests - public static Test suite() { - TestSuite suite = new TestSuite(SerialLightTest.class); - return suite; - } - } diff --git a/java/test/jmri/jmrix/lenz/PackageTest.java b/java/test/jmri/jmrix/lenz/PackageTest.java index ac5234262d9..c9547158e5b 100644 --- a/java/test/jmri/jmrix/lenz/PackageTest.java +++ b/java/test/jmri/jmrix/lenz/PackageTest.java @@ -32,7 +32,7 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(XNetReplyTest.class)); suite.addTest(new JUnit4TestAdapter(XNetTurnoutTest.class)); suite.addTest(new TestSuite(XNetSensorTest.class)); - suite.addTest(new TestSuite(XNetLightTest.class)); + suite.addTest(new JUnit4TestAdapter(XNetLightTest.class)); suite.addTest(new JUnit4TestAdapter(XNetPacketizerTest.class)); suite.addTest(new JUnit4TestAdapter(XNetTurnoutManagerTest.class)); suite.addTest(new JUnit4TestAdapter(XNetSensorManagerTest.class)); diff --git a/java/test/jmri/jmrix/lenz/XNetLightTest.java b/java/test/jmri/jmrix/lenz/XNetLightTest.java index 7c700f7e314..25b9e801c42 100644 --- a/java/test/jmri/jmrix/lenz/XNetLightTest.java +++ b/java/test/jmri/jmrix/lenz/XNetLightTest.java @@ -1,7 +1,9 @@ package jmri.jmrix.lenz; import jmri.util.JUnitUtil; +import org.junit.After; import org.junit.Assert; +import org.junit.Before; /** * Tests for the {@link jmri.jmrix.lenz.XNetLight} class. @@ -31,14 +33,10 @@ public void checkOffMsgSent() { Assert.assertEquals("OFF state", jmri.Light.OFF, t.getState()); } - // from here down is testing infrastructure - public XNetLightTest(String s) { - super(s); - } - // The minimal setup for log4J @Override - protected void setUp() { + @Before + public void setUp() { apps.tests.Log4JFixture.setUp(); // prepare an interface xnis = new XNetInterfaceScaffold(new LenzCommandStation()); @@ -47,8 +45,8 @@ protected void setUp() { t = new XNetLight(xnis, xlm, "XL21"); } - @Override - protected void tearDown() { + @After + public void tearDown() { JUnitUtil.tearDown(); } diff --git a/java/test/jmri/jmrix/libusb/PackageTest.java b/java/test/jmri/jmrix/libusb/PackageTest.java index 1019bec4d9e..76a4d8a2644 100644 --- a/java/test/jmri/jmrix/libusb/PackageTest.java +++ b/java/test/jmri/jmrix/libusb/PackageTest.java @@ -6,7 +6,8 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ - UsbViewActionTest.class + UsbViewActionTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.libusb package diff --git a/java/test/jmri/jmrix/loconet/LnOpsModeProgrammerTest.java b/java/test/jmri/jmrix/loconet/LnOpsModeProgrammerTest.java index 4bf32b0626b..ea47d6effc5 100644 --- a/java/test/jmri/jmrix/loconet/LnOpsModeProgrammerTest.java +++ b/java/test/jmri/jmrix/loconet/LnOpsModeProgrammerTest.java @@ -138,6 +138,145 @@ public void testSv1Write() throws ProgrammerException { } + public void testBoardRead0() throws ProgrammerException { + LnOpsModeProgrammer lnopsmodeprogrammer = new LnOpsModeProgrammer(sm, memo, 4, true); + + lnopsmodeprogrammer.setMode(LnProgrammerManager.LOCONETBDOPSWMODE); + lnopsmodeprogrammer.readCV("113.6",pl); + + // should have written and not returned + Assert.assertEquals("one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + Assert.assertEquals("sent byte 0", 0xD0, lnis.outbound.get(0).getElement(0) & 0xFF); + Assert.assertEquals("sent byte 1", 0x62, lnis.outbound.get(0).getElement(1) & 0xFF); + Assert.assertEquals("sent byte 2", 0x03, lnis.outbound.get(0).getElement(2) & 0xFF); + Assert.assertEquals("sent byte 3", 113, lnis.outbound.get(0).getElement(3) & 0xFF); + Assert.assertEquals("sent byte 4", 0x0A, lnis.outbound.get(0).getElement(4) & 0xFF); + + int testVal = 0; + + // check echo of sent message has no effect + LocoNetMessage m = lnis.outbound.get(0); + lnopsmodeprogrammer.message(m); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + // Known-good message in reply + m = new LocoNetMessage(new int[]{0xB4, 0x50, 0x40, 0x00}); + lnopsmodeprogrammer.message(m); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("Got programming reply", 1, pl.getRcvdInvoked()); + Assert.assertEquals("Reply status OK", 0, pl.getRcvdStatus()); + Assert.assertEquals("Reply value matches", testVal, pl.getRcvdValue()); + + } + + public void testBoardRead1() throws ProgrammerException { + LnOpsModeProgrammer lnopsmodeprogrammer = new LnOpsModeProgrammer(sm, memo, 4, true); + + lnopsmodeprogrammer.setMode(LnProgrammerManager.LOCONETBDOPSWMODE); + lnopsmodeprogrammer.readCV("113.6",pl); + + // should have written and not returned + Assert.assertEquals("one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + Assert.assertEquals("sent byte 0", 0xD0, lnis.outbound.get(0).getElement(0) & 0xFF); + Assert.assertEquals("sent byte 1", 0x62, lnis.outbound.get(0).getElement(1) & 0xFF); + Assert.assertEquals("sent byte 2", 0x03, lnis.outbound.get(0).getElement(2) & 0xFF); + Assert.assertEquals("sent byte 3", 113, lnis.outbound.get(0).getElement(3) & 0xFF); + Assert.assertEquals("sent byte 4", 0x0A, lnis.outbound.get(0).getElement(4) & 0xFF); + + int testVal = 1; + + // check echo of sent message has no effect + LocoNetMessage m = lnis.outbound.get(0); + lnopsmodeprogrammer.message(m); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + // Known-good message in reply + m = new LocoNetMessage(new int[]{0xB4, 0x50, 0x60, 0x00}); + lnopsmodeprogrammer.message(m); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("Got programming reply", 1, pl.getRcvdInvoked()); + Assert.assertEquals("Reply status OK", 0, pl.getRcvdStatus()); + Assert.assertEquals("Reply value matches", testVal, pl.getRcvdValue()); + + } + + public void testBoardReadTimeout() throws ProgrammerException { + LnOpsModeProgrammer lnopsmodeprogrammer = new LnOpsModeProgrammer(sm, memo, 4, true); + + lnopsmodeprogrammer.setMode(LnProgrammerManager.LOCONETBDOPSWMODE); + lnopsmodeprogrammer.readCV("113.6",pl); + + // should have written and not returned + Assert.assertEquals("one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + // No reply message, wait for timeout + jmri.util.JUnitUtil.waitFor(()->{return pl.getRcvdInvoked() == 1;},"programming reply not received"); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("Reply status Not OK", jmri.ProgListener.FailedTimeout, pl.getRcvdStatus()); + Assert.assertTrue("Correct thread", pl.wasRightThread()); + } + + + public void testBoardWrite() throws ProgrammerException { + LnOpsModeProgrammer lnopsmodeprogrammer = new LnOpsModeProgrammer(sm, memo, 4, true); + + int testVal = 1; + + lnopsmodeprogrammer.setMode(LnProgrammerManager.LOCONETBDOPSWMODE); + lnopsmodeprogrammer.writeCV("113.6", testVal, pl); + + // should have written + Assert.assertEquals("one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + Assert.assertEquals("sent byte 0", 0xD0, lnis.outbound.get(0).getElement(0) & 0xFF); + Assert.assertEquals("sent byte 1", 0x72, lnis.outbound.get(0).getElement(1) & 0xFF); + Assert.assertEquals("sent byte 2", 0x03, lnis.outbound.get(0).getElement(2) & 0xFF); + Assert.assertEquals("sent byte 3", 113, lnis.outbound.get(0).getElement(3) & 0xFF); + Assert.assertEquals("sent byte 4", 0x0B, lnis.outbound.get(0).getElement(4) & 0xFF); + + // check echo of sent message has no effect + LocoNetMessage m = lnis.outbound.get(0); + lnopsmodeprogrammer.message(m); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + // Known-good message in reply + m = new LocoNetMessage(new int[]{0xB4, 0x50, 0x60, 0x00}); + lnopsmodeprogrammer.message(m); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("Got programming reply", 1, pl.getRcvdInvoked()); + Assert.assertEquals("Reply status OK", 0, pl.getRcvdStatus()); + Assert.assertEquals("Reply value matches", testVal, pl.getRcvdValue()); + + } + + public void testBoardWriteTimeout() throws ProgrammerException { + LnOpsModeProgrammer lnopsmodeprogrammer = new LnOpsModeProgrammer(sm, memo, 4, true); + + int testVal = 1; + + lnopsmodeprogrammer.setMode(LnProgrammerManager.LOCONETBDOPSWMODE); + lnopsmodeprogrammer.writeCV("113.6", testVal, pl); + + // should have written + Assert.assertEquals("one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("No programming reply", 0, pl.getRcvdInvoked()); + + // No reply message, wait for timeout + jmri.util.JUnitUtil.waitFor(()->{return pl.getRcvdInvoked() == 1;},"programming reply not received"); + Assert.assertEquals("still one message sent", 1, lnis.outbound.size()); + Assert.assertEquals("Reply status Not OK", jmri.ProgListener.FailedTimeout, pl.getRcvdStatus()); + Assert.assertTrue("Correct thread", pl.wasRightThread()); + } + public void testSv1ARead() throws ProgrammerException { LnOpsModeProgrammer lnopsmodeprogrammer = new LnOpsModeProgrammer(sm, memo, 1, true); diff --git a/java/test/jmri/jmrix/mrc/PackageTest.java b/java/test/jmri/jmrix/mrc/PackageTest.java index 295bfb17e29..59041ed05e4 100644 --- a/java/test/jmri/jmrix/mrc/PackageTest.java +++ b/java/test/jmri/jmrix/mrc/PackageTest.java @@ -29,7 +29,8 @@ MrcThrottleManagerTest.class, MrcTrafficListenerFilterTest.class, MrcTurnoutManagerTest.class, - MrcTurnoutTest.class + MrcTurnoutTest.class, + MrcClockControlTest.class }) /** diff --git a/java/test/jmri/jmrix/openlcb/swing/hub/HubActionTest.java b/java/test/jmri/jmrix/openlcb/swing/hub/HubActionTest.java new file mode 100644 index 00000000000..8bb41a8e9bd --- /dev/null +++ b/java/test/jmri/jmrix/openlcb/swing/hub/HubActionTest.java @@ -0,0 +1,42 @@ +package jmri.jmrix.openlcb.swing.hub; + +import java.awt.GraphicsEnvironment; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; +/** + * @author Bob Jacobsen Copyright 2013 + * @author Paul Bender Copyright(C) 2016 + */ +public class HubActionTest { + + jmri.jmrix.can.CanSystemConnectionMemo memo; + jmri.jmrix.can.TrafficController tc; + + @Test + public void testCtor() { + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + HubAction h = new HubAction(); + Assert.assertNotNull("Action object non-null", h); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + + memo = new jmri.jmrix.can.CanSystemConnectionMemo(); + tc = new jmri.jmrix.can.adapters.loopback.LoopbackTrafficController(); + memo.setTrafficController(tc); + memo.setProtocol(jmri.jmrix.can.ConfigurationManager.OPENLCB); + + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } +} diff --git a/java/test/jmri/jmrix/openlcb/swing/hub/PackageTest.java b/java/test/jmri/jmrix/openlcb/swing/hub/PackageTest.java index 70a3c109540..85df03cb040 100644 --- a/java/test/jmri/jmrix/openlcb/swing/hub/PackageTest.java +++ b/java/test/jmri/jmrix/openlcb/swing/hub/PackageTest.java @@ -5,7 +5,8 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ - HubPaneTest.class + HubActionTest.class, + HubPaneTest.class }) /** diff --git a/java/test/jmri/jmrix/openlcb/swing/monitor/MonitorFrameDemo.java b/java/test/jmri/jmrix/openlcb/swing/monitor/MonitorFrameDemo.java index fede13b8f44..0876ae109d4 100644 --- a/java/test/jmri/jmrix/openlcb/swing/monitor/MonitorFrameDemo.java +++ b/java/test/jmri/jmrix/openlcb/swing/monitor/MonitorFrameDemo.java @@ -50,7 +50,7 @@ public void testReply(CanReply f) { public void testFireViaAction() throws Exception { Assume.assumeFalse(GraphicsEnvironment.isHeadless()); - new MonitorPane.Default().actionPerformed(null); + new MonitorAction().actionPerformed(null); jmri.jmrix.can.CanMessage msg = new jmri.jmrix.can.CanMessage( diff --git a/java/test/jmri/jmrix/powerline/cm11/SpecificLightTest.java b/java/test/jmri/jmrix/powerline/cm11/SpecificLightTest.java index 09bc61e7c6e..bd411474020 100644 --- a/java/test/jmri/jmrix/powerline/cm11/SpecificLightTest.java +++ b/java/test/jmri/jmrix/powerline/cm11/SpecificLightTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -18,7 +17,6 @@ public class SpecificLightTest { private SpecificTrafficController tc = null; @Test - @Ignore("seems correct per the documentation, but results in a null light") public void ConstructorTest(){ Assert.assertNotNull("SpecificLight constructor",new SpecificLight("PLA2",tc)); } @@ -28,7 +26,11 @@ public void setUp() { JUnitUtil.setUp(); jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); - tc = new SpecificTrafficController(new SpecificSystemConnectionMemo()); + SpecificSystemConnectionMemo memo = new SpecificSystemConnectionMemo(); + tc = new SpecificTrafficController(memo); + memo.setTrafficController(tc); + memo.configureManagers(); + memo.setSerialAddress(new jmri.jmrix.powerline.SerialAddress(memo)); } @After diff --git a/java/test/jmri/jmrix/powerline/cp290/SpecificLightTest.java b/java/test/jmri/jmrix/powerline/cp290/SpecificLightTest.java index b1bdf3d7205..da35c6961d0 100644 --- a/java/test/jmri/jmrix/powerline/cp290/SpecificLightTest.java +++ b/java/test/jmri/jmrix/powerline/cp290/SpecificLightTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -18,7 +17,6 @@ public class SpecificLightTest { private SpecificTrafficController tc = null; @Test - @Ignore("seems correct per the documentation, but results in a null light") public void ConstructorTest(){ Assert.assertNotNull("SpecificLight constructor",new SpecificLight("PLA2",tc)); } @@ -28,7 +26,11 @@ public void setUp() { JUnitUtil.setUp(); jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); - tc = new SpecificTrafficController(new SpecificSystemConnectionMemo()); + SpecificSystemConnectionMemo memo = new SpecificSystemConnectionMemo(); + tc = new SpecificTrafficController(memo); + memo.setTrafficController(tc); + memo.configureManagers(); + memo.setSerialAddress(new jmri.jmrix.powerline.SerialAddress(memo)); } @After diff --git a/java/test/jmri/jmrix/powerline/insteon2412s/SpecificInsteonLightTest.java b/java/test/jmri/jmrix/powerline/insteon2412s/SpecificInsteonLightTest.java index e5038f39506..6f9ff298e4b 100644 --- a/java/test/jmri/jmrix/powerline/insteon2412s/SpecificInsteonLightTest.java +++ b/java/test/jmri/jmrix/powerline/insteon2412s/SpecificInsteonLightTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -18,7 +17,6 @@ public class SpecificInsteonLightTest { private SpecificTrafficController tc = null; @Test - @Ignore("seems correct per the documentation, but results in a null light") public void ConstructorTest(){ Assert.assertNotNull("SpecificLight constructor",new SpecificInsteonLight("PLA2",tc)); } @@ -28,7 +26,11 @@ public void setUp() { JUnitUtil.setUp(); jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); - tc = new SpecificTrafficController(new SpecificSystemConnectionMemo()); + SpecificSystemConnectionMemo memo = new SpecificSystemConnectionMemo(); + tc = new SpecificTrafficController(memo); + memo.setTrafficController(tc); + memo.configureManagers(); + memo.setSerialAddress(new jmri.jmrix.powerline.SerialAddress(memo)); } @After diff --git a/java/test/jmri/jmrix/powerline/insteon2412s/SpecificX10LightTest.java b/java/test/jmri/jmrix/powerline/insteon2412s/SpecificX10LightTest.java index 86be3cd1010..1c98b5d2bf0 100644 --- a/java/test/jmri/jmrix/powerline/insteon2412s/SpecificX10LightTest.java +++ b/java/test/jmri/jmrix/powerline/insteon2412s/SpecificX10LightTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -18,7 +17,6 @@ public class SpecificX10LightTest { private SpecificTrafficController tc = null; @Test - @Ignore("seems correct per the documentation, but results in a null light") public void ConstructorTest(){ Assert.assertNotNull("SpecificLight constructor",new SpecificX10Light("PLA2",tc)); } @@ -28,7 +26,11 @@ public void setUp() { JUnitUtil.setUp(); jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); - tc = new SpecificTrafficController(new SpecificSystemConnectionMemo()); + SpecificSystemConnectionMemo memo = new SpecificSystemConnectionMemo(); + tc = new SpecificTrafficController(memo); + memo.setTrafficController(tc); + memo.configureManagers(); + memo.setSerialAddress(new jmri.jmrix.powerline.SerialAddress(memo)); } @After diff --git a/java/test/jmri/jmrix/powerline/simulator/SpecificInsteonLightTest.java b/java/test/jmri/jmrix/powerline/simulator/SpecificInsteonLightTest.java index bc0b165f3e8..c7deace8a7e 100644 --- a/java/test/jmri/jmrix/powerline/simulator/SpecificInsteonLightTest.java +++ b/java/test/jmri/jmrix/powerline/simulator/SpecificInsteonLightTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -18,7 +17,6 @@ public class SpecificInsteonLightTest { private SpecificTrafficController tc = null; @Test - @Ignore("seems correct per the documentation, but results in a null light") public void ConstructorTest(){ Assert.assertNotNull("SpecificLight constructor",new SpecificInsteonLight("PLA2",tc)); } @@ -28,7 +26,11 @@ public void setUp() { JUnitUtil.setUp(); jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); - tc = new SpecificTrafficController(new SpecificSystemConnectionMemo()); + SpecificSystemConnectionMemo memo = new SpecificSystemConnectionMemo(); + tc = new SpecificTrafficController(memo); + memo.setTrafficController(tc); + memo.configureManagers(); + memo.setSerialAddress(new jmri.jmrix.powerline.SerialAddress(memo)); } @After diff --git a/java/test/jmri/jmrix/powerline/simulator/SpecificX10LightTest.java b/java/test/jmri/jmrix/powerline/simulator/SpecificX10LightTest.java index fa6d8ca6e2c..f235edd56be 100644 --- a/java/test/jmri/jmrix/powerline/simulator/SpecificX10LightTest.java +++ b/java/test/jmri/jmrix/powerline/simulator/SpecificX10LightTest.java @@ -4,7 +4,6 @@ import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; /** @@ -18,7 +17,6 @@ public class SpecificX10LightTest { private SpecificTrafficController tc = null; @Test - @Ignore("seems correct per the documentation, but results in a null light") public void ConstructorTest(){ Assert.assertNotNull("SpecificLight constructor",new SpecificX10Light("PLA2",tc)); } @@ -28,7 +26,11 @@ public void setUp() { JUnitUtil.setUp(); jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); - tc = new SpecificTrafficController(new SpecificSystemConnectionMemo()); + SpecificSystemConnectionMemo memo = new SpecificSystemConnectionMemo(); + tc = new SpecificTrafficController(memo); + memo.setTrafficController(tc); + memo.configureManagers(); + memo.setSerialAddress(new jmri.jmrix.powerline.SerialAddress(memo)); } @After diff --git a/java/test/jmri/util/JTableUtilTest.java b/java/test/jmri/jmrix/pricom/pockettester/MonitorActionTest.java similarity index 66% rename from java/test/jmri/util/JTableUtilTest.java rename to java/test/jmri/jmrix/pricom/pockettester/MonitorActionTest.java index 2fff0e00646..ea5a60bfa87 100644 --- a/java/test/jmri/util/JTableUtilTest.java +++ b/java/test/jmri/jmrix/pricom/pockettester/MonitorActionTest.java @@ -1,5 +1,6 @@ -package jmri.util; +package jmri.jmrix.pricom.pockettester; +import jmri.util.JUnitUtil; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -9,11 +10,14 @@ * * @author Paul Bender Copyright (C) 2017 */ -public class JTableUtilTest { +public class MonitorActionTest { @Test public void testCTor() { - JTableUtil t = new JTableUtil(); + MonitorAction t = new MonitorAction(){ + void connect(DataListener l){ + } + }; Assert.assertNotNull("exists",t); } @@ -28,6 +32,6 @@ public void tearDown() { JUnitUtil.tearDown(); } - // private final static Logger log = LoggerFactory.getLogger(JTableUtilTest.class); + // private final static Logger log = LoggerFactory.getLogger(DataSourceActionTest.class); } diff --git a/java/test/jmri/jmrix/pricom/pockettester/PackageTest.java b/java/test/jmri/jmrix/pricom/pockettester/PackageTest.java index 17e5fba8337..07bcb5eab49 100644 Binary files a/java/test/jmri/jmrix/pricom/pockettester/PackageTest.java and b/java/test/jmri/jmrix/pricom/pockettester/PackageTest.java differ diff --git a/java/test/jmri/jmrix/pricom/pockettester/PacketTableActionTest.java b/java/test/jmri/jmrix/pricom/pockettester/PacketTableActionTest.java new file mode 100644 index 00000000000..deef28e397d --- /dev/null +++ b/java/test/jmri/jmrix/pricom/pockettester/PacketTableActionTest.java @@ -0,0 +1,37 @@ +package jmri.jmrix.pricom.pockettester; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class PacketTableActionTest { + + @Test + public void testCTor() { + PacketTableAction t = new PacketTableAction(){ + void connect(DataListener l){ + } + }; + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } + + // private final static Logger log = LoggerFactory.getLogger(DataSourceActionTest.class); + +} diff --git a/java/test/jmri/util/com/sun/TableSorterTest.java b/java/test/jmri/jmrix/pricom/pockettester/StatusActionTest.java similarity index 70% rename from java/test/jmri/util/com/sun/TableSorterTest.java rename to java/test/jmri/jmrix/pricom/pockettester/StatusActionTest.java index 7e21c6e8983..2fb1049bd95 100644 --- a/java/test/jmri/util/com/sun/TableSorterTest.java +++ b/java/test/jmri/jmrix/pricom/pockettester/StatusActionTest.java @@ -1,4 +1,4 @@ -package jmri.util.com.sun; +package jmri.jmrix.pricom.pockettester; import jmri.util.JUnitUtil; import org.junit.After; @@ -10,11 +10,14 @@ * * @author Paul Bender Copyright (C) 2017 */ -public class TableSorterTest { +public class StatusActionTest { @Test public void testCTor() { - TableSorter t = new TableSorter(); + StatusAction t = new StatusAction(){ + void connect(StatusFrame l){ + } + }; Assert.assertNotNull("exists",t); } @@ -29,6 +32,6 @@ public void tearDown() { JUnitUtil.tearDown(); } - // private final static Logger log = LoggerFactory.getLogger(TableSorterTest.class); + // private final static Logger log = LoggerFactory.getLogger(DataSourceActionTest.class); } diff --git a/java/test/jmri/jmrix/rfid/swing/PackageTest.java b/java/test/jmri/jmrix/rfid/swing/PackageTest.java index 60620e92f75..8a9823bac80 100644 --- a/java/test/jmri/jmrix/rfid/swing/PackageTest.java +++ b/java/test/jmri/jmrix/rfid/swing/PackageTest.java @@ -8,7 +8,8 @@ jmri.jmrix.rfid.swing.serialmon.PackageTest.class, RfidMenuTest.class, RfidComponentFactoryTest.class, - RfidNamedPaneActionTest.class + RfidNamedPaneActionTest.class, + RfidPanelTest.class }) /** * Tests for the jmri.jmrix.rfid.swing package diff --git a/java/test/jmri/jmrix/rfid/swing/RfidPanelTest.java b/java/test/jmri/jmrix/rfid/swing/RfidPanelTest.java new file mode 100644 index 00000000000..ab2c1a87a97 --- /dev/null +++ b/java/test/jmri/jmrix/rfid/swing/RfidPanelTest.java @@ -0,0 +1,45 @@ +package jmri.jmrix.rfid.swing; + +import java.awt.GraphicsEnvironment; +import jmri.jmrix.rfid.RfidSystemConnectionMemo; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for RfidPanel class. + * + * @author Paul Bender Copyright (C) 2016 + **/ + +public class RfidPanelTest { + + private RfidSystemConnectionMemo memo = null; + + @Test + public void MemoConstructorTest(){ + Assume.assumeFalse(GraphicsEnvironment.isHeadless()); + Assert.assertNotNull("RfidPanel constructor",new RfidPanel(){ + // class under test is abstract, but doesn't appear to + // have any abstract methods. + }); + } + + @Before + public void setUp() { + JUnitUtil.setUp(); + + jmri.util.JUnitUtil.initDefaultUserMessagePreferences(); + memo = new RfidSystemConnectionMemo(); + } + + @After + public void tearDown(){ + memo=null; + JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/jmrix/roco/z21/PackageTest.java b/java/test/jmri/jmrix/roco/z21/PackageTest.java index df0637b39fa..6fa95ac3620 100644 --- a/java/test/jmri/jmrix/roco/z21/PackageTest.java +++ b/java/test/jmri/jmrix/roco/z21/PackageTest.java @@ -33,7 +33,8 @@ Z21XNetPacketizerTest.class, Z21ConstantsTest.class, Z21XNetConnectionConfigTest.class, - Z21XNetMessageTest.class + Z21XNetMessageTest.class, + Z21MultiMeterTest.class }) public class PackageTest { diff --git a/java/test/jmri/jmrix/roco/z21/Z21MessageTest.java b/java/test/jmri/jmrix/roco/z21/Z21MessageTest.java index 4025d96c8c8..35299e271d9 100644 --- a/java/test/jmri/jmrix/roco/z21/Z21MessageTest.java +++ b/java/test/jmri/jmrix/roco/z21/Z21MessageTest.java @@ -153,6 +153,22 @@ public void toMonitorStringRailComDataRequest(){ Assert.assertEquals("Monitor String","04 00 89 00",m.toMonitorString()); } + @Test + public void GetSystemStateDataChangedRequest(){ + Z21Message m = Z21Message.getLanSystemStateDataChangedRequestMessage(); + Assert.assertEquals("length", 4, m.getNumDataElements()); + Assert.assertEquals("0th byte", 0x04, m.getElement(0) & 0xFF); + Assert.assertEquals("1st byte", 0x00, m.getElement(1) & 0xFF); + Assert.assertEquals("2nd byte", 0x85, m.getElement(2) & 0xFF); + Assert.assertEquals("3rd byte", 0x00, m.getElement(3) & 0xFF); + } + + @Test + public void toMonitorStringSystemStateDataChangedRequest(){ + Z21Message m = Z21Message.getLanSystemStateDataChangedRequestMessage(); + Assert.assertEquals("Monitor String","04 00 85 00",m.toMonitorString()); + } + // The minimal setup for log4J @Before diff --git a/java/test/jmri/jmrix/roco/z21/Z21MultiMeterTest.java b/java/test/jmri/jmrix/roco/z21/Z21MultiMeterTest.java new file mode 100644 index 00000000000..655a699263f --- /dev/null +++ b/java/test/jmri/jmrix/roco/z21/Z21MultiMeterTest.java @@ -0,0 +1,35 @@ +package jmri.jmrix.roco.z21; + +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class Z21MultiMeterTest extends jmri.implementation.AbstractMultiMeterTestBase{ + + @Override + @Before + public void setUp() { + JUnitUtil.setUp(); + // infrastructure objects + Z21InterfaceScaffold tc = new Z21InterfaceScaffold(); + Z21SystemConnectionMemo memo = new Z21SystemConnectionMemo(); + memo.setTrafficController(tc); + memo.setRocoZ21CommandStation(new RocoZ21CommandStation()); + mm = new Z21MultiMeter(memo); + } + + @After + public void tearDown() { + mm.dispose(); + JUnitUtil.tearDown(); + } + + // private final static Logger log = LoggerFactory.getLogger(DCCppMultiMeterTest.class); + +} diff --git a/java/test/jmri/jmrix/roco/z21/Z21ReplyTest.java b/java/test/jmri/jmrix/roco/z21/Z21ReplyTest.java index 1814158b004..56f2771648b 100644 --- a/java/test/jmri/jmrix/roco/z21/Z21ReplyTest.java +++ b/java/test/jmri/jmrix/roco/z21/Z21ReplyTest.java @@ -140,20 +140,20 @@ public void railCom2Entries(){ public void railComAddress(){ byte msg[]={(byte)0x1E,(byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x20,(byte)0x21,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08}; Z21Reply m = new Z21Reply(msg,30); - Assert.assertTrue("RailCom Address",(new jmri.DccLocoAddress(1,false)).equals(m.getRailComLocoAddress(0))); - Assert.assertTrue("RailCom Address 2",(new jmri.DccLocoAddress(8225,true)).equals(m.getRailComLocoAddress(1))); + Assert.assertTrue("RailCom Address",(new jmri.DccLocoAddress(256,true)).equals(m.getRailComLocoAddress(0))); + Assert.assertTrue("RailCom Address 2",(new jmri.DccLocoAddress(8480,true)).equals(m.getRailComLocoAddress(1))); } @Test public void railComRcvCount(){ - byte msg[]={(byte)0x11,(byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08}; + byte msg[]={(byte)0x11,(byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08}; Z21Reply m = new Z21Reply(msg,17); Assert.assertEquals("RailCom Rcv Count",1,m.getRailComRcvCount(0)); } @Test public void railComErrCount(){ - byte msg[]={(byte)0x11,(byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08}; + byte msg[]={(byte)0x11,(byte)0x00,(byte)0x88,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x06,(byte)0x07,(byte)0x08}; Z21Reply m = new Z21Reply(msg,17); Assert.assertEquals("RailCom Err Count",5,m.getRailComErrCount(0)); } @@ -179,6 +179,72 @@ public void railComTemp(){ Assert.assertEquals("RailCom Temp",8,m.getRailComTemp(0)); } + //Test System Data related methods. + @Test + public void systemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + m = new Z21Reply(msg1,7); + Assert.assertFalse("Not System Data Changed Reply",m.isSystemDataChangedReply()); + } + + @Test + public void mainCurrentFromSystemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + Assert.assertEquals("Main Current",256,m.getSystemDataMainCurrent()); + } + + @Test + public void progCurrentFromSystemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + Assert.assertEquals("Programming Track Current",0,m.getSystemDataProgCurrent()); + } + + @Test + public void filteredMainCurrentFromSystemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + Assert.assertEquals("Filtered Main Current",256,m.getSystemDataFilteredMainCurrent()); + } + + @Test + public void temperatureFromSystemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + Assert.assertEquals("Temperature",0,m.getSystemDataTemperature()); + } + + @Test + public void supplyVoltageFromSystemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + Assert.assertEquals("Supply Voltage",1280,m.getSystemDataSupplyVoltage()); + } + + @Test + public void vccVoltageFromSystemDataChangedReply(){ + byte msg[]={(byte)0x14,(byte)0x00,(byte)0x85,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x01,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x05,(byte)0x06,(byte)0x07,(byte)0x08,(byte)0x00,(byte)0x00,(byte)0x00}; + Z21Reply m = new Z21Reply(msg,20); + Assert.assertTrue("System Data Changed Reply",m.isSystemDataChangedReply()); + byte msg1[]={(byte)0x07,(byte)0x00,(byte)0x40,(byte)0x00,(byte)0x61,(byte)0x82,(byte)0xE3}; + Assert.assertEquals("Main Current",1798,m.getSystemDataVCCVoltage()); + } + + // The minimal setup for log4J @Before public void setUp() { diff --git a/java/test/jmri/jmrix/roco/z21/Z21SystemConnectionMemoTest.java b/java/test/jmri/jmrix/roco/z21/Z21SystemConnectionMemoTest.java index 62b2dcb12fe..4ed9506aa00 100644 --- a/java/test/jmri/jmrix/roco/z21/Z21SystemConnectionMemoTest.java +++ b/java/test/jmri/jmrix/roco/z21/Z21SystemConnectionMemoTest.java @@ -18,7 +18,6 @@ public class Z21SystemConnectionMemoTest extends jmri.jmrix.SystemConnectionMemo @Ignore("Not Ready Yet") public void testConfigureManagers(){ Z21SystemConnectionMemo a = (Z21SystemConnectionMemo)scm; - a.setTrafficController(new Z21InterfaceScaffold()); a.configureManagers(); Assert.assertNotNull(a); } @@ -51,12 +50,26 @@ public void testProvidesConsistManager(){ Assert.assertFalse("Provides ConsistManager",scm.provides(jmri.ConsistManager.class)); } + @Test + public void testProvidesMultiMeter(){ + Assert.assertTrue("Provides MultiMeter",scm.provides(jmri.MultiMeter.class)); + } + + @Test + public void testGetMultiMeter(){ + Assert.assertNotNull("Get MultiMeter",scm.get(jmri.MultiMeter.class)); + } + // The minimal setup for log4J @Override @Before public void setUp() { JUnitUtil.setUp(); - scm = new Z21SystemConnectionMemo(); + Z21InterfaceScaffold tc = new Z21InterfaceScaffold(); + Z21SystemConnectionMemo memo = new Z21SystemConnectionMemo(); + memo.setTrafficController(tc); + memo.setRocoZ21CommandStation(new RocoZ21CommandStation()); + scm = memo; } @Override diff --git a/java/test/jmri/jmrix/rps/Ash1_0AlgorithmTest.java b/java/test/jmri/jmrix/rps/Ash1_0AlgorithmTest.java index a784c4c19ac..43aa0c97cda 100644 --- a/java/test/jmri/jmrix/rps/Ash1_0AlgorithmTest.java +++ b/java/test/jmri/jmrix/rps/Ash1_0AlgorithmTest.java @@ -24,7 +24,6 @@ public class Ash1_0AlgorithmTest { // right answer to these is 0,0,12 @Test - @Ignore // fails for unknown reasons public void testCalc5() { Reading r = new Reading("21", new double[]{7. / vs, 13. / vs, 13. / vs, 13. / vs, 3. / vs}); @@ -38,14 +37,16 @@ public void testCalc5() { Calculator c = new Ash1_0Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 4 readings, 5 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); - Assert.assertEquals("x close", true, Math.abs(m.x - 0.) < 0.001); - Assert.assertEquals("y close", true, Math.abs(m.y - 0.) < 0.001); - Assert.assertEquals("z close", true, Math.abs(m.z - 12.) < 0.001); + Assert.assertEquals("x close", 0.0 , m.x, 0.001); + Assert.assertEquals("y close", 0.0 , m.y, 0.001); + Assert.assertEquals("z close", 12.0, m.z, 0.001); } @Test - @Ignore // fails for unknown reasons public void testCalc4_not1() { Reading r = new Reading("21", new double[]{13. / vs, 13. / vs, 13. / vs, 3. / vs}); @@ -59,14 +60,16 @@ public void testCalc4_not1() { Calculator c = new Ash1_0Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 3 readings, 4 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); - Assert.assertEquals("x close", true, Math.abs(m.x - 0.) < 0.001); - Assert.assertEquals("y close", true, Math.abs(m.y - 0.) < 0.001); - Assert.assertEquals("z close", true, Math.abs(m.z - 12.) < 0.001); + Assert.assertEquals("x close", 0.0 , m.x, 0.001); + Assert.assertEquals("y close", 0.0 , m.y, 0.001); + Assert.assertEquals("z close", 12.0, Math.abs(m.z), 0.001); } @Test - @Ignore // fails for unknown reasons public void testCalc4_not2() { Reading r = new Reading("21", new double[]{7. / vs, 13. / vs, 13. / vs, 3. / vs}); @@ -80,14 +83,17 @@ public void testCalc4_not2() { Calculator c = new Ash1_0Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 3 readings, 4 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); - Assert.assertEquals("x close", true, Math.abs(m.x - 0.) < 0.001); - Assert.assertEquals("y close", true, Math.abs(m.y - 0.) < 0.001); - Assert.assertEquals("z close", true, Math.abs(m.z - 12.) < 0.001); + Assert.assertEquals("x close", 0.0 , m.x, 0.001); + Assert.assertEquals("y close", 0.0 , m.y, 0.001); + Assert.assertEquals("z close", 12.0, Math.abs(m.z), 0.001); } @Test - @Ignore // fails for unknown reasons + @Ignore("Does not produce expected result") public void testCalc4_not3() { Reading r = new Reading("21", new double[]{7. / vs, 13. / vs, 13. / vs, 3. / vs}); @@ -101,10 +107,13 @@ public void testCalc4_not3() { Calculator c = new Ash1_0Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 3 readings, 4 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); - Assert.assertEquals("x close", true, Math.abs(m.x - 0.) < 0.001); - Assert.assertEquals("y close", true, Math.abs(m.y - 0.) < 0.001); - Assert.assertEquals("z close", true, Math.abs(m.z - 12.) < 0.001); + Assert.assertEquals("x close", 0.0 , m.x, 0.001); + Assert.assertEquals("y close", 0.0 , m.y, 0.001); + Assert.assertEquals("z close", 12.0, m.z, 0.001); } @Before diff --git a/java/test/jmri/jmrix/rps/Ash1_1AlgorithmTest.java b/java/test/jmri/jmrix/rps/Ash1_1AlgorithmTest.java index b550db87c0f..f1e8c8c6ad3 100644 --- a/java/test/jmri/jmrix/rps/Ash1_1AlgorithmTest.java +++ b/java/test/jmri/jmrix/rps/Ash1_1AlgorithmTest.java @@ -31,7 +31,6 @@ public class Ash1_1AlgorithmTest { } @Test - @Ignore // fails for unknown reasons public void testCalc5() { Point3d s1 = new Point3d(10.0f, 0.0f, 12.0f); @@ -47,6 +46,9 @@ public void testCalc5() { Calculator c = new Ash1_1Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 4 readings, 5 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); Assert.assertEquals("x close", true, Math.abs(m.x - 3.) < 0.001); Assert.assertEquals("y close", true, Math.abs(m.y - 2.) < 0.001); @@ -54,7 +56,6 @@ public void testCalc5() { } @Test - @Ignore // fails for unknown reasons public void testCalc4_not1() { Point3d s2 = new Point3d(-3.0f, 4.0f, 9.0f); Point3d s3 = new Point3d(-3.0f, -4.0f, 10.0f); @@ -68,6 +69,9 @@ public void testCalc4_not1() { Calculator c = new Ash1_1Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 3 readings, 4 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); Assert.assertEquals("x close", true, Math.abs(m.x - 3.) < 0.001); Assert.assertEquals("y close", true, Math.abs(m.y - 2.) < 0.001); @@ -75,7 +79,6 @@ public void testCalc4_not1() { } @Test - @Ignore // fails for unknown reasons public void testCalc4_not2() { Point3d s1 = new Point3d(10.0f, 0.0f, 12.0f); Point3d s3 = new Point3d(-3.0f, -4.0f, 10.0f); @@ -89,6 +92,9 @@ public void testCalc4_not2() { Calculator c = new Ash1_1Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 3 readings, 4 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); Assert.assertEquals("x close", true, Math.abs(m.x - 3.) < 0.001); Assert.assertEquals("y close", true, Math.abs(m.y - 2.) < 0.001); @@ -96,7 +102,6 @@ public void testCalc4_not2() { } @Test - @Ignore // fails for unknown reasons public void testCalc4_not3() { Point3d s1 = new Point3d(10.0f, 0.0f, 12.0f); Point3d s2 = new Point3d(-3.0f, 4.0f, 9.0f); @@ -110,6 +115,9 @@ public void testCalc4_not3() { Calculator c = new Ash1_1Algorithm(s, vs); Measurement m = c.convert(r, new Point3d(1.f, 1.f, 10.f)); + // there probably shouldn't be an error generated by the class under + // test here. + jmri.util.JUnitAppender.assertErrorMessage("Mismatch: 3 readings, 4 receivers"); Assert.assertEquals("ID ok", "21", m.getId()); Assert.assertEquals("x close", true, Math.abs(m.x - 3.) < 0.001); Assert.assertEquals("y close", true, Math.abs(m.y - 2.) < 0.001); diff --git a/java/test/jmri/jmrix/rps/PackageTest.java b/java/test/jmri/jmrix/rps/PackageTest.java index 8f51bc44ecd..a64e4308cc0 100644 --- a/java/test/jmri/jmrix/rps/PackageTest.java +++ b/java/test/jmri/jmrix/rps/PackageTest.java @@ -34,7 +34,6 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(RpsSensorManagerTest.class)); suite.addTest(jmri.jmrix.rps.RpsSensorTest.suite()); suite.addTest(jmri.jmrix.rps.RegionTest.suite()); - suite.addTest(jmri.jmrix.rps.TransformTest.suite()); suite.addTest(new JUnit4TestAdapter(BundleTest.class)); suite.addTest(new JUnit4TestAdapter(jmri.jmrix.rps.serial.PackageTest.class)); suite.addTest(new JUnit4TestAdapter(jmri.jmrix.rps.configurexml.PackageTest.class)); diff --git a/java/test/jmri/jmrix/rps/TransformTest.java b/java/test/jmri/jmrix/rps/TransformTest.java deleted file mode 100644 index 5d0d52b5364..00000000000 --- a/java/test/jmri/jmrix/rps/TransformTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package jmri.jmrix.rps; - -import jmri.util.JUnitUtil; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * JUnit tests for the rps.Transform class. - * - * @author Bob Jacobsen Copyright 2007 - */ -public class TransformTest extends TestCase { - - public void testBasic() { - } - - // from here down is testing infrastructure - public TransformTest(String s) { - super(s); - } - - // Main entry point - static public void main(String[] args) { - String[] testCaseName = {"-noloading", TransformTest.class.getName()}; - junit.textui.TestRunner.main(testCaseName); - } - - // test suite from all defined tests - public static Test suite() { - TestSuite suite = new TestSuite(TransformTest.class); - return suite; - } - - // The minimal setup for log4J - @Override - protected void setUp() { - JUnitUtil.setUp(); - } - - @Override - protected void tearDown() { - JUnitUtil.tearDown(); - } - -} diff --git a/java/test/jmri/jmrix/sprog/sprogmon/BundleTest.java b/java/test/jmri/jmrix/sprog/sprogmon/BundleTest.java new file mode 100644 index 00000000000..6537a67082b --- /dev/null +++ b/java/test/jmri/jmrix/sprog/sprogmon/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.sprog.sprogmon; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/sprog/sprogmon/PackageTest.java b/java/test/jmri/jmrix/sprog/sprogmon/PackageTest.java index a4a26d2975e..bdd847eed97 100644 --- a/java/test/jmri/jmrix/sprog/sprogmon/PackageTest.java +++ b/java/test/jmri/jmrix/sprog/sprogmon/PackageTest.java @@ -8,7 +8,8 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ SprogMonFrameTest.class, - SprogMonActionTest.class + SprogMonActionTest.class, + BundleTest.class }) /** diff --git a/java/test/jmri/jmrix/tmcc/PackageTest.java b/java/test/jmri/jmrix/tmcc/PackageTest.java index 3894a544f7d..68eab6a08e0 100644 --- a/java/test/jmri/jmrix/tmcc/PackageTest.java +++ b/java/test/jmri/jmrix/tmcc/PackageTest.java @@ -46,6 +46,7 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(SerialThrottleManagerTest.class)); suite.addTest(new JUnit4TestAdapter(SerialThrottleTest.class)); suite.addTest(new JUnit4TestAdapter(BundleTest.class)); + suite.addTest(new JUnit4TestAdapter(jmri.jmrix.tmcc.swing.PackageTest.class)); return suite; } diff --git a/java/test/jmri/jmrix/tmcc/packetgen/BundleTest.java b/java/test/jmri/jmrix/tmcc/packetgen/BundleTest.java new file mode 100644 index 00000000000..785f5a22f03 --- /dev/null +++ b/java/test/jmri/jmrix/tmcc/packetgen/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.tmcc.packetgen; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/tmcc/packetgen/PackageTest.java b/java/test/jmri/jmrix/tmcc/packetgen/PackageTest.java index 0127c92539c..87c529c1eee 100644 --- a/java/test/jmri/jmrix/tmcc/packetgen/PackageTest.java +++ b/java/test/jmri/jmrix/tmcc/packetgen/PackageTest.java @@ -8,7 +8,8 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ SerialPacketGenActionTest.class, - SerialPacketGenFrameTest.class + SerialPacketGenFrameTest.class, + BundleTest.class }) /** diff --git a/java/test/jmri/jmrix/tmcc/serialdriver/BundleTest.java b/java/test/jmri/jmrix/tmcc/serialdriver/BundleTest.java new file mode 100644 index 00000000000..889247b75da --- /dev/null +++ b/java/test/jmri/jmrix/tmcc/serialdriver/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.tmcc.serialdriver; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/tmcc/serialdriver/PackageTest.java b/java/test/jmri/jmrix/tmcc/serialdriver/PackageTest.java index e3c1f8bfdd4..2e8f4c91c99 100644 --- a/java/test/jmri/jmrix/tmcc/serialdriver/PackageTest.java +++ b/java/test/jmri/jmrix/tmcc/serialdriver/PackageTest.java @@ -10,7 +10,8 @@ @Suite.SuiteClasses({ ConnectionConfigTest.class, SerialDriverAdapterTest.class, - jmri.jmrix.tmcc.serialdriver.configurexml.PackageTest.class + jmri.jmrix.tmcc.serialdriver.configurexml.PackageTest.class, + BundleTest.class }) /** diff --git a/java/test/jmri/jmrix/tmcc/serialmon/BundleTest.java b/java/test/jmri/jmrix/tmcc/serialmon/BundleTest.java new file mode 100644 index 00000000000..903ddfd0042 --- /dev/null +++ b/java/test/jmri/jmrix/tmcc/serialmon/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.tmcc.serialmon; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/tmcc/serialmon/PackageTest.java b/java/test/jmri/jmrix/tmcc/serialmon/PackageTest.java index 5b8e544505a..3d33541f398 100644 --- a/java/test/jmri/jmrix/tmcc/serialmon/PackageTest.java +++ b/java/test/jmri/jmrix/tmcc/serialmon/PackageTest.java @@ -7,7 +7,8 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ SerialMonActionTest.class, - SerialMonFrameTest.class + SerialMonFrameTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.tmcc.serialmon package diff --git a/java/test/jmri/jmrix/tmcc/simulator/BundleTest.java b/java/test/jmri/jmrix/tmcc/simulator/BundleTest.java new file mode 100644 index 00000000000..bfffce4a3d0 --- /dev/null +++ b/java/test/jmri/jmrix/tmcc/simulator/BundleTest.java @@ -0,0 +1,29 @@ +package jmri.jmrix.tmcc.simulator; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Tests for the Bundle class + * + * @author Bob Jacobsen Copyright (C) 2012 + */ +public class BundleTest { + + @Test public void testGoodKeys() { + Assert.assertEquals("(none)", Bundle.getMessage("none")); + Assert.assertEquals("No locomotive detected (301);", Bundle.getMessage("NoLocoDetected")); + Assert.assertEquals("Turnout", Bundle.getMessage("BeanNameTurnout")); + } + + @Test public void testBadKey() { + try { + Bundle.getMessage("FFFFFTTTTTTT"); + } catch (java.util.MissingResourceException e) { + return; + } // OK + Assert.fail("No exception thrown"); + } + +} diff --git a/java/test/jmri/jmrix/tmcc/simulator/PackageTest.java b/java/test/jmri/jmrix/tmcc/simulator/PackageTest.java index 7ff2347757d..0bb6b529225 100644 --- a/java/test/jmri/jmrix/tmcc/simulator/PackageTest.java +++ b/java/test/jmri/jmrix/tmcc/simulator/PackageTest.java @@ -10,8 +10,8 @@ @Suite.SuiteClasses({ ConnectionConfigTest.class, SimulatorAdapterTest.class, - jmri.jmrix.tmcc.simulator.configurexml.PackageTest.class - + jmri.jmrix.tmcc.simulator.configurexml.PackageTest.class, + BundleTest.class }) /** * Tests for the jmri.jmrix.tmcc.simulator package. diff --git a/java/test/jmri/jmrix/tmcc/swing/PackageTest.java b/java/test/jmri/jmrix/tmcc/swing/PackageTest.java new file mode 100644 index 00000000000..f897c4eb748 --- /dev/null +++ b/java/test/jmri/jmrix/tmcc/swing/PackageTest.java @@ -0,0 +1,18 @@ +package jmri.jmrix.tmcc.swing; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + + +@RunWith(Suite.class) +@Suite.SuiteClasses({ +}) +/** + * Tests for the jmri.jmrix.tmcc.swing package + * + * @author Paul Bender Copyright (C) 2017 + */ +public class PackageTest { + + +} diff --git a/java/test/jmri/jmrix/tmcc/swing/TmccComponentFactoryTest.java b/java/test/jmri/jmrix/tmcc/swing/TmccComponentFactoryTest.java new file mode 100644 index 00000000000..ca64b295a9e --- /dev/null +++ b/java/test/jmri/jmrix/tmcc/swing/TmccComponentFactoryTest.java @@ -0,0 +1,36 @@ +package jmri.jmrix.tmcc.swing; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import java.awt.GraphicsEnvironment; +import jmri.jmrix.tmcc.TmccSystemConnectionMemo; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class TmccComponentFactoryTest { + + @Test + public void testCTor() { + TmccSystemConnectionMemo memo = new TmccSystemConnectionMemo(); + TmccComponentFactory t = new TmccComponentFactory(memo); + Assert.assertNotNull("exists",t); + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/java/test/jmri/managers/AbstractLightMgrTestBase.java b/java/test/jmri/managers/AbstractLightMgrTestBase.java index fbf0824c959..9a7abc9dd18 100644 --- a/java/test/jmri/managers/AbstractLightMgrTestBase.java +++ b/java/test/jmri/managers/AbstractLightMgrTestBase.java @@ -9,10 +9,8 @@ /** - * Abstract Base Class for LightManager tests in specific jmrix packages. This - * is not itself a test class, e.g. should not be added to a suite. Instead, - * this forms the base for test classes, including providing some common tests - * + * Abstract Base Class for LightManager tests in specific jmrix packages. + *

              * This is not itself a test class, e.g. should not be added to a suite. * Instead, this forms the base for test classes, including providing some * common tests diff --git a/java/test/jmri/swing/JmriJTablePersistenceManagerTest.java b/java/test/jmri/swing/JmriJTablePersistenceManagerTest.java index ddec4c91a8d..c4dbb863671 100644 --- a/java/test/jmri/swing/JmriJTablePersistenceManagerTest.java +++ b/java/test/jmri/swing/JmriJTablePersistenceManagerTest.java @@ -1,6 +1,5 @@ package jmri.swing; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import apps.tests.Log4JFixture; @@ -236,14 +235,14 @@ public void testClearState() { String name = "test name"; JTable table = testTable(name); JmriJTablePersistenceManagerSpy instance = new JmriJTablePersistenceManagerSpy(); - Assert.assertFalse(instance.getDirty()); + Assert.assertFalse(instance.isDirty()); instance.cacheState(table); - Assert.assertTrue(instance.getDirty()); + Assert.assertTrue(instance.isDirty()); Assert.assertNotNull(instance.getColumnsMap(name)); instance.setDirty(false); instance.clearState(table); Assert.assertNull(instance.getColumnsMap(name)); - Assert.assertTrue(instance.getDirty()); + Assert.assertTrue(instance.isDirty()); } /** @@ -340,23 +339,6 @@ public void testGetProvides() { Assert.assertEquals(expected, instance.getProvides()); } - /** - * Test of getPersistedState method, of class JmriJTablePersistenceManager. - */ - @Test - @Ignore - public void testGetPersistedState() { - System.out.println("getPersistedState"); - String table = ""; - String column = ""; - JmriJTablePersistenceManager instance = new JmriJTablePersistenceManager(); - JmriJTablePersistenceManager.TableColumnPreferences expResult = null; - JmriJTablePersistenceManager.TableColumnPreferences result = instance.getPersistedState(table, column); - assertEquals(expResult, result); - // TODO review the generated test code and remove the default call to fail. - fail("The test case is a prototype."); - } - /** * Test of setPersistedState method, of class JmriJTablePersistenceManager. */ @@ -416,8 +398,8 @@ private JTable testTable(String name) { private final static class JmriJTablePersistenceManagerSpy extends JmriJTablePersistenceManager { @Override - public boolean getDirty() { - return super.getDirty(); + public boolean isDirty() { + return super.isDirty(); } @Override diff --git a/java/test/jmri/util/PackageTest.java b/java/test/jmri/util/PackageTest.java index c9ddcfaf61a..ca84cc532a4 100644 --- a/java/test/jmri/util/PackageTest.java +++ b/java/test/jmri/util/PackageTest.java @@ -69,7 +69,6 @@ public static Test suite() { suite.addTest(new junit.framework.JUnit4TestAdapter(GetClassPathTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(GetJavaPropertyTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(HelpUtilTest.class)); - suite.addTest(new junit.framework.JUnit4TestAdapter(JTableUtilTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(JTextPaneAppenderTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(JmriInsetsTest.class)); suite.addTest(new junit.framework.JUnit4TestAdapter(JmriJFrameTest.class)); diff --git a/java/test/jmri/util/com/sun/PackageTest.java b/java/test/jmri/util/com/sun/PackageTest.java index 7181c6edffd..a0a7efe02a9 100644 --- a/java/test/jmri/util/com/sun/PackageTest.java +++ b/java/test/jmri/util/com/sun/PackageTest.java @@ -6,7 +6,6 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ - TableSorterTest.class, TransferActionListenerTest.class }) /** diff --git a/java/test/jmri/util/swing/DrawSquaresTest.java b/java/test/jmri/util/swing/DrawSquaresTest.java new file mode 100644 index 00000000000..8821232c3c7 --- /dev/null +++ b/java/test/jmri/util/swing/DrawSquaresTest.java @@ -0,0 +1,37 @@ +package jmri.util.swing; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author Egbert Broerse Copyright (C) 2017 + */ +public class DrawSquaresTest { + + @Test + public void testCall() { + BufferedImage bi = DrawSquares.getImage(100, 100, 25, Color.white, Color.black); + Assert.assertNotNull("exists", bi); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } + + // private final static Logger log = LoggerFactory.getLogger(DrawSquaresTest.class); + +} diff --git a/java/test/jmri/util/swing/ImagePanelTest.java b/java/test/jmri/util/swing/ImagePanelTest.java new file mode 100644 index 00000000000..b6ae5f903f9 --- /dev/null +++ b/java/test/jmri/util/swing/ImagePanelTest.java @@ -0,0 +1,44 @@ +package jmri.util.swing; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author Egbert Broerse Copyright (C) 2017 + */ +public class ImagePanelTest { + + @Test + public void testCall() { + ImagePanel ip = new ImagePanel(); + Assert.assertNotNull("exists", ip); + } + + @Test + public void setImage() { + ImagePanel ip = new ImagePanel(); + BufferedImage img = new BufferedImage(100, 50, BufferedImage.TYPE_INT_ARGB); + ip.setImage(img); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } + + // private final static Logger log = LoggerFactory.getLogger(ImagePanelTest.class); + +} diff --git a/java/test/jmri/util/swing/JComboBoxUtilTest.java b/java/test/jmri/util/swing/JComboBoxUtilTest.java new file mode 100644 index 00000000000..18ba018f1ce --- /dev/null +++ b/java/test/jmri/util/swing/JComboBoxUtilTest.java @@ -0,0 +1,38 @@ +package jmri.util.swing; + +import java.awt.GraphicsEnvironment; +import javax.swing.*; +import jmri.*; +import jmri.util.JUnitUtil; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author Bob Jacobsen Copyright (C) 2017 + */ +public class JComboBoxUtilTest { + + @Test + public void testCall() { + JComboBox c = new JComboBox<>(new String[]{"A", "B"}); + JComboBoxUtil.setupComboBoxMaxRows(c); + } + + // The minimal setup for log4J + @Before + public void setUp() { + JUnitUtil.setUp(); + } + + @After + public void tearDown() { + JUnitUtil.tearDown(); + } + + // private final static Logger log = LoggerFactory.getLogger(JmriBeanComboBoxTest.class); + +} diff --git a/java/test/jmri/util/swing/PackageTest.java b/java/test/jmri/util/swing/PackageTest.java index 28fdd8adb0a..0347b6dd340 100644 --- a/java/test/jmri/util/swing/PackageTest.java +++ b/java/test/jmri/util/swing/PackageTest.java @@ -39,6 +39,7 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(GuiUtilBaseTest.class)); suite.addTest(new JUnit4TestAdapter(JmriBeanComboBoxTest.class)); suite.addTest(new JUnit4TestAdapter(JMenuUtilTest.class)); + suite.addTest(new JUnit4TestAdapter(JComboBoxUtilTest.class)); suite.addTest(new JUnit4TestAdapter(JToolBarUtilTest.class)); suite.addTest(new JUnit4TestAdapter(JTreeUtilTest.class)); suite.addTest(new JUnit4TestAdapter(JmriPanelTest.class)); @@ -57,6 +58,8 @@ public static Test suite() { suite.addTest(new JUnit4TestAdapter(ComboBoxColorChooserPanelTest.class)); suite.addTest(new JUnit4TestAdapter(ButtonGroupColorChooserPanelTest.class)); suite.addTest(new JUnit4TestAdapter(ButtonSwatchColorChooserPanelTest.class)); + suite.addTest(new JUnit4TestAdapter(DrawSquaresTest.class)); + suite.addTest(new JUnit4TestAdapter(ImagePanelTest.class)); return suite; } diff --git a/java/test/jmri/util/usb/PackageTest.java b/java/test/jmri/util/usb/PackageTest.java index 99d234f59d9..61a482b7470 100644 --- a/java/test/jmri/util/usb/PackageTest.java +++ b/java/test/jmri/util/usb/PackageTest.java @@ -10,7 +10,8 @@ UsbBrowserActionTest.class, UsbBrowserFrameTest.class, UsbBrowserPanelTest.class, - UsbBrowserStartupActionFactoryTest.class, + UsbBrowserStartupActionFactoryTest.class, + UsbUtilTest.class }) /** * Tests for the jmri.util.usb package diff --git a/java/test/jmri/util/usb/UsbUtilTest.java b/java/test/jmri/util/usb/UsbUtilTest.java new file mode 100644 index 00000000000..d12b928ec5e --- /dev/null +++ b/java/test/jmri/util/usb/UsbUtilTest.java @@ -0,0 +1,76 @@ +package jmri.util.usb; + +import java.io.UnsupportedEncodingException; +import javax.usb.UsbDevice; +import javax.usb.UsbDisconnectedException; +import javax.usb.UsbException; +import jmri.util.JUnitAppender; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +/** + * + * @author Paul Bender Copyright (C) 2017 + */ +public class UsbUtilTest { + + @Rule + public MockitoRule rule = MockitoJUnit.rule(); + + @Test + public void testGetFullProductName() { + UsbDevice mockDevice = Mockito.mock(UsbDevice.class); + try { + // test MFG and product name complete + Mockito.when(mockDevice.getManufacturerString()).thenReturn("Foo"); + Mockito.when(mockDevice.getProductString()).thenReturn("Bar"); + Assert.assertEquals("Foo Bar", UsbUtil.getFullProductName(mockDevice)); + // test product name contains MFG name + Mockito.when(mockDevice.getProductString()).thenReturn("FooBar"); + Assert.assertEquals("FooBar", UsbUtil.getFullProductName(mockDevice)); + // test no MFG or product name + Mockito.when(mockDevice.getManufacturerString()).thenReturn(null); + Mockito.when(mockDevice.getProductString()).thenReturn(null); + Assert.assertEquals(null, UsbUtil.getFullProductName(mockDevice)); + // test exceptions thrown by device + Mockito.when(mockDevice.getManufacturerString()).thenThrow(UsbException.class); + Assert.assertEquals(null, UsbUtil.getFullProductName(mockDevice)); + JUnitAppender.assertErrorMessage("Unable to read data from " + mockDevice.toString()); + Mockito.when(mockDevice.getManufacturerString()).thenThrow(UnsupportedEncodingException.class); + Assert.assertEquals(null, UsbUtil.getFullProductName(mockDevice)); + JUnitAppender.assertErrorMessage("Unable to read data from " + mockDevice.toString()); + Mockito.when(mockDevice.getManufacturerString()).thenThrow(UsbDisconnectedException.class); + Assert.assertEquals(null, UsbUtil.getFullProductName(mockDevice)); + JUnitAppender.assertErrorMessage("Unable to read data from " + mockDevice.toString()); + // test that unexpected exception is not caught + try { + Mockito.when(mockDevice.getManufacturerString()).thenThrow(NullPointerException.class); + Assert.assertEquals("", UsbUtil.getFullProductName(mockDevice)); + Assert.fail("NPE not thrown"); + } catch (NullPointerException ex) { + // catch exception to not break test + } + JUnitAppender.assertErrorMessage("Unable to read data from " + mockDevice.toString()); + } catch (UsbException | UnsupportedEncodingException | UsbDisconnectedException ex) { + // try/catch to match API, however mock object will not throw these + } + } + + // The minimal setup for log4J + @Before + public void setUp() { + jmri.util.JUnitUtil.setUp(); + } + + @After + public void tearDown() { + jmri.util.JUnitUtil.tearDown(); + } + +} diff --git a/jython/StartLoggingToFile.py b/jython/StartLoggingToFile.py new file mode 100644 index 00000000000..2fe0d71d918 --- /dev/null +++ b/jython/StartLoggingToFile.py @@ -0,0 +1,21 @@ +# Sample script to find all open LocoNet Monitor windows +# and tell them to start logging to their (preselected) log file. +# +# Author: Bob Jacobsen, copyright 2017 +# Part of the JMRI distribution + +import jmri +import javax.swing + +for frame in jmri.util.JmriJFrame.getFrameList() : + # We can't use isinstance because monitor frames are just JmriJFrames + # so we just try ... + try : + for panel in frame.contentPane.components : + if isinstance(panel, jmri.jmrix.loconet.locomon.LocoMonPane) : + panel.startLogButtonActionPerformed(None) + print "Started logging on '", frame.title,"' window" + except BaseException : + # just ignore + continue + \ No newline at end of file diff --git a/jython/test/StartLoggingToFileTest.py b/jython/test/StartLoggingToFileTest.py new file mode 100644 index 00000000000..f82567ff0ae --- /dev/null +++ b/jython/test/StartLoggingToFileTest.py @@ -0,0 +1,6 @@ +# Test the StartLoggingToFile.py script + +execfile("jython/StartLoggingToFile.py") + +# Just checking that it parses and executes. +# Note that normally there's no LocoNet Monitor window open here diff --git a/lib/usb-api-1.0.2.jar b/lib/usb-api-1.0.2.jar index 7abd6f709ea..e22a6a11210 100644 Binary files a/lib/usb-api-1.0.2.jar and b/lib/usb-api-1.0.2.jar differ diff --git a/nbproject/project.xml b/nbproject/project.xml index 94c25fdd2f1..f440eeec113 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -211,7 +211,7 @@ java/test - java/tmp:target/classes:lib/junit-4.12.jar:lib/xercesImpl.jar:lib/gluegen-rt.jar:lib/jakarta-regexp-1.5.jar:lib/javacsv.jar:lib/jdom-2.0.5.jar:lib/jdom.jar:lib/jfcunit.jar:lib/jhall.jar:lib/jinput.jar:lib/jmdns-3.5.3.jar:lib/joal.jar:lib/openlcb.jar:lib/jlfgr-1_0.jar:lib/jython-standalone-2.7.0.jar:lib/log4j-1.2.17.jar:lib/mailapi.jar:lib/purejavacomm-1.0.1.jar:lib/servlet.jar:lib/vecmath-1.5.2.jar:lib/annotations.jar:lib/jsr305.jar:lib/i18nchecker.jar:lib/slf4j-api-1.7.25.jar:lib/slf4j-log4j12-1.7.25.jar:lib/jul-to-slf4j-1.7.25.jar:lib/pi4j-core.jar:lib/pi4j-device.jar:lib/pi4j-gpio-extension.jar:lib/pi4j-service.jar:lib/commons-lang3-3.2.1.jar:lib/jackson-databind-2.8.5.jar:lib/websocket-api-9.4.7.v20170914.jar:lib/javax.servlet-api-3.1.0.jar:lib/powermock-api-mockito-common-1.6.5.jar:lib/powermock-mockito2-1.6.5-full.jar:lib/xbjlib-1.1.1.jar:lib/mockito-core-2.0.42-beta.jar:lib/jemmy-2.3.1.1-RELEASE802.jar:lib/jetty-util-9.4.7.v20170914.jar:lib/xbee-java-library-1.2.0.jar:lib/org-openide-util-lookup-RELEASE82.jar:lib/commons-io-1.3.1.jar:lib/cucumber-junit-1.2.5.jar:lib/cucumber-core-1.2.5.jar + java/tmp:target/classes:lib/junit-4.12.jar:lib/xercesImpl.jar:lib/gluegen-rt.jar:lib/jakarta-regexp-1.5.jar:lib/javacsv.jar:lib/jdom-2.0.5.jar:lib/jdom.jar:lib/jfcunit.jar:lib/jhall.jar:lib/jinput.jar:lib/jmdns-3.5.3.jar:lib/joal.jar:lib/openlcb.jar:lib/jlfgr-1_0.jar:lib/jython-standalone-2.7.0.jar:lib/log4j-1.2.17.jar:lib/mailapi.jar:lib/purejavacomm-1.0.1.jar:lib/servlet.jar:lib/vecmath-1.5.2.jar:lib/annotations.jar:lib/jsr305.jar:lib/i18nchecker.jar:lib/slf4j-api-1.7.25.jar:lib/slf4j-log4j12-1.7.25.jar:lib/jul-to-slf4j-1.7.25.jar:lib/pi4j-core.jar:lib/pi4j-device.jar:lib/pi4j-gpio-extension.jar:lib/pi4j-service.jar:lib/commons-lang3-3.2.1.jar:lib/jackson-databind-2.8.5.jar:lib/websocket-api-9.4.7.v20170914.jar:lib/javax.servlet-api-3.1.0.jar:lib/powermock-api-mockito-common-1.6.5.jar:lib/powermock-mockito2-1.6.5-full.jar:lib/xbjlib-1.1.1.jar:lib/mockito-core-2.0.42-beta.jar:lib/jemmy-2.3.1.1-RELEASE802.jar:lib/jetty-util-9.4.7.v20170914.jar:lib/xbee-java-library-1.2.0.jar:lib/org-openide-util-lookup-RELEASE82.jar:lib/commons-io-1.3.1.jar:lib/cucumber-junit-1.2.5.jar:lib/cucumber-core-1.2.5.jar:lib/usb-api-1.0.2.jar target/classes 1.8 diff --git a/pom.xml b/pom.xml index dde26ef64fe..8256300f6d0 100644 --- a/pom.xml +++ b/pom.xml @@ -571,7 +571,7 @@ net.ossindex ossindex-maven-plugin - 2.3.3 + 2.3.7 true diff --git a/release.properties b/release.properties index 82b17d25c1b..e6be616f412 100644 --- a/release.properties +++ b/release.properties @@ -1,11 +1,11 @@ -#Sat, 07 Oct 2017 12:09:04 -0700 +#Mon, 20 Nov 2017 06:46:15 -0800 # Changes to this file are to be checked in by JMRI release pumpkins only # # these are the numbers for the NEXT release from this branch release.major=4 release.minor=9 -release.build=6 +release.build=7 # additional release descriptor for a long-running expermimental difference # from what is produced by building JMRI/master (e.g. "pjc"). Should not contain diff --git a/scripts/BundleKeysReport.py b/scripts/BundleKeysReport.py new file mode 100755 index 00000000000..9770186579d --- /dev/null +++ b/scripts/BundleKeysReport.py @@ -0,0 +1,216 @@ +## +# Identify keys within a bundle properties file that are not being used. +# The JMRI source package is required. +# +# Dave Sand copyright 2017 +## + +import io +import os +from os.path import join +import glob +from time import time + +import jmri +import java +from javax.swing import JFileChooser, JOptionPane +from javax.swing.filechooser import FileNameExtensionFilter + +dialogTitle = "Bundle Keys Report" + +## +# Select a properties file to be anaylzed. This will normally be the +# default (English) file. +## +fc = JFileChooser(FileUtil.getProgramPath()) +fc.setDialogTitle(dialogTitle) +fc.setFileFilter(FileNameExtensionFilter("Bundle Properties", ["properties"])); +ret = fc.showOpenDialog(None) +if ret == JFileChooser.APPROVE_OPTION: + selectedBundle = fc.getSelectedFile().toString() + startTime = time() +else: + print "No file selected, bye" + quit() + +# set up path info +bundleFile = os.path.basename(selectedBundle) +fullPath = os.path.dirname(selectedBundle) +splitPath = fullPath.split(os.sep + "src" + os.sep) +jmriPath = splitPath[0] +bundlePath = splitPath[1] +dotPath = ".".join(bundlePath.split(os.sep)) +testPath = join(jmriPath, "test", bundlePath) + +print dialogTitle + "\n" +print "Bundle Property File: '{}'\n".format(bundleFile) + +print "Full path: {}".format(fullPath) +print "Test path: {}".format(testPath) +print "JMRI path: {}".format(jmriPath) +print "Bundle path: {}".format(bundlePath) +print "Java format: {}".format(dotPath) + +cntUse = 0 +cntNot = 0 +notUsedList = [] +bundleType = "Standard" # Specified in Bundle.java, follow the tree structure + +## +# Check Bundle.java +# If the selected file is not the specified bundle for this package, +# display a warning dialog. Set the bundleType variable to Single +## +try: + with io.open(join(fullPath, "Bundle.java"), "r", encoding="utf-8") as javaFile: + javaContent = javaFile.read() + checkName = dotPath + "." + bundleFile[:-11] + if javaContent.find(checkName) == -1: + bundleType = "Single" + JOptionPane.showMessageDialog(None, + "The selected property file is not in the bundle hierarchy.\nA single level search will be performed.", + dialogTitle, JOptionPane.INFORMATION_MESSAGE) +except IOError: + JOptionPane.showMessageDialog(None, + "Bundle.java does not exist.\nUsing a single level search.", + dialogTitle, JOptionPane.INFORMATION_MESSAGE) + bundleType = "Single" + +## +# If a class references the current bundle outside of the bundle inheritance tree, +# see if any of the unused keys where used. If so, they can be removed from +# the unused list. +# chkPath : The full path to the class being checked +## +def checkKeys(chkPath): + remCnt = 0 + notUsedWork = notUsedList[:] + + with io.open(chkPath, "r", encoding="utf-8") as chkFile: + chkLine = chkFile.read() + for cKey in notUsedWork: + ck = '"{}"'.format(cKey) + if chkLine.find(ck) != -1: + try: + notUsedList.remove(cKey) + print " {} removed".format(cKey) + remCnt += 1 + except ValueError: + print "Error removing {} from not list".format(cKey) + + print " {} keys removed\n".format(remCnt) + +## +# Follow the file tree recursively +# Search each java or python source file for occurrences of a key +# key : The current bundle key or package name +# path : The starting path for the file recursion +# mode : Key = quiet, return on match; Reference = Print matches +# return : True as soon as a match is found in Key mode; otherwise False +## +def searchFiles(key, path, mode): + if mode == "Key": + k = '"{}"'.format(key) + else: + k = key + for root, dirNames, fileNames in os.walk(path): + for fileName in fileNames: + if fileName[-5:] == ".java" or fileName[-3:] == ".py": + with io.open(join(root, fileName), "r", encoding="utf-8") as reFile: + reLine = reFile.read() + if reLine.find(k) != -1: + if mode == "Key": + return True + if reLine.find("public class Bundle extends") == -1: + print " {}".format(join(root, fileName)) + checkKeys(join(root, fileName)) + if bundleType == "Single" and mode == "Key": + return False + return False + +## +# Phase 1 +# For each key in the property file, search the directory tree for +# any usage. The normal case is that any uses will be at or below the +# directory that contains the property file. +## +print "\n---- Bundle Key Not Used List ----" +with io.open(selectedBundle, "r", encoding="utf-8") as propertyFile: + for propertyLine in propertyFile: + splitLine = propertyLine.split("=") + if len(splitLine) > 1: + propertyKey = splitLine[0].strip() + if searchFiles(propertyKey, fullPath, "Key"): + cntUse += 1 + else: + # Not used in the src path, try the test path + if searchFiles(propertyKey, testPath, "Key"): + cntUse += 1 + else: + cntNot += 1 + print " {}".format(propertyKey) + notUsedList.append(propertyKey) +print "\nSummary: {} used, {} not used".format(cntUse, cntNot) +midTime = time() + +## +# Phase 2 +# Find any external references to the property file. This covers those +# cases where bundle inheritance was not used. +# The proper Bundle.java should always be listed. +## +bundleName = bundleFile.split(".") +bundleArg = ".".join([dotPath, bundleName[0]]) +print "\n---- Find Bundle References :: {}".format(bundleArg) +searchFiles(bundleArg, jmriPath, "References") +searchFiles(bundleArg, join(FileUtil.getProgramPath(), "jython"), "References") + +print "Final notUsedList size = {}".format(len(notUsedList)) +endTime = time() + +print "\nTiming" +print (" Phase 1: {}").format(midTime-startTime) +print (" Phase 2: {}").format(endTime-midTime) +print (" Total: {}").format(endTime-startTime) + +## +# Provide the option to export the unused key list to an external file. +## +saveResp = JOptionPane.showConfirmDialog(None, "Do you want to save the unused key list?", dialogTitle, JOptionPane.YES_NO_OPTION) +if saveResp == 0: + fo = JFileChooser(FileUtil.getUserFilesPath()) + fo.setDialogTitle(dialogTitle) + ret = fo.showSaveDialog(None) + if ret == JFileChooser.APPROVE_OPTION: + keyFile = fo.getSelectedFile().toString() + with io.open(keyFile, "w", encoding="utf-8") as outputFile: + outputFile.write("\n".join(notUsedList)) + +## +# Provide the option to update the property files. +# All of the files for the current bundle name will be updated. +# A backup will be created for each file before it is updated. 4 copies of the backup will be retained. +# The unused keys will be converted to comments with the NotUsed tag. +# Note: If the Java tree is managed by Git, the backups will create new file entries. +# These backup files should not be included in a commit. +## +updateResp = JOptionPane.showConfirmDialog(None, "Do you want to update the property files?", dialogTitle, JOptionPane.YES_NO_OPTION) +if updateResp == 0: + globArgument = join(fullPath, bundleFile[:-11] + "*properties") + print globArgument + for propName in glob.glob(globArgument): + print "---- Update {}".format(propName) + FileUtil.backup(FileUtil.getFile(propName)) + with io.open(propName, "r+", encoding="utf-8") as ioFile: + propLines = ioFile.readlines() + ioFile.seek(0) + ioFile.truncate() + for propLine in propLines: + splitLine = propLine.split("=") + if len(splitLine) > 1: + checkKey = splitLine[0].strip() + if notUsedList.count(checkKey) > 0: + propLine = "#NotUsed " + propLine + ioFile.write(propLine) + +print "\n{} Done".format(dialogTitle) \ No newline at end of file diff --git a/scripts/ClassKeysReport.py b/scripts/ClassKeysReport.py new file mode 100755 index 00000000000..7bce9edba18 --- /dev/null +++ b/scripts/ClassKeysReport.py @@ -0,0 +1,183 @@ +## +# Look for non-standard getString and getMessage key arguments. +# These will normally be variables. +# Other exceptions: +# If a key contains special characters, it will be flagged as a variable. +# The valid characters are a-z, A-Z, 0-9 and underscore. +# +# The JMRI source package is required. +# +# Dave Sand copyright 2017 +## + +import io +import re +import os +from os.path import join +import glob + +import jmri +import java +import com.csvreader +from javax.swing import JFileChooser, JOptionPane +from javax.swing.filechooser import FileNameExtensionFilter + +dialogTitle = "Class Keys Report" +print " {}".format(dialogTitle) +keyList = [] + +# Select a Java program or package directory to be analyzed. +fc = JFileChooser(FileUtil.getProgramPath()) +fc.setDialogTitle(dialogTitle) +fc.setFileFilter(FileNameExtensionFilter("Java Program", ["java"])); +fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES) +ret = fc.showOpenDialog(None) +if ret == JFileChooser.APPROVE_OPTION: + selectedItem = fc.getSelectedFile().toString() +else: + print 'No file selected, bye' + quit() + +# RegEx patterns. Capture the first word after the start of the match string. +# The first one looks for a word within double quotes. +# The second one looks for a plain word. +# A word contains a-z, A-Z, 0-9 or underscore characters. +reStrKey = re.compile('\W*"(\w+)"\W*[,)]') +reVarKey = re.compile('\W*(\w+)\W') + +## +# Determine class for a variable key. +# The first getMessage parameter can be a Locale object. +# variableKey : The current key +# filePath : The current file being processed +# return : The class type: String, Locale or Unknown +## +def findVariableClass(variableKey, filePath): + with io.open(filePath, "r", encoding="utf-8") as chkFile: + for chkLine in chkFile: + for classType in ['String', 'Locale']: + chkClassArg = '.*{}\s+{}'.format(classType, variableKey) + reChkClass = re.compile(chkClassArg) + chkMatch = re.match(chkClassArg, chkLine) + if chkMatch is not None: + return classType + return 'Unknown' + +## +# Search for the next word in the line fragment. +# lineFragment : The line fragment to be searched. +# return : A tuple that has the key and key type +## +def findKey(lineFragment): + returnValues = 'None', 'Unknown' + chkStr = re.match(reStrKey, lineFragment) + if chkStr is not None: + returnValues = chkStr.group(1), 'String' + else: + chkVar = re.match(reVarKey, lineFragment) + if chkVar is not None: + returnValues = chkVar.group(1), 'Variable' + return returnValues + +## +# Search a line of code for occruances of getString or getMessage. +# Display a message for non-standard key references. +# All keys are added to a list that can be exported as a CSV file. +# classLine : The current line of code +# num : The current line number +# filePath : The current file path +## +def findKeys(classLine, num, filePath): + for searchText in ['Bundle.getMessage(', 'getString(']: + searchType = 'Local' if searchText == 'getString(' else 'Bundle' + searchSize = len(searchText) + idx = 0 + while idx >= 0 and idx < len(classLine): + idx = classLine.find(searchText, idx) + if idx == -1: + break + idx += searchSize + key, keyType = findKey(classLine[idx:]) + if keyType == 'Variable': + if findVariableClass(key, filePath) == 'Locale': + key, keyType = findKey(classLine[idx + len(key):]) + if keyType != 'String': + print " {}, Search Type = {}, Key Type = {}, Key = '{}', \tText = {}".format(num, searchType, keyType, key, classLine.strip()) + keyList.append([num, searchType, keyType, key, classLine.strip()]) + +## +# Read each line of the supplied file and call the parser +# filePath : The full path for the file +## +def doFile(filePath): + keyList.append([filePath]) + with io.open(filePath, "r", encoding="utf-8") as classFile: + num = 0 + for classLine in classFile: + num += 1 + findKeys(classLine, num, filePath) + +# Process a single file selection +if os.path.isfile(selectedItem): + print '\n Check {}'.format(selectedItem) + doFile(selectedItem) + +# Process package directory selection +if os.path.isdir(selectedItem): + globArgument = join(selectedItem, "*java") + for className in glob.glob(globArgument): + if os.path.basename(className) == 'Bundle.java': + continue + print '\n Check {}'.format(className) + doFile(className) +## +# Create the CSV header record +# csvFile : The output file +## +def writeHeader(csvFile): + csvFile.write("Line #") + csvFile.write("Search Type") + csvFile.write("Key Type") + csvFile.write("Key") + csvFile.write("Line Text / Class File") + csvFile.endRecord() + +## +# Create the CSV detail record +# The file path and name go into column 5 +# csvFile : The output file +## +def writeDetails(csvFile): + for keyRow in keyList: + if len(keyRow) == 1: + csvFile.write("") + csvFile.write("") + csvFile.write("") + csvFile.write("") + csvFile.write(keyRow[0]) + else: + csvFile.write('{}'.format(keyRow[0])) + csvFile.write(keyRow[1]) + csvFile.write(keyRow[2]) + csvFile.write(keyRow[3]) + csvFile.write(keyRow[4]) + csvFile.endRecord() + +# Provide the option to export the full class key list to an external file. +saveResp = JOptionPane.showConfirmDialog(None, "Do you want to export the full class key list to a CSV file?", dialogTitle, JOptionPane.YES_NO_OPTION) +if saveResp == 0: + fo = JFileChooser(FileUtil.getUserFilesPath()) + fo.setDialogTitle(dialogTitle) + fo.setFileFilter(FileNameExtensionFilter("CSV", ["csv"])); + ret = fo.showSaveDialog(None) + if ret == JFileChooser.APPROVE_OPTION: + keyFile = fo.getSelectedFile().toString() + csvFile = com.csvreader.CsvWriter(java.io.BufferedOutputStream(java.io.FileOutputStream(keyFile)),',',java.nio.charset.Charset.defaultCharset()) + writeHeader(csvFile) + writeDetails(csvFile) + csvFile.flush() + csvFile.close() + JOptionPane.showMessageDialog(None,"Class keys export completed",dialogTitle,JOptionPane.INFORMATION_MESSAGE) + +print '\n {} Done'.format(dialogTitle) + diff --git a/scripts/HOWTO-distribution.md b/scripts/HOWTO-distribution.md index 1e99b689fa3..1f81c3513ba 100644 --- a/scripts/HOWTO-distribution.md +++ b/scripts/HOWTO-distribution.md @@ -60,7 +60,7 @@ If you're attempting to perform this on MS Windows, refer to the MS Windows note - Update this note by (details in the update-HOWTO.sh comments; arguments when you run it should be last release, this release you're making, the next release; you may need to update): ``` - ./scripts/update-HOWTO.sh 4.9.5 4.9.6 4.9.7 + ./scripts/update-HOWTO.sh 4.9.6 4.9.7 4.9.8 ``` (and then manually update that line above to be last version release, this version being made today, next version to be made later; i.e. when starting to do *.4, the arguments are *.3 *.4 *.5) @@ -155,7 +155,7 @@ We roll some general code maintenance items into the release process. They can - If you fixed anything, commit it back. Also commit the current copy of these notes. Push directly back to master on GitHub. ``` -git commit -m"for 4.9.5" scripts/HOWTO-distribution.md +git commit -m"for 4.9.6" scripts/HOWTO-distribution.md git push github ``` @@ -172,13 +172,13 @@ git push github ``` cd (local web copy)/releasenotes git pull - cp jmri4.9.5.shtml jmri4.9.6.shtml + cp jmri4.9.6.shtml jmri4.9.7.shtml (edit the new release note accordingly) change numbers throughout move new warnings to old remove old-version change notes - git add jmri4.9.5.shtml - git commit -m"start new 4.9.6 release note" jmri4.9.6.shtml + git add jmri4.9.6.shtml + git commit -m"start new 4.9.7 release note" jmri4.9.7.shtml git push github cd (local JMRI copy) ``` @@ -213,13 +213,13 @@ where the date at the end should be the date (and optionally time) of the last r - Put the following comment in the release GitHub item saying the branch exists, and all future changes should be documented in the new release note: ``` -The release-4.9.5 branch has been created. +The release-4.9.6 branch has been created. -From now on, please document your changes in the [jmri4.9.6.shtml](https://github.com/JMRI/website/blob/master/releasenotes/jmri4.9.6.shtml) release note file. +From now on, please document your changes in the [jmri4.9.7.shtml](https://github.com/JMRI/website/blob/master/releasenotes/jmri4.9.7.shtml) release note file. -Maintainers, please set the 4.9.6 milestone on pulls from now on, as that will be the next test release from the HEAD of the master branch. +Maintainers, please set the 4.9.7 milestone on pulls from now on, as that will be the next test release from the HEAD of the master branch. -Jenkins will be creating files shortly at the [CI server](http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.5/) +Jenkins will be creating files shortly at the [CI server](http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6/) ```` ================================================================================ @@ -248,11 +248,11 @@ Jenkins will be creating files shortly at the [CI server](http://jmri.tagadab.co - Change the release note to point to the just-built files (in CI or where you put them), commit, wait (or force via ["Build Now"](http://jmri.tagadab.com/jenkins/job/Web%20Site/job/Website%20from%20JMRI%20GitHub%20website%20repository/) update). Confirm visible on web. -- Announce the file set via email to jmri-developers@lists.sf.net with a subject line "First 4.9.5 files available": +- Announce the file set via email to jmri-developers@lists.sf.net with a subject line "First 4.9.6 files available": -First JMRI 4.9.5 files are available in the usual way at: +First JMRI 4.9.6 files are available in the usual way at: -http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.5 +http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6 Feedback appreciated. I would like to release this later today or tomorrow morning. @@ -263,7 +263,7 @@ Feedback appreciated. I would like to release this later today or tomorrow morni If anybody wants to add a change from here on in, they should -- Ideally, start the work on either the release-4.9.5 branch (if working after that was started) or on a branch-from-master that's _before_ the release-4.9.5 branch was created. That way, the change can be cleanly included in the release branch, and also directly onto master. +- Ideally, start the work on either the release-4.9.6 branch (if working after that was started) or on a branch-from-master that's _before_ the release-4.9.6 branch was created. That way, the change can be cleanly included in the release branch, and also directly onto master. - Commit their changes to that branch, and push as needed to get it to their GitHub fork. @@ -271,7 +271,7 @@ If anybody wants to add a change from here on in, they should - One to master, as usual - - One to the release branch e.g. "release-4.9.5". The comment on this PR should explain why this should be included instead of waiting for the next release. + - One to the release branch e.g. "release-4.9.6". The comment on this PR should explain why this should be included instead of waiting for the next release. Merging the PR to the master makes those changes available on further developments forever; the one on the release, if accepted, includes the change and kicks off new runs of the various CI and build jobs. @@ -279,7 +279,7 @@ If anybody wants to add a change from here on in, they should If somebody has merged their change into master (or it's branched from master later than the release tag), you have two choices: -- Merge master into the release-4.9.5 branch. This will bring _everything_ that's been merged in, so remember to update the version markers on those PRs. Effectively, you've just started the release process later. Note that the `release.properties` file will have the wrong minor number in it: You'll have to edit and commit that to get the right number in the release. +- Merge master into the release-4.9.6 branch. This will bring _everything_ that's been merged in, so remember to update the version markers on those PRs. Effectively, you've just started the release process later. Note that the `release.properties` file will have the wrong minor number in it: You'll have to edit and commit that to get the right number in the release. - `git cherrypick` just the changes you want. Read the documentation on that command carefully and double check your work. If possible, check the contents of the release branch on the GitHub web site to make sure only the changes you wanted were included. @@ -311,13 +311,13 @@ This step uploads the Linux, Mac OS X and Windows files to the SourceForge file (replace "user" below with your SourceForge.net user name; must have SSH keys for SourceForge.net set up) - - (The "./testrelease 4.9.5" local script on shell.sf.net does the following steps, except for the edit, of course) + - (The "./testrelease 4.9.6" local script on shell.sf.net does the following steps, except for the edit, of course) ``` ssh user,jmri@shell.sf.net create ssh user,jmri@shell.sf.net - curl -o release.zip "http://jmri.tagadab.com/jenkins/job/Test%20Releases/job/4.9.5/ws/dist/release/*zip*/release.zip" + curl -o release.zip "http://jmri.tagadab.com/jenkins/job/Test%20Releases/job/4.9.6/ws/dist/release/*zip*/release.zip" (use the following instead if building on second Jenkins server) - curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.5/ws/dist/release/*zip*/release.zip" + curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6/ws/dist/release/*zip*/release.zip" rm release/JMRI* unzip release.zip cd release @@ -366,28 +366,28 @@ Note: Unlike releasing files to SourceForge, once a GitHub Release is created it - Fill out form: - - "tag version field" gets v4.9.5 (e.g. leading lower-case "v") - - @ branch: select the release-4.9.5 release branch + - "tag version field" gets v4.9.6 (e.g. leading lower-case "v") + - @ branch: select the release-4.9.6 release branch ``` -"Release title" field gets "Test/Prod Release 4.9.5" +"Release title" field gets "Test/Prod Release 4.9.6" ``` - Description content (the testrelease script above proposed this!): ``` -[Release notes](http://jmri.org/releasenotes/jmri4.9.5.shtml) +[Release notes](http://jmri.org/releasenotes/jmri4.9.6.shtml) Checksums: File | SHA256 checksum ---|--- -[JMRI.4.9.5.Re5a0179.dmg](https://github.com/JMRI/JMRI/releases/download/v4.9.5/JMRI.4.9.5.Re5a0179.dmg) | 9e7e4fcd9cfe6a5cadf50c2b1bdf6f1e838d524ff4ce5fd90191e254fd584525 -[JMRI.4.9.5.Re5a0179.exe](https://github.com/JMRI/JMRI/releases/download/v4.9.5/JMRI.4.9.5.Re5a0179.exe) | fd7a4b12d119761e44d2441e2a715ddbd9b6cf857d0418d5470303bd9aefd2e6 -[JMRI.4.9.5.Re5a0179.tgz](https://github.com/JMRI/JMRI/releases/download/v4.9.5/JMRI.4.9.5.Re5a0179.tgz) | 9e22b0dd001c8c541ad6899058d3e25140ddd3dac229098eece1899ff064dbfc +[JMRI.4.9.6.Re5a0179.dmg](https://github.com/JMRI/JMRI/releases/download/v4.9.6/JMRI.4.9.6.Re5a0179.dmg) | 9e7e4fcd9cfe6a5cadf50c2b1bdf6f1e838d524ff4ce5fd90191e254fd584525 +[JMRI.4.9.6.Re5a0179.exe](https://github.com/JMRI/JMRI/releases/download/v4.9.6/JMRI.4.9.6.Re5a0179.exe) | fd7a4b12d119761e44d2441e2a715ddbd9b6cf857d0418d5470303bd9aefd2e6 +[JMRI.4.9.6.Re5a0179.tgz](https://github.com/JMRI/JMRI/releases/download/v4.9.6/JMRI.4.9.6.Re5a0179.tgz) | 9e22b0dd001c8c541ad6899058d3e25140ddd3dac229098eece1899ff064dbfc ``` - Attach files by selecting them or dragging them in (you might have to have downloaded them above via e.g. a separate ``` -curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.5/lastSuccessfulBuild/artifact/dist/release/*zip*/release.zip"" +curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6/lastSuccessfulBuild/artifact/dist/release/*zip*/release.zip"" ``` and expansion; it's slow to upload from a typical home connection, though, so wish we had a way to cross-load from somewhere fast - if release.zip is still on SF.net, you can do ``` @@ -401,9 +401,9 @@ Note there's a little progress bar that has to go across & "Uploading your relea Alternatively, if you have shell access to the Jenkins server, you perhaps can upload directly from there, once the initial draft release has been created (this hasn't been tested): ``` -github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.5 -n "JMRI.4.9.5+Rd144052.dmg" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.9.5/workspace/dist/release/JMRI.4.9.5+Rd144052.dmg -github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.5 -n "JMRI.4.9.5+Rd144052.exe" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.5+Rd144052.exe -github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.5 -n "JMRI.4.9.5+Rd144052.tgz" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.5+Rd144052.tgz +github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.6 -n "JMRI.4.9.6+Rd144052.dmg" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.9.6/workspace/dist/release/JMRI.4.9.6+Rd144052.dmg +github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.6 -n "JMRI.4.9.6+Rd144052.exe" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.6+Rd144052.exe +github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.6 -n "JMRI.4.9.6+Rd144052.tgz" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.6+Rd144052.tgz ``` - Click "Publish Release" @@ -421,7 +421,7 @@ git fetch git checkout master git pull git checkout -b temp-master -git merge origin/release-4.9.5 +git merge origin/release-4.9.6 ``` Note that you're testing the merge of the release branch back onto master. This should report "Already up-to-date.", i.e. no changes, with the possible exception of some auto-generated files: @@ -453,11 +453,12 @@ git checkout -b (release-n.n.n+1) git push github ``` -- Create the next [GitHub Issue](https://github.com/JMRI/JMRI/issues) to hold discussion with conventional title "Create Test Release 4.9.6". Add the next release milestone (created above) to it. Typical text: - +- Create the next [GitHub Issue](https://github.com/JMRI/JMRI/issues) to hold discussion with conventional title "Create Test Release 4.9.7". Add the next release milestone (created above) to it. Typical text: +``` This is the third release of the 4.10 cycle. It's intended to be released around Novemebr 18 from HEAD of master. +``` -- Confirm that the tag for the current release (release-4.9.5) is in place, then manually delete the current release branch via the [GitHub UI](https://github.com/JMRI/JMRI/branches). +- Confirm that the tag for the current release (release-4.9.6) is in place, then manually delete the current release branch via the [GitHub UI](https://github.com/JMRI/JMRI/branches). - Go to the GitHub PR and Issues [labels list](https://github.com/JMRI/JMRI/labels) and remove any "afterNextTestRelease" (and "afterNextProductionRelease" if appropriate) labels from done items @@ -487,26 +488,27 @@ If you don't, a bunch of Windows users are likely to whine - Mail announcement to jmriusers@yahoogroups.com - Subject is "Test version 4.9.5 of JMRI/DecoderPro is available for download" or "JMRI 4.8 is available for download" + Subject is "Test version 4.9.6 of JMRI/DecoderPro is available for download" or "JMRI 4.8 is available for download" Content: -Test version 4.9.5 of JMRI/DecoderPro is available for download. +Test version 4.9.6 of JMRI/DecoderPro is available for download. This is the next in a series of test releases that will culminate in a production release, hopefully in December 2017. -There have been a lot of updates in this version, so it should be considered experimental. +- Alt: There have been a lot of updates in this version, so it should be considered experimental. +- Alt: We're getting close to the end of the development series, so we'd appreciate feedback on whether or not this release works for your layout. -If you use JMRI on Linux or Mac and are updating from JMRI 4.7.3 or earlier, there’s a necessary migration step. (Not needed on Windows) Please see the release note for details: +If you use JMRI on Linux or Mac and are updating from JMRI 4.7.3 or earlier, there’s a necessary migration step. (Not needed on Windows) Please see the release note for details: -For more information on the issues, new features and bug fixes in 4.9.5 please see the release note: - +For more information on the issues, new features and bug fixes in 4.9.6 please see the release note: + Note that JMRI is made available under the GNU General Public License. For more information, please see our copyright and licensing page. The download links, along with lots of other information which we hope you'll read, can be found on the release note page: - + - If a production version, update the SF automatic download icon by selecting default in SF.net FRS (3 times) @@ -559,7 +561,7 @@ If you're building locally: - Get the release in your local work directory ``` - git checkout release-4.9.5 + git checkout release-4.9.6 ``` - edit release.properties to say release.official=true (last line) diff --git a/xml/decoderIndex.xml b/xml/decoderIndex.xml index 063d7e8cdf4..0b0f80825b1 100644 --- a/xml/decoderIndex.xml +++ b/xml/decoderIndex.xml @@ -1,8 +1,8 @@ - - + + @@ -2375,6 +2375,9 @@ + + + @@ -2397,6 +2400,9 @@ + + + @@ -2432,6 +2438,12 @@ + + + + + + @@ -10528,6 +10540,66 @@ + + + + + + + + dcc + + + + + + + + + dcc + + + + + + + + + + + dcc + + + + + + + + + dcc + + + + + + + + + + + dcc + + + + + + + + + dcc + + + diff --git a/xml/decoders/Digitrax_BDL168.xml b/xml/decoders/Digitrax_BDL168.xml new file mode 100644 index 00000000000..e37cd8ce2bc --- /dev/null +++ b/xml/decoders/Digitrax_BDL168.xml @@ -0,0 +1,699 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + LOCONETBDOPSWMODE + + + + + + + + + + + + + Direct Home Wiring + + + Whole-layout Common Rail Wiring + + + + + + + + + normal + + + reversed (pay attention to other RailSync wire) + + + + + + + + + Disable Transponding + + + Enable Transponding + + + + + + + + Enable Transponding + + + Unsupported + + + + + + + + Enable Transponding + + + Unsupported + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + report occupied when zone power is off + + + are not forced when zone power is off + + + + + + + + + is a normal Detection Section + + + is a Zone Power ON qualifier for whole-layout common-rail wired systems + + + + + + + + + acts as the LocoNet Master + + + is not the LocoNet Master + + + + + + + + + provides LocoNet termination + + + does not terminate LocoNet + + + + + + + + + Wait for 5-second power-up delay (for DB150 compatibility) + + + Wait for 0.5 second power-up delay + + + + + + + + + Resistance below about 22K Ohms is shown as Occupied + + + Resistance below about 10K Ohms is shown as Occupied + + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Responds with status at GPON and interrogate commmands + + + Responds only to interrogate commmands + + + + + + + + Standard interrogation + + + Ignore OpSw36 setting; reply at every interrogation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sequential Mode + + + Verbose Mode + + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sends Transponding messages + + + does not send Transponding messages + + + + + + + + + + OpSws + + Short Address + gt + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Basic + + + + + + + + + Basic OpSw Settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Transponding Controls + + + + + + + + + + + Notes + + + + + + + + + + + + + + + + + CVs + CV + CV-Tabelle + Taula-CV + Tabulka CV + CV-tabel + + Short Address + eq + 0 + + + + + + + + \ No newline at end of file diff --git a/xml/decoders/Digitrax_DS64.xml b/xml/decoders/Digitrax_DS64.xml new file mode 100644 index 00000000000..e9b53a290cc --- /dev/null +++ b/xml/decoders/Digitrax_DS64.xml @@ -0,0 +1,645 @@ + + + + + + + + + + + + + + + + + + + + + + + + + LOCONETBDOPSWMODE + + + + + + + + + + + + Outputs are pulsed (OpSw1=t) + Thrown is first choice; Closed is second choice + + + Outputs are static (OpSw1=c) + Thrown is first choice; Closed is second choice + + + + + + + Outputs pulse active or blink for 0.1 second (OpSw2=t) + + + Outputs pulse active or blink for 0.2 second (OpSw2=c) + + + + + + + + Add 0 seconds to the pulse or blink rate (OpSw3=t) + + + Add 0.3 seconds to the pulse or blink rate (OpSw3=c) + + + + + + + + Add 0 seconds to the pulse or blink rate (OpSw4=t) + + + Add 0.7 seconds to the pulse or blink rate (OpSw4=c) + + + + + + + + + Add 0 seconds to the pulse or blink rate (OpSw5=t) + + + Add 1.5 seconds to the pulse or blink rate (OpSw5=c) + + + + + + + + Outputs automatically power-up to the last known state (OpSw6=t) + Thrown is first choice; Closed is second choice + + + Each output remain undriven until its turnout command is received (OpSw6=c) + Thrown is first choice; Closed is second choice + + + + + + + + Short delay for interrogation requests (OpSw8=t) + Thrown is first choice; Closed is second choice + + + Long delay for interrogation requests (OpSw8=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Static Outputs remain powered (OpSw9=t) + Thrown is first choice; Closed is second choice + + + Static Outputs are shut off after 16 seconds (OpSw9=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Throttle and Computer commands are accepted (OpSw10=t) + Thrown is first choice; Closed is second choice + + + Computer commands are accepted (OpSw10=c) + Thrown is first choice; Closed is second choice + + + + + + + Routes are triggered by Switch commands from Computers or Throttles (OpSw11=t) + Thrown is first choice; Closed is second choice + + + Routes are triggered by DS64 inputs (OpSw11=c) + Thrown is first choice; Closed is second choice + + + + + + + + S inputs affect output; A inputs send Sensor messages (OpSw12=t) + Thrown is first choice; Closed is second choice + + + A input high forces output "Thrown"; S input high forces output "Closed" (OpSw12 = c) + Thrown is first choice; Closed is second choice + + + + + + + + Inputs have no effect (OpSw13=t) + Thrown is first choice; Closed is second choice + + + Inputs act as LocoNet Sensors and also control related outputs per OpSw12 (OpSw13=c) + Thrown is first choice; Closed is second choice + + + + + + + + Accepts commands from LocoNet messages and Track (OpSw14=t) + Thrown is first choice; Closed is second choice + + + Accepts commands from Track only (OpSw14=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Inputs can control outputs (OpSw15=t) + Thrown is first choice; Closed is second choice + + + Inputs have no direct effect on outputs (OpSw15=c) + Thrown is first choice; Closed is second choice + + + + + + + + + + + + + Output 1 does not provide "crossing-gate" output (OpSw17=t) + Thrown is first choice; Closed is second choice + + + Output 1 provides "crossing-gate" output (OpSw17=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Output 2 does not provide "crossing-gate" output (OpSw18=t) + Thrown is first choice; Closed is second choice + + + Output 2 provides "crossing-gate" output (OpSw18=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Output 3 does not provide "crossing-gate" output (OpSw19=t) + Thrown is first choice; Closed is second choice + + + Output 3 provides "crossing-gate" output (OpSw19=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Output 4 does not provide "crossing-gate" output (OpSw20=t) + Thrown is first choice; Closed is second choice + + + Output 4 provides "crossing-gate" output (OpSw20=c) + Thrown is first choice; Closed is second choice + + + + + + + + + Inputs generate LocoNet "General Sensor" messages (OpSw21=t) + Thrown is first choice; Closed is second choice + + + Inputs generate LocoNet "LocoNet Turnout State" messages (OpSw21=c) + Thrown is first choice; Closed is second choice + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OpSws + + Short Address + gt + 0 + + + + + + + + + + + + + Basic + + + + + + + + DS64 Basic Settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Notes + + + + + + + + CVs + CV + CV-Tabelle + Taula-CV + Tabulka CV + CV-tabel + + Short Address + eq + 0 + + + + + + \ No newline at end of file diff --git a/xml/decoders/Digitrax_PM4.xml b/xml/decoders/Digitrax_PM4.xml new file mode 100644 index 00000000000..a45814ce5f7 --- /dev/null +++ b/xml/decoders/Digitrax_PM4.xml @@ -0,0 +1,501 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + LOCONETBDOPSWMODE + + + + + + + + + + + + Thrown + Closed + + + + + + Thrown + Closed + + + + + + Thrown + Closed + + + + + + Thrown + Closed + + + + + + Normal + Slow + + + + + + Short-circuit Protection (pins 5 and 6 unconnected) + Autoreversing (with pin E shorted to pin 5 and pin F shorted to pin 6) + + + + + + Thrown + Closed + + + + + + Normal + Slow + + + + + + Short-circuit Protection (pins 9 and 10 unconnected) + Autoreversing (with pin K shorted to pin 9 and pin L shorted to pin 10) + + + + + + Thrown + Closed + + + + + + Normal + Slow + + + + + + Short-circuit Protection (pins 13 and 14 unconnected) + Autoreversing (with pin P shorted to pin 13 and pin R shorted to pin 14) + + + + + + Thrown + Closed + + + + + + Slow + Normal + + + + + + + Short-circuit Protection (pins 17 and 18 unconnected) + Autoreversing (with pin U shorted to pin 17 and pin V shorted to pin 18) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OpSws + + Short Address + gt + 0 + + + + + + + + + + + + + + Basic + + + + + + + + Basic Settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Notes + + + + + + + + CVs + CV + CV-Tabelle + Taula-CV + Tabulka CV + CV-tabel + + Short Address + eq + 0 + + + + + + \ No newline at end of file diff --git a/xml/decoders/Digitrax_SE8c.xml b/xml/decoders/Digitrax_SE8c.xml new file mode 100644 index 00000000000..2c062a0f80e --- /dev/null +++ b/xml/decoders/Digitrax_SE8c.xml @@ -0,0 +1,507 @@ + + + + + + + + + + + + + + + + + + + + + + + + + LOCONETBDOPSWMODE + + + + + + + + Board IDs may be in the range 1-24 or 1-36, depending on the + number of aspects per head + + + + + + SE8c Mode + + + Reserved + + + + + + + + Four aspects per head + + + Two aspects per head + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Thrown + + + Closed + + + + + + + + Thrown + + + Closed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pulsed outputs + + + Static outputs for Semaphores or slow-motion turnout machines + + + + + + + + + + + + + + DCC Track Signal (RailSync wires in LocoNet cable) + + + LocoNet messages + + + + + + + + + toggle the corresponding SMTM0x outputs + + + are ignored + + + + + + + + + + + + + OpSws + + Short Address + gt + 0 + + + + + + + + + + + + + + Basic + + + + + + + + Basic SE8c OpSw Settings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Notes + + + + + + + CVs + CV + CV-Tabelle + Taula-CV + Tabulka CV + CV-tabel + + Short Address + eq + 0 + + + + + + diff --git a/xml/decoders/NCE_Light-It_accessory.xml b/xml/decoders/NCE_Light-It_accessory.xml new file mode 100644 index 00000000000..d6471062c64 --- /dev/null +++ b/xml/decoders/NCE_Light-It_accessory.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + 2017 + JMRI + + + + + Dave + Heap + + + + + + 1 + 2017-11-14 + DGH + Created + + + + + + + + + + + dcc + + + + + + + + + dcc + + + + + + Ops Mode Accessory Programming + accessory + 500 + + OPSACCBYTEMODE + + + + + + + + + + OPSACCBYTEMODE + + + + + + + + diff --git a/xml/decoders/NCE_Light-It_mobile.xml b/xml/decoders/NCE_Light-It_mobile.xml new file mode 100644 index 00000000000..a6637c90175 --- /dev/null +++ b/xml/decoders/NCE_Light-It_mobile.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + 2017 + JMRI + + + + + Dave + Heap + + + + + + 1 + 2017-11-14 + DGH + Created + + + + + + + + + + + dcc + + + + + + + + + dcc + + + + + + Ops Mode Delayed Programming + 500 + + OPSBYTEMODE + + + + + + + OPSBYTEMODE + + + + + + + + diff --git a/xml/decoders/NCE_Light-It_signal.xml b/xml/decoders/NCE_Light-It_signal.xml new file mode 100644 index 00000000000..889062de113 --- /dev/null +++ b/xml/decoders/NCE_Light-It_signal.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + 2017 + JMRI + + + + + Dave + Heap + + + + + + 1 + 2017-11-14 + DGH + Created + + + + + + + + + + + dcc + + + + + + + + + dcc + + + + + + Ops Mode Accessory Programming + signal + 500 + + OPSACCEXTBYTEMODE + + + + + + + + + + OPSACCBYTEMODE + + + + + + + + diff --git a/xml/decoders/SoundTraxx_Tsu2_Diesel.xml b/xml/decoders/SoundTraxx_Tsu2_Diesel.xml index 2dbe73a0c2f..3116c376499 100755 --- a/xml/decoders/SoundTraxx_Tsu2_Diesel.xml +++ b/xml/decoders/SoundTraxx_Tsu2_Diesel.xml @@ -97,6 +97,12 @@ MJM Added Poppet Valves select and more PM to Baldwin and other decoders + + 7 + 2017-11-21 + MJM + Added GEVO G12 Tier 4 to GE Diesels and fix bug in poppet value cv + @@ -1339,6 +1345,9 @@ GE Cummins + + GEVO G12 Tier 4 + @@ -1427,7 +1436,7 @@ - + Poppet Valves diff --git a/xml/decoders/SoundTraxx_Tsu_SoundCar.xml b/xml/decoders/SoundTraxx_Tsu_SoundCar.xml index f6a43841fea..dbd833db9fd 100644 --- a/xml/decoders/SoundTraxx_Tsu_SoundCar.xml +++ b/xml/decoders/SoundTraxx_Tsu_SoundCar.xml @@ -14,20 +14,26 @@ - + + + + - - + + + @@ -35,33 +41,107 @@ - + - - + + + + Headlight + Bell + Airhorn/Whistle + Short Horn + + FX5 Output + FX6 Output + Dimmer + Mute + Generator + Uncoupling + Apply/Release Brakes + Coupler Clank + - - Headlight - Bell - Airhorn/Whistle - Short Horn - Unassigned - FX5 Output - FX6 Output - Dimmer - Mute - Generator - Uncoupling - Apply/Release Brakes - Coupler Clank + + + + + + + + + + + + + + + + + + + + + + + Headlight + Bell + Airhorn/Whistle + Short Horn + + FX5 Output + FX6 Output + Dimmer + Mute + Generator + Uncoupling + Apply/Release Brakes + Coupler Clank + + + + + + + + + + + + + + + + + + + + + + + + Headlight + Bell + Airhorn/Whistle + Short Horn + Spook the Livestock + FX5 Output + FX6 Output + Dimmer + Mute + Generator + Uncoupling + Apply/Release Brakes + Coupler Clank + @@ -365,12 +445,10 @@ - @@ -406,12 +484,10 @@ - @@ -447,12 +523,10 @@ - @@ -488,12 +562,10 @@ - @@ -514,12 +586,10 @@ - @@ -556,12 +626,10 @@ - @@ -571,7 +639,7 @@ - + @@ -606,22 +674,20 @@ - - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - + - + - --> - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + - - + Generator sound effect controlled by F9 Effetto suono Generatore controllato da F9 @@ -1590,8 +1638,8 @@ - - + + Two axles per truck Carrello a 2 assi @@ -1628,7 +1676,8 @@ - + + Wabco E2 @@ -1646,7 +1695,58 @@ - - - - - + --> + + - Disable + Disabled Cattle @@ -2000,9 +2100,9 @@ - + - + Cast bell @@ -2020,7 +2120,34 @@ - + + + + + Modern Cast bell + Campana in Fusione, moderno + + + Bronze Cast bell + Campana di Bronzo + + + Cast bell + Campana in Fusione + + + Electronic bell + Campana Elettronica + + + Gong bell + Campana a Gong + + + + + + F1 @@ -2028,36 +2155,36 @@ F2 - + F3 F4 - + F5 F6 - - + + F7 F8 - + F9 F10 - + F11 F12 - + @@ -2079,9 +2206,9 @@ - + --> diff --git a/xml/decoders/TCS_FW86.xml b/xml/decoders/TCS_FW86.xml index a675a533a02..e200491521c 100644 --- a/xml/decoders/TCS_FW86.xml +++ b/xml/decoders/TCS_FW86.xml @@ -16,9 +16,11 @@ + + @@ -269,73 +271,77 @@ - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - + + @@ -349,98 +355,117 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - diff --git a/xml/decoders/nce/lightItBasicPane.xml b/xml/decoders/nce/lightItBasicPane.xml new file mode 100644 index 00000000000..ba2239c7e6a --- /dev/null +++ b/xml/decoders/nce/lightItBasicPane.xml @@ -0,0 +1,103 @@ + + + Basic + Bàsic + Basic + Basis + Základní + Basis + + + + + + + + + + + Address Format + exists + 1 + + + + + + + + + Indirizzo Corto + Establir adreça primària (curta) + Definiert die Kurze Adresse + Nastavit primární (krátkou) adresu + Bepaalt het Korte Adres + + + Imposta l'indirizzo esteso + Establir adreça llarga + Definiert die Lange Adresse + Nastavit rozšířenou (dlouhou) adresu + Bepaalt het Lang Adres + + + Determina se la Loco usa l'indirizzo corto o quello esteso + Estableix si es fa servir adreça curta o llarga + Lok benutzt lange oder kurze Adresse + Určuje zdali bude lokomotiva používat krátkou nebo dlouhou adresu + Bepaalt of Loc het lange of het korte adres gebruikt + + + + + diff --git a/xml/decoders/nce/lightItCVs.xml b/xml/decoders/nce/lightItCVs.xml new file mode 100644 index 00000000000..fdb7d7ed6f7 --- /dev/null +++ b/xml/decoders/nce/lightItCVs.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 - All Flashing + + + + + + + + 31 - All Off + + + + + + diff --git a/xml/decoders/nce/lightItEnumFunction.xml b/xml/decoders/nce/lightItEnumFunction.xml new file mode 100644 index 00000000000..2ffe9d12fb1 --- /dev/null +++ b/xml/decoders/nce/lightItEnumFunction.xml @@ -0,0 +1,90 @@ + + + + F0 + + + F1 + + + F2 + + + F3 + + + F4 + + + F5 + + + F6 + + + F7 + + + F8 + + + F9 + + + F10 + + + F11 + + + F12 + + + F13 + + + F14 + + + F15 + + + F16 + + + F17 + + + F18 + + + F19 + + + F20 + + + F21 + + + F22 + + + F23 + + + F24 + + + F25 + + + F26 + + + F27 + + + F28 + + diff --git a/xml/decoders/nce/lightItEnumLightEffect.xml b/xml/decoders/nce/lightItEnumLightEffect.xml new file mode 100644 index 00000000000..957d755665f --- /dev/null +++ b/xml/decoders/nce/lightItEnumLightEffect.xml @@ -0,0 +1,51 @@ + + + + 0 – off (all outputs off) + + + 1 – Steady on + + + 2 – Slow flashing + + + 3 – Fluorescent flicker A, more on than off + + + 4 – Fluorescent flicker B, more off than on + + + 5 – Fluorescent flicker C, a definitely dying fluorescent tube + + + 6 – Single strobe light (every 2 seconds) + + + 7 – Double strobe light (every 2 seconds) + + + 8 – Rotary beacon + + + 9 – Railroad crossing signal phase A + + + 10 – Railroad crossing signal phase B + + + 11 – Random on/off (times from 4 seconds to 1 minute) + + + 12 – Random on/off (times from 4 seconds to 2 minutes) + + + 13 – Random on/off (times from 8 seconds to 4 minutes) + + + 14 – Mercury vapor street light (coming on over about 30 seconds) + + + 15 – Rapid flashing + + diff --git a/xml/decoders/nce/lightItEnumSignalEffect.xml b/xml/decoders/nce/lightItEnumSignalEffect.xml new file mode 100644 index 00000000000..9efaa23893f --- /dev/null +++ b/xml/decoders/nce/lightItEnumSignalEffect.xml @@ -0,0 +1,51 @@ + + + + 0 - Red + + + 1 - Yellow + + + 2 - Green + + + 3 - Flashing Red + + + 4 - Flashing Yellow + + + 5 - Flashing Green + + + 6 - Red + Yellow + + + 7 - Flashing Red + Yellow + + + 8 - Red + Flashing Yellow + + + 9 - Red + Green + + + 10 - Flashing Red + Green + + + 11 - Red + Flashing Green + + + 12 - Yellow + Green + + + 13 - Flashing Yellow + Green + + + 14 - Yellow + Flashing Green + + + 15 - All On + + diff --git a/xml/decoders/nce/lightItOutputsPane.xml b/xml/decoders/nce/lightItOutputsPane.xml new file mode 100644 index 00000000000..7dab2b4562e --- /dev/null +++ b/xml/decoders/nce/lightItOutputsPane.xml @@ -0,0 +1,80 @@ + + + Outputs + + + + + + + + + + + W/G Effect + exists + 1 + + + + + + + + + + + + + + + + + + + + Aspect 0 + exists + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/decoders/zimo/CV260-CV355sound.xml b/xml/decoders/zimo/CV260-CV355sound.xml index 7925dc9a9be..6056f306843 100644 --- a/xml/decoders/zimo/CV260-CV355sound.xml +++ b/xml/decoders/zimo/CV260-CV355sound.xml @@ -624,7 +624,7 @@ - + diff --git a/xml/decoders/zimo/CV260-CV355sound_version30.xml b/xml/decoders/zimo/CV260-CV355sound_version30.xml index c426415600c..847cc0e7973 100644 --- a/xml/decoders/zimo/CV260-CV355sound_version30.xml +++ b/xml/decoders/zimo/CV260-CV355sound_version30.xml @@ -751,7 +751,7 @@ - + diff --git a/xml/schema/decoder.xsd b/xml/schema/decoder.xsd index bc59212da4d..7547a03fe4d 100644 --- a/xml/schema/decoder.xsd +++ b/xml/schema/decoder.xsd @@ -924,6 +924,7 @@ + diff --git a/xml/schema/types/editors.xsd b/xml/schema/types/editors.xsd index 89aba4c0dd3..2491300cef2 100644 --- a/xml/schema/types/editors.xsd +++ b/xml/schema/types/editors.xsd @@ -204,6 +204,43 @@ + + + + Define the XML structure for storing and loading LayoutTrackDrawingOptions + + + jmri.jmrit.display.layouteditor.configurexml.LayoutTrackDrawingOptionsXml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/schema/types/layouteditor.xsd b/xml/schema/types/layouteditor.xsd index 774e881730e..7f11caa1d2b 100644 --- a/xml/schema/types/layouteditor.xsd +++ b/xml/schema/types/layouteditor.xsd @@ -37,8 +37,9 @@ jmri.jmrit.display.configurexml.LayoutEditorXml - + + @@ -60,8 +61,8 @@ - +