use of com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo.AzureValidationInfoBuilder in project azure-tools-for-java by Microsoft.
the class AbstractSpringCloudAppInfoPanel method init.
protected void init() {
final SubscriptionComboBox selectorSubscription = this.getSelectorSubscription();
final SpringCloudClusterComboBox selectorCluster = this.getSelectorCluster();
final ValidationDebouncedTextInput textName = this.getTextName();
selectorSubscription.setRequired(true);
selectorSubscription.addItemListener(this::onSubscriptionChanged);
selectorCluster.setRequired(true);
selectorCluster.addItemListener(this::onClusterChanged);
textName.setRequired(true);
textName.setValue(this.defaultAppName);
textName.setValidator(() -> {
try {
validateSpringCloudAppName(textName.getValue(), this.cluster);
} catch (final IllegalArgumentException e) {
final AzureValidationInfoBuilder builder = AzureValidationInfo.builder();
return builder.input(textName).type(AzureValidationInfo.Type.ERROR).message(e.getMessage()).build();
}
return AzureValidationInfo.OK;
});
if (Objects.nonNull(this.cluster)) {
selectorSubscription.setValue(new ItemReference<>(this.cluster.subscriptionId(), Subscription::getId));
selectorCluster.setValue(new ItemReference<>(this.cluster.name(), IAzureResource::name));
}
}
Aggregations