Search in sources :

Example 6 with DatePanel

use of com.evolveum.midpoint.web.component.input.DatePanel in project midpoint by Evolveum.

the class DatePanelFactory method getPanel.

@Override
protected InputPanel getPanel(PrismPropertyPanelContext<XMLGregorianCalendar> panelCtx) {
    DatePanel panel = new DatePanel(panelCtx.getComponentId(), panelCtx.getRealValueModel());
    Form<?> form = Form.findForm(panelCtx.getForm());
    DateValidator validator;
    String validatorErrorMessageKey;
    if (ScheduleType.F_EARLIEST_START_TIME.equals(panelCtx.getDefinitionName()) || ScheduleType.F_LATEST_START_TIME.equals(panelCtx.getDefinitionName())) {
        validator = WebComponentUtil.getRangeValidator(form, TaskType.F_SCHEDULE);
        validatorErrorMessageKey = "ScheduleType.dateValidator.errorMessage";
    } else {
        validator = WebComponentUtil.getRangeValidator(form, SchemaConstants.PATH_ACTIVATION);
        validatorErrorMessageKey = "DateValidator.message.fromAfterTo";
    }
    if (ActivationType.F_VALID_FROM.equals(panelCtx.getDefinitionName()) || ScheduleType.F_EARLIEST_START_TIME.equals(panelCtx.getDefinitionName())) {
        validator.setDateFrom((DateTimeField) panel.getBaseFormComponent());
    } else if (ActivationType.F_VALID_TO.equals(panelCtx.getDefinitionName()) || ScheduleType.F_LATEST_START_TIME.equals(panelCtx.getDefinitionName())) {
        validator.setDateTo((DateTimeField) panel.getBaseFormComponent());
    }
    validator.setMessageKey(validatorErrorMessageKey);
    return panel;
}
Also used : DateValidator(com.evolveum.midpoint.web.util.DateValidator) DatePanel(com.evolveum.midpoint.web.component.input.DatePanel) DateTimeField(org.apache.wicket.extensions.yui.calendar.DateTimeField)

Aggregations

DatePanel (com.evolveum.midpoint.web.component.input.DatePanel)6 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)3 DateValidator (com.evolveum.midpoint.web.util.DateValidator)3 PropertyModel (org.apache.wicket.model.PropertyModel)3 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)2 TextPanel (com.evolveum.midpoint.web.component.input.TextPanel)2 InputPanel (com.evolveum.midpoint.web.component.prism.InputPanel)2 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)2 QName (javax.xml.namespace.QName)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 PasswordPanel (com.evolveum.midpoint.gui.api.component.password.PasswordPanel)1 ItemPathDto (com.evolveum.midpoint.gui.api.component.path.ItemPathDto)1 ItemPathPanel (com.evolveum.midpoint.gui.api.component.path.ItemPathPanel)1 CanonicalItemPath (com.evolveum.midpoint.prism.path.CanonicalItemPath)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 MultiValueChoosePanel (com.evolveum.midpoint.web.component.form.multivalue.MultiValueChoosePanel)1