本文整理汇总了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;
}
示例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());
}
}
示例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;
}
示例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));
}
示例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")));
}