From: Ben Soares Date: Sat, 20 Jul 2024 16:55:37 +0000 (+0100) Subject: JAL-3631 Group/box and simplify visibility of advanced options on additional tasks... X-Git-Tag: Release_2_11_4_0~20^2~9 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=71a5b1cd32ce8559a8789e67dbfd6312aa4956e0;p=jalview.git JAL-3631 Group/box and simplify visibility of advanced options on additional tasks screen in the install4j installation wizard. --- diff --git a/utils/install4j/install4j10_template.install4j b/utils/install4j/install4j10_template.install4j index eb0dcba..119c1d8 100644 --- a/utils/install4j/install4j10_template.install4j +++ b/utils/install4j/install4j10_template.install4j @@ -183,7 +183,7 @@ - + @@ -845,6 +845,7 @@ formEnvironment.getFormComponentById("US_NO_UPDATES_WARNING").setVisible(showWar Enable advanced options for system installation + 3030 2985 3013 2986 @@ -858,7 +859,8 @@ FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_US FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); -LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); +LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_OPTIONS_GROUP"); +LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); @@ -866,26 +868,21 @@ LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// set visibility of all "ADVANCEDITEM" components (does not include groups) and layout groups -for (FormComponent fc: formEnvironment.getFormComponents()) { - String id = formEnvironment.getId(fc); - if (id.contains("ADVANCEDITEM")) { - fc.setVisible(advancedOptions); - } -} -lg.setVisible(advancedOptions); +// set visibility of Advanced options layout group +lg_advancedGroup.setVisible(advancedOptions); if (!advancedOptions) { return; } + // get boolean status of "Allow user-space updates" checkbox JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); boolean userUpdates = jcb_user.isSelected(); // set enabled of customised user appdir path group -lg.setEnabled(advancedOptions && userUpdates); +lg_setUserAppdirPath.setEnabled(advancedOptions && userUpdates); // set enabled of allow installation updates checkbox fc_installerUpdates.setEnabled(advancedOptions && !userUpdates); @@ -906,36 +903,76 @@ JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject boolean installerUpdates = jcb_installer.isSelected(); // should we show the No updates warning? -boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); -FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); -fc_warning.setVisible(showWarning); +boolean showNoUpdatesWarning = advancedOptions && !(userUpdates || installerUpdates); +FormComponent fc_noUpdatesWarning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); +fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); // get String value of userAppdirPath text field JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); String userAppdirPath = jtf_userAppdirPath.getText(); -// not using this yet + +// should we show the invalid user-space path warning? +boolean u = userAppdirPath.contains("%u"); +boolean h = userAppdirPath.contains("%h"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(advancedOptions && userUpdates && allowUserAppdirPath && fc_userAppdirPath.isEnabled() && showInvalidPathWarning); + + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); advancedOptions - + - <html>The following options are <strong>strongly recommended</strong> to be left as default unless there is a particular reason to change them.</html> - - context.getBooleanVariable("advancedOptions") - - - - - - Allow user-space updates for ${compiler:JALVIEW_APPLICATION_NAME} components - - 3021 + + + + + + + - <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} + + + 4 + 4 + 4 + 4 + + + + + context.getBooleanVariable("advancedOptions") + + + + + + + + <html>The following options are <strong>strongly recommended</strong> to be left as default unless there is a particular reason to change them.</html> + + + + + + Allow user-space updates for ${compiler:JALVIEW_APPLICATION_NAME} components + + 3021 + + <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} <br> components to be automatically downloaded <br> @@ -950,15 +987,16 @@ 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_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); -LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); +LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_OPTIONS_GROUP"); +LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); @@ -966,26 +1004,21 @@ LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// set visibility of all "ADVANCEDITEM" components (does not include groups) and layout groups -for (FormComponent fc: formEnvironment.getFormComponents()) { - String id = formEnvironment.getId(fc); - if (id.contains("ADVANCEDITEM")) { - fc.setVisible(advancedOptions); - } -} -lg.setVisible(advancedOptions); +// set visibility of Advanced options layout group +lg_advancedGroup.setVisible(advancedOptions); if (!advancedOptions) { return; } + // get boolean status of "Allow user-space updates" checkbox JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); boolean userUpdates = jcb_user.isSelected(); // set enabled of customised user appdir path group -lg.setEnabled(advancedOptions && userUpdates); +lg_setUserAppdirPath.setEnabled(advancedOptions && userUpdates); // set enabled of allow installation updates checkbox fc_installerUpdates.setEnabled(advancedOptions && !userUpdates); @@ -1006,52 +1039,66 @@ JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject boolean installerUpdates = jcb_installer.isSelected(); // should we show the No updates warning? -boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); -FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); -fc_warning.setVisible(showWarning); +boolean showNoUpdatesWarning = advancedOptions && !(userUpdates || installerUpdates); +FormComponent fc_noUpdatesWarning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); +fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); // get String value of userAppdirPath text field JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); String userAppdirPath = jtf_userAppdirPath.getText(); -// not using this yet - - - allowUserDefaultAppdirUpdates - - context.getBooleanVariable("advancedOptions") - - - - - - - 0 - 32 - 0 - 0 - - - - - context.getBooleanVariable("advancedOptions") - - - - - - + +// should we show the invalid user-space path warning? +boolean u = userAppdirPath.contains("%u"); +boolean h = userAppdirPath.contains("%h"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(advancedOptions && userUpdates && allowUserAppdirPath && fc_userAppdirPath.isEnabled() && showInvalidPathWarning); + + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); + + + allowUserDefaultAppdirUpdates + + + - Customise the user-space path - + + + 0 + 32 + 0 + 0 + + + - FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); + + + + + + + + Customise the user-space path + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); -LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); +LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_OPTIONS_GROUP"); +LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); @@ -1059,26 +1106,21 @@ LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// set visibility of all "ADVANCEDITEM" components (does not include groups) and layout groups -for (FormComponent fc: formEnvironment.getFormComponents()) { - String id = formEnvironment.getId(fc); - if (id.contains("ADVANCEDITEM")) { - fc.setVisible(advancedOptions); - } -} -lg.setVisible(advancedOptions); +// set visibility of Advanced options layout group +lg_advancedGroup.setVisible(advancedOptions); if (!advancedOptions) { return; } + // get boolean status of "Allow user-space updates" checkbox JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); boolean userUpdates = jcb_user.isSelected(); // set enabled of customised user appdir path group -lg.setEnabled(advancedOptions && userUpdates); +lg_setUserAppdirPath.setEnabled(advancedOptions && userUpdates); // set enabled of allow installation updates checkbox fc_installerUpdates.setEnabled(advancedOptions && !userUpdates); @@ -1099,24 +1141,40 @@ JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject boolean installerUpdates = jcb_installer.isSelected(); // should we show the No updates warning? -boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); -FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); -fc_warning.setVisible(showWarning); +boolean showNoUpdatesWarning = advancedOptions && !(userUpdates || installerUpdates); +FormComponent fc_noUpdatesWarning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); +fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); // get String value of userAppdirPath text field JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); String userAppdirPath = jtf_userAppdirPath.getText(); -// not using this yet - - - allowSetUserAppdirPath - - - - - <html>The base path where individual users' updates + +// should we show the invalid user-space path warning? +boolean u = userAppdirPath.contains("%u"); +boolean h = userAppdirPath.contains("%h"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(advancedOptions && userUpdates && allowUserAppdirPath && fc_userAppdirPath.isEnabled() && showInvalidPathWarning); + + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); + + + allowSetUserAppdirPath + + + + + <html>The base path where individual users' updates <br> will be stored. <br> @@ -1134,29 +1192,132 @@ The default value on ${installer:osName} is <br> <pre>${installer:userDefaultAppdirBase}</pre> </html> - - - boolean u = text.contains("%u"); -boolean h = text.contains("%h"); -boolean t = text.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); +FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); +LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_OPTIONS_GROUP"); +LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); -boolean valid = text.length() == 0 || u || h || t; -if (!valid) { - // popup warning? + +// get boolean status of "Enable advanced options" checkbox +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = jcb_advancedOptions.isSelected(); + +// set visibility of Advanced options layout group +lg_advancedGroup.setVisible(advancedOptions); + +if (!advancedOptions) { + return true; } + + + +// get boolean status of "Allow user-space updates" checkbox +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = jcb_user.isSelected(); + +// set enabled of customised user appdir path group +lg_setUserAppdirPath.setEnabled(advancedOptions && userUpdates); + +// set enabled of allow installation updates checkbox +fc_installerUpdates.setEnabled(advancedOptions && !userUpdates); + + + +// get boolean status of "Customise the user-space path" checkbox +JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); +boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); + +// set enabled of userAppdirPath text field +fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); + + + +// get boolean status of "Allow installation updates" checkbox +JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); +boolean installerUpdates = jcb_installer.isSelected(); + +// should we show the No updates warning? +boolean showNoUpdatesWarning = advancedOptions && !(userUpdates || installerUpdates); +FormComponent fc_noUpdatesWarning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); +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"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(advancedOptions && userUpdates && allowUserAppdirPath && fc_userAppdirPath.isEnabled() && showInvalidPathWarning); + + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); + + + return true; - - - userAppdirPath - - - - - - - Allow installation updates for ${compiler:JALVIEW_APPLICATION_NAME} components - <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} + + + + + // get String value of userAppdirPath text field +FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); +boolean u = userAppdirPath.contains("%u"); +boolean h = userAppdirPath.contains("%h"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(showInvalidPathWarning); + + + + + + + + + userAppdirPath + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); + +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = jcb_user.isSelected(); + +JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); +boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); + +configurationObject.setEnabled(userUpdates && allowUserAppdirPath); + + + + + + Allow installation updates for ${compiler:JALVIEW_APPLICATION_NAME} components + <html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME} <br> components to be automatically downloaded <br> @@ -1179,14 +1340,15 @@ Installation updates will be installed into <br> <pre>${installer:sys.contentDir}</pre> </html> - - - FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); -LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); +LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_OPTIONS_GROUP"); +LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); @@ -1194,26 +1356,21 @@ LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// set visibility of all "ADVANCEDITEM" components (does not include groups) and layout groups -for (FormComponent fc: formEnvironment.getFormComponents()) { - String id = formEnvironment.getId(fc); - if (id.contains("ADVANCEDITEM")) { - fc.setVisible(advancedOptions); - } -} -lg.setVisible(advancedOptions); +// set visibility of Advanced options layout group +lg_advancedGroup.setVisible(advancedOptions); if (!advancedOptions) { return; } + // get boolean status of "Allow user-space updates" checkbox JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); boolean userUpdates = jcb_user.isSelected(); // set enabled of customised user appdir path group -lg.setEnabled(advancedOptions && userUpdates); +lg_setUserAppdirPath.setEnabled(advancedOptions && userUpdates); // set enabled of allow installation updates checkbox fc_installerUpdates.setEnabled(advancedOptions && !userUpdates); @@ -1234,55 +1391,185 @@ JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject boolean installerUpdates = jcb_installer.isSelected(); // should we show the No updates warning? -boolean showWarning = advancedOptions && !(userUpdates || installerUpdates); -FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); -fc_warning.setVisible(showWarning); +boolean showNoUpdatesWarning = advancedOptions && !(userUpdates || installerUpdates); +FormComponent fc_noUpdatesWarning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); +fc_noUpdatesWarning.setVisible(advancedOptions && showNoUpdatesWarning); // get String value of userAppdirPath text field JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); String userAppdirPath = jtf_userAppdirPath.getText(); -// not using this yet - - - allowInstallerAppdirUpdates - - context.getBooleanVariable("advancedOptions") - - - - - - - ${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png - - - No automatic updates will occur when Jalview is launched - - context.getBooleanVariable("advancedOptions") -&& -!( + +// should we show the invalid user-space path warning? +boolean u = userAppdirPath.contains("%u"); +boolean h = userAppdirPath.contains("%h"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(advancedOptions && userUpdates && allowUserAppdirPath && fc_userAppdirPath.isEnabled() && showInvalidPathWarning); + + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); + + + allowInstallerAppdirUpdates + + + + + + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); +FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); +LayoutGroup lg_advancedGroup = formEnvironment.getLayoutGroupById("SS_ADVANCED_OPTIONS_GROUP"); +LayoutGroup lg_setUserAppdirPath = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); + + +// set defaults +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +jcb_user.setSelected(true); + +JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); +jcb_allowUserAppdirPath.setSelected(false); + +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +jtf_userAppdirPath.setText(""); + +JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); +jcb_installer.setSelected(false); + + + +// get boolean status of "Enable advanced options" checkbox +JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); +boolean advancedOptions = jcb_advancedOptions.isSelected(); + +// set visibility of Advanced options layout group +lg_advancedGroup.setVisible(advancedOptions); + +if (!advancedOptions) { + return; +} + + + +// get boolean status of "Allow user-space updates" checkbox +boolean userUpdates = jcb_user.isSelected(); + +// set enabled of customised user appdir path group +lg_setUserAppdirPath.setEnabled(advancedOptions && userUpdates); + +// set enabled of allow installation updates checkbox +fc_installerUpdates.setEnabled(advancedOptions && !userUpdates); + + + +// get boolean status of "Customise the user-space path" checkbox +boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); + +// set enabled of userAppdirPath text field +fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath && fc_allowUserAppdirPath.isEnabled()); + + + +// get boolean status of "Allow installation updates" checkbox +boolean installerUpdates = jcb_installer.isSelected(); + +// should we show the No updates warning? +boolean showNoUpdatesWarning = advancedOptions && !(userUpdates || installerUpdates); +FormComponent fc_noUpdatesWarning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); +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"); +boolean t = userAppdirPath.startsWith("~" + (String)context.getVariable("sys.fileSeparator")); + +boolean showInvalidPathWarning = !( userAppdirPath.length() == 0 || u || h || t ); +FormComponent fc_invalidPathWarning = formEnvironment.getFormComponentById("SS_INVALID_USER_APPDIR_PATH_WARNING"); +fc_invalidPathWarning.setVisible(advancedOptions && userUpdates && allowUserAppdirPath && fc_userAppdirPath.isEnabled() && showInvalidPathWarning); + + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); + + + Reset advanced options to defaults + + FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS"); +FormComponent fc_userUpdates = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); +FormComponent fc_installerUpdates = formEnvironment.getFormComponentById("SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM"); +FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ALLOW_USER_APPDIR_PATH"); + +JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); +boolean userUpdates = jcb_user.isSelected(); + +JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); +boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); + +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); + +JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); +boolean installerUpdates = jcb_installer.isSelected(); + + +// set whether "Set defaults" button should be enabled +FormComponent fc_setDefaults = formEnvironment.getFormComponentById("SS_SET_DEFAULTS_ADVANCEDITEM"); +JButton jb_setDefaults = (JButton) fc_setDefaults.getConfigurationObject(); +boolean enableSetDefaults = !( userUpdates && !allowUserAppdirPath && userAppdirPath.length() == 0 && !installerUpdates ); +jb_setDefaults.setEnabled(enableSetDefaults); + + + + + + ${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png + + + No automatic updates will occur when ${compiler:JALVIEW_APPLICATION_NAME} is launched + + !( context.getBooleanVariable("allowUserDefaultAppdirUpdates") || context.getBooleanVariable("allowInstallerAppdirUpdates") ) - - - - - - ${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png - - - No automatic updates will occur when Jalview is launched - - context.getBooleanVariable("advancedOptions") -&& -!( + + + + + + ${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png + + + The user-space path should contain one of "~" (at the start), "%u" or "%h" + + !( context.getBooleanVariable("allowUserDefaultAppdirUpdates") || context.getBooleanVariable("allowInstallerAppdirUpdates") ) - + + +