Package eu.bandm.tools.installer
Class DownloadDialog
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
eu.bandm.tools.graficUtils.TextDialog
eu.bandm.tools.installer.DownloadDialog
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
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
ATTENTION some of the translation keys are defined by messages from "GetAndUnpackZipArchive".
(Created by extracting from bandm_book/.../book2/base/Gui.java,translations.muli and extending (checksum, etc).)
(Replaces DownloadDialog_DeEn, which is deprecated because it uses jawaws/JNLP)
get_newPosition()
and
get_newDigest()
) and store it persistently.
The initial situation when calling may be
position and checksums of DEnS known, | unknown (from persistent storage or a previous call) | calculate checksum anew | digest identical, files | differ, files changed| unchanged | | | | uptodate | outofdate | uptodate | outofdate | | | | | ----print this situation---------------------------------------- ask for user wishes 1) download DEnS .......................................... 2) browse local copy .......................... 3) browse web copy ...................................... 4) terminate this dialog ................................. ---- download process ------------------------------------------ online | load zip | unzip | calculate md5 | ---- AFTER return / must be done on caller's level ------------- store position/checksum to persistent storageThe architecture is as follows
+--------------------+ |JDialog | | | +--------------------+ /_\ | +--------------------+ |TextDialog | | | +--------------------+ /_\ | +-------------------------+ +--------------------+ | GetAndUnpackZipArchive | |DownloadDialog | -----------<>| .fromTo() | | | +-------------------------+ +--------------------+The persistent storage of the file position must be done by the caller, using
get_newPosition()
and get_newDigest()
.
ATTENTION some of the translation keys are defined by messages from "GetAndUnpackZipArchive".
(Created by extracting from bandm_book/.../book2/base/Gui.java,translations.muli and extending (checksum, etc).)
(Replaces DownloadDialog_DeEn, which is deprecated because it uses jawaws/JNLP)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionInput parameter by the caller: where to read the documentation online.protected @eu.bandm.tools.annotations.Opt byte[]
Local value: last checksum of DEnS during this dialog.Local value: last successful storage of DEnS during this dialog.static final String
Current language, if none is given to the constructor call.protected final String
Input parameter by the caller: name of the DEnS directory, fixed per application.protected final String
Input parameter by the caller: relative start for HTML-browing relative toDEnS_dir_name
.protected final URL
Input parameter by the caller: where to download the ZIP file.(package private) final String
Current user language.List of language preferences.protected CatalogByString
Dictionary of all translations.protected @eu.bandm.tools.annotations.Opt byte[]
Output value: last checksum of DEnS during this dialog.Output value: last successful storage of DEnS during this dialog.protected final @eu.bandm.tools.annotations.Opt byte[]
Input parameter by the caller: last checksum d of DEnS, if any.Input parameter by the caller: last local store positon of DEnS, if any.protected File
Temporary storage during dialog, between choosing and confirmation.protected boolean
Output value: whether the current/new downloaded data has been locally altered.Fields inherited from class eu.bandm.tools.graficUtils.TextDialog
answer, defaultSize, DIGITS, epane, firstPara, hasShortcuts, icon, keylistener, LF, linklistener, NON_SELECTED_LINK, shortcutlist, stepNum
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
ConstructorDescriptionDownloadDialog
(@Opt JFrame frame, @Opt String title, String DEnS_dir_name, URL downloadUrl, @Opt URL browseUrl, String docu_start_filepath, boolean modal, @Opt String lang, @Opt File oldPosition, @eu.bandm.tools.annotations.Opt byte[] oldDigest, @Opt String serviceEmail, @Opt Dimension windowsize) After creation the (inherited) message runDialog() must be called. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Create text which describes the possible alternatives
download/download anew
browse online
browse local IFF local loadedprotected void
Create text which describes the current information status, and which will appear as first.protected String
Text building block.@eu.bandm.tools.annotations.Opt byte[]
Output parameter: Is != null iffget_newPosition()
!= null.Output parameter: Only set != null when a new position has been entered by the user and the download succeeded.boolean
Output parameter: whether the current/new downloaded data has been locally altered.protected String
Definition of a new translation at the place of its application.protected String
Definition of a new translation at the place of its application.protected String
Definition of a new translation at the place of its application.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 ofcurPosition
,curDigest
andtampered
.Methods inherited from class eu.bandm.tools.graficUtils.TextDialog
appendText, appendTextLine, doReact, finished, runDialog, showURI, transformLinks, wrapError, wrapTT
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
lang
Current user language. Is fixed for one run uf this dialog. -
langs
List of language preferences. Only needed for fall-back when a translation is missing. -
defaultLang
Current language, if none is given to the constructor call.- See Also:
-
DEnS_dir_name
Input parameter by the caller: name of the DEnS directory, fixed per application. -
downloadUrl
Input parameter by the caller: where to download the ZIP file. -
browseUrl
Input parameter by the caller: where to read the documentation online. -
docu_start_filepath
Input parameter by the caller: relative start for HTML-browing relative toDEnS_dir_name
. -
oldPosition
Input parameter by the caller: last local store positon of DEnS, if any. -
curPosition
Local value: last successful storage of DEnS during this dialog. -
newPosition
Output value: last successful storage of DEnS during this dialog. -
oldDigest
Input parameter by the caller: last checksum d of DEnS, if any. -
curDigest
Local value: last checksum of DEnS during this dialog. -
newDigest
Output value: last checksum of DEnS during this dialog. -
tampered
protected boolean tamperedOutput value: whether the current/new downloaded data has been locally altered. -
mulicat
Dictionary of all translations. Must be enhanced when new a language is added. -
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 fromGetAndUnpackZipArchive
. This code supports languges "de" and "en". New languages can be added by subclassingd= new DownloadDialog_DeEn(....) {{mulicat.put("when opening url socket", "nl", "xx xx xx", "fr", "xx xx xx"); mulicat.put("when writing local file", "nl", "xx xx xx", "fr", "xx xx xx"); }};
- Parameters:
frame
- OPT, window of application, MAY be used by Swing for positioning, etc.title
- OPT, window title for dialog pop-up windowDEnS_dir_name
- file name of the one(1) directory which will be created on the local machine for storing all Do+X+S-files This must be also the only(1) top-level dir in the installed zipfile. When for the position of download is asked, and a directory with this name is selected, than the effect is the same as if its parent were selected.browseUrl
- the url where the online net browsing can start,docu_start_filepath
- file name of the entry point for local browsing, relative to the download position (something like "doc/user/index.html")modal
- whether the dialog is a modal onelang
- OPT preferred language, defaults todefaultLang
.oldPosition
- OPT file position of previous, memorized download of DEnS-filesoldDigest
- OPT checksum for oldPosition. Both must be null, or not-null.windowsize
- OPT for the dialog window
-
-
Method Details
-
get_newPosition
Output parameter: Only set != null when a new position has been entered by the user and the download succeeded. -
get_newDigest
Output parameter: Is != null iffget_newPosition()
!= null. -
get_tampered
public boolean get_tampered()Output parameter: whether the current/new downloaded data has been locally altered. -
muli
Definition of a new translation at the place of its application. Returns the translated text. (Not useful with MulIMessage sending!) -
muli
Definition of a new translation at the place of its application. Returns the translated text. (Not useful with MulIMessage sending!) -
muli
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
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 ofcurPosition
,curDigest
andtampered
.
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 classTextDialog
-