Package org.rhq.coregui.client.components.form

Examples of org.rhq.coregui.client.components.form.StringLengthValidator


    }
    private void buildForm() {
        if (!formBuilt) {
            nameField = new SimpleEditableFormItem("name", MSG.common_title_name());
            nameField.setWidth(300);
            StringLengthValidator notEmptyValidator = new StringLengthValidator(1, null, false);
            // ensure these are executed in a validate() override
            nameField.setValidators(notEmptyValidator);

            descriptionField = new SimpleEditableTextAreaFormItem("description", MSG.common_title_description());
            descriptionField.setWidth(300);
View Full Code Here


    private static String buildFormItemIdFromTraitDisplayName(String traitName) {
        return traitName.replaceAll("\\.", "_").replaceAll(" ", "__");
    }

    private void buildForm(ResourceType type) {
        StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1, null, false);
        //StringLengthValidator notNullValidator = new StringLengthValidator(null, null, false);

        List<FormItem> formItems = new ArrayList<FormItem>();

        if (isHeaderEnabled()) {//conditionally display header
View Full Code Here

        boolean isDynaGroup = (group.getGroupDefinition() != null);
        boolean hasInventoryPermission = (this.groupComposite.getResourcePermission().isInventory());
        boolean canEdit = (!isDynaGroup && isEditable && hasInventoryPermission);

        StringLengthValidator notEmptyOrNullValidator = new StringLengthValidator(1, null, false);
        StringLengthValidator notNullValidator = new StringLengthValidator(null, null, false);

        final FormItem nameItem;
        if (canEdit) {
            final EditableFormItem togglableNameItem = new EditableFormItem();
            togglableNameItem.setValidators(notEmptyOrNullValidator);
View Full Code Here

            + MSG.view_adminTopology_storageNodes_clusterSettings_credentials_desc() + "</div>");
        FormItemBuilder.resetOddRow();
        items = buildHeaderItems();

        // username field
        StringLengthValidator usernameValidator = new StringLengthValidator(4, 100, false);
        builder = new FormItemBuilder();
        List<FormItem> usernameItems = builder.withName(FIELD_USERNAME).withTitle(MSG.common_title_username())
            .withDescription(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_username())
            .withValue(settings.getUsername()).withReadOnlySetTo(true).withValidators(usernameValidator).build();
        items.addAll(usernameItems);

        // password field
        StringLengthValidator passwordValidator1 = new StringLengthValidator(6, 100, false);
        passwordValidator1.setErrorMessage(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_err1());
        // due to SmartGWT bug that changes focus after each input (https://code.google.com/p/smartgwt/issues/detail?id=309)
        passwordValidator1.setValidateOnChange(false);
        builder = new FormItemBuilder();
        List<FormItem> passwordItems = builder.withName(FIELD_PASSWORD).withTitle(MSG.common_title_password())
            .withDescription(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_password())
            .withValue(settings.getPasswordHash()).withReadOnlySetTo(readOnly).withValidators(passwordValidator1)
            .withAttribute("autocomplete", "off").build((FormItem) GWT.create(PasswordItem.class));
        items.addAll(passwordItems);

        // password_verify field
        builder = new FormItemBuilder();
        passwordValidator1 = new StringLengthValidator(6, 100, false);
        passwordValidator1.setErrorMessage(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_err1());
        MatchesFieldValidator passwordValidator2 = new MatchesFieldValidator();
        passwordValidator2.setOtherField(FIELD_PASSWORD);
        passwordValidator2.setErrorMessage(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_err2());
        // due to same bug in SmartGWT as above
        passwordValidator1.setValidateOnChange(false);
        passwordValidator2.setValidateOnChange(false);
        List<FormItem> passwordVerifyItems = builder.withName(FIELD_PASSWORD_VERIFY)
            .withTitle(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_verify_title())
            .withValue(settings.getPasswordHash())
            .withDescription(MSG.view_adminTopology_storageNodes_clusterSettings_credentials_verify())
View Full Code Here

TOP

Related Classes of org.rhq.coregui.client.components.form.StringLengthValidator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.