From aa08e15534601876c95b7a4c58b4bbc72b2290c0 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 22 Jul 2024 20:36:33 +0100 Subject: [PATCH] JAL-3631 Minor fixes to the advanced options scripts --- utils/install4j/install4j10_template.install4j | 141 ++++++++++++++++-------- 1 file changed, 94 insertions(+), 47 deletions(-) diff --git a/utils/install4j/install4j10_template.install4j b/utils/install4j/install4j10_template.install4j index 5e8bb2a..eb99e67 100644 --- a/utils/install4j/install4j10_template.install4j +++ b/utils/install4j/install4j10_template.install4j @@ -392,6 +392,16 @@ return wrapperLink; Util.isMacOS() && !context.getBooleanVariable("isAdmin") // Admin on macOS will add path to /etc/paths.d in Create File action + + + + + Boolean.FALSE + + + advancedOptions + + @@ -402,6 +412,26 @@ return wrapperLink; allowUserDefaultAppdirUpdates + + + + + Boolean.FALSE + + + allowSetUserAppdirPath + + + + + + + "" + + + userAppdirPath + + @@ -947,6 +977,10 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); // set enabled of userAppdirPath text field fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); + // get boolean status of "Allow installation updates" checkbox @@ -960,10 +994,6 @@ fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - // should we show the invalid user-space path warning? boolean u = userAppdirPath.contains("%u"); boolean h = userAppdirPath.contains("%h"); @@ -1064,10 +1094,10 @@ On ${installer:osName}, user updates will be installed under <pre>${installer:userDefaultAppdirBase}</pre> unless customised below. </html> - FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_notUsed = formEnvironment.getFormComponentById("SS_NOT_USED"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); @@ -1083,6 +1113,7 @@ boolean advancedOptions = jcb_advancedOptions.isSelected(); // set visibility of Advanced options layout group lg_advancedGroup.setVisible(advancedOptions); +fc_notUsed.setVisible(!advancedOptions); if (!advancedOptions) { return; @@ -1109,6 +1140,10 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); // set enabled of userAppdirPath text field fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); + // get boolean status of "Allow installation updates" checkbox @@ -1122,10 +1157,6 @@ fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - // should we show the invalid user-space path warning? boolean u = userAppdirPath.contains("%u"); boolean h = userAppdirPath.contains("%h"); @@ -1170,6 +1201,7 @@ jb_setDefaults.setEnabled(enableSetDefaults); FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_notUsed = formEnvironment.getFormComponentById("SS_NOT_USED"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); @@ -1185,6 +1217,7 @@ boolean advancedOptions = jcb_advancedOptions.isSelected(); // set visibility of Advanced options layout group lg_advancedGroup.setVisible(advancedOptions); +fc_notUsed.setVisible(!advancedOptions); if (!advancedOptions) { return; @@ -1211,6 +1244,10 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); // set enabled of userAppdirPath text field fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); + // get boolean status of "Allow installation updates" checkbox @@ -1224,10 +1261,6 @@ fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - // should we show the invalid user-space path warning? boolean u = userAppdirPath.contains("%u"); boolean h = userAppdirPath.contains("%h"); @@ -1275,6 +1308,7 @@ The default value on ${installer:osName} is FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_notUsed = formEnvironment.getFormComponentById("SS_NOT_USED"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); @@ -1290,6 +1324,7 @@ boolean advancedOptions = jcb_advancedOptions.isSelected(); // set visibility of Advanced options layout group lg_advancedGroup.setVisible(advancedOptions); +fc_notUsed.setVisible(!advancedOptions); if (!advancedOptions) { return true; @@ -1316,6 +1351,10 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); // set enabled of userAppdirPath text field fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); + // get boolean status of "Allow installation updates" checkbox @@ -1329,10 +1368,6 @@ fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - // should we show the invalid user-space path warning? boolean u = userAppdirPath.contains("%u"); boolean h = userAppdirPath.contains("%h"); @@ -1374,7 +1409,8 @@ fc_invalidPathWarning.setVisible(showInvalidPathWarning); userAppdirPath - component.setEnabled( context.getBooleanVariable("allowUserDefaultAppdirUpdates") && context.getBooleanVariable("allowSetUserAppdirPath") ) + component.setEnabled( context.getBooleanVariable("allowUserDefaultAppdirUpdates") && context.getBooleanVariable("allowSetUserAppdirPath") ); + @@ -1407,6 +1443,7 @@ Installation updates will be installed into FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_notUsed = formEnvironment.getFormComponentById("SS_NOT_USED"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); @@ -1422,6 +1459,7 @@ boolean advancedOptions = jcb_advancedOptions.isSelected(); // set visibility of Advanced options layout group lg_advancedGroup.setVisible(advancedOptions); +fc_notUsed.setVisible(!advancedOptions); if (!advancedOptions) { return; @@ -1448,6 +1486,10 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); // set enabled of userAppdirPath text field fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); + // get boolean status of "Allow installation updates" checkbox @@ -1461,10 +1503,6 @@ fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - // should we show the invalid user-space path warning? boolean u = userAppdirPath.contains("%u"); boolean h = userAppdirPath.contains("%h"); @@ -1492,6 +1530,7 @@ jb_setDefaults.setEnabled(enableSetDefaults); FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_notUsed = formEnvironment.getFormComponentById("SS_NOT_USED"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); @@ -1500,6 +1539,7 @@ LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_O LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); + // set defaults JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); jcb_user.setSelected(true); @@ -1521,6 +1561,7 @@ boolean advancedOptions = jcb_advancedOptions.isSelected(); // set visibility of Advanced options layout group lg_advancedGroup.setVisible(advancedOptions); +fc_notUsed.setVisible(!advancedOptions); if (!advancedOptions) { return; @@ -1545,6 +1586,9 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); // set enabled of userAppdirPath text field fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); +// get String value of userAppdirPath text field +String userAppdirPath = jtf_userAppdirPath.getText(); + // get boolean status of "Allow installation updates" checkbox @@ -1557,9 +1601,6 @@ fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); -// get String value of userAppdirPath text field -String userAppdirPath = jtf_userAppdirPath.getText(); - // should we show the invalid user-space path warning? boolean u = userAppdirPath.contains("%u"); boolean h = userAppdirPath.contains("%h"); @@ -2020,9 +2061,10 @@ return advanced ? !( allowUser || allowInstaller ) : false; 2823 - - # Uncomment the following line to disable user-space updates - #-Dnouserdefaultappdir=true + + # + # Uncomment the following line to disable user-space updates + #-Dnouserdefaultappdir=true !context.getBooleanVariable("disableUserDefaultAppdirUpdates") @@ -2030,9 +2072,10 @@ return advanced ? !( allowUser || allowInstaller ) : false; 2823 - - # Comment out the following line to allow user-space updates - -Dnouserdefaultappdir=true + + # + # Comment out the following line to allow user-space updates + -Dnouserdefaultappdir=true context.getBooleanVariable("disableUserDefaultAppdirUpdates") @@ -2040,11 +2083,12 @@ return advanced ? !( allowUser || allowInstaller ) : false; 2823 - - # The below line sets a custom path for user-space updates -- use with caution. - # A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username. - # If unset, the default is ${installer:userDefaultAppdirBase} for ${installer:osName} - -Dsetuserappdirpath=${installer:setUserAppdirPath} + + # + # The below line sets a custom path for user-space updates -- use with caution. + # A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username. + # If unset, the default is ${installer:userDefaultAppdirBase} for ${installer:osName} + -Dsetuserappdirpath=${installer:setUserAppdirPath} (String)context.getVariable("setUserAppdirPath") != null @@ -2052,11 +2096,12 @@ return advanced ? !( allowUser || allowInstaller ) : false; 2823 - - # Uncomment the below line to set a custom path for user-space updates -- use with caution. - # A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username. - # If not set, the default is ${installer:userDefaultAppdirBase} for ${installer:osName} - # -Dsetuserappdirpath=${installer:setUserAppdirPath} + + # + # Uncomment the below line to set a custom path for user-space updates -- use with caution. + # A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username. + # If not set, the default is ${installer:userDefaultAppdirBase} for ${installer:osName} + #-Dsetuserappdirpath=/tmp/jalview/%u (String)context.getVariable("setUserAppdirPath") == null @@ -2064,9 +2109,10 @@ return advanced ? !( allowUser || allowInstaller ) : false; 2823 - - # Uncomment the following line to also disable all updates - #-Dsilent=noupdate + + # + # Uncomment the following line to also disable all updates + #-Dsilent=noupdate !context.getBooleanVariable("disableUpdates") @@ -2074,9 +2120,10 @@ return advanced ? !( allowUser || allowInstaller ) : false; 2823 - - # Comment out the following line to enable updates - -Dsilent=noupdate + + # + # Comment out the following line to enable updates + -Dsilent=noupdate context.getBooleanVariable("disableUpdates") -- 1.7.10.2