Search in sources :

Example 1 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project midpoint by Evolveum.

the class PageSelfRegistration method initLayout.

private void initLayout() {
    final Form<?> mainForm = new Form<>(ID_MAIN_FORM);
    initAccessBehaviour(mainForm);
    add(mainForm);
    addMultilineLable(ID_WELCOME, "PageSelfRegistration.welcome.message", mainForm);
    addMultilineLable(ID_ADDITIONAL_TEXT, "PageSelfRegistration.additional.message", mainForm);
    initStaticFormLayout(mainForm);
    initDynamicFormLayout(mainForm);
    CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA);
    captcha.setOutputMarkupId(true);
    mainForm.add(captcha);
    AjaxSubmitButton register = new AjaxSubmitButton(ID_SUBMIT_REGISTRATION) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            showErrors(target);
        }

        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            submitRegistration(target);
        }
    };
    mainForm.add(register);
    MultiLineLabel label = new MultiLineLabel(ID_REGISTRATION_SUBMITED, createStringResource("PageSelfRegistration.registration.confirm.message"));
    add(label);
    label.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return submited;
        }

        @Override
        public boolean isEnabled() {
            return submited;
        }
    });
    AjaxButton back = new AjaxButton(ID_BACK) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            setResponsePage(PageLogin.class);
        }
    };
    mainForm.add(back);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(com.evolveum.midpoint.web.component.form.Form) CaptchaPanel(com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Example 2 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project wicket by apache.

the class AjaxEditableMultiLineLabel method newLabel.

/**
 * {@inheritDoc}
 */
@Override
protected MultiLineLabel newLabel(final MarkupContainer parent, final String componentId, final IModel<T> model) {
    MultiLineLabel label = new MultiLineLabel(componentId, model) {

        private static final long serialVersionUID = 1L;

        /**
         * {@inheritDoc}
         */
        @Override
        public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
            Object modelObject = getDefaultModelObject();
            if ((modelObject == null) || "".equals(modelObject)) {
                replaceComponentTagBody(markupStream, openTag, defaultNullLabel());
            } else {
                super.onComponentTagBody(markupStream, openTag);
            }
        }
    };
    label.setOutputMarkupId(true);
    label.add(new LabelAjaxBehavior(getLabelAjaxEvent()));
    return label;
}
Also used : ComponentTag(org.apache.wicket.markup.ComponentTag) MarkupStream(org.apache.wicket.markup.MarkupStream) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Example 3 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project midpoint by Evolveum.

the class PageForgotPassword method initButtons.

private void initButtons(Form<?> form) {
    AjaxSubmitButton submit = new AjaxSubmitButton(ID_SUBMIT, createStringResource("PageForgetPassword.resetPassword")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            processResetPassword(target, form);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getFeedbackPanel());
        }
    };
    submit.setOutputMarkupId(true);
    form.add(submit);
    form.setDefaultButton(submit);
    AjaxButton backButton = new AjaxButton(ID_BACK, createStringResource("PageForgetPassword.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            setResponsePage(PageLogin.class);
        }
    };
    backButton.setOutputMarkupId(true);
    form.add(backButton);
    add(form);
    MultiLineLabel label = new MultiLineLabel(ID_PASSWORD_RESET_SUBMITED, createStringResource("PageForgotPassword.form.submited.message"));
    add(label);
    label.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return submited;
        }

        @Override
        public boolean isEnabled() {
            return submited;
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Example 4 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project midpoint by Evolveum.

the class PageSelfRegistration method addMultilineLable.

private void addMultilineLable(String id, String messageKey, Form<?> mainForm) {
    MultiLineLabel welcome = new MultiLineLabel(id, createStringResource(messageKey));
    welcome.setOutputMarkupId(true);
    welcome.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !submited;
        }
    });
    mainForm.add(welcome);
}
Also used : VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Example 5 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project midpoint by Evolveum.

the class PageSelfRegistration method addMultilineLable.

private void addMultilineLable(String id, StringResourceModel messageModel, WebMarkupContainer mainForm) {
    MultiLineLabel welcome = new MultiLineLabel(id, messageModel);
    welcome.setOutputMarkupId(true);
    // welcome.add(new VisibleEnableBehaviour() {
    // private static final long serialVersionUID = 1L;
    // 
    // @Override
    // public boolean isVisible() {
    // return !submited;
    // }
    // });
    mainForm.add(welcome);
}
Also used : MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Aggregations

MultiLineLabel (org.apache.wicket.markup.html.basic.MultiLineLabel)7 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 CaptchaPanel (com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Form (com.evolveum.midpoint.web.component.form.Form)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 ComponentTag (org.apache.wicket.markup.ComponentTag)1 MarkupStream (org.apache.wicket.markup.MarkupStream)1 Fragment (org.apache.wicket.markup.html.panel.Fragment)1