<applications>
<application id="installer" beanClass="com.install4j.runtime.beans.applications.InstallerApplication" actionElevationType="elevated" styleId="35" customIcnsFile="${compiler:JALVIEW_DIR}/${compiler:INSTALLER_MAC_ICON}" customIcoFile="${compiler:JALVIEW_DIR}/${compiler:INSTALLER_WINDOWS_ICON}">
<serializedBean>
- <property name="frameHeight" type="int" value="768" />
+ <property name="frameHeight" type="int" value="812" />
<property name="frameWidth" type="int" value="1024" />
<property name="useCustomIcon" type="boolean" value="true" />
</serializedBean>
<serializedBean>
<property name="checkboxText" type="string">Enable advanced options for system installation</property>
<property name="coupledComponentIds">
+ <add type="string">3030</add>
<add type="string">2985</add>
<add type="string">3013</add>
<add type="string">2986</add>
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");
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);
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</property>
+
+// 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);</property>
</object>
</property>
<property name="variableName" type="string">advancedOptions</property>
</serializedBean>
</formComponent>
- <formComponent name="Strongly recommended text" id="2985" customizedId="SS_LABEL_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.MultilineHtmlLabelComponent" insetLeft="16">
+ <group name="Advanced options group" id="3030" customizedId="SS_ADVANCED_OPTIONS_GROUP" beanClass="com.install4j.runtime.beans.groups.VerticalFormComponentGroup">
<serializedBean>
- <property name="labelHtml" type="string"><html>The following options are <strong>strongly recommended</strong> to be left as default unless there is a particular reason to change them.</html></property>
- </serializedBean>
- <visibilityScript>context.getBooleanVariable("advancedOptions")
-</visibilityScript>
- </formComponent>
- <formComponent id="3013" customizedId="SS_VSPACE_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.SpacerComponent" insetLeft="16" />
- <formComponent name="BOTHSPACE: Allow automatic updates in user's home directory" id="2986" customizedId="SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent" insetLeft="16">
- <serializedBean>
- <property name="checkboxText" type="string">Allow user-space updates for ${compiler:JALVIEW_APPLICATION_NAME} components</property>
- <property name="coupledComponentIds">
- <add type="string">3021</add>
+ <property name="borderSides">
+ <object class="com.install4j.runtime.beans.formcomponents.BorderSides">
+ <property name="bottom" type="boolean" value="true" />
+ <property name="left" type="boolean" value="true" />
+ <property name="right" type="boolean" value="true" />
+ <property name="top" type="boolean" value="true" />
+ </object>
</property>
- <property name="helpText" type="string"><html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME}
+ <property name="insets">
+ <object class="java.awt.Insets">
+ <int>4</int>
+ <int>4</int>
+ <int>4</int>
+ <int>4</int>
+ </object>
+ </property>
+ <property name="visibilityScript">
+ <object class="com.install4j.api.beans.ScriptProperty">
+ <property name="value" type="string">context.getBooleanVariable("advancedOptions")
+</property>
+ </object>
+ </property>
+ </serializedBean>
+ <beans>
+ <formComponent name="Strongly recommended text" id="2985" customizedId="SS_LABEL_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.MultilineHtmlLabelComponent" insetLeft="16">
+ <serializedBean>
+ <property name="labelHtml" type="string"><html>The following options are <strong>strongly recommended</strong> to be left as default unless there is a particular reason to change them.</html></property>
+ </serializedBean>
+ </formComponent>
+ <formComponent id="3013" customizedId="SS_VSPACE_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.SpacerComponent" insetLeft="16" />
+ <formComponent name="BOTHSPACE: Allow automatic updates in user's home directory" id="2986" customizedId="SS_ALLOW_USER_APPDIR_UPDATES_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent" insetLeft="16">
+ <serializedBean>
+ <property name="checkboxText" type="string">Allow user-space updates for ${compiler:JALVIEW_APPLICATION_NAME} components</property>
+ <property name="coupledComponentIds">
+ <add type="string">3021</add>
+ </property>
+ <property name="helpText" type="string"><html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME}
<br>
components to be automatically downloaded
<br>
<pre>${installer:userDefaultAppdirBase}</pre>
unless customised below.
</html></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");
+ <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_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");
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);
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</property>
- </object>
- </property>
- <property name="variableName" type="string">allowUserDefaultAppdirUpdates</property>
- </serializedBean>
- <visibilityScript>context.getBooleanVariable("advancedOptions")
-</visibilityScript>
- </formComponent>
- <group name="SYSTEMSPACE: Customise user appDir path" id="3021" customizedId="SS_SET_USER_APPDIR_PATH" beanClass="com.install4j.runtime.beans.groups.HorizontalFormComponentGroup">
- <serializedBean>
- <property name="insets">
- <object class="java.awt.Insets">
- <int>0</int>
- <int>32</int>
- <int>0</int>
- <int>0</int>
- </object>
- </property>
- <property name="visibilityScript">
- <object class="com.install4j.api.beans.ScriptProperty">
- <property name="value" type="string">context.getBooleanVariable("advancedOptions")
-</property>
- </object>
- </property>
- </serializedBean>
- <beans>
- <formComponent name="SYSTEMSPACE: Allow setting userAppdirPath" id="3022" customizedId="SS_ALLOW_USER_APPDIR_PATH" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent">
+
+// 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);</property>
+ </object>
+ </property>
+ <property name="variableName" type="string">allowUserDefaultAppdirUpdates</property>
+ </serializedBean>
+ </formComponent>
+ <group name="SYSTEMSPACE: Customise user appDir path" id="3021" customizedId="SS_SET_USER_APPDIR_PATH" beanClass="com.install4j.runtime.beans.groups.HorizontalFormComponentGroup">
<serializedBean>
- <property name="checkboxText" type="string">Customise the user-space path</property>
- <property name="selectionScript">
+ <property name="insets">
+ <object class="java.awt.Insets">
+ <int>0</int>
+ <int>32</int>
+ <int>0</int>
+ <int>0</int>
+ </object>
+ </property>
+ <property name="visibilityScript">
<object class="com.install4j.api.beans.ScriptProperty">
- <property name="value" type="string">FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS");
+ <property name="value" type="string" />
+ </object>
+ </property>
+ </serializedBean>
+ <beans>
+ <formComponent name="SYSTEMSPACE: Allow setting userAppdirPath" id="3022" customizedId="SS_ALLOW_USER_APPDIR_PATH" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent">
+ <serializedBean>
+ <property name="checkboxText" type="string">Customise the user-space path</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_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");
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);
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</property>
- </object>
- </property>
- <property name="variableName" type="string">allowSetUserAppdirPath</property>
- </serializedBean>
- </formComponent>
- <formComponent name="SYSTEMSPACE: Set userAppdirPath" id="3024" customizedId="SS_USER_APPDIR_PATH" beanClass="com.install4j.runtime.beans.formcomponents.TextfieldComponent">
- <serializedBean>
- <property name="helpText" type="string"><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);</property>
+ </object>
+ </property>
+ <property name="variableName" type="string">allowSetUserAppdirPath</property>
+ </serializedBean>
+ </formComponent>
+ <formComponent name="SYSTEMSPACE: Set userAppdirPath" id="3024" customizedId="SS_USER_APPDIR_PATH" beanClass="com.install4j.runtime.beans.formcomponents.TextfieldComponent">
+ <serializedBean>
+ <property name="helpText" type="string"><html>The base path where individual users' updates
<br>
will be stored.
<br>
<br>
<pre>${installer:userDefaultAppdirBase}</pre>
</html></property>
- <property name="inputVerifier">
- <object class="com.install4j.api.beans.ScriptProperty">
- <property name="value" type="string">boolean u = text.contains("%u");
-boolean h = text.contains("%h");
-boolean t = text.startsWith("~" + (String)context.getVariable("sys.fileSeparator"));
+ <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_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;</property>
- </object>
- </property>
- <property name="variableName" type="string">userAppdirPath</property>
- </serializedBean>
- </formComponent>
- </beans>
- </group>
- <formComponent name="SYSTEMSPACE: Allow automatic updates in the installation directory" id="2974" customizedId="SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent" insetLeft="16">
- <serializedBean>
- <property name="checkboxText" type="string">Allow installation updates for ${compiler:JALVIEW_APPLICATION_NAME} components</property>
- <property name="helpText" type="string"><html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME}
+ </object>
+ </property>
+ <property name="keyListener">
+ <object class="com.install4j.api.beans.ScriptProperty">
+ <property name="value" type="string">// 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);
+</property>
+ </object>
+ </property>
+ <property name="keyValidator">
+ <object class="com.install4j.api.beans.ScriptProperty">
+ <property name="value" type="string" />
+ </object>
+ </property>
+ <property name="variableName" type="string">userAppdirPath</property>
+ </serializedBean>
+ <initScript>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);</initScript>
+ </formComponent>
+ </beans>
+ </group>
+ <formComponent name="SYSTEMSPACE: Allow automatic updates in the installation directory" id="2974" customizedId="SS_ALLOW_INSTALLER_APPDIR_UPDATES_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent" insetLeft="16">
+ <serializedBean>
+ <property name="checkboxText" type="string">Allow installation updates for ${compiler:JALVIEW_APPLICATION_NAME} components</property>
+ <property name="helpText" type="string"><html>This option allows updates to ${compiler:JALVIEW_APPLICATION_NAME}
<br>
components to be automatically downloaded
<br>
<br>
<pre>${installer:sys.contentDir}</pre>
</html></property>
- <property name="selectionScript">
- <object class="com.install4j.api.beans.ScriptProperty">
- <property name="value" type="string">FormComponent fc_advancedOptions = formEnvironment.getFormComponentById("SS_ADVANCED_OPTIONS");
+ <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_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");
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);
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</property>
- </object>
- </property>
- <property name="variableName" type="string">allowInstallerAppdirUpdates</property>
- </serializedBean>
- <visibilityScript>context.getBooleanVariable("advancedOptions")
-</visibilityScript>
- </formComponent>
- <formComponent name="BOTHSPACE: No updates warning" id="2988" customizedId="SS_NO_UPDATES_WARNING" beanClass="com.install4j.runtime.beans.formcomponents.LabelComponent" insetLeft="16">
- <serializedBean>
- <property name="labelIconFile">
- <object class="com.install4j.api.beans.ExternalFile">
- <string>${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png</string>
- </object>
- </property>
- <property name="labelText" type="string">No automatic updates will occur when Jalview is launched</property>
- </serializedBean>
- <visibilityScript>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);</property>
+ </object>
+ </property>
+ <property name="variableName" type="string">allowInstallerAppdirUpdates</property>
+ </serializedBean>
+ </formComponent>
+ <formComponent name="Set defaults" id="3029" customizedId="SS_SET_DEFAULTS_ADVANCEDITEM" beanClass="com.install4j.runtime.beans.formcomponents.ButtonComponent" insetTop="8" insetLeft="16">
+ <serializedBean>
+ <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_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);</property>
+ </object>
+ </property>
+ <property name="buttonText" type="string">Reset advanced options to defaults</property>
+ </serializedBean>
+ <initScript>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);</initScript>
+ </formComponent>
+ <formComponent name="BOTHSPACE: No updates warning" id="2988" customizedId="SS_NO_UPDATES_WARNING" beanClass="com.install4j.runtime.beans.formcomponents.LabelComponent" insetLeft="16">
+ <serializedBean>
+ <property name="labelIconFile">
+ <object class="com.install4j.api.beans.ExternalFile">
+ <string>${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png</string>
+ </object>
+ </property>
+ <property name="labelText" type="string">No automatic updates will occur when ${compiler:JALVIEW_APPLICATION_NAME} is launched</property>
+ </serializedBean>
+ <visibilityScript>!(
context.getBooleanVariable("allowUserDefaultAppdirUpdates")
|| context.getBooleanVariable("allowInstallerAppdirUpdates")
)</visibilityScript>
- </formComponent>
- <formComponent name="SYSTEMSPACE: Invalid user-space path warning" id="3027" customizedId="SS_INVALID_USER_APPDIR_PATH_WARNING" beanClass="com.install4j.runtime.beans.formcomponents.LabelComponent" insetLeft="16">
- <serializedBean>
- <property name="labelIconFile">
- <object class="com.install4j.api.beans.ExternalFile">
- <string>${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png</string>
- </object>
- </property>
- <property name="labelText" type="string">No automatic updates will occur when Jalview is launched</property>
- </serializedBean>
- <visibilityScript>context.getBooleanVariable("advancedOptions")
-&&
-!(
+ </formComponent>
+ <formComponent name="SYSTEMSPACE: Invalid user-space path warning" id="3027" customizedId="SS_INVALID_USER_APPDIR_PATH_WARNING" beanClass="com.install4j.runtime.beans.formcomponents.LabelComponent" insetLeft="16">
+ <serializedBean>
+ <property name="labelIconFile">
+ <object class="com.install4j.api.beans.ExternalFile">
+ <string>${compiler:JALVIEW_DIR}/${compiler:INSTALL4J_UTILS_DIR}/warning.png</string>
+ </object>
+ </property>
+ <property name="labelText" type="string">The user-space path should contain one of "~" (at the start), "%u" or "%h"</property>
+ </serializedBean>
+ <visibilityScript>!(
context.getBooleanVariable("allowUserDefaultAppdirUpdates")
|| context.getBooleanVariable("allowInstallerAppdirUpdates")
)</visibilityScript>
- </formComponent>
+ </formComponent>
+ </beans>
+ </group>
</formComponents>
</screen>
<screen id="15" beanClass="com.install4j.runtime.beans.screens.InstallationScreen" rollbackBarrier="true" rollbackBarrierExitCode="0">