JAL-3631 Minor fixes to the advanced options scripts
authorBen Soares <b.soares@dundee.ac.uk>
Mon, 22 Jul 2024 19:36:33 +0000 (20:36 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Mon, 22 Jul 2024 19:36:33 +0000 (20:36 +0100)
utils/install4j/install4j10_template.install4j

index 5e8bb2a..eb99e67 100644 (file)
@@ -392,6 +392,16 @@ return wrapperLink;
                 </serializedBean>
                 <condition>Util.isMacOS() &amp;&amp; !context.getBooleanVariable("isAdmin") // Admin on macOS will add path to /etc/paths.d in Create File action</condition>
               </action>
+              <action name="BOTHSPACE: Set advancedOptions" id="3040" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
+                <serializedBean>
+                  <property name="script">
+                    <object class="com.install4j.api.beans.ScriptProperty">
+                      <property name="value" type="string">Boolean.FALSE</property>
+                    </object>
+                  </property>
+                  <property name="variableName" type="string">advancedOptions</property>
+                </serializedBean>
+              </action>
               <action name="BOTHSPACE: Set allowUserDefaultAppdirUpdates" id="2976" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
                 <serializedBean>
                   <property name="script">
@@ -402,6 +412,26 @@ return wrapperLink;
                   <property name="variableName" type="string">allowUserDefaultAppdirUpdates</property>
                 </serializedBean>
               </action>
+              <action name="BOTHSPACE: Set allowSetUserAppdirPath" id="3039" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
+                <serializedBean>
+                  <property name="script">
+                    <object class="com.install4j.api.beans.ScriptProperty">
+                      <property name="value" type="string">Boolean.FALSE</property>
+                    </object>
+                  </property>
+                  <property name="variableName" type="string">allowSetUserAppdirPath</property>
+                </serializedBean>
+              </action>
+              <action name="BOTHSPACE: Set userAppdirPath" id="3038" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
+                <serializedBean>
+                  <property name="script">
+                    <object class="com.install4j.api.beans.ScriptProperty">
+                      <property name="value" type="string">""</property>
+                    </object>
+                  </property>
+                  <property name="variableName" type="string">userAppdirPath</property>
+                </serializedBean>
+              </action>
               <action name="BOTHSPACE: Set allowInstallerAppdirUpdates" id="2977" beanClass="com.install4j.runtime.beans.actions.control.SetVariableAction" rollbackBarrierExitCode="0">
                 <serializedBean>
                   <property name="script">
@@ -947,6 +977,10 @@ boolean allowUserAppdirPath = jcb_allowUserAppdirPath.isSelected();
 // set enabled of userAppdirPath text field
 fc_userAppdirPath.setEnabled(advancedOptions &amp;&amp; allowUserAppdirPath &amp;&amp; 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 &amp;&amp; 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
 &lt;pre&gt;${installer:userDefaultAppdirBase}&lt;/pre&gt;
 unless customised below.
 &lt;/html&gt;</property>
-                          <property name="initiallySelected" type="boolean" value="true" />
                           <property name="selectionScript">
                             <object class="com.install4j.api.beans.ScriptProperty">
                               <property name="value" type="string">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 &amp;&amp; allowUserAppdirPath &amp;&amp; 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 &amp;&amp; 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);</property>
                               <property name="selectionScript">
                                 <object class="com.install4j.api.beans.ScriptProperty">
                                   <property name="value" type="string">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 &amp;&amp; allowUserAppdirPath &amp;&amp; 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 &amp;&amp; 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
                               <property name="inputVerifier">
                                 <object class="com.install4j.api.beans.ScriptProperty">
                                   <property name="value" type="string">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 &amp;&amp; allowUserAppdirPath &amp;&amp; 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 &amp;&amp; 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);
                               </property>
                               <property name="variableName" type="string">userAppdirPath</property>
                             </serializedBean>
-                            <initScript>component.setEnabled( context.getBooleanVariable("allowUserDefaultAppdirUpdates") &amp;&amp; context.getBooleanVariable("allowSetUserAppdirPath") )</initScript>
+                            <initScript>component.setEnabled( context.getBooleanVariable("allowUserDefaultAppdirUpdates") &amp;&amp; context.getBooleanVariable("allowSetUserAppdirPath") );
+</initScript>
                           </formComponent>
                         </beans>
                       </group>
@@ -1407,6 +1443,7 @@ Installation updates will be installed into
                           <property name="selectionScript">
                             <object class="com.install4j.api.beans.ScriptProperty">
                               <property name="value" type="string">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 &amp;&amp; allowUserAppdirPath &amp;&amp; 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 &amp;&amp; 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);</property>
                           <property name="actionScript">
                             <object class="com.install4j.api.beans.ScriptProperty">
                               <property name="value" type="string">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 &amp;&amp; allowUserAppdirPath &amp;&amp; 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 &amp;&amp; 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;</property>
                   <action name="Allow user-space updates" id="2996" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="2">
