Search in sources :

Example 1 with RangeValidator

use of org.apache.wicket.validation.validator.RangeValidator in project midpoint by Evolveum.

the class PageSizePopover method initLayout.

protected void initLayout() {
    Button popButton = new Button(ID_POP_BUTTON);
    popButton.setOutputMarkupId(true);
    add(popButton);
    WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
    popover.setOutputMarkupId(true);
    add(popover);
    Form form = new Form(ID_FORM);
    popover.add(form);
    AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) {

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            super.onError(target, form);
            target.add(getPageBase().getFeedbackPanel());
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            super.onSubmit(target, form);
            pageSizeChanged(target);
        }
    };
    form.add(button);
    TextField input = new TextField(ID_INPUT, createInputModel());
    input.add(new RangeValidator(5, 100));
    input.setLabel(createStringResource("PageSizePopover.title"));
    input.add(new SearchFormEnterBehavior(button));
    input.setType(Integer.class);
    form.add(input);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SearchFormEnterBehavior(com.evolveum.midpoint.web.util.SearchFormEnterBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Button(org.apache.wicket.markup.html.form.Button) Form(org.apache.wicket.markup.html.form.Form) TextField(org.apache.wicket.markup.html.form.TextField) RangeValidator(org.apache.wicket.validation.validator.RangeValidator) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 2 with RangeValidator

use of org.apache.wicket.validation.validator.RangeValidator in project midpoint by Evolveum.

the class TableConfigurationPanel method initPopoverLayout.

private void initPopoverLayout() {
    WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
    popover.setOutputMarkupId(true);
    add(popover);
    Form form = new Form(ID_FORM);
    popover.add(form);
    AjaxSubmitButton button = new AjaxSubmitButton(ID_BUTTON) {

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(TableConfigurationPanel.this.get(createComponentPath(ID_POPOVER, ID_FORM, "inputFeedback")));
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            pageSizeChanged(target);
        }
    };
    form.add(button);
    TextField input = new TextField(ID_INPUT, createInputModel());
    input.add(new RangeValidator(5, 100));
    input.setLabel(createStringResource("PageSizePopover.title"));
    input.add(new SearchFormEnterBehavior(button));
    input.setType(Integer.class);
    input.setOutputMarkupId(true);
    FeedbackPanel feedback = new FeedbackPanel("inputFeedback", new ComponentFeedbackMessageFilter(input));
    feedback.setOutputMarkupId(true);
    form.add(feedback);
    form.add(input);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SearchFormEnterBehavior(com.evolveum.midpoint.web.util.SearchFormEnterBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) Form(org.apache.wicket.markup.html.form.Form) TextField(org.apache.wicket.markup.html.form.TextField) RangeValidator(org.apache.wicket.validation.validator.RangeValidator) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 3 with RangeValidator

use of org.apache.wicket.validation.validator.RangeValidator in project ocvn by devgateway.

the class EditAdminSettingsPage method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    editForm.add(new Label("excelTitle", new StringResourceModel("excelTitle", this, null)));
    excelBatchSize = new TextFieldBootstrapFormComponent<>("excelBatchSize");
    excelBatchSize.integer();
    excelBatchSize.getField().add(new RangeValidator(1, 10000));
    excelBatchSize.required();
    editForm.add(excelBatchSize);
    editForm.add(new Label("systemTitle", new StringResourceModel("systemTitle", this, null)));
    //        rebootServer = new CheckBoxToggleBootstrapFormComponent("rebootServer");
    //        editForm.add(rebootServer);
    disableApiSecurity = new CheckBoxToggleBootstrapFormComponent("disableApiSecurity");
    editForm.add(disableApiSecurity);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) RangeValidator(org.apache.wicket.validation.validator.RangeValidator) StringResourceModel(org.apache.wicket.model.StringResourceModel) CheckBoxToggleBootstrapFormComponent(org.devgateway.toolkit.forms.wicket.components.form.CheckBoxToggleBootstrapFormComponent)

Aggregations

RangeValidator (org.apache.wicket.validation.validator.RangeValidator)3 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)2 SearchFormEnterBehavior (com.evolveum.midpoint.web.util.SearchFormEnterBehavior)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 Form (org.apache.wicket.markup.html.form.Form)2 TextField (org.apache.wicket.markup.html.form.TextField)2 ComponentFeedbackMessageFilter (org.apache.wicket.feedback.ComponentFeedbackMessageFilter)1 Label (org.apache.wicket.markup.html.basic.Label)1 Button (org.apache.wicket.markup.html.form.Button)1 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)1 StringResourceModel (org.apache.wicket.model.StringResourceModel)1 CheckBoxToggleBootstrapFormComponent (org.devgateway.toolkit.forms.wicket.components.form.CheckBoxToggleBootstrapFormComponent)1