Search in sources :

Example 1 with SpringCloudClusterComboBox

use of com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudClusterComboBox 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));
    }
}
Also used : SubscriptionComboBox(com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox) SpringCloudClusterComboBox(com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudClusterComboBox) AzureValidationInfoBuilder(com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo.AzureValidationInfoBuilder) ValidationDebouncedTextInput(com.microsoft.azure.toolkit.intellij.common.ValidationDebouncedTextInput)

Aggregations

ValidationDebouncedTextInput (com.microsoft.azure.toolkit.intellij.common.ValidationDebouncedTextInput)1 SubscriptionComboBox (com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox)1 SpringCloudClusterComboBox (com.microsoft.azure.toolkit.intellij.springcloud.component.SpringCloudClusterComboBox)1 AzureValidationInfoBuilder (com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo.AzureValidationInfoBuilder)1