Package eu.bandm.tools.installer
Class DocumentedDistribution2<M extends Model<M>,G extends Gui>
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
eu.bandm.tools.installer.DocumentedDistribution2<M,G>
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
- Direct Known Subclasses:
Application
Top-Level programm for distribution of code (as binary), plus documentation,
example(s) and sources.
(Since javaws/JNLP is deprecated since jse 9 and no more contained in jse 11, this is a REPLACEMENT for the deprecated @link{DocumentedDistribution}. It uses java.util.prefs.Preferences and java.awt.Desktop.getDesktop().browse(..) (as wrapped by BrowserControl) instead.)
Contains
(Since javaws/JNLP is deprecated since jse 9 and no more contained in jse 11, this is a REPLACEMENT for the deprecated @link{DocumentedDistribution}. It uses java.util.prefs.Preferences and java.awt.Desktop.getDesktop().browse(..) (as wrapped by BrowserControl) instead.)
Contains
- global public constant definitions
- the top-level control flow for the very different use cases, including prefs.Preference interfacing,
- Downloading "DEnS" (="Documentation,Examples and Sources"
- A gui with menu, options panel, message panel.
- Multi-language support
- Currently MISSING is (semi-)automated version updating; this had been done by javaws/JNLP in the preceding version
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
DocumentedDistribution2.Configuration<MM extends Model,
GG extends Gui> Auxiliary data class to define the main operation parameters by a particular instance of a particular application, realized as a subclass ofDocumentedDistribution2
.Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
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 TypeFieldDescriptionMaps Swing objects to MuLi keys for dynamic language change.Maps Swing objects to MuLi keys for dynamic language change.protected Map<AbstractButton,
String> Maps Swing objects to MuLi keys for dynamic language change.protected JPanel
The container below the options for the "action" buttons.protected boolean
Whether there were non-meta options in the command line, and the correspoding payload task is executed.protected boolean
Whether there are no string argument particles from a command line.Disk file position of the currently running code.This is a copy of the original list of languagesDocumentedDistribution2.Configuration.user_language_icons
, completed byGui.StringIcon
s when no flag icon has been provided.The configuration object passed to the constructor call.protected byte[]
Checksum of all files in the local copy of DEnS.Common root directory's position of documentation, examples and sources on the local machine.static final String[]
Evidentprotected SwingMessageField<SimpleMessage<String>>
Text label showing always the last message sent to .Menu items initially inactive; enabled after successful DEnS download.protected JButton
The button below the GUI option pane, for starting processing.The name of the first/main signer of the code.protected boolean
Flag set after all GUI elements have been created.static final ImageIcon
An icon showing the German flag.static final ImageIcon
An icon showing the flag of the Roman Empire, for Latin translations.static final ImageIcon
An icon showing the flag of Spain.static final ImageIcon
An icon showing the flag of the USA.protected boolean
Set to true if no payload task is defined on the command line (=no non-meta options), and can further be set true explicitly by the payload task (by callbackrequestInteraction(boolean)
for starting the GUI nevertheless.protected boolean
Output to the payload task implementation whether its execution comes directly from the command lines, with no GUI interference.protected boolean
Reflects whether more than one language has been specified.protected boolean
Whether this runs from a jar file.protected JTabbedPane
The top container for all tab panes (options, messages, and subclass specifics).static final String
This is a key string pointing into the translationCatalogByString
, to an OPTIONAL additional text shown after the first (autmatically generated) sentences of the about window.static final String
This is a key string pointing into the translationCatalogByString
, which is required because the language of the document may depend on the current language preferences.static final String
This is a key string pointing into the translationCatalogByString
, to a three-word explanation of the program's purpose, in different languages.static final String
This is a key string pointing into the translationCatalogByString
, which is required because the language of the document may depend on the current language preferences.Maps Swing objects to MuLi keys for dynamic language change.protected final ButtonGroup
The language buttons appearing in the language drop-down menu.protected final Selection
Central control for UI language switch.protected JMenu
The language drop-down menu.static final String
The name of the top-level menu entry for switching the user language.static final char
The acceleration character of the top-level menu entry for switching the user language.(package private) SwingMessageTable<String>
static final String
The string representation of the url of the metatools docu.final MessageReceiver<SimpleMessage<String>>
Is only known to be a receiver, for programming discipline.protected final MessageCounter
Must be global.protected final MessagePrinter<SimpleMessage<String>>
protected final MessageStore<SimpleMessage<String>>
protected final MessageTee<SimpleMessage<String>>
Must be global because further consumers will later be added in case of GUI use.protected final MessageTranslator<String>
Receiver for messages with a line number location.protected G
The central instance holdign the options GUI.protected M
The central instance holding the ooptions for all payload runs, GUI editing, serialization etc.protected static final String
Persistency keyprotected static final String
Persistency key.protected static final String
Persistency keyprotected static final String
Persistency keyfinal String
The button below the GUI option pane, for resetting to default values.protected final MessageTee<SimpleMessage<String>>
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
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
ConstructorDescriptionDocumentedDistribution2
(DocumentedDistribution2.Configuration<M, G> configuration) Only constructor, which stores theDocumentedDistribution2.Configuration
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMenu()
Add a new Menu, currently only with "File:quit", "Language" and "Help:about and docu" entries.protected void
addMuli_jTabbedPane
(Component p, String text) Adds the component at the end of the top-level JTabbedPane and memorizes it for later language switch.protected void
addMuli_jTabbedPane
(Component p, String text, int position) Adds the component at the given position of the top-level JTabbedPane and memorizes it for later language switch.protected void
addMuli_jTabbedPane
(Component p, String text, @Opt String tooltiptext) protected abstract void
Call-back method to be overridden whenever the subclass wants to add further items to the main menu bar.protected abstract void
Call-back method to be overridden whenever the subclass wants to add further tabbed panes to the main windows tabbed stack.void
Callback for the payload implementation to clear the message fieldDelivers the source text of an HTML link to close a window, in the current language.protected void
compareLanguageSets
(Collection<String> A, String Aname, Collection<String> B, String Bname) Meta-analysis about the consistency of translations.protected void
compareLanguageSets2
(Collection<String> A, String Aname, Collection<String> B, String Bname) Meta-analysis about the consistency of translations.protected void
complete_icon_list
(List<String> langs, List<Icon> icons) Add a provisonary text icon like "[it]
" to the list of flag icons, if no flag is contained at the list position of the language code.protected abstract void
Call-back method to be overridden whenever the subclass wants to add further items after the gui has been constructed and populated.protected String
Evidentprotected void
dumpPreferences
(boolean all) For debugging only, print COMPLETE current persistency tree to System.err.protected void
dumpPreferences
(PrintStream stream, boolean all) For debugging only, print COMPLETE current persistency tree.protected abstract void
Call-back main execution method, called with all parameters entered intooptionsModel
, coming from the GUI or command line.protected void
Exceptions are caught here, explicitly.int
Number of critical messages (errors, failures) in the standard message channel.Returns the string representation of the name of the last signer in the first certificate chain.protected URL
Laut https://www.edureka.co/community/5035/retrieving-the-path-of-a-runing-jar-file "new File(ABC.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getPath();"void
guiConfirmExit
(int source) protected String
protected String
Makes an "in situ" definition usingCatalog.insitu(Object,List,List)
of the current muli messages catalog, with the current language preferences.protected String
Makes an "in situ" definition usingCatalog.insitu(Object,List,List,Object...)
of the current muli messages catalog, with the current language preferences.protected String
Makes an "in situ" definition usingCatalog.INSITU(Object,List)
.protected boolean
Output to the payload task implementation whether its execution comes directly from the command lines, with no GUI interference.protected boolean
Is only called if DEnS have been downloaded, according to perssitent storage.protected TextDialog
makeAboutDialog
(String title, boolean modal) Display a pop-up dialog window with an overall status text for the user.protected String
The field can contain keys to translations of credit sentences.protected <X extends AbstractButton>
XShould work for JButton, JMenu, JMenuItem, JRadioButton, JCheckBox.protected void
makeMuli_anyTabbedPane
(Component p, String text, @Opt String tooltiptext) Memorizes the component as being contained in ANY JTabbedPane for later language switch.protected JLabel
makeMuli_JLabel
(String text) protected String
Contructs the information text which presents status to the human user, in the current language.void
non_static_main
(String[] args) Main entry for command line and for GUI operation.protected void
Store the state of the option model to the persistency cache.protected void
Delete all persistency entries for this package.protected @eu.bandm.tools.annotations.Opt byte[]
Return empty array if nothing found in preference storage.persistentGetString
(String key, @Opt String deflt) Read the data which is stored under the current application and the explicit key used as key.protected void
persistentPutByteArray
(String key, byte[] values) Store the data, retrievable by the current application and the explicit key used as key.protected void
persistentPutString
(String key, @Opt String value) Put the data, retrievable by the current application and the explict key used together as key.protected void
populate()
Generate all graphic panes and add them to the topmost window = this.protected void
Print standardized command line "--help" output.protected void
Print standardized and parseable command line "--version" output.protected void
requestInteraction
(boolean rq) A call-back to be called fromexecuteBatchOperation()
to switch on/off gui mode, according to the analysed options, or to performance results, etc.protected void
selectExampleOptions
(@Opt String shortName) Is called by the framework and must be implemented by the derived class to let the options inoptionsModel
point to a prefactored example.void
Callback for the payload implementation to show a short text in the message fieldprotected void
protected void
showPreferencesInDialogWindow
(boolean all) Shows all stored persistent data in a dialog and allows to clear the own data.protected String
Convert for output on stdout/stderr by stripping all HTML formatting.boolean
switchLanguage
(String lang) Main service to switch the language of error messages, help functions, GUI labels, and many others.boolean
Switch language without protocol message.void
switchToTab
(Component comp) Callback for the payload implementation to switch to the tab which shows the given component.void
If errors have been counted, then print a text to the terminal of the command line and exits the application.void
If errors have been counted, then print a text to the terminal of the command line and exits the application.void
AsterminateApplicationDueToSevereErrors(eu.bandm.tools.message.MessageCounter)
, with printing of the usage information in case of error.Translate the input String as defined by the catalog object and the language code priority sequence, both frommsg
.Translate the input String as defined by the catalog object and the language code priority sequence, both frommsg
.protected String[]
Make a translation, then eliminate the shortcutIndication character at position 0 and set the one-key mnemonic to the successor of its second appearance, if any.Find a translation for the input String according to the catalog object and the language code priority sequence, both frommsg
, or null if not found.protected void
Switch the text and the mnemonic of the tab of the JTabbedPane, containing the component.protected void
Central self-reflecting data collection and analysis.void
Central dialog to download DEnS (documentation, examples and sources).Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
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, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, 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, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
-
Field Details
-
configuration
The configuration object passed to the constructor call. -
isMuLi
protected boolean isMuLiReflects whether more than one language has been specified. -
metatools_doc_url
The string representation of the url of the metatools docu.- See Also:
-
KEY_PATH_local_userdocumentation
This is a key string pointing into the translationCatalogByString
, which is required because the language of the document may depend on the current language preferences.- See Also:
-
KEY_URL_web_userdocumentation
This is a key string pointing into the translationCatalogByString
, which is required because the language of the document may depend on the current language preferences.- See Also:
-
KEY_ultra_short_description
This is a key string pointing into the translationCatalogByString
, to a three-word explanation of the program's purpose, in different languages. A one-sentence form is preferred and there should be NO FULL-STOP at the end.- See Also:
-
KEY_about_additional_text
This is a key string pointing into the translationCatalogByString
, to an OPTIONAL additional text shown after the first (autmatically generated) sentences of the about window.- See Also:
-
icon_flag_Germany
An icon showing the German flag. Prepared as a call-back for the payload specific class to put it intoDocumentedDistribution2.Configuration
. -
icon_flag_USA
An icon showing the flag of the USA. Prepared as a call-back for the payload specific class to put it intoDocumentedDistribution2.Configuration
. -
icon_flag_romanEmpire
An icon showing the flag of the Roman Empire, for Latin translations. Prepared as a call-back for the payload specific class to put it intoDocumentedDistribution2.Configuration
. -
icon_flag_Spain
An icon showing the flag of Spain. Prepared as a call-back for the payload specific class to put it intoDocumentedDistribution2.Configuration
. -
programJavaClassName
-
generationComment
-
languagePrefs
Central control for UI language switch. All visible GUI elements can register here for notification. -
msgCounter
Must be global. -
msgStore
-
msgPrinter
-
msgTranslator
-
translatedAndFormatted
-
msgTee
Must be global because further consumers will later be added in case of GUI use. -
msg
Is only known to be a receiver, for programming discipline. -
msgXML
Receiver for messages with a line number location. Provided here as convenience for sub-classes. -
completed_user_language_icons
This is a copy of the original list of languagesDocumentedDistribution2.Configuration.user_language_icons
, completed byGui.StringIcon
s when no flag icon has been provided. -
jarRunning
protected boolean jarRunningWhether this runs from a jar file. -
codePosition
Disk file position of the currently running code. -
firstSignerName
The name of the first/main signer of the code. -
DEnS_dir
Common root directory's position of documentation, examples and sources on the local machine. -
DEnS_cs
protected byte[] DEnS_csChecksum of all files in the local copy of DEnS. -
PK_DEnS_local_dir
Persistency key. Persistency entries are indexed by the payload subclass and the constants starting with "PK_..".- See Also:
-
PK_DEnS_digest
Persistency key- See Also:
-
PK_optionsLastRun
Persistency key- See Also:
-
PK_optionsLanguage
Persistency key- See Also:
-
emptyArgs
Evident -
optionsModel
The central instance holding the ooptions for all payload runs, GUI editing, serialization etc. -
optionsGui
The central instance holdign the options GUI. Is a clone from the instance inconfiguration
.) -
executeButton
The button below the GUI option pane, for starting processing. -
resetToDefaultsButton
The button below the GUI option pane, for resetting to default values. Its creation is controlled by configuration. -
guiPopulated
protected boolean guiPopulatedFlag set after all GUI elements have been created. -
jTabbedPane
The top container for all tab panes (options, messages, and subclass specifics). -
buttonPanel
The container below the options for the "action" buttons. -
errorMsgField
Text label showing always the last message sent to . Is positioned at the bottom of the main window and always visible, on each tab. -
interactiveIsRequested
protected boolean interactiveIsRequestedSet to true if no payload task is defined on the command line (=no non-meta options), and can further be set true explicitly by the payload task (by callbackrequestInteraction(boolean)
for starting the GUI nevertheless. -
cmdLineIsEmpty
protected boolean cmdLineIsEmptyWhether there are no string argument particles from a command line. -
cmdLineDefinesTask
protected boolean cmdLineDefinesTaskWhether there were non-meta options in the command line, and the correspoding payload task is executed. -
isInitialCall
protected boolean isInitialCallOutput to the payload task implementation whether its execution comes directly from the command lines, with no GUI interference. -
exampleMenuItems
Menu items initially inactive; enabled after successful DEnS download. -
messageTable
SwingMessageTable<String> messageTable -
button2textKey
Maps Swing objects to MuLi keys for dynamic language change. The text entries must all have the "accelerator format" like "!e!xit
", seetranslateAndExtractShortcut(String)
, because the accelerator key with the language. -
label2textKey
Maps Swing objects to MuLi keys for dynamic language change. -
anyTabbedPane2textKey
Maps Swing objects to MuLi keys for dynamic language change. -
anyTabbedPane2tooltip
Maps Swing objects to MuLi keys for dynamic language change. -
languageButtons
The language buttons appearing in the language drop-down menu.
-
-
Constructor Details
-
DocumentedDistribution2
Only constructor, which stores theDocumentedDistribution2.Configuration
. Initializing the message pipeline is also executed, but the source is in separate initializers and initialization blocks.
-
-
Method Details
-
closeDialogLink
Delivers the source text of an HTML link to close a window, in the current language. -
translate
Translate the input String as defined by the catalog object and the language code priority sequence, both frommsg
. The current muli messages catalog is initialised from theconfiguration
object. If no translation is defined, the KEY ITSELF is returned! The work is done by the methodCatalog.translateRobust(Object,List)
-
translateNonRobust
Find a translation for the input String according to the catalog object and the language code priority sequence, both frommsg
, or null if not found. The current muli messages catalog is initialised from theconfiguration
object. Is needed for optional payload specific text blocks. -
translate
Translate the input String as defined by the catalog object and the language code priority sequence, both frommsg
. The current muli messages catalog is initialised from theconfiguration
object. The work is done by the methodCatalog.translateAllAndFormatRobust(Object,List,List)
-
insitu
Makes an "in situ" definition usingCatalog.insitu(Object,List,List,Object...)
of the current muli messages catalog, with the current language preferences. That means it delivers a found translation immediately, but stores the translations as a side effect, for later retrieval. The current muli messages catalog is given bymsg
and has been initialised from theconfiguration
object.- Parameters:
translations
- list of PAIRS of String, each language code and textargs
- objects formatted into the translated text by printf codes
-
insitu
Makes an "in situ" definition usingCatalog.insitu(Object,List,List)
of the current muli messages catalog, with the current language preferences. That means it delivers a found translation immediately, but stores the translations as a side effect, for later retrieval. The current muli messages catalog is given bymsg
and has been initialised from theconfiguration
object. This is the variant for constant texts, i.e. without printf embedding.- Parameters:
translations
- list of PAIRS of String, each language code and text
-
insitu
- See Also:
-
INSITU
Makes an "in situ" definition usingCatalog.INSITU(Object,List)
. It puts the definitions in the current translation catalog and returns the key, so this can be used immediately e.g. as the text argument for message sending.ATTENTION more than one calls with the same key are illegal and bring unpredictable results, because only one of both storings will be executed. The current muli messages catalog is given by
msg
and has been initialised from theconfiguration
object.- Parameters:
key
-translations
- list of PAIRS of String, each language code and text
-
guiConfirmExit
public void guiConfirmExit(int source) - Parameters:
source
- 0=payload task definitely wants exit, 1=from window close 2=from menu
-
terminateApplicationDueToSevereErrors
public void terminateApplicationDueToSevereErrors()If errors have been counted, then print a text to the terminal of the command line and exits the application. May only be called in command-line mode. Inquires global message counter. -
terminateApplicationDueToSevereErrors
If errors have been counted, then print a text to the terminal of the command line and exits the application. May only be called in command-line mode. -
terminateApplicationDueToSevereErrors_usage
AsterminateApplicationDueToSevereErrors(eu.bandm.tools.message.MessageCounter)
, with printing of the usage information in case of error. May only be called in command-line mode. -
currentLanguage
Evident -
getCriticalCount
public int getCriticalCount()Number of critical messages (errors, failures) in the standard message channel. -
isInitialCall
protected boolean isInitialCall()Output to the payload task implementation whether its execution comes directly from the command lines, with no GUI interference. -
selectExampleOptions
Is called by the framework and must be implemented by the derived class to let the options inoptionsModel
point to a prefactored example. The shortNames of these examples must be listed inDocumentedDistribution2.Configuration.examplesShortNames
and thus appear in a Menu.- Parameters:
shortName
- the name from the menu which identifies the example. Can be =null iff there is only one example.
-
executeBatchOperation
protected abstract void executeBatchOperation()Call-back main execution method, called with all parameters entered intooptionsModel
, coming from the GUI or command line. Must be called by one of the user-defined GUI field entries, or a button like "go!-)".
Situations:cmd-line-parameters filled in | | interactively filled, | | GO button pressed | | isInitialCall=true | | =false | | execute (possibly skip GUI) | | process data, return | | to GUI
-
addUserPagesToTabbedPane
protected abstract void addUserPagesToTabbedPane()Call-back method to be overridden whenever the subclass wants to add further tabbed panes to the main windows tabbed stack. Must in turn call the service access pointaddMuli_jTabbedPane(Component, String)
, with "String" being the key for MuLi Translation. -
addUserMenuItems
protected abstract void addUserMenuItems()Call-back method to be overridden whenever the subclass wants to add further items to the main menu bar. Is called after menu-component "[0] = file" is created, but the right-most ("language" and "help") are not yet existing. -
completeGuiPopulation
protected abstract void completeGuiPopulation()Call-back method to be overridden whenever the subclass wants to add further items after the gui has been constructed and populated. -
requestInteraction
protected void requestInteraction(boolean rq) A call-back to be called fromexecuteBatchOperation()
to switch on/off gui mode, according to the analysed options, or to performance results, etc.- Parameters:
rq
- whether the payload execution requests to start the GUI.
-
setErrorMsg
Callback for the payload implementation to show a short text in the message field -
clearErrorMsg
public void clearErrorMsg()Callback for the payload implementation to clear the message field -
switchToTab
Callback for the payload implementation to switch to the tab which shows the given component. -
non_static_main
Main entry for command line and for GUI operation. Can be started
1 locally from command line (jar file as executive)
2 by "clicking" a jar file in a "graphic" operating system.
It shows different behaviours according to the combination of the following parameters:- jar-click or cmd-line start?
- DEnS already downloaded or not?
- command line arguments present or empty?
combinable with --vers --help --lang --gui --clear --geom PAYLOAD META: --version -- COMB ERR COMB ERR ERR --help -- COMB ERR COMB ERR ERR --language -- COMB COMB COMB COMB --gui -- COMB COMB COMB --clearPersistency -- COMB COMB --geometry -- COMB
The common operations are always ..- Set up message channels.
- Parse command line options (including an empty string)
- If options specify a payload task, then execute main functionality
by applying
executeBatchOperation()
on this data, controlled by the global inputoptionsModel
- if there is no such processing task, or if interactive mode has been asked for explicitly, either by the commandline or by payload run, then start the GUI mode.
Possible use cases / combinations:
(A) cmd line not empty / has payload options - parsed w/o errors --> execute cmd line - parsed with errors --> signal to user (gui/non-gui) (B) cmd line empty - preferences altered by user in a preceding session --> start user's preferences in Gui else start with an empty Gui
(The example option datas are not loaded automatically, but can be copied into the GUI pane by menu.) -
compareLanguageSets
protected void compareLanguageSets(Collection<String> A, String Aname, Collection<String> B, String Bname) Meta-analysis about the consistency of translations. Prints both possible differences of both sets to the standard message channel. Since this is a mere technical warning, which normally should not appear, it is only in theCompiler.LINGUA_FRANCA
. -
compareLanguageSets2
protected void compareLanguageSets2(Collection<String> A, String Aname, Collection<String> B, String Bname) Meta-analysis about the consistency of translations. Prints one difference of both sets to the standard message channel. -
isTampered
protected boolean isTampered()Is only called if DEnS have been downloaded, according to perssitent storage. -
updateStatusInformation
protected void updateStatusInformation()Central self-reflecting data collection and analysis. Fills global variables. -
makeCreditsText
The field can contain keys to translations of credit sentences. The translation text can be HTML-formatted. If muli-mode, then credits for the flags are added implicitly.- Returns:
- formatted HTML to print all credits.
-
makeStatusText
Contructs the information text which presents status to the human user, in the current language.updateStatusInformation()
must have been called before, This text is presented (a) possibly as greeting text and (b) by Menu--help--about. -
makeAboutDialog
Display a pop-up dialog window with an overall status text for the user. Is called when starting the program (if enabled byDocumentedDistribution2.Configuration.startWithStatusInformationDialog
and by the "Help->about" menu. Both cases have different window titles. -
getRunningCodeSource
Laut https://www.edureka.co/community/5035/retrieving-the-path-of-a-runing-jar-file "new File(ABC.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getPath();" -
getFirstSignerName
Returns the string representation of the name of the last signer in the first certificate chain. In most cases there will be only one(1) such certificate chain.- Returns:
- null if no certificate or unknown certificate type. Latter case issues a warning.
-
stripHtml
Convert for output on stdout/stderr by stripping all HTML formatting. Noassumptions on formatting beyond "newline" are made (e.g. no termcaps etc. is used) -
POSIX_print_help
protected void POSIX_print_help()Print standardized command line "--help" output. Language selectable. Cf https://www.gnu.org/prep/standards/html_node/002d_002d_help.html -
POSIX_print_version
protected void POSIX_print_version()Print standardized and parseable command line "--version" output. English only. Cf https://www.gnu.org/prep/standards/html_node/002d_002d_version.html -
populate
protected void populate()Generate all graphic panes and add them to the topmost window = this. -
setMessageTableSeparatorKey
-
executeBatchOperation_caught
protected void executeBatchOperation_caught()Exceptions are caught here, explicitly. Other Throwables (i.e. Errors) are caught be call to "monitor(..)" above. -
makeMuli_JLabel
-
translateAndExtractShortcut
Make a translation, then eliminate the shortcutIndication character at position 0 and set the one-key mnemonic to the successor of its second appearance, if any. Examples:!be!enden long=beenden short=e $$quit long=quit short=q !quit quit short=null !$quit $quit short=null !$qui!t $quit short=t
-
addMuli_jTabbedPane
Adds the component at the end of the top-level JTabbedPane and memorizes it for later language switch.- Parameters:
text
- text to translate, in "Mnemomic format": First character is deleted and its second appearance marks the mnemonic, as in "%e%xit
" or "&&File
".
-
addMuli_jTabbedPane
-
addMuli_jTabbedPane
Adds the component at the given position of the top-level JTabbedPane and memorizes it for later language switch.- Parameters:
text
- text to translate, in "Mnemomic format": First character is deleted and its second appearance marks the mnemonic, as in "%e%xit
" or "&&File
".
-
makeMuli_anyTabbedPane
Memorizes the component as being contained in ANY JTabbedPane for later language switch. This version is NOT related to the top-leveljTabbedPane
and does not insert the component anywhere. Instead, the component must already be inserted in some JTabbedPane.- Parameters:
text
- text to translate, in "Mnemomic format": First character is deleted and its second appearance marks the mnemonic, as in "%e%xit
" or "&&File
".- Throws:
IllegalArgumentException
- in case "p" is not directly contained in a JTabbedPane.
-
updateLanguage_anyTabbedPane
Switch the text and the mnemonic of the tab of the JTabbedPane, containing the component. -
makeMuli
Should work for JButton, JMenu, JMenuItem, JRadioButton, JCheckBox. Typical usage pattern:myPanel.add(makeMuli(new JButton(), "$button$text"));
- Parameters:
text
- text to translate, in "Mnemomic format": First character is deleted and its second appearance marks the mnemonic, as in "%e%xit
" or "&&File
".
-
switchLanguage
Main service to switch the language of error messages, help functions, GUI labels, and many others. The work is carried out byswitchLanguage_internal(String)
, and then additionally a log message is generated. -
switchLanguage_internal
Switch language without protocol message. Only lets pass languages which are in the configuration list. Updates all resources to the newlanguage, UNCONDITIONALLY.- Returns:
- whether language has changed w.r.t current selection.
-
complete_icon_list
Add a provisonary text icon like "[it]
" to the list of flag icons, if no flag is contained at the list position of the language code. -
addMenu
protected void addMenu()Add a new Menu, currently only with "File:quit", "Language" and "Help:about and docu" entries. See http://docs.oracle.com/javase/tutorial/uiswing/ -
showPreferencesInDialogWindow
protected void showPreferencesInDialogWindow(boolean all) Shows all stored persistent data in a dialog and allows to clear the own data. Pesistency operations are for qualified users only, so MuLi is NOT supported, but LINGUA FRANCA expected.- Parameters:
all
- whether all data and not only for this application is shown.
-
user_requests_documentation
public void user_requests_documentation()Central dialog to download DEnS (documentation, examples and sources). -
persistAllCmdLineArgs
protected void persistAllCmdLineArgs()Store the state of the option model to the persistency cache. Must be called by the payload code explicitly (in case of success, or sim.) -
persistentPutString
Put the data, retrievable by the current application and the explict key used together as key.
"this.getClass()
identifies the package of the derived application, not of this class. -
persistentGetString
Read the data which is stored under the current application and the explicit key used as key. -
persistentPutByteArray
Store the data, retrievable by the current application and the explicit key used as key. -
persistentGetByteArray
Return empty array if nothing found in preference storage. -
persistentClear
protected void persistentClear()Delete all persistency entries for this package. I.e., the package which contains the base class (derived from this class) of this. -
dumpPreferences
protected void dumpPreferences(boolean all) For debugging only, print COMPLETE current persistency tree to System.err. The format is an XML format defined byPreferences.exportSubtree(java.io.OutputStream)
.- Parameters:
all
- whether all data and not only for this application is shown.
-
dumpPreferences
For debugging only, print COMPLETE current persistency tree. The format is an XML format defined byPreferences.exportSubtree(java.io.OutputStream)
.- Parameters:
all
- whether all data and not only for this application is shown.
-