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


Java StringValidator类代码示例

本文整理汇总了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);
}
 
开发者ID:PkayJava,项目名称:MBaaS,代码行数:13,代码来源:StringPanel.java

示例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());
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:8,代码来源:UsernameTextField.java

示例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);

}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:35,代码来源:CustomerListPage.java

示例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));
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:35,代码来源:GroupCreateUpdatePanel.java

示例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"));
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:28,代码来源:CustomizingPanel.java

示例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);
}
 
开发者ID:camaradosdeputadosoficial,项目名称:edemocracia,代码行数:9,代码来源:PropostaPage.java

示例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());
}
 
开发者ID:apache,项目名称:syncope,代码行数:15,代码来源:AjaxTextFieldITCase.java

示例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
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:8,代码来源:PFAutoCompleteMaxLengthTextField.java

示例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
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:8,代码来源:AjaxMaxLengthEditableLabel.java

示例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;
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:9,代码来源:MaxLengthTextArea.java

示例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.
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:8,代码来源:MaxLengthTextField.java

示例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);
}
 
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:15,代码来源:AddEditAnalyzerClassPanel.java

示例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);
}
 
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:13,代码来源:AddEditFilterClassPanel.java

示例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);
}
 
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:15,代码来源:AddEditFieldTypeClassPanel.java

示例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);
}
 
开发者ID:BassJel,项目名称:Jouve-Project,代码行数:13,代码来源:AddEditTokenizerClassPanel.java


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