Package jmri.jmrix

Class AbstractLoaderPane

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
LoaderPane, LoaderPane

public abstract class AbstractLoaderPane extends JmriPanel implements ActionListener
Pane for downloading .hex files and .dmf files to those LocoNet devices which support firmware updates via LocoNet IPL messages. This version relies on the file contents interpretation mechanisms built into the readHex() methods found in class jmri.jmrit.MemoryContents to automatically interpret the file's addressing type - either 16-bit or 24-bit addressing. The interpreted addressing type is reported in the pane after a file is read. The user cannot select the addressing type. This version relies on the file contents checking mechanisms built into the readHex() methods found in class jmri.jmrit.MemoryContents to check for a wide variety of possible issues in the contents of the firmware update file. Any exception thrown by at method is used to select an error message to display in the status line of the pane.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getHelpTarget

      public abstract String getHelpTarget()
      Provide a help target string which an enclosing frame can provide as a help reference.

      This automatically provides a reference to the usual place for JMRI window-specific help pages that are named for the implementing class, but note this is a Pane class, not a Frame class.

      Overrides:
      getHelpTarget in class JmriPanel
      Returns:
      the target String
    • addOptionsPanel

      protected void addOptionsPanel()
      Include code to add additional options here. By convention, if you include visible options, follow with a JSeparator.
    • initComponents

      public void initComponents()
      2nd stage of initialization, invoked after the constructor is complete.
      Overrides:
      initComponents in class JmriPanel
    • addChooserFilters

      protected void addChooserFilters(JFileChooser chooser)
      Add filter(s) for possible types to the input file chooser.
      Parameters:
      chooser - the file chooser to add filter(s) to
    • handleOptionsInFileContent

      protected void handleOptionsInFileContent(MemoryContents inputContent)
    • doRead

      protected void doRead(JFileChooser chooser)
      Read file into local memory.
      Parameters:
      chooser - chooser to select the file to read from
    • doLoad

      protected void doLoad()
    • doVerify

      protected void doVerify()
    • enableDownloadVerifyButtons

      protected void enableDownloadVerifyButtons()
      Cleans up the GUI interface. Updates status line to a localized "done" message or a localized "aborted" message depending on the value returned by isOperationAborted() . Assumes that the file was properly read to memory and is usable for firmware update and/or verify operations, and configures the Load, and Verify GUI buttons as enabled, and the Abort GUI button as disabled.
    • disableDownloadVerifyButtons

      protected void disableDownloadVerifyButtons()
      Cleans up the GUI interface after a firmware file read fails. Assumes that the invoking code will update the GUI status line as appropriate for the particular cause of failure. Configures the Load, Verify and Abort GUI buttons as disabled.
    • setOperationAborted

      protected void setOperationAborted(boolean state)
    • isOperationAborted

      protected boolean isOperationAborted()
    • setDefaultFieldValues

      protected void setDefaultFieldValues()
    • parametersAreValid

      protected boolean parametersAreValid()
      Checks the values in the GUI text boxes to determine if any are invalid. Intended for use immediately after reading a firmware file for the purpose of validating any key/value pairs found in the file. Also intended for use immediately before a "verify" or "download" operation to check that the user has not changed any of the GUI text values to ones that are unsupported. Note that this method cannot guarantee that the values are suitable for the hardware being updated and/or for the particular firmware information which was read from the firmware file.
      Returns:
      false if one or more GUI text box contains an invalid value
    • intParameterIsValid

      protected boolean intParameterIsValid(JTextField jtf, int minOk, int maxOk)
    • updateDownloadVerifyButtons

      protected void updateDownloadVerifyButtons()
      Conditionally enables or disables the Download and Verify GUI buttons based on the validity of the parameter values in the GUI and the state of the memory contents object.
    • clearInputFileName

      public void clearInputFileName()
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener