From: Ben Soares Date: Sat, 20 Jul 2024 08:52:28 +0000 (+0100) Subject: JAL-3631 Consistently and correctly enable/diable/hide elements on the additional... X-Git-Tag: Release_2_11_4_0~20^2~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c6b82be5e90e35c86b3655e75d667afcf3a91209;p=jalview.git JAL-3631 Consistently and correctly enable/diable/hide elements on the additional tasks screen in the install4j installation wizard. --- diff --git a/utils/install4j/install4j10_template.install4j b/utils/install4j/install4j10_template.install4j index 564b1a5..eb0dcba 100644 --- a/utils/install4j/install4j10_template.install4j +++ b/utils/install4j/install4j10_template.install4j @@ -539,6 +539,12 @@ return context.getCompilerVariable("sys.platform"); + + + <strong>Administrator mode</strong> + + context.getBooleanVariable("isAdmin") + ${form:welcomeMessage} @@ -854,50 +860,62 @@ FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); + + // get boolean status of "Enable advanced options" checkbox JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// get boolean status of "Allow user-space updates" checkbox -JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); -boolean userUpdates = jcb_user.isSelected(); - -// get boolean status of "Allow installation updates" checkbox -JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); -boolean installerUpdates = jcb_installer.isSelected(); - -// get boolean status of "Customise the user-space path" checkbox -JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); -boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); - -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - -// set visibility of all "ADVANCEDITEM" components (does not include groups) +// 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); } } -// set visibility of customised user appdir path group (checkbox and text field) lg.setVisible(advancedOptions); -// set enabled of userAppdirPath text field -fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath); +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); // set enabled of allow installation updates checkbox -fc_installerUpdates.setEnabled(!userUpdates); +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 showWarning = advancedOptions && !(userUpdates || installerUpdates); FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); fc_warning.setVisible(showWarning); - + + + +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); +// not using this yet advancedOptions @@ -942,50 +960,62 @@ FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); + + // get boolean status of "Enable advanced options" checkbox JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// get boolean status of "Allow user-space updates" checkbox -JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); -boolean userUpdates = jcb_user.isSelected(); - -// get boolean status of "Allow installation updates" checkbox -JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); -boolean installerUpdates = jcb_installer.isSelected(); - -// get boolean status of "Customise the user-space path" checkbox -JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); -boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); - -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - -// set visibility of all "ADVANCEDITEM" components (does not include groups) +// 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); } } -// set visibility of customised user appdir path group (checkbox and text field) lg.setVisible(advancedOptions); -// set enabled of userAppdirPath text field -fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath); +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); // set enabled of allow installation updates checkbox -fc_installerUpdates.setEnabled(!userUpdates); +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 showWarning = advancedOptions && !(userUpdates || installerUpdates); FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); fc_warning.setVisible(showWarning); - + + + +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); +// not using this yet allowUserDefaultAppdirUpdates @@ -1023,50 +1053,62 @@ FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); + + // get boolean status of "Enable advanced options" checkbox JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// get boolean status of "Allow user-space updates" checkbox -JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); -boolean userUpdates = jcb_user.isSelected(); - -// get boolean status of "Allow installation updates" checkbox -JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); -boolean installerUpdates = jcb_installer.isSelected(); - -// get boolean status of "Customise the user-space path" checkbox -JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); -boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); - -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - -// set visibility of all "ADVANCEDITEM" components (does not include groups) +// 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); } } -// set visibility of customised user appdir path group (checkbox and text field) lg.setVisible(advancedOptions); -// set enabled of userAppdirPath text field -fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath); +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); // set enabled of allow installation updates checkbox -fc_installerUpdates.setEnabled(!userUpdates); +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 showWarning = advancedOptions && !(userUpdates || installerUpdates); FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); fc_warning.setVisible(showWarning); - + + + +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); +// not using this yet allowSetUserAppdirPath @@ -1146,50 +1188,62 @@ FormComponent fc_allowUserAppdirPath = formEnvironment.getFormComponentById("SS_ FormComponent fc_userAppdirPath = formEnvironment.getFormComponentById("SS_USER_APPDIR_PATH"); LayoutGroup lg = formEnvironment.getLayoutGroupById("SS_SET_USER_APPDIR_PATH"); + + // get boolean status of "Enable advanced options" checkbox JCheckBox jcb_advancedOptions = (JCheckBox) fc_advancedOptions.getConfigurationObject(); boolean advancedOptions = jcb_advancedOptions.isSelected(); -// get boolean status of "Allow user-space updates" checkbox -JCheckBox jcb_user = (JCheckBox) fc_userUpdates.getConfigurationObject(); -boolean userUpdates = jcb_user.isSelected(); - -// get boolean status of "Allow installation updates" checkbox -JCheckBox jcb_installer = (JCheckBox) fc_installerUpdates.getConfigurationObject(); -boolean installerUpdates = jcb_installer.isSelected(); - -// get boolean status of "Customise the user-space path" checkbox -JCheckBox jcb_allowUserAppdirPath = (JCheckBox) fc_allowUserAppdirPath.getConfigurationObject(); -boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected(); - -// get String value of userAppdirPath text field -JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); -String userAppdirPath = jtf_userAppdirPath.getText(); - -// set visibility of all "ADVANCEDITEM" components (does not include groups) +// 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); } } -// set visibility of customised user appdir path group (checkbox and text field) lg.setVisible(advancedOptions); -// set enabled of userAppdirPath text field -fc_userAppdirPath.setEnabled(advancedOptions && allowUserAppdirPath); +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); // set enabled of allow installation updates checkbox -fc_installerUpdates.setEnabled(!userUpdates); +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 showWarning = advancedOptions && !(userUpdates || installerUpdates); FormComponent fc_warning = formEnvironment.getFormComponentById("SS_NO_UPDATES_WARNING"); fc_warning.setVisible(showWarning); - + + + +// get String value of userAppdirPath text field +JTextField jtf_userAppdirPath = (JTextField) fc_userAppdirPath.getConfigurationObject(); +String userAppdirPath = jtf_userAppdirPath.getText(); +// not using this yet allowInstallerAppdirUpdates