Search in sources :

Example 1 with AzurePasswordFieldInput

use of com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput in project azure-tools-for-java by Microsoft.

the class PasswordUtils method generatePasswordFieldInput.

public static AzurePasswordFieldInput generatePasswordFieldInput(JPasswordField passwordField, JTextField adminUsernameTextField) {
    return new AzurePasswordFieldInput(passwordField) {

        @Override
        public AzureValidationInfo doValidate() {
            final AzureValidationInfo info = super.doValidate();
            if (!AzureValidationInfo.OK.equals(info)) {
                return info;
            }
            final String adminUsername = adminUsernameTextField.getText();
            final String value = this.getValue();
            return PasswordUtils.validatePassword(value, adminUsername, this);
        }
    };
}
Also used : AzureValidationInfo(com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo) AzurePasswordFieldInput(com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput)

Example 2 with AzurePasswordFieldInput

use of com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput in project azure-tools-for-java by Microsoft.

the class PasswordUtils method generateConfirmPasswordFieldInput.

public static AzurePasswordFieldInput generateConfirmPasswordFieldInput(JPasswordField confirmPasswordField, JPasswordField passwordField) {
    return new AzurePasswordFieldInput(confirmPasswordField) {

        @Override
        public AzureValidationInfo doValidate() {
            final AzureValidationInfo info = super.doValidate();
            if (!AzureValidationInfo.OK.equals(info)) {
                return info;
            }
            final String value = this.getValue();
            final char[] password = passwordField.getPassword();
            final String passwordAsString = password != null ? String.valueOf(password) : StringUtils.EMPTY;
            return PasswordUtils.validateConfirmPassword(value, passwordAsString, this);
        }
    };
}
Also used : AzureValidationInfo(com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo) AzurePasswordFieldInput(com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput)

Example 3 with AzurePasswordFieldInput

use of com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput in project azure-tools-for-java by Microsoft.

the class VMCreationDialog method createUIComponents.

private void createUIComponents() {
    // TODO: place custom component creation code here
    this.cbSubscription = new SubscriptionComboBox();
    this.cbSubscription.setRequired(true);
    this.cbImage = new VirtualMachineImageComboBox();
    this.cbImage.setRequired(true);
    this.cbSize = new VirtualMachineSizeComboBox();
    this.cbSize.setRequired(true);
    this.cbAvailabilityOptions = new NetworkAvailabilityOptionsComboBox();
    this.cbVirtualNetwork = new VirtualNetworkComboBox();
    this.cbVirtualNetwork.setRequired(true);
    this.cbSubnet = new SubnetComboBox();
    this.cbSubnet.setRequired(true);
    this.cbSecurityGroup = new SecurityGroupComboBox();
    this.cbPublicIp = new PublicIPAddressComboBox();
    this.cbPublicIp.setRequired(true);
    this.cbStorageAccount = new AzureStorageAccountComboBox();
    this.txtUserName = new ValidationDebouncedTextInput();
    this.txtUserName.setRequired(true);
    this.txtVisualMachineName = new ValidationDebouncedTextInput();
    this.txtVisualMachineName.setRequired(true);
    this.txtVisualMachineName.setValidator(this::validateVirtualMachineName);
    this.txtMaximumPrice = new ValidationDebouncedTextInput();
    this.txtPassword = new JPasswordField();
    this.passwordFieldInput = new AzurePasswordFieldInput(txtPassword, true);
    this.txtConfirmPassword = new JPasswordField();
    this.confirmPasswordFieldInput = new AzurePasswordFieldInput(txtConfirmPassword, true);
    this.cbSubscription.refreshItems();
}
Also used : NetworkAvailabilityOptionsComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.NetworkAvailabilityOptionsComboBox) VirtualNetworkComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.VirtualNetworkComboBox) AzureStorageAccountComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.AzureStorageAccountComboBox) SubscriptionComboBox(com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox) VirtualMachineImageComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.VirtualMachineImageComboBox) VirtualMachineSizeComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.VirtualMachineSizeComboBox) PublicIPAddressComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.ip.PublicIPAddressComboBox) SubnetComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.SubnetComboBox) SecurityGroupComboBox(com.microsoft.azure.toolkit.intellij.vm.creation.component.SecurityGroupComboBox) ValidationDebouncedTextInput(com.microsoft.azure.toolkit.intellij.common.ValidationDebouncedTextInput) AzurePasswordFieldInput(com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput)

Aggregations

AzurePasswordFieldInput (com.microsoft.azure.toolkit.intellij.common.component.AzurePasswordFieldInput)3 AzureValidationInfo (com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo)2 ValidationDebouncedTextInput (com.microsoft.azure.toolkit.intellij.common.ValidationDebouncedTextInput)1 SubscriptionComboBox (com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox)1 AzureStorageAccountComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.AzureStorageAccountComboBox)1 NetworkAvailabilityOptionsComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.NetworkAvailabilityOptionsComboBox)1 SecurityGroupComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.SecurityGroupComboBox)1 SubnetComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.SubnetComboBox)1 VirtualMachineImageComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.VirtualMachineImageComboBox)1 VirtualMachineSizeComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.VirtualMachineSizeComboBox)1 VirtualNetworkComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.VirtualNetworkComboBox)1 PublicIPAddressComboBox (com.microsoft.azure.toolkit.intellij.vm.creation.component.ip.PublicIPAddressComboBox)1