Install4j——组合框组件配置条件
Install4j - combo box component configuration conditions
我们正在使用安装程序 6.1.6。
今天我们支持SQL服务器认证,我希望添加Windows认证模式.
的新能力
我们的数据库配置设置为配置表单,我想添加一个新的组合框表单组件,其中将包含 2 个服务器身份验证选项。
是否可以使用条件表达式定义组合框的Windows身份验证选项仅适用于 Windows OS? (为 Linux 用户显示它没有意义)
一些表单组件是 "username" & "password"。如果用户选择 windows 身份验证模式 ,则这些字段不再相关。那样的话可以隐藏吗?
当运行安装程序使用安静模式时,组合框选项是否会导致冲突?是否将第一个选项设置为默认值?
Is it possible to define the combo-box's Windows Authentication option
with a condition expression for Windows OS only? (it doesn't make
sense to display it for Linux users)
您可以将 "Drop-down list" 表单组件的 "Drop-down list entries" 属性 设置为包含字符串数组的安装程序变量:
${installer:authenticationOptions}
在表单的预激活脚本中,您可以使用以下代码设置变量:
List<String> options = new ArrayList<>();
options.add("One");
options.add("Two");
if (Util.isWindows()) {
options.add("Three");
}
context.setVariable("authenticationOptions", options.toArray(new String[0]));
Some of the form components are "username" & "password". In case the
user chooses the windows authentication mode these fields aren't
relevant anymore. Is it possible to conceal them in that case?
是的,通过使用如下代码禁用 "Selection change script" 属性 中的组件:
// to disable
formEnvironment.getFormComponentById("123").setEnabled(!selectedItem.equals("Windows authentication"));
// or to hide
formEnvironment.getFormComponentById("123").setVisible(!selectedItem.equals("Windows authentication"));
Is the combo-box option could lead to a conflict when running the installer
with a quite mode?
默认情况下,第一个索引是 selected。这可以使用 "Drop-down list" 表单组件的 "Initially selected index" 属性 配置。
备选方案:
我会考虑使用 "Single radio button" 表单组件作为您的身份验证选项。它们都绑定到相同的变量名,以形成一个组,并具有与下拉列表相同的效果。使用 "Visibility script" 属性 你可以根据 OS 隐藏一些选项,例如
Util.isWindows()
并且选项仅在 Windows 上可见。使用配置区域中的 "Coupled form components" 选项卡,您可以 select 其他根据 selection 禁用或启用的表单组件。
我们正在使用安装程序 6.1.6。 今天我们支持SQL服务器认证,我希望添加Windows认证模式.
的新能力我们的数据库配置设置为配置表单,我想添加一个新的组合框表单组件,其中将包含 2 个服务器身份验证选项。
是否可以使用条件表达式定义组合框的Windows身份验证选项仅适用于 Windows OS? (为 Linux 用户显示它没有意义)
一些表单组件是 "username" & "password"。如果用户选择 windows 身份验证模式 ,则这些字段不再相关。那样的话可以隐藏吗?
当运行安装程序使用安静模式时,组合框选项是否会导致冲突?是否将第一个选项设置为默认值?
Is it possible to define the combo-box's Windows Authentication option with a condition expression for Windows OS only? (it doesn't make sense to display it for Linux users)
您可以将 "Drop-down list" 表单组件的 "Drop-down list entries" 属性 设置为包含字符串数组的安装程序变量:
${installer:authenticationOptions}
在表单的预激活脚本中,您可以使用以下代码设置变量:
List<String> options = new ArrayList<>();
options.add("One");
options.add("Two");
if (Util.isWindows()) {
options.add("Three");
}
context.setVariable("authenticationOptions", options.toArray(new String[0]));
Some of the form components are "username" & "password". In case the user chooses the windows authentication mode these fields aren't relevant anymore. Is it possible to conceal them in that case?
是的,通过使用如下代码禁用 "Selection change script" 属性 中的组件:
// to disable
formEnvironment.getFormComponentById("123").setEnabled(!selectedItem.equals("Windows authentication"));
// or to hide
formEnvironment.getFormComponentById("123").setVisible(!selectedItem.equals("Windows authentication"));
Is the combo-box option could lead to a conflict when running the installer with a quite mode?
默认情况下,第一个索引是 selected。这可以使用 "Drop-down list" 表单组件的 "Initially selected index" 属性 配置。
备选方案:
我会考虑使用 "Single radio button" 表单组件作为您的身份验证选项。它们都绑定到相同的变量名,以形成一个组,并具有与下拉列表相同的效果。使用 "Visibility script" 属性 你可以根据 OS 隐藏一些选项,例如
Util.isWindows()
并且选项仅在 Windows 上可见。使用配置区域中的 "Coupled form components" 选项卡,您可以 select 其他根据 selection 禁用或启用的表单组件。