当前位置: 首页>>代码示例>>Java>>正文


Java FormComponent.isValid方法代码示例

本文整理汇总了Java中org.apache.wicket.markup.html.form.FormComponent.isValid方法的典型用法代码示例。如果您正苦于以下问题:Java FormComponent.isValid方法的具体用法?Java FormComponent.isValid怎么用?Java FormComponent.isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.markup.html.form.FormComponent的用法示例。


在下文中一共展示了FormComponent.isValid方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateFormModelValidator

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private void validateFormModelValidator(IFormModelValidator validator) {
	Args.notNull(validator, "validator");

	final FormComponent<?>[] dependents = validator.getDependentFormComponents();

	boolean validate = true;

	if (dependents != null) {
		for (final FormComponent<?> dependent : dependents) {
			if (!dependent.isValid() || !dependent.isVisibleInHierarchy()) {
				validate = false;
				break;
			}
		}
	}

	if (validate) {
		validator.validate(this);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:ModelValidatingForm.java

示例2: onConfigure

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
protected void onConfigure() {
    final Component component = element.getContext()
            .getComponentRegistry()
            .getComponent(element.getModelWicketId());
    final FormComponent<?> formComponent = Components.asFormComponent(component);
    if (formComponent != null) {
        final StringBuilder sb = new StringBuilder();
        if (showHelpText()) {
            if (!formComponent.isValid()) {
                boolean firstMessage = true;
                for (final FeedbackMessage message : formComponent.getFeedbackMessages()) {
                    if (!firstMessage) {
                        sb.append("<br>");
                    }
                    firstMessage = false;
                    sb.append(message.getMessage());
                }
            }
            help.setDefaultModelObject(sb);
        }
        help.setVisible(sb.length() > 0);
    }
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:25,代码来源:GridColumnBorder.java

示例3: afterRender

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
public void afterRender(Component component) {
	FormComponent fc = (FormComponent) component;
	if (!fc.isValid()) {
		String error;
		if (fc.hasFeedbackMessage()) {
			FeedbackMessage first = fc.getFeedbackMessages().first();
			first.markRendered();
			error = first.getMessage().toString();
			
		} else {
			error = "Your input is invalid.";
		}
		fc.getResponse().write("*<span id=\"helpBlock2\" class=\"help-block\">"+error+"</span>");
		super.afterRender(component);
	}
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:18,代码来源:ValidationMsgBehavior.java

示例4: beforeRender

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
public void beforeRender(Component c) {
	if (c instanceof FormComponent) {
		FormComponent fc = (FormComponent) c;
		if (!fc.isValid()) {
			super.beforeRender(c);
			
		}
	}
	
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:12,代码来源:ValidationMsgBehavior.java

示例5: beforeRender

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public void beforeRender(Component component) {
    FormComponent<?> fc = (FormComponent<?>) component;
    Response r = component.getResponse();

    String label = (fc.getLabel() != null) ? fc.getLabel().getObject(): null;
    if (label != null) {
        r.write("<span class=\"param\">");
        r.write("<label for=\"");
        r.write(fc.getMarkupId());
        r.write("\"");
        if (!fc.isValid()) {
            r.write(" class=\"error\"");
        }
        r.write(" />");
        r.write(Strings.escapeMarkup(label));
        r.write("</label>");
        r.write("</span>");

        NotNull clazz;

        try {
            Field field = fc.getForm().getModelObject().getClass().getDeclaredField(fc.getInputName());
            clazz = field.getAnnotation(NotNull.class);
        } catch (NoSuchFieldException e) {
            clazz = null;
        }

        if (clazz != null || fc.isRequired()) {
            r.write("<span class=\"required\" title=\"");
            r.write(fc.getString("portal.error.required.field.title"));
            r.write("\">");
            r.write(fc.getString("portal.required.field")+"</span>");
        } else {
            r.write("<span class=\"notrequired\"></span>");
        }
        r.write("<span class=\"value\">");

    }
    super.beforeRender(component);
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:41,代码来源:FieldFeedbackDecorator.java

示例6: onComponentTag

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
public void onComponentTag(Component component, ComponentTag tag) {
    FormComponent<?> fc = (FormComponent<?>) component;
    if (!fc.isValid()) {
        String c1 = tag.getAttribute("class");
        if (c1 == null) {
            tag.put("class", "errorField");
        } else {
            tag.put("class", " errorField " + c1);
        }
    }
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:13,代码来源:FieldFeedbackDecorator.java

示例7: changeCssClass

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
/**
 * Changes the CSS class of the linked {@link FormComponent} via AJAX.
 *
 * @param ajaxRequestTarget of type AjaxRequestTarget
 * @param valid Was the validation succesful?
 * @param cssClass The CSS class that must be set on the linked {@link FormComponent}
 */
private void changeCssClass(AjaxRequestTarget ajaxRequestTarget, boolean valid, String cssClass) {
    FormComponent formComponent = getFormComponent();

    if(formComponent.isValid() == valid){
        formComponent.add(new AttributeModifier("class", true, new Model("formInputField " + cssClass)));
        ajaxRequestTarget.add(formComponent);
    }

    if(updateComponent!=null){
        ajaxRequestTarget.add(updateComponent);
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:20,代码来源:ComponentVisualErrorBehaviour.java

示例8: isConvertedInputSatisfyingRequirements

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
protected final boolean isConvertedInputSatisfyingRequirements(FormComponent<T> prerequisiteField, T convertedInput) {
	return (!useWicketValidation || prerequisiteField.isValid()) && isObjectValid(convertedInput);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:AbstractAjaxInputPrerequisiteBehavior.java

示例9: isCurrentModelSatisfyingRequirements

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
protected final boolean isCurrentModelSatisfyingRequirements(FormComponent<T> prerequisiteField, IModel<T> currentModel) {
	return (!useWicketValidation || prerequisiteField.isValid()) && isObjectValid(currentModel.getObject());
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:AbstractAjaxInputPrerequisiteBehavior.java

示例10: hasError

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private static boolean hasError(FormComponent<?> formComponent) {
	return formComponent.getMetaData(HAS_ERROR) != null || !formComponent.isValid();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:FormErrorDecoratorListener.java


注:本文中的org.apache.wicket.markup.html.form.FormComponent.isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。