本文整理汇总了Java中org.apache.wicket.validation.validator.StringValidator类的典型用法代码示例。如果您正苦于以下问题:Java StringValidator类的具体用法?Java StringValidator怎么用?Java StringValidator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringValidator类属于org.apache.wicket.validation.validator包,在下文中一共展示了StringValidator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitialize
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
Label label = new Label("label", this.name);
this.add(label);
TextField<String> field = new TextField<>("field", new PropertyModel<>(this.fields, this.name));
field.setLabel(Model.of(name));
field.add(StringValidator.maximumLength(255));
TextFeedbackPanel feedback = new TextFeedbackPanel("feedback", field);
this.add(field);
this.add(feedback);
}
示例2: UsernameTextField
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public UsernameTextField(String id) {
super(id);
Injector.get().inject(this);
add(StringValidator.minimumLength(3));
setRequired(true);
add(new UsernameExistsValidator());
}
示例3: CustomerListPage
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public CustomerListPage() {
FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
feedbackPanel.setOutputMarkupId(true);
add(feedbackPanel);
add(new WebSocketBehavior() {
@Override
protected void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message) {
if (message instanceof CustomerChangedEvent) {
CustomerChangedEvent event = (CustomerChangedEvent)message;
info("changed/created " + event.getCustomer().getFirstname() + " " + event.getCustomer().getLastname());
handler.add(feedbackPanel);
}
}
});
customerFilterModel = new CompoundPropertyModel<>(new CustomerFilter());
CustomerDataProvider customerDataProvider = new CustomerDataProvider(customerFilterModel);
queue(new BookmarkablePageLink<Customer>("create", CustomerCreatePage.class));
queue(new ValidationForm<>("form", customerFilterModel));
queue(new LabeledFormBorder<>(getString("id"), new TextField<>("id")));
queue(new LabeledFormBorder<>(getString("username"), new UsernameSearchTextField("usernameLike")));
queue(new LabeledFormBorder<>(getString("firstname"), new TextField<String>("firstnameLike").add(StringValidator.minimumLength(3))));
queue(new LabeledFormBorder<>(getString("lastname"), new TextField<String>("lastnameLike").add(StringValidator.minimumLength(3))));
queue(new LabeledFormBorder<>(getString("active"), new CheckBox("active")));
queue(cancelButton());
customerDataTable(customerDataProvider);
}
示例4: GroupCreateUpdatePanel
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public GroupCreateUpdatePanel(CreateUpdateAction action, GroupInfo groupInfo,
GroupsListPanel groupsListPanel) {
super(action, groupInfo);
setWidth(440);
add(form);
TitledBorder border = new TitledBorder("border");
add(border);
form.add(border);
// Group name
RequiredTextField<String> groupNameTf = new RequiredTextField<>("groupName");
setDefaultFocusField(groupNameTf);
groupNameTf.add(StringValidator.maximumLength(100));
groupNameTf.setEnabled(isCreate());// don't allow groupname update
groupNameTf.add(new NameValidator("Invalid group name '%s'"));
border.add(groupNameTf);
// Group description
TextArea groupDescriptionTextArea = new TextArea("description");
border.add(groupDescriptionTextArea);
// If default for newly created users
border.add(new StyledCheckbox("newUserDefault"));
// Cancel button
form.add(new ModalCloseLink("cancel"));
// Submit button
TitledAjaxSubmitLink submit = createSubmitButton(groupsListPanel);
form.add(submit);
form.add(new DefaultButtonBehavior(submit));
}
示例5: CustomizingPanel
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public CustomizingPanel(String id, IModel model) {
super(id, model);
add(new CssClass("general-settings-panel"));
fileUploadLogo = new LogoFileUploadForm("logoPath", this);
add(fileUploadLogo);
TextField<String> urlLogo = new TextField<>("logo");
urlLogo.add(new UriValidator("http", "https"));
urlLogo.add(new UrlChangedBehavior());
urlLogo.setOutputMarkupId(true);
fileUploadLogo.add(urlLogo);
TextField<String> footer = new TextField<>("footer");
fileUploadLogo.add(new ResetLink("reset", fileUploadLogo));
footer.add(StringValidator.maximumLength(MAX_FOOTER_LENGTH));
footer.add(new AttributeModifier("maxlength", MAX_FOOTER_LENGTH));
footer.setOutputMarkupId(true);
add(footer);
fileUploadLogo.add(new SchemaHelpBubble(("logo.help")));
fileUploadLogo.add(new HelpBubble("logoFile.help", "Upload a logo image file."));
add(new SchemaHelpBubble("footer.help"));
fileUploadLogo.add(new PreviewLogoPanel("logoPreview"));
}
示例6: initEmenta
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
private void initEmenta() {
String texto = getModelObject() != null ? getModelObject().getEmenta() : "";
ementa = new TextArea<String>("ementa",Model.of(texto));
ementa.setRequired(true);
ementa.setOutputMarkupId(true);
ementa.add(StringValidator.maximumLength(3000));
form.add(ementa);
}
示例7: nullIsNotValidated
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
@Test
public void nullIsNotValidated() {
TestPage<String, AjaxTextFieldPanel> testPage =
new TestPage.Builder<String, AjaxTextFieldPanel>().build(
new AjaxTextFieldPanel(TestPage.FIELD, TestPage.FIELD, TEXT_MODEL));
testPage.getFieldPanel().getField().setRequired(false);
testPage.getFieldPanel().getField().add(StringValidator.minimumLength(2));
TESTER.startPage(testPage);
FormTester formTester = TESTER.newFormTester(testPage.getForm().getId());
formTester.setValue("field:textField", "");
formTester.submit();
assertNull(testPage.getFieldPanel().getDefaultModelObject());
assertTrue(testPage.getFieldPanel().getField().isValid());
}
示例8: init
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
private void init(final Integer maxLength)
{
if (maxLength != null) {
add(StringValidator.maximumLength(maxLength));
//add(AttributeModifier.replace("maxlength", String.valueOf(maxLength))); // Done by StringValidator
}
}
示例9: init
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
private void init(final String id, final Integer maxLength)
{
if (maxLength != null) {
add(StringValidator.maximumLength(maxLength));
// add(AttributeModifier.replace("maxlength", String.valueOf(maxLength))); // Done by StringValidator
}
}
示例10: init
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
private void init(final String id, final Integer maxLength)
{
if (maxLength != null) {
add(StringValidator.maximumLength(maxLength));
// add(AttributeModifier.replace("maxlength", String.valueOf(maxLength))); // Not supported by html textarea!
this.maxLength = maxLength;
}
}
示例11: init
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
private void init(final String id, final Integer maxLength)
{
if (maxLength != null) {
add(StringValidator.maximumLength(maxLength));
// add(AttributeModifier.replace("maxlength", String.valueOf(maxLength))); // Field maxlength is produced by StringValidator.
}
}
示例12: AddEditAnalyzerClassPanel
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public AddEditAnalyzerClassPanel(String id, AnalyzerClass analyzerClass, Component refreshComponentP) {
super(id, true);
this.analyzerClassModel = new ReloadableEntityModel<AnalyzerClass>(analyzerClass);
this.refreshComponent = refreshComponentP;
this.isCreation = analyzerClass.getId() == null;
Form form = getForm();
form.setModel(new CompoundPropertyModel(analyzerClassModel));
form.add(new SetFocusBehavior(form));
TextField classNameField = new RequiredTextField("className");
classNameField.add(new StringValidator.MaximumLengthValidator(255));
form.add(classNameField);
}
示例13: AddEditFilterClassPanel
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public AddEditFilterClassPanel(String id, FilterClass filterClass, Component refreshComponentP) {
super(id, true);
this.filterClassModel = new ReloadableEntityModel<FilterClass>(filterClass);
this.refreshComponent = refreshComponentP;
Form form = getForm();
form.setModel(new CompoundPropertyModel(filterClassModel));
TextField classNameField = new RequiredTextField("className");
classNameField.add(new StringValidator.MaximumLengthValidator(255));
form.add(classNameField);
}
示例14: AddEditFieldTypeClassPanel
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public AddEditFieldTypeClassPanel(String id, FieldTypeClass fieldTypeClass, Component refreshComponentP) {
super(id, true);
this.fieldTypeClassModel = new ReloadableEntityModel<FieldTypeClass>(fieldTypeClass);
this.refreshComponent = refreshComponentP;
Form form = getForm();
form.setModel(new CompoundPropertyModel(fieldTypeClassModel));
add(form);
form.add(new SetFocusBehavior(form));
TextField classNameField = new RequiredTextField("className");
classNameField.add(new StringValidator.MaximumLengthValidator(255));
form.add(classNameField);
}
示例15: AddEditTokenizerClassPanel
import org.apache.wicket.validation.validator.StringValidator; //导入依赖的package包/类
public AddEditTokenizerClassPanel(String id, TokenizerClass tokenizerClass, Component refreshComponentP) {
super(id, true);
this.tokenizerClassModel = new ReloadableEntityModel<TokenizerClass>(tokenizerClass);
this.refreshComponent = refreshComponentP;
Form form = getForm();
form.setModel(new CompoundPropertyModel(tokenizerClassModel));
TextField classNameField = new RequiredTextField("className");
classNameField.add(new StringValidator.MaximumLengthValidator(255));
form.add(classNameField);
}