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


Java FormComponent.setRequired方法代码示例

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


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

示例1: doCheck

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private boolean doCheck(FormComponent<?> formComponent) {
	boolean onError = false;
	formComponent.setRequired(true);
	
	if (
			(emptyMode && formComponent.checkRequired())
		||	(!emptyMode && !formComponent.checkRequired())
	) {
		ValidationError validationError = new ValidationError();
		if (errorRessourceKey != null) {
			validationError.addKey(errorRessourceKey);
		}
		(formComponentOnError != null ? formComponentOnError : formComponent).error(validationError.addKey(emptyMode ? "EmptyRequired" : "Required"));
		onError = true;
	}
	
	formComponent.setRequired(false);
	return onError;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:20,代码来源:ConditionalRequiredFormModelValidator.java

示例2: AttributeInputPanel

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public AttributeInputPanel(String markupId, IModel<AttributeModel> attributeModel) {
    super(markupId);
    this.attributeModel = attributeModel;

    AttributeModel attribute = attributeModel.getObject();
    // attribute name
    this.nameLabel = new Label("attributeName", Model.of(attribute.getName() + (attribute.isRequired() ? "*" : "")));
    this.nameLabel.setOutputMarkupId(true);
    this.add(this.nameLabel);

    // attribute description
    Label descriptionLabel = new Label("attributeDescription");
    if (null == attribute.getDescription() || attribute.getDescription().trim().isEmpty()) {
        descriptionLabel.setVisible(false);
    } else {
        descriptionLabel.setDefaultModel(Model.of(attribute.getDescription()));
    }
    this.add(descriptionLabel);

    // attribute input
    AbstractFormComponentPanel inputPanel = newInputPanel("inputPanel", attribute);
    this.add(inputPanel);
    FormComponent inputFormComponent = inputPanel.getFormComponent();
    inputFormComponent.setRequired(attribute.isRequired());
    inputFormComponent.add(new AjaxFormComponentValidationBehavior("blur", this.nameLabel));
    if (attribute.isRequired() && !attribute.hasValue()) {
        this.nameLabel.add(new AjaxFormComponentValidationBehavior.InvalidAttributeModifier());
    }
}
 
开发者ID:citlab,项目名称:Intercloud,代码行数:30,代码来源:AttributeInputPanel.java

示例3: newGavcField

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
private Component newGavcField(String id, boolean required, Behavior behavior) {
    FormComponent textField = new TextField(id);
    textField.setRequired(required);
    textField.setOutputMarkupId(true);
    textField.add(behavior);
    return textField;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:8,代码来源:DeployArtifactPanel.java

示例4: RemoteRepoImportPanel

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
public RemoteRepoImportPanel(CachingDescriptorHelper cachingDescriptorHelper) {
    setWidth(740);
    add(new CssClass("import-remote-repos"));
    Form loadForm = new SecureForm("loadForm");
    add(loadForm);

    MarkupContainer loadBorder = new TitledBorder("loadBorder");
    loadForm.add(loadBorder);

    loadBorder.add(new HelpBubble("urlHelp",
            "Enter the base URL of another Artifactory server you want to import repository definitions from."));
    FormComponent<String> urlTextField = new TextField<>("url", new PropertyModel<String>(this, "url"));
    urlTextField.add(new UriValidator("http", "https"));
    setPersistent(urlTextField);
    urlTextField.setOutputMarkupId(true);
    urlTextField.setRequired(true);
    urlTextField.setDefaultModelObject("http://repo.jfrog.org/artifactory");
    loadBorder.add(urlTextField);
    loadBorder.add(getLoadButton(loadForm));

    Form listForm = new SecureForm("listForm");
    add(listForm);

    MarkupContainer listBorder = new TitledBorder("listBorder");
    listForm.add(listBorder);
    createRepositoryList(listBorder);

    add(new ModalCloseLink("cancel"));
    //Submit button
    importButton = getImportButton(cachingDescriptorHelper, listForm);
    importButton.setOutputMarkupId(true);
    add(importButton);
    listForm.add(new DefaultButtonBehavior(importButton));
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:35,代码来源:RemoteRepoImportPanel.java

示例5: addExtraComponentsToForm

import org.apache.wicket.markup.html.form.FormComponent; //导入方法依赖的package包/类
@Override
protected void addExtraComponentsToForm(Form form) {
    FormComponent<String> relativePathTextField = new TextField<>("path");
    relativePathTextField.setRequired(true);
    form.add(relativePathTextField);
    form.add(new HelpBubble("path.help", new ResourceModel("path.help")));
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:8,代码来源:BintrayArtifactPanel.java


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