-                        <element index="0"># Uncomment the following line to disable user-space updates</element>
-                        <element index="1">#-Dnouserdefaultappdir=true</element>
+                      <property name="vmOptions" type="array" elementType="string" length="3">
+                        <element index="0">#</element>
+                        <element index="1"># Uncomment the following line to disable user-space updates</element>
+                        <element index="2">#-Dnouserdefaultappdir=true</element>
                       </property>
                     </serializedBean>
                     <condition>!context.getBooleanVariable("disableUserDefaultAppdirUpdates")</condition>
@@ -2030,9 +2072,10 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                   <action name="Disable user-space updates" id="2997" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="2">
-                        <element index="0"># Comment out the following line to allow user-space updates</element>
-                        <element index="1">-Dnouserdefaultappdir=true</element>
+                      <property name="vmOptions" type="array" elementType="string" length="3">
+                        <element index="0">#</element>
+                        <element index="1"># Comment out the following line to allow user-space updates</element>
+                        <element index="2">-Dnouserdefaultappdir=true</element>
                       </property>
                     </serializedBean>
                     <condition>context.getBooleanVariable("disableUserDefaultAppdirUpdates")</condition>
@@ -2040,11 +2083,12 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                   <action name="Set setUserAppdirPath property" id="3026" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="4">
-                        <element index="0"># The below line sets a custom path for user-space updates -- use with caution.</element>
-                        <element index="1"># A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username.</element>
-                        <element index="2"># If unset, the default is ${installer:userDefaultAppdirBase} for ${installer:osName}</element>
-                        <element index="3">-Dsetuserappdirpath=${installer:setUserAppdirPath}</element>
+                      <property name="vmOptions" type="array" elementType="string" length="5">
+                        <element index="0">#</element>
+                        <element index="1"># The below line sets a custom path for user-space updates -- use with caution.</element>
+                        <element index="2"># A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username.</element>
+                        <element index="3"># If unset, the default is ${installer:userDefaultAppdirBase} for ${installer:osName}</element>
+                        <element index="4">-Dsetuserappdirpath=${installer:setUserAppdirPath}</element>
                       </property>
                     </serializedBean>
                     <condition>(String)context.getVariable("setUserAppdirPath") != null</condition>
@@ -2052,11 +2096,12 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                   <action name="Don't set setUserAppdirPath property" id="3037" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="4">
-                        <element index="0"># Uncomment the below line to set a custom path for user-space updates -- use with caution.</element>
-                        <element index="1"># A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username.</element>
-                        <element index="2"># If not set, the default is ${installer:userDefaultAppdirBase} for ${installer:osName}</element>
-                        <element index="3"># -Dsetuserappdirpath=${installer:setUserAppdirPath}</element>
+                      <property name="vmOptions" type="array" elementType="string" length="5">
+                        <element index="0">#</element>
+                        <element index="1"># Uncomment the below line to set a custom path for user-space updates -- use with caution.</element>
+                        <element index="2"># A leading ~/ or %h anywhere will be sustituted with the user's home path, and %u by the username.</element>
+                        <element index="3"># If not set, the default is ${installer:userDefaultAppdirBase} for ${installer:osName}</element>
+                        <element index="4">#-Dsetuserappdirpath=/tmp/jalview/%u</element>
                       </property>
                     </serializedBean>
                     <condition>(String)context.getVariable("setUserAppdirPath") == null</condition>
@@ -2064,9 +2109,10 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                   <action name="Allow updates" id="2998" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="2">
-                        <element index="0"># Uncomment the following line to also disable all updates</element>
-                        <element index="1">#-Dsilent=noupdate </element>
+                      <property name="vmOptions" type="array" elementType="string" length="3">
+                        <element index="0">#</element>
+                        <element index="1"># Uncomment the following line to also disable all updates</element>
+                        <element index="2">#-Dsilent=noupdate </element>
                       </property>
                     </serializedBean>
                     <condition>!context.getBooleanVariable("disableUpdates")</condition>
@@ -2074,9 +2120,10 @@ return advanced ? !( allowUser || allowInstaller ) : false;</property>
                   <action name="Disable updates" id="2999" beanClass="com.install4j.runtime.beans.actions.misc.AddVmOptionsAction" actionElevationType="elevated" rollbackBarrierExitCode="0">
                     <serializedBean>
                       <property name="launcherId" type="string">2823</property>
-                      <property name="vmOptions" type="array" elementType="string" length="2">
-                        <element index="0"># Comment out the following line to enable updates</element>
-                        <element index="1">-Dsilent=noupdate</element>
+                      <property name="vmOptions" type="array" elementType="string" length="3">
+                        <element index="0">#</element>
+                        <element index="1"># Comment out the following line to enable updates</element>
+                        <element index="2">-Dsilent=noupdate</element>
                       </property>
                     </serializedBean>
                     <condition>context.getBooleanVariable("disableUpdates")</condition>