Class DownloadDialog

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class DownloadDialog extends TextDialog
Complex multi-lingual dialog for installing "DEnS" = "Documentation, Examples and Sources" on the local machine. Could be used for other kinds of archives when the texts are adjusted accordingly. After completion of this dialog (a) the local file system may have changed and (b) the CALLER must retrieve this info (by get_newPosition() and
See Also:
  • Field Details

    • lang

      final String lang
      Current user language. Is fixed for one run uf this dialog.
    • langs

      final List<String> langs
      List of language preferences. Only needed for fall-back when a translation is missing.
    • defaultLang

      public static final String defaultLang
      Current language, if none is given to the constructor call.
      See Also:
    • DEnS_dir_name

      protected final String DEnS_dir_name
      Input parameter by the caller: name of the DEnS directory, fixed per application.
    • downloadUrl

      protected final URL downloadUrl
      Input parameter by the caller: where to download the ZIP file.
    • browseUrl

      @Opt protected final @Opt URL browseUrl
      Input parameter by the caller: where to read the documentation online.
    • docu_start_filepath

      protected final String docu_start_filepath
      Input parameter by the caller: relative start for HTML-browing relative to DEnS_dir_name.
    • oldPosition

      @Opt protected final @Opt File oldPosition
      Input parameter by the caller: last local store positon of DEnS, if any.
    • curPosition

      @Opt protected @Opt File curPosition
      Local value: last successful storage of DEnS during this dialog.
    • newPosition

      @Opt protected @Opt File newPosition
      Output value: last successful storage of DEnS during this dialog.
    • oldDigest

      @Opt protected final @eu.bandm.tools.annotations.Opt byte[] oldDigest
      Input parameter by the caller: last checksum d of DEnS, if any.
    • curDigest

      @Opt protected @eu.bandm.tools.annotations.Opt byte[] curDigest
      Local value: last checksum of DEnS during this dialog.
    • newDigest

      @Opt protected @eu.bandm.tools.annotations.Opt byte[] newDigest
      Output value: last checksum of DEnS during this dialog.
    • tampered

      protected boolean tampered
      Output value: whether the current/new downloaded data has been locally altered.
    • mulicat

      protected CatalogByString mulicat
      Dictionary of all translations. Must be enhanced when new a language is added.
    • selected_DEnS_Path

      protected File selected_DEnS_Path
      Temporary storage during dialog, between choosing and confirmation.
  • Constructor Details

    • DownloadDialog

      public DownloadDialog(@Opt @Opt JFrame frame, @Opt @Opt String title, String DEnS_dir_name, URL downloadUrl, @Opt @Opt URL browseUrl, String docu_start_filepath, boolean modal, @Opt @Opt String lang, @Opt @Opt File oldPosition, @Opt @eu.bandm.tools.annotations.Opt byte[] oldDigest, @Opt @Opt String serviceEmail, @Opt @Opt Dimension windowsize)
      After creation the (inherited) message runDialog() must be called. This performs the dialog by calling "react()" etc.
      This dialog class has its own translation dictionary. This must also contain the translations for the error messages from
  • Method Details

    • get_newPosition

      @Opt public @Opt File get_newPosition()
      Output parameter: Only set != null when a new position has been entered by the user and the download succeeded.
    • get_newDigest

      @Opt public @eu.bandm.tools.annotations.Opt byte[] get_newDigest()
      Output parameter: Is != null iff get_newPosition()!= null.
    • get_tampered

      public boolean get_tampered()
      Output parameter: whether the current/new downloaded data has been locally altered.
    • muli

      protected String muli(String key, List<String> translations, Object... args)
      Definition of a new translation at the place of its application. Returns the translated text. (Not useful with MulIMessage sending!)
    • muli

      protected String muli(String key, List<String> translations)
      Definition of a new translation at the place of its application. Returns the translated text. (Not useful with MulIMessage sending!)
    • muli

      protected String muli(String key, String... pairs)
      Definition of a new translation at the place of its application. Returns the translated text. (Not useful with MulIMessage sending!)
    • appendStatusText

      protected void appendStatusText()
      Create text which describes the current information status, and which will appear as first. Is only called ONCE(1), at the very beginning. First inquiry situation:
      persistent info, but no old download
      persistent info, old download, tampered with
      persistent info, old download, unchanged
    • appendAlternatives

      protected void appendAlternatives()
      Create text which describes the possible alternatives
      download/download anew
      browse online
      browse local IFF local loaded
    • closeDialogLink

      protected String closeDialogLink()
      Text building block.
    • react

      protected void react()
      Reactions on situation/alternative texts:
      answer = "download"
      ===> file chooser
      =======> result = abort ====> restart loop
      =======> result = selected ====> safety question
      =======> answer = cancel ====> restart loop
      =======> answer = okay ====> start download, iff okay, calculate new checksum, set values of curPosition, curDigest and tampered.


      answer = "browseMet" "browseLocal"
      ===> browser remote control failed ===> show text to load page manually
      ===> browser remote control returns okay ===> show text to end dialog
      Overrides:
      react in class TextDialog