Package org.apache.wicket.validation.validator

Examples of org.apache.wicket.validation.validator.AbstractValidator


                public void renderHead(IHeaderResponse response) {
                    response.renderOnLoadJavascript("document.getElementById('" + loginName.getMarkupId() + "').focus()");
                }
            }));
            // validation: does user already exist with same loginName?
            loginName.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    User temp = getJtrac().loadUser(s);
                    if(temp != null && temp.getId() != user.getId()) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "user_form.loginId.error.exists";
                }               
            });
            // validation no strange characters
            loginName.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();                  
                    if(!ValidationUtils.isValidLoginName(s)) {
                        error(v);
                    }
View Full Code Here


            // option ===========================================================
            final TextField field = new TextField("roleKey");
            field.setRequired(true);
            field.add(new ErrorHighlighter());
            // validation: format ok?
            field.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();                   
                    if(!ValidationUtils.isValidRoleKey(s)) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "space_role_form.error.role.invalid";
                }               
            });
            // validation: already exists?
            field.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(space.getMetadata().getRolesMap().containsKey(s)) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "space_role_form.error.role.exists";
                }               
            });
            // validation is this a 'reserved' role name?
            field.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(s == null) {
                        return;
                    }
View Full Code Here

            // option ===========================================================
            final TextField field = new TextField("stateName");
            field.setRequired(true);
            field.add(new ErrorHighlighter());
            // validation: format ok?
            field.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(!ValidationUtils.isValidStateName(s)) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "space_state_form.error.state.invalid";
                }               
            });
            // validation: already exists?
            field.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(space.getMetadata().getStatesMap().containsValue(s)) {
                        error(v);
                    }
View Full Code Here

            // prefix Code =====================================================
            TextField prefixCode = new TextField("space.prefixCode");
            prefixCode.setRequired(true);
            prefixCode.add(new ErrorHighlighter());
            // validation: greater than 3 chars?
            prefixCode.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(s.length() < 3) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "space_form.error.prefixCode.tooShort";
                }               
            });
            prefixCode.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(s.length() > 10) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "space_form.error.prefixCode.tooLong";
                }               
            });            
            // validation: format ok?
            prefixCode.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(!ValidationUtils.isValidSpaceKey(s)) {
                        error(v);
                    }
                }
                @Override
                protected String resourceKey() {                   
                    return "space_form.error.prefixCode.invalid";
                }               
            });           
            // validation: does space already exist with same prefixCode ?
            prefixCode.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    Space temp = getJtrac().loadSpace(s);
                    if(temp != null && temp.getId() != space.getId()) {
                        error(v);
View Full Code Here

            add(new Label("label", new PropertyModel(field, "label")));
            // option ===========================================================
            final TextField option = new TextField("option");
            option.setRequired(true);
            option.add(new ErrorHighlighter());
            option.add(new AbstractValidator() {
                protected void onValidate(IValidatable v) {
                    String s = (String) v.getValue();
                    if(field.hasOption(s)) {
                        error(v);
                    }
View Full Code Here

                };               
                hide.add(listView);
                optionField = new TextField("option");
                // validation, does option already exist?
                // TODO validate that at least one option exists
                optionField.add(new AbstractValidator() {
                    protected void onValidate(IValidatable v) {
                        String s = (String) v.getValue();
                        if(field.hasOption(s)) {
                            error(v);
                        }
View Full Code Here

        super(id);
        add(new FeedbackPanel("feedback").setOutputMarkupId(true));
        TextField wst = new TextField("workspace", new PropertyModel(this, "workspace"));
        wst.setRequired(true);

        wst.add(new AbstractValidator() {

            @Override
            protected void onValidate(IValidatable validatable) {
                String value = (String) validatable.getValue();
                if (GeoServerApplication.get().getCatalog().getWorkspaceByName(value) != null) {
View Full Code Here

TOP

Related Classes of org.apache.wicket.validation.validator.AbstractValidator

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